/* ==========================================================================
   Home: "أحدث العروض والكوبونات" — vertical coupon tickets.
   Same family as the list ticket (brand colour, dashed perforation, notches)
   but stood upright: brand head on top, value + title in the middle, CTA below.
   Uses the tokens from sc-header.css. --store / --store-on = brand colours.
   ========================================================================== */
/* The section sets its own background so the ticket notches (--cut) always match it. */
.sc-latest { --sc-latest-bg: #F4F1EA; padding-block: 36px 52px; background: var(--sc-latest-bg); }
.sc-latest .sc-hdeal { --cut: var(--sc-latest-bg); }
.sc-latest__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 20px; }

/* Type tabs */
.sc-latest__tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 999px; background: #fff; box-shadow: 0 2px 10px rgba(28, 43, 51, .06); }
.sc-latest__tabs button { padding: 7px 16px; border: 0; border-radius: 999px; background: none; color: var(--sc-ink); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background .2s, color .2s; }
.sc-latest__tabs button:hover { background: var(--sc-green-soft); color: var(--sc-green); }
.sc-latest__tabs button.is-active { background: var(--sc-green); color: #fff; }

/* Grid */
.sc-latest__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 4px; list-style: none; }
.sc-latest__grid > li[hidden] { display: none; }

/* Card: shadow on the wrapper because the ticket edges are cut out */
.sc-hdeal { --cut: var(--sc-bg, #F7F5F0); position: relative; display: flex; flex-direction: column; height: 100%; border-radius: 20px; background: #fff; box-shadow: 0 8px 22px rgba(28, 43, 51, .08); transition: transform .25s, box-shadow .25s; }
.sc-hdeal:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(28, 43, 51, .14); }

.sc-hdeal__head { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px; padding: 16px 16px 20px; border-radius: 20px 20px 0 0; background: var(--store); color: var(--store-on); overflow: hidden; }
/* Soft light sweep across the brand colour */
.sc-hdeal__head::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 80px at 85% 0%, rgba(255, 255, 255, .28), transparent 70%); pointer-events: none; }
.sc-hdeal__logo { grid-row: 1 / 3; display: block; width: 52px; height: 52px; overflow: hidden; border: 3px solid #fff; border-radius: 15px; background: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); transition: transform .3s; }
.sc-hdeal__logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sc-hdeal:hover .sc-hdeal__logo { transform: rotate(-6deg) scale(1.05); }
.sc-hdeal__store { overflow: hidden; font-size: 15px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.sc-hdeal__type { justify-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--store-on) 16%, transparent); font-size: 11.5px; font-weight: 700; }

/* Perforation: dashed line + two round notches */
.sc-hdeal__tear { position: relative; display: block; height: 0; margin: 0 18px; border-top: 2px dashed var(--sc-line); }
.sc-hdeal__tear::before, .sc-hdeal__tear::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--cut); }
.sc-hdeal__tear::before { inset-inline-start: -30px; }
.sc-hdeal__tear::after { inset-inline-end: -30px; }

.sc-hdeal__body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 18px 6px; }
.sc-hdeal__value { color: var(--sc-green); font-size: 24px; font-weight: 800; line-height: 1.2; }
.sc-hdeal__title { display: -webkit-box; margin: 0; overflow: hidden; font-size: 17px; font-weight: 800; line-height: 1.6; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-hdeal__title a { color: var(--sc-ink); }
.sc-hdeal__title a:hover { color: var(--sc-green); }
.sc-hdeal__terms { display: -webkit-box; margin: 0; overflow: hidden; color: var(--sc-muted); font-size: 14px; line-height: 1.75; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* Trust line at the bottom of the body: success / uses / expiry + flags (flags pushed to the end). */
.sc-hdeal__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--sc-line); }
.sc-hdeal__meta { flex-wrap: nowrap; gap: 5px; overflow: hidden; }
.sc-hdeal__meta > span:not(.sc-hdeal__where) { display: inline-flex; flex: none; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 999px; background: var(--sc-green-soft); color: var(--sc-green); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.sc-hdeal__meta .sc-icon { width: 11px; height: 11px; }
/* Country: a white pill (flag + name) on the far side of the brand strip,
   vertically centred with the logo. Several countries = flags only. */
.sc-hdeal__head { grid-template-columns: auto 1fr auto; }
.sc-hdeal__where { position: relative; z-index: 1; grid-column: 3; grid-row: 1 / 3; align-self: center; display: flex; gap: 4px; }
.sc-hdeal__country { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: #fff; color: #1C2B33; font-size: 12px; font-weight: 700; box-shadow: 0 3px 8px rgba(0, 0, 0, .15); }
[dir="rtl"] .sc-hdeal__country { padding: 4px 4px 4px 10px; }
.sc-hdeal__country img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }

/* Link to the store's other offers: closes the body so cards never look empty. */
.sc-hdeal__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--sc-green); font-size: 13px; font-weight: 700; }
.sc-hdeal__more:hover { text-decoration: underline; }
[dir="ltr"] .sc-hdeal__more .sc-icon { transform: scaleX(-1); }

