/* Flash Deals storefront section — everything scoped under .yps-fd. */
.yps-fd {
	--fd-red: #b3121b;       /* prices + digits */
	--fd-badge: #b3121b;
	--fd-save-bg: #fdecec;
	--fd-muted: #7a7f87;
	--fd-line: #e7e9ec;
}

/* Banner: full-bleed, natural ratio (direct child of the unconstrained section). */
.yps-fd__banner { display: block; width: 100%; height: auto; border-radius: 0; margin: 0; }

/* ---------- Shared countdown (under the banner) ----------
   Compact: one line of label + boxed digits, RTL order (largest unit on the
   right, read first), labels centred under their own box. */
.yps-fd__timer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px 4px; }
.yps-fd__timer-title { margin: 0; font-size: .95rem; font-weight: 700; color: #1b1d21; }
.yps-fd__digits { display: inline-flex; align-items: flex-start; gap: 4px; direction: rtl; font-variant-numeric: tabular-nums; }
.yps-fd__unit { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.yps-fd__unit[hidden], .yps-fd__sep[hidden] { display: none; }
.yps-fd__unit b {
	display: block; min-width: 2.4ch; padding: 4px 6px; border-radius: 8px; text-align: center;
	background: var(--fd-save-bg); color: var(--fd-red);
	font-size: 1.35rem; line-height: 1.1; font-weight: 800; direction: ltr;
}
.yps-fd__unit small { font-size: .68rem; color: var(--fd-muted); line-height: 1; }
.yps-fd__sep { font-size: 1.2rem; line-height: 1.6; font-weight: 800; color: var(--fd-red); }
.yps-fd.is-ended .yps-fd__timer-title::after { content: " — انتهى العرض"; color: var(--fd-muted); font-weight: 500; }

/* ---------- Track ---------- */
.yps-fd__grid { margin-top: 10px; }
.yps-fd__grid.y-grid--scroll { padding-inline: 16px; gap: 10px; align-items: stretch; }
@media (min-width: 768px) and (max-width: 767px) { .yps-fd__grid.y-grid--scroll { padding-inline: var(--y-pad, 24px); } }
.yps-fd__grid.y-grid--scroll > .yps-fd__slot { width: clamp(150px, 43vw, 200px); display: flex; }

/* ---------- Card ---------- */
.yps-fd .yps-fdc {
	position: relative; display: flex; flex-direction: column; width: 100%;
	background: #fff; border: 1.5px solid var(--fd-base, #E3E5E8); border-radius: 14px; /* static border = fallback + reduced-motion */
	isolation: isolate;
}
.yps-fd .yps-fdc__media { border-radius: 12.5px 12.5px 0 0; overflow: hidden; }
.yps-fd .yps-fdc__media { position: relative; background: #fff; aspect-ratio: 4 / 3; display: block; }
.yps-fd .yps-fdc__media > a { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px 8px 4px; }
.yps-fd .yps-fdc__media img { width: 100%; height: 100%; object-fit: contain; display: block; margin: 0; }

.yps-fd .yps-fdc__badge {
	position: absolute; top: 8px; right: 8px; left: auto; z-index: 2;
	background: var(--fd-badge); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1;
	padding: 5px 8px; border-radius: 6px; white-space: nowrap;
}
.yps-fd .yps-fdc__fav {
	position: absolute; top: 4px; right: auto; left: 4px; z-index: 2; /* badge takes the start (right) corner, heart the end (left) */
	width: 34px; height: 34px; margin: 0; background: transparent; box-shadow: none;
}
.yps-fd .yps-fdc__fav svg { width: 20px; height: 20px; }

.yps-fd .yps-fdc__body { display: flex; flex-direction: column; flex: 1; padding: 8px 10px 10px; gap: 6px; }
.yps-fd .yps-fdc__title { margin: 0; font-size: .86rem; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yps-fd .yps-fdc__title a { color: #1b1d21; text-decoration: none; }

/* Per-card countdown row (only rendered when products end at different times) */
.yps-fd .yps-fdc__timer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; border-block: 1px dashed var(--fd-line); }
.yps-fd .yps-fdc__timer-label { font-size: .7rem; color: var(--fd-muted); }
.yps-fd .yps-fdc__timer .yps-fd__unit b { font-size: .85rem; padding: 2px 3px; border-radius: 5px; }
.yps-fd .yps-fdc__timer .yps-fd__unit small { font-size: .55rem; }
.yps-fd .yps-fdc__timer .yps-fd__sep { font-size: .9rem; }
.yps-fd .yps-fdc__timer .yps-fd__digits { gap: 2px; }

/* Prices + add button: two columns, never overlapping */
.yps-fd .yps-fdc__foot { margin-top: auto; display: flex; align-items: flex-end; gap: 8px; }
.yps-fd .yps-fdc__prices { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.yps-fd .yps-fdc__price-row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 0; }
.yps-fd .yps-fdc__now { font-size: 1.12rem; font-weight: 800; color: var(--fd-red); line-height: 1.15; white-space: nowrap; unicode-bidi: isolate; }
.yps-fd .yps-fdc__was { font-size: .74rem; color: var(--fd-muted); text-decoration: line-through; text-decoration-thickness: 1px; white-space: nowrap; unicode-bidi: isolate; }
.yps-fd .yps-fdc__save { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--fd-red); background: var(--fd-save-bg); border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
/* «بيخلص بسرعة» image tag under the price (admin-configurable, default per store) */
.yps-fd .yps-fdc__tag { display: block; height: 16px; width: auto; max-width: 100%; margin: 2px 0 0; object-fit: contain; object-position: right center; }
@media (min-width: 768px) and (max-width: 767px) { .yps-fd .yps-fdc__tag { height: 18px; } }
.yps-fd .yps-fdc__add {
	position: static; inset: auto; transform: none; margin: 0; flex: 0 0 auto;
	width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
	border-radius: 50%; border: 1px solid #d7dade; background: #fff; color: #1b1d21;
}
.yps-fd .yps-fdc__add svg { width: 18px; height: 18px; }
.yps-fd .yps-fdc__add.added::after { display: none; }
.yps-fd .yps-fdc .added_to_cart { display: none; }
.yps-fd .yps-fdc__oos { font-size: .72rem; color: var(--fd-muted); font-weight: 700; }
.yps-fd .yps-fdc.is-outofstock .yps-fdc__media img { opacity: .55; }

@media (min-width: 768px) and (max-width: 767px) {
	.yps-fd__unit b { font-size: 1.6rem; }
	.yps-fd .yps-fdc__now { font-size: 1.25rem; }
}
html[dir="ltr"] .yps-fd .yps-fdc__badge { right: auto; left: 8px; }
html[dir="ltr"] .yps-fd .yps-fdc__fav { left: auto; right: 4px; }

/* ------------------------------------------------------------------ *
 * Animated gradient border — a short red→orange sheen travelling clockwise
 * around the card every 4.5s. Drawn on an overlay that sits exactly on top of
 * the card's own 1.5px border (inset:-1.5px), masked to a ring, so the card's
 * size, content and background never move. Only enabled when flash-deals.js
 * confirms support (@property + conic-gradient) by adding .yps-fd--sheen;
 * otherwise the plain grey border above is what shows.
 * ------------------------------------------------------------------ */
@property --fd-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.yps-fd--sheen .yps-fdc::after {
	content: ""; position: absolute; inset: -1.5px; z-index: 5; pointer-events: none;
	border-radius: 14px; padding: 1.5px;
	background:
		conic-gradient(from var(--fd-a),
			transparent 0deg 250deg,
			color-mix(in srgb, var(--fd-c1, #B5121B) 35%, transparent) 275deg,
			var(--fd-c1, #B5121B) 300deg,
			var(--fd-c2, #EE2634) 322deg,
			var(--fd-c3, #FF9A45) 342deg,
			color-mix(in srgb, var(--fd-c3, #FF9A45) 0%, transparent) 360deg),
		var(--fd-base, #E3E5E8);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	animation: yps-fd-sheen var(--fd-speed, 4.5s) linear infinite;
	animation-play-state: paused;           /* runs only while on screen */
}
.yps-fd--sheen .yps-fdc.is-fd-visible::after { animation-play-state: running; }
.yps-fd--sheen.is-fd-hidden-tab .yps-fdc::after { animation-play-state: paused; }
@keyframes yps-fd-sheen { to { --fd-a: 360deg; } }

@media (prefers-reduced-motion: reduce) {
	.yps-fd--sheen .yps-fdc::after { display: none; }
}

/* ---------- Swipe hint (added by flash-deals.js only when the row overflows) ---------- */
.yps-fd { position: relative; }
.yps-fd__swipe {
	display: flex; align-items: center; justify-content: center; gap: 6px; width: max-content;
	margin: 8px auto 0; padding: 5px 12px; border-radius: 999px;
	background: var(--fd-save-bg); color: var(--fd-red); font-size: .78rem; font-weight: 700;
	transition: opacity .35s ease, transform .35s ease;
}
.yps-fd__swipe-hand { display: inline-block; animation: yps-fd-swipe 1.4s ease-in-out infinite; }
@keyframes yps-fd-swipe { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-8px); } }
.yps-fd.fd-swiped .yps-fd__swipe { opacity: 0; transform: translateY(-4px); pointer-events: none; }
@media (min-width: 1024px) and (max-width: 767px) { .yps-fd__swipe { display: none; } }
@media (prefers-reduced-motion: reduce) { .yps-fd__swipe-hand { animation: none; } }

/* ------------------------------------------------------------------ *
 * 2026-10-08 calm pass — less to read, less moving at once.
 * Timer: one quiet pill «ينتهي خلال  1 يوم  23:38:40» instead of four
 * labelled boxes. Card: small «-20٪» badge, no gallery dots, lighter add
 * button, still/soft border (the sheen only shimmers faintly).
 * ------------------------------------------------------------------ */
.yps-fd__timer {
	width: max-content; max-width: calc(100% - 32px); margin: 12px auto 2px; padding: 6px 14px;
	flex-wrap: nowrap; gap: 8px; border-radius: 999px; background: var(--fd-save-bg);
}
.yps-fd__timer-title { font-size: .8rem; font-weight: 600; color: var(--fd-red); }
.yps-fd__digits { gap: 2px; align-items: baseline; }
.yps-fd__unit { flex-direction: row; align-items: baseline; gap: 3px; }
.yps-fd__unit b, .yps-fd .yps-fdc__timer .yps-fd__unit b { background: none; padding: 0; min-width: 2ch; border-radius: 0; font-size: 1.05rem; color: var(--fd-red); }
.yps-fd__unit small { display: none; }
.yps-fd__unit[data-unit-d] small { display: inline; font-size: .8rem; font-weight: 700; color: var(--fd-red); margin-inline-end: 6px; }
.yps-fd__unit[data-unit-d] b { min-width: 0; }
.yps-fd__sep { font-size: 1rem; line-height: 1; color: var(--fd-red); opacity: .6; }
.yps-fd__sep[data-sep-d] { display: none; }
@media (min-width: 768px) and (max-width: 767px) { .yps-fd__unit b { font-size: 1.15rem; } }

.yps-fd .yps-fdc__badge { top: 8px; right: 8px; padding: 3px 6px; font-size: .68rem; border-radius: 999px; }
.yps-fd .y-card__dots { display: none !important; }
.yps-fd .yps-fdc__media > a { padding: 26px 8px 6px; }
.yps-fd .yps-fdc__fav svg { width: 18px; height: 18px; }
.yps-fd .yps-fdc__add { width: 32px; height: 32px; border-color: transparent; background: #f3f4f6; }
.yps-fd .yps-fdc__add svg { width: 16px; height: 16px; }
.yps-fd .yps-fdc__now { font-size: 1.05rem; }
.yps-fd .yps-fdc__tag { height: 14px; opacity: .92; }
@media (min-width: 768px) and (max-width: 767px) { .yps-fd .yps-fdc__tag { height: 16px; } }
.yps-fd--sheen .yps-fdc::after { opacity: .55; }
.yps-fd .yps-fdc__badge { direction: ltr; unicode-bidi: isolate; }

/* 2026-10-08 scroll pass: the animated @property conic border repainted every
   card on every frame (main-thread paint) and made the page stutter while
   scrolling. Static soft-red border instead; swipe hand stops once dismissed. */
.yps-fd--sheen .yps-fdc::after { display: none; }
.yps-fd .yps-fdc { border-color: #f2c4c7; }
.yps-fd.fd-swiped .yps-fd__swipe-hand { animation: none; }

/* ------------------------------------------------------------------ *
 * v2 «offer card» (2026-10-08): ~1.5 cards per phone screen, square photo,
 * savings badge on the photo, big price, low-stock bar, full-width CTA.
 * Scoped to .yps-fdc--v2 (preview ?fdv2=1 / option yps_fd_card_v2).
 * ------------------------------------------------------------------ */
.yps-fd__grid.y-grid--scroll > .yps-fd__slot:has(.yps-fdc--v2) { width: clamp(180px, 60vw, 240px); }
.yps-fd .yps-fdc--v2 { border: 1px solid #f2c4c7; border-radius: 16px; overflow: hidden; }
.yps-fd .yps-fdc--v2 .yps-fdc__media { aspect-ratio: 1 / 1; background: #f4f5f7; border-radius: 0; }
.yps-fd .yps-fdc--v2 .yps-fdc__media > a { padding: 10px; }
.yps-fd .yps-fdc--v2 .yps-fdc__media img { mix-blend-mode: multiply; }
.yps-fd .yps-fdc--v2 .yps-fdc__badge { top: 10px; right: 10px; padding: 5px 10px; border-radius: 8px; font-size: .8rem; font-weight: 800; direction: rtl; }
.yps-fd .yps-fdc--v2 .yps-fdc__fav { top: 8px; left: 8px; width: 32px; height: 32px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; }
.yps-fd .yps-fdc--v2 .yps-fdc__body { padding: 10px 12px 12px; gap: 6px; }
.yps-fd .yps-fdc--v2 .yps-fdc__title { font-size: .9rem; font-weight: 600; }
.yps-fd .yps-fdc--v2 .yps-fdc__foot { flex-direction: column; align-items: stretch; gap: 10px; }
.yps-fd .yps-fdc--v2 .yps-fdc__now { font-size: 1.3rem; }
.yps-fd .yps-fdc--v2 .yps-fdc__was { font-size: .8rem; }
.yps-fd .yps-fdc--v2 .yps-fdc__pct { font-size: .7rem; font-weight: 700; color: var(--fd-red); background: var(--fd-save-bg); border-radius: 999px; padding: 2px 7px; }
.yps-fd .yps-fdc--v2 .yps-fdc__stock span { display: block; font-size: .74rem; font-weight: 700; color: var(--fd-red); margin-bottom: 4px; }
.yps-fd .yps-fdc--v2 .yps-fdc__stock i { display: block; height: 4px; border-radius: 4px; background: #f1f1f1; position: relative; overflow: hidden; }
.yps-fd .yps-fdc--v2 .yps-fdc__stock i::after { content: ""; position: absolute; inset: 0 0 0 auto; width: var(--fd-left, 30%); background: var(--fd-red); border-radius: 4px; }
.yps-fd .yps-fdc--v2 .yps-fdc__add { width: 100%; height: 40px; border-radius: 10px; background: #1b1d21; color: #fff; border: 0; font-size: .88rem; font-weight: 700; text-decoration: none; }
.yps-fd .yps-fdc--v2 .yps-fdc__add.loading { opacity: .6; }
.yps-fd .yps-fdc--v2 .yps-fdc__oos { display: block; text-align: center; padding: 10px; border-radius: 10px; background: #f3f4f6; }

/* v2 trim (2026-10-08, owner: «كلام كتير»): one discount number on the photo,
   price + struck price, same round + button as the regular cards. */
.yps-fd .yps-fdc--v2 .yps-fdc__foot { flex-direction: row; align-items: flex-end; gap: 8px; }
.yps-fd .yps-fdc--v2 .yps-fdc__add { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: #f3f4f6; color: #1b1d21; }
.yps-fd .yps-fdc--v2 .yps-fdc__add svg { width: 18px; height: 18px; }
.yps-fd .yps-fdc--v2 .yps-fdc__badge { font-size: .78rem; direction: ltr; }
.yps-fd .yps-fdc--v2 .yps-fdc__now { font-size: 1.2rem; }
.yps-fd .yps-fdc--v2 .yps-fdc__stock { font-size: .72rem; font-weight: 700; color: var(--fd-red); }
.yps-fd .yps-fdc--v2 .yps-fdc__oos { padding: 0; background: none; }

/* v2: model photo fills the card (cover, no inner padding) + a soft static
   tinted backdrop behind the whole section, faded in/out with a gradient mask
   (one paint, no animation). */
.yps-fd .yps-fdc--v2 .yps-fdc__media { background: #fff; }
.yps-fd .yps-fdc--v2 .yps-fdc__media > a { padding: 0; }
.yps-fd .yps-fdc--v2 .yps-fdc__media img { object-fit: cover; mix-blend-mode: normal; }
.yps-fd .yps-fdc--v2 .y-card__track, .yps-fd .yps-fdc--v2 .y-card__slide { width: 100%; height: 100%; }
.yps-fd:has(.yps-fdc--v2) { isolation: isolate; padding-bottom: 18px; }
.yps-fd:has(.yps-fdc--v2)::before {
	content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
	background: linear-gradient(160deg, #fff1ec 0%, #fde3e3 45%, #fff4ea 100%);
	-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 80%, transparent 100%);
	mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 80%, transparent 100%);
}

/* v2 round 3: a bit smaller (~2 cards + a peek), compact animated swipe hint. */
.yps-fd__grid.y-grid--scroll > .yps-fd__slot:has(.yps-fdc--v2) { width: clamp(150px, 45vw, 200px); }
.yps-fd .yps-fdc--v2 .yps-fdc__now { font-size: 1.05rem; }
.yps-fd .yps-fdc--v2 .yps-fdc__was { font-size: .72rem; }
.yps-fd .yps-fdc--v2 .yps-fdc__body { padding: 8px 10px 10px; gap: 4px; }
.yps-fd .yps-fdc--v2 .yps-fdc__add { width: 32px; height: 32px; flex-basis: 32px; }
.yps-fd:has(.yps-fdc--v2) .yps-fd__swipe { margin-top: 10px; padding: 3px 10px; font-size: .72rem; background: #fff; }

/* v2 round 4: deals overlap the listing hero — the model photo is their
   backdrop (owner request). Section pulled up over the faded lower part of the
   photo; own tinted backdrop dropped there so the photo shows through. */
.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) { position: relative; z-index: 3; margin-top: -190px; padding-top: 0; }
.yef-listing__banner + .yps-fd:has(.yps-fdc--v2)::before { display: none; }
.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) .yps-fd__banner { width: calc(100% - 32px); margin: 0 auto; border-radius: 12px; }
.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) .yps-fd__timer { background: #fff; }
.yps-fd ~ .yef-listing__body { margin-top: 0; }
@media (min-width: 768px) and (max-width: 767px) {
	.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) { margin-top: -230px; }
	.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) .yps-fd__banner { max-width: 900px; }
}
.yef-listing__banner + .yps-fd:has(.yps-fdc--v2) { padding-bottom: 6px; margin-bottom: 18px; }
.yps-fd:has(.yps-fdc--v2) .yps-fd__grid { padding-bottom: 4px; }
/* beat the card-gallery mu-plugin's .yef-listing:is([data-sub]) .yef-listing__body{margin-top:-64px} */
.yef-listing .yps-fd ~ .yef-listing__body.yef-listing__body { margin-top: 0; }

/* v2: model photos fill the frame; plain product shots (front/side) sit
   smaller with breathing room — big edge-to-edge frames looked heavy. */
.yps-fd .yps-fdc--v2 .yps-fdc__media img:not([src*="-model-"]) { object-fit: contain; padding: 18% 12%; box-sizing: border-box; }
.yps-fd .yps-fdc--v2 .yps-fdc__media img:not([src*="-model-"]) { mix-blend-mode: multiply; }
/* product-only shots: bigger again (owner: too small), still not edge-to-edge */
.yps-fd .yps-fdc--v2 .yps-fdc__media img:not([src*="-model-"]) { padding: 6% 4%; }
.yps-fd .yps-fdc--v2 .yps-fdc__tag { height: 16px; }
.yps-fd .yps-fdc--v2 .yps-fdc__media img:not([src*="-model-"]) { padding: 0 2%; transform: scale(1.08); }
