/*
 * «اسلاید محصولات» (Integrations\Home\Products, home/products.js). The cards
 * are the shop's (archive.css); this sets the row, its arrows and dots, and
 * the three looks: card, glass (frosted cards over a soft colour) and minimal.
 */

.fhm-products {
	--fpr-btn-bg: color-mix(in srgb, var(--fhm-accent) 10%, #fff);
	--fpr-btn-fg: var(--fhm-accent);
	--fpr-arrow-bg: #fff;
	--fpr-arrow-fg: #1d1730;
	--fpr-glass1: color-mix(in srgb, var(--fhm-accent) 16%, #fff);
	--fpr-glass2: color-mix(in srgb, var(--fhm-accent) 6%, #eaf1ff);
	position: relative;
}

.fhm-products .fhm-head {
	margin-block-end: 16px;
}

/* ---------- The row ---------- */

.fhm-products__shelf {
	position: relative;
}

.fhm-products__track {
	display: grid;
	grid-auto-columns: var(--fpr-w, 210px);
	grid-auto-flow: column;
	gap: 12px;
	margin: 0;
	padding: 2px 2px 8px;
	/* An RTL scroller can still widen the page in Chrome; its cards stay inside. */
	contain: paint;
	scroll-padding-inline: 2px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	list-style: none;
}

.fhm-products__track::-webkit-scrollbar {
	display: none;
}

.fhm-products__track > .fs-card {
	block-size: 100%;
	scroll-snap-align: start;
}

/* The card's button in the widget's own colours. */
.fhm-products .fs-card__add {
	background: var(--fpr-btn-bg);
	color: var(--fpr-btn-fg) !important;
}

.fhm-products .fs-card__add:hover {
	background: var(--fpr-btn-fg);
	color: var(--fpr-btn-bg) !important;
}

/* ---------- Arrows ---------- */

.fhm-products__arrow {
	position: absolute;
	inset-block-start: 38%;
	z-index: 3;
	display: grid;
	place-items: center;
	inline-size: 36px;
	block-size: 36px;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--fpr-arrow-fg) 12%, transparent);
	border-radius: 50%;
	background: var(--fpr-arrow-bg);
	color: var(--fpr-arrow-fg);
	box-shadow: 0 6px 16px rgb(29 23 48 / 0.1);
	cursor: pointer;
	transition: opacity 0.2s, transform 0.2s;
}

.fhm-products.is-arrows-large .fhm-products__arrow {
	inline-size: 46px;
	block-size: 46px;
}

.fhm-products__arrow:active {
	transform: scale(0.92);
}

.fhm-products__arrow[disabled] {
	opacity: 0;
	pointer-events: none;
}

.fhm-products__arrow.is-prev {
	inset-inline-start: -8px;
}

.fhm-products__arrow.is-next {
	inset-inline-end: -8px;
}

.fhm-products__arrow.is-prev svg {
	transform: rotate(-90deg);
}

.fhm-products__arrow.is-next svg {
	transform: rotate(90deg);
}

/* ---------- Dots (phones) ---------- */

.fhm-products__dots {
	display: none;
	justify-content: center;
	gap: 6px;
	margin-block-start: 10px;
}

.fhm-products__dots i {
	inline-size: 6px;
	block-size: 6px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--fhm-accent) 20%, #e7e3ee);
	transition: inline-size 0.2s, background-color 0.2s;
}

.fhm-products__dots i.is-on {
	inline-size: 18px;
	background: var(--fhm-accent);
}

/* ---------- Glass: frosted cards over a soft colour ---------- */

/* The colours live on ::before: Elementor's lazy-load wipes gradients inside its containers. */
.fhm-products.is-glass {
	isolation: isolate;
	padding: 24px;
	overflow: hidden;
	border-radius: calc(var(--fhm-radius, 16px) + 8px);
	background-color: var(--fpr-glass1);
}

.fhm-products.is-glass::before,
.fhm-products.is-glass::after {
	content: "";
	position: absolute;
	z-index: -1;
	pointer-events: none;
}

.fhm-products.is-glass::before {
	inset: 0;
	background: linear-gradient(135deg, var(--fpr-glass1), var(--fpr-glass2));
}

/* A soft light behind the cards, so the frost has something to blur. */
.fhm-products.is-glass::after {
	inset-block-start: -30%;
	inset-inline-end: 10%;
	inline-size: 45%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, color-mix(in srgb, var(--fhm-accent) 28%, transparent), transparent 70%);
}

.fhm-products.is-glass .fs-card {
	border-color: rgb(255 255 255 / 0.7);
	background: rgb(255 255 255 / 0.55);
	box-shadow: 0 8px 24px rgb(29 23 48 / 0.06), inset 0 1px 0 rgb(255 255 255 / 0.8);
	-webkit-backdrop-filter: blur(14px) saturate(1.4);
	backdrop-filter: blur(14px) saturate(1.4);
}

.fhm-products.is-glass .fs-card__media {
	background: rgb(255 255 255 / 0.45);
}

.fhm-products.is-glass .fhm-products__arrow {
	background: rgb(255 255 255 / 0.7);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.fhm-products.is-glass .fhm-products__arrow.is-prev {
	inset-inline-start: -6px;
}

.fhm-products.is-glass .fhm-products__arrow.is-next {
	inset-inline-end: -6px;
}

/* Glass with no colour behind it: the frosted cards stand on the page itself. */
.fhm-products.is-glass.no-bg {
	padding: 0;
	overflow: visible;
	border-radius: 0;
	background: none;
}

.fhm-products.is-glass.no-bg::before,
.fhm-products.is-glass.no-bg::after {
	content: none;
}

.fhm-products.is-glass.no-bg .fs-card {
	border-color: color-mix(in srgb, var(--fhm-accent) 14%, rgb(255 255 255 / 0.7));
	background: linear-gradient(160deg, rgb(255 255 255 / 0.85), color-mix(in srgb, var(--fhm-accent) 5%, rgb(255 255 255 / 0.6)));
	box-shadow: 0 10px 28px color-mix(in srgb, var(--fhm-accent) 10%, transparent), inset 0 1px 0 #fff;
}

.fhm-products.is-glass.no-bg .fs-card__media {
	background: color-mix(in srgb, var(--fhm-accent) 5%, #f7f6fa);
}

.fhm-products.is-glass.no-bg .fhm-products__arrow.is-prev {
	inset-inline-start: -8px;
}

.fhm-products.is-glass.no-bg .fhm-products__arrow.is-next {
	inset-inline-end: -8px;
}

/* ---------- Minimal: no frame, the picture carries the card ---------- */

.fhm-products.is-minimal .fs-card {
	border: 0;
	background: none;
	box-shadow: none;
}

.fhm-products.is-minimal .fs-card__media {
	overflow: hidden;
	border-radius: var(--fhm-radius, 16px);
}

.fhm-products.is-minimal .fs-card__body {
	padding-inline: 2px;
}

/* ---------- Phones ---------- */

@media (max-width: 767px) {
	.fhm-products__track {
		/* About one and a half cards in sight: the price and the button keep their room. */
		grid-auto-columns: min(62%, 240px);
	}

	/* Swiped with a finger: the arrows step aside, dots say where the row is. */
	.fhm-products__arrow {
		display: none;
	}

	.fhm-products.has-dots .fhm-products__dots {
		display: flex;
	}

	.fhm-products.is-glass {
		padding: 16px 12px;
		border-radius: var(--fhm-radius, 16px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.fhm-products__track {
		scroll-behavior: auto;
	}
}