/* CTA: green pill; code type shows the last 3 characters peeking from a dashed gold tab */
.sc-hdeal__foot { padding: 12px 18px 18px; }
.sc-hdeal__cta { position: relative; display: flex; align-items: center; justify-content: center; min-height: 46px; overflow: hidden; border-radius: var(--sc-pill); background: var(--sc-green); color: #fff; font-size: 14.5px; font-weight: 800; transition: background .2s; }
.sc-hdeal__cta:hover { background: var(--sc-green-dark); color: #fff; }
.sc-hdeal__cta--code { justify-content: flex-start; padding-inline-start: 18px; border: 2px dashed var(--sc-gold); background: #FFF8E3; color: var(--sc-ink); }
.sc-hdeal__cta--code .sc-coupon__cta-label { position: relative; z-index: 1; display: flex; align-items: center; align-self: stretch; padding-inline: 14px 22px; margin-inline-start: -18px; border-radius: 12px 0 0 12px; background: var(--sc-green); color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); }
[dir="rtl"] .sc-hdeal__cta--code .sc-coupon__cta-label { border-radius: 0 12px 12px 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%); padding-inline: 14px 22px; }
.sc-hdeal__peek { order: 2; margin-inline-start: auto; padding-inline: 14px; font-family: ui-monospace, monospace; font-size: 15px; font-weight: 800; letter-spacing: 1px; color: var(--sc-green-dark); }
.sc-hdeal__cta--code:hover { background: #FFF1C4; }
.sc-hdeal__cta.is-revealed .sc-coupon__cta-label { clip-path: none; margin-inline-start: 0; width: 100%; justify-content: center; border-radius: 12px; letter-spacing: 1px; }
.sc-hdeal__cta.is-revealed .sc-hdeal__peek { display: none; }

.sc-latest__more { display: flex; justify-content: center; margin-top: 26px; }
.sc-latest__more a { display: inline-flex; align-items: center; gap: 8px; padding: 11px 24px; border: 2px solid var(--sc-green); border-radius: 999px; color: var(--sc-green); font-weight: 800; transition: background .2s, color .2s; }
.sc-latest__more a:hover { background: var(--sc-green); color: #fff; }
[dir="ltr"] .sc-latest__more .sc-icon { transform: scaleX(-1); }

@media (max-width: 1100px) {
	.sc-latest__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
	.sc-latest__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
/* Mobile: tabs scroll sideways, two compact cards per row. */
@media (max-width: 600px) {
	.sc-latest { padding-block: 20px 36px; }
	.sc-latest__tabs { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
	.sc-latest__tabs::-webkit-scrollbar { display: none; }
	.sc-latest__tabs button { flex: none; padding: 6px 13px; font-size: 12.5px; }
	/* Two compact cards per row. Head is a centred stack: logo (with the country
	   flag as a small badge on its corner) · store name · type chip. */
	.sc-latest__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 2px; }
	.sc-hdeal { border-radius: 16px; }
	.sc-hdeal__head { grid-template-columns: 1fr; justify-items: center; row-gap: 6px; padding: 14px 10px 16px; border-radius: 16px 16px 0 0; text-align: center; }
	.sc-hdeal__logo { grid-column: 1; grid-row: 1; width: 48px; height: 48px; border-radius: 14px; }
	.sc-hdeal__store { grid-row: 2; max-width: 100%; font-size: 13px; }
	.sc-hdeal__type { grid-row: 3; justify-self: center; margin-top: 0; font-size: 10.5px; }
	/* Flag badge: same grid cell as the logo, nudged onto its lower outer corner. */
	.sc-hdeal__where { position: relative; grid-column: 1; grid-row: 1; align-self: end; justify-self: center; gap: 0; transform: translate(-24px, 6px); }
	[dir="ltr"] .sc-hdeal__where { transform: translate(24px, 6px); }
	.sc-hdeal__country, [dir="rtl"] .sc-hdeal__country { padding: 0; font-size: 0; background: none; box-shadow: none; }
	.sc-hdeal__country img { width: 20px; height: 20px; box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0, 0, 0, .25); }
	.sc-hdeal__country + .sc-hdeal__country { margin-inline-start: -6px; }

	.sc-hdeal__tear { margin: 0 12px; }
	.sc-hdeal__tear::before { inset-inline-start: -23px; width: 18px; height: 18px; top: -10px; }
	.sc-hdeal__tear::after { inset-inline-end: -23px; width: 18px; height: 18px; top: -10px; }
	.sc-hdeal__body { gap: 6px; padding: 12px 12px 2px; }
	.sc-hdeal__value { font-size: 19px; }
	.sc-hdeal__title { font-size: 14px; }
	.sc-hdeal__terms { font-size: 12px; }
	/* Small screens: one trust chip only, and no "N عروض من …" line (it wrapped). */
	.sc-hdeal__meta { padding-top: 8px; }
	.sc-hdeal__meta > span:not(.sc-hdeal__where) { font-size: 10px; padding: 2px 6px; }
	.sc-hdeal__meta > span:nth-child(n+2) { display: none; }
	.sc-hdeal__more { display: none; }
	.sc-hdeal__foot { padding: 10px 12px 12px; }
	.sc-hdeal__cta { min-height: 40px; font-size: 12.5px; }
	.sc-hdeal__cta--code { padding-inline-start: 10px; }
	.sc-hdeal__cta--code .sc-coupon__cta-label, [dir="rtl"] .sc-hdeal__cta--code .sc-coupon__cta-label { padding-inline: 10px 16px; margin-inline-start: -10px; }
	.sc-hdeal__peek { padding-inline: 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
	.sc-hdeal, .sc-hdeal__logo { transition: none; }
}
