/* =========================================================
   متجر السنبلة — صفحة العرض
   قاعدتان:
   1) بدون الصنف .motion (بدون JS، «تقليل الحركة»، توفير البيانات):
      صفحة ثابتة ومقروءة.
   2) مع .motion: الأقسام تطول وتُثبَّت (sticky) وملف showcase.js
      يحرّك transform و opacity فقط عبر متغيرات CSS.
   ========================================================= */
body.showcase { overflow-x: clip; }
.showcase main { display: block; }

/* الرأس: رابط الكاتالوج بارز */
.nav-cta { background: var(--indigo); color: #fff !important; font-weight: 600; }
.nav-cta:hover { background: var(--indigo-2) !important; }

.btn-light { background: var(--cotton); color: var(--indigo); }
.btn-light:hover { background: #fff; }
.btn-indigo { background: var(--indigo); color: #fff; }
.btn-indigo:hover { background: var(--indigo-2); }
.btn-sm { min-height: 44px; padding: 10px 18px; font-size: .95rem; }
.text-link { color: var(--indigo); font-weight: 600; text-underline-offset: 4px; }

/* =========================================================
   الحالة الثابتة (الأساس)
   ========================================================= */
.scene { position: relative; }
.pin { position: relative; }

/* M1 */
.hero .pin { position: relative; padding: 14px var(--pad) 0; }
.hero-card {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  min-height: min(78svh, 720px); background: var(--indigo);
}
/* طبقة النص: فوق البطاقة وبنفس حدودها النهائية، ولا تتحرك معها */
.hero-layer {
  position: absolute; z-index: 1; inset: 14px var(--pad) 0;
  display: grid; align-content: end; pointer-events: none;
}
.hero-layer a { pointer-events: auto; }
.hero-card picture, .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-img { object-fit: cover; }
.hero-card::after {   /* تعتيم أسفل الصورة ليُقرأ النص */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20, 24, 38, .82) 0%, rgba(20, 24, 38, .45) 38%, rgba(20, 24, 38, 0) 70%);
}
.hero-text {
  position: relative; z-index: 1; color: var(--cotton);
  padding: clamp(22px, 5vw, 56px); display: grid; gap: 12px; justify-items: start; max-width: 720px;
}
.hero-kicker { font-size: .9rem; letter-spacing: .02em; color: #EBD9B0; }
.hero-title {
  color: #fff; font-size: clamp(2.4rem, 9vw, 5.2rem); line-height: 1.08; text-wrap: balance;
}
.hero-lead { font-size: clamp(1rem, 2.4vw, 1.2rem); max-width: 40ch; color: #F2ECE2; }
.hero-text .btn { margin-top: 6px; }
.hero-scroll { display: none; }

/* M2 */
.stack { padding: clamp(40px, 8vw, 96px) var(--pad) 0; display: grid; gap: 20px; max-width: var(--wrap); margin-inline: auto; }
.stack-card {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: var(--linen); display: grid; box-shadow: var(--shadow);
}
.stack-card:nth-child(2) { background: #E6EAF1; }
.stack-card:nth-child(3) { background: #F1E6D0; }
.stack-media { aspect-ratio: 16 / 10; }
.stack-media img { width: 100%; height: 100%; object-fit: cover; }
.stack-body { padding: clamp(22px, 4vw, 48px); display: grid; gap: 12px; align-content: center; }
.stack-body h2 { font-size: clamp(1.7rem, 5vw, 2.8rem); text-wrap: balance; }
.stack-body p { font-size: 1.05rem; max-width: 46ch; }
.stack-veil { display: none; }
@media (min-width: 900px) {
  .stack-card { grid-template-columns: 1.1fr 1fr; min-height: 460px; }
  .stack-media { aspect-ratio: auto; }
}

/* M3 */
.tray { padding: clamp(48px, 8vw, 96px) var(--pad) 0; }
.tray .pin { max-width: var(--wrap); margin-inline: auto; }
.tray-head { text-align: center; display: grid; gap: 6px; margin-bottom: 20px; }
.tray-title { font-size: clamp(1.8rem, 6vw, 3rem); }
.tray-hint { color: var(--muted); font-size: .9rem; }
.tray-plate, .tray-caption { display: none; }
.tray-rolls {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 10px;
  justify-items: center; padding: 10px 0 6px;
}
.tray-cards {
  list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.tcard {
  background: #fff; border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow);
  border: 1px dashed var(--line); display: grid; gap: 4px; align-content: start;
}
.tcard-t { font-family: var(--f-title); color: var(--indigo); font-size: 1.15rem; font-weight: 600; }
.tcard-p { color: var(--muted); }
.tcard-big { font-family: var(--f-title); color: var(--indigo); font-size: 2rem; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.tcard .btn { justify-self: start; margin-top: 8px; }

/* اللفيفة (مرسومة بالكود) */
.roll {
  --w: clamp(54px, 15vw, 92px);
  position: relative; display: grid; justify-items: center; text-decoration: none; color: var(--ink);
  width: calc(var(--w) * 1.25);
}
.roll-fig { display: block; position: relative; width: var(--w); height: calc(var(--w) * 2.05); }
.roll-ground {
  position: absolute; left: -18%; right: -18%; bottom: calc(var(--w) * -.12); height: calc(var(--w) * .34);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(34, 30, 26, .35), rgba(34, 30, 26, 0));
}
.roll-body {
  position: absolute; inset: calc(var(--w) * .17) 0 0; overflow: hidden;
  border-radius: 0 0 50% 50% / 0 0 calc(var(--w) * .17) calc(var(--w) * .17);
  background-color: var(--c, #ccc);
}
.roll-tex {
  position: absolute; inset: 0 auto 0 0; width: 200%;
  background-repeat: repeat-x; background-size: 50% 100%; background-position: 0 0;
  will-change: transform;
}
.roll-shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,.12) 14%, rgba(255,255,255,.22) 32%, rgba(255,255,255,.06) 46%, rgba(0,0,0,.14) 70%, rgba(0,0,0,.55) 100%);
}
.roll-top {
  position: absolute; top: 0; left: 0; right: 0; height: calc(var(--w) * .34); border-radius: 50%;
  background:
    radial-gradient(closest-side, #E9DFC9 0 18%, #8a7a62 19% 23%, transparent 24%),
    repeating-radial-gradient(closest-side, rgba(0,0,0,.20) 0 1px, rgba(0,0,0,0) 1px 4px),
    var(--c, #ccc);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15), inset 0 -3px 6px rgba(255,255,255,.25);
}
.roll-dim { position: absolute; inset: 0; background: #141826; opacity: 0; pointer-events: none; border-radius: 6px; }
.roll-name { display: block; margin-top: 12px; font-size: .82rem; text-align: center; line-height: 1.3; }
.roll:hover .roll-name, .roll:focus-visible .roll-name { color: var(--indigo); text-decoration: underline; }

/* M4 */
.wave {
  margin-top: clamp(48px, 8vw, 96px);
  background: var(--indigo) url("../../images/showcase/wave-1600.webp") center / cover no-repeat;
  position: relative;
}
.wave::before { content: ""; position: absolute; inset: 0; background: rgba(20, 28, 50, .5); }
.wave .pin { min-height: 70svh; display: grid; place-items: center; padding: 64px var(--pad); }
.wave-shape { display: none; }
.wave-text {
  position: relative; z-index: 1; text-align: center; color: var(--cotton);
  display: grid; gap: 16px; justify-items: center; max-width: 820px;
}
.wave-title { color: #fff; font-size: clamp(2rem, 7vw, 4rem); line-height: 1.15; text-wrap: balance; }
.wave-lead { font-size: clamp(1.02rem, 2.5vw, 1.25rem); color: #E9E3D8; }
.showcase .site-footer { margin-top: 0; }

/* =========================================================
   وضع الحركة (.motion على <html>، يضعه سطر في <head> قبل أول رسم)
   التثبيت بـ position: sticky (CSS)، والحركة كلها من GSAP + ScrollTrigger
   (showcase.js). هنا فقط: التخطيط + الحالة الأولى قبل وصول GSAP.
   --hh: ارتفاع الرأس (يقيسه showcase.js، والقيمة الافتراضية تقريبية)
   ========================================================= */
.motion .pin {
  position: sticky; top: var(--hh, 86px);
  height: calc(100svh - var(--hh, 86px)); overflow: clip;
}

/* M1: البطاقة (خلفية) تتحرك؛ طبقة النص ثابتة في حدود البطاقة النهائية */
.motion .hero { height: calc(100svh + 70svh); }
.motion .hero .pin { padding: 0; }
.motion .hero-card {
  position: absolute; inset: 14px var(--pad) 18px; min-height: 0;
  transform: scale(1.12);            /* تقريب لحالة البداية قبل GSAP */
  will-change: transform;
}
.motion .hero-layer { inset: 14px var(--pad) 18px; }
.motion .hero-scroll {
  display: block; position: absolute; z-index: 1; bottom: 22px; inset-inline-end: 26px;
  color: #fff; font-size: .8rem;
}
.motion .hero-scroll span::after {
  content: ""; display: block; width: 1px; height: 34px; margin: 8px auto 0;
  background: repeating-linear-gradient(to bottom, #fff 0 4px, transparent 4px 8px);
}

/* M2 */
.motion .stack { gap: 0; padding-bottom: 12svh; }
.motion .stack-card {
  position: sticky; top: calc(var(--hh, 86px) + 16px + var(--i) * 14px);
  height: calc(100svh - var(--hh, 86px) - 60px); margin-bottom: 14svh;
}
.motion .stack-media { overflow: hidden; }
.motion .stack-media img { will-change: transform; }
.motion .stack-card:last-child { margin-bottom: 0; }
.motion .stack-media { aspect-ratio: auto; min-height: 0; }
@media (max-width: 899px) {
  .motion .stack-card { grid-template-rows: 1fr auto; }
  .motion .stack-body { padding: 20px 22px 24px; }
}
.motion .stack-veil {
  display: block; position: absolute; inset: 0; background: #141826; pointer-events: none; opacity: 0;
}

/* M3 */
.motion .tray { height: 380svh; padding: 0; }
.motion .tray .pin { display: block; max-width: none; padding: 18px var(--pad) 0; }
.motion .tray-head { margin-bottom: 0; position: relative; z-index: 5; }
.motion .tray-stage { position: absolute; inset: 0; }
.motion .tray-plate {
  display: block; position: absolute; left: 50%; top: var(--cy, 60%);
  width: var(--pw, 600px); height: var(--ph, 170px); translate: -50% -50%;
  border-radius: 50%; background: #E8DCC6;
  box-shadow: 0 calc(var(--ph, 170px) * .12) 0 #CDBB9C, 0 calc(var(--ph, 170px) * .28) 40px rgba(34, 30, 26, .25);
}
.motion .tray-plate::after {
  content: ""; position: absolute; inset: 7%; border-radius: 50%; border: 1.5px dashed rgba(30, 42, 74, .35);
}
.motion .tray-rolls { display: block; padding: 0; }
.motion:not(.motion-ready) .tray-rolls { visibility: hidden; }   /* حتى يضعها GSAP في أماكنها */
.motion .roll {
  position: absolute; left: 0; top: 0; width: auto; display: block;
  --w: clamp(50px, 6.6vw, 92px);
  transform-origin: 50% 100%; will-change: transform;
}
.motion .roll-name { display: none; }
.motion .tray-caption {
  display: block; position: absolute; left: 50%; translate: -50% 0; top: calc(var(--cy, 60%) + var(--ph, 170px) * .5 + 34px);
  margin: 0; white-space: nowrap; font-family: var(--f-title); font-size: 1.15rem; color: var(--indigo);
  background: var(--cotton); padding: 4px 16px; border-radius: 999px; border: 1px dashed var(--line); z-index: 4;
}
.motion .tray-caption:empty { display: none; }
.motion .tray-cards { position: absolute; inset: 0; margin: 0; display: block; pointer-events: none; z-index: 300; }
.motion .tcard {
  position: absolute; width: min(280px, 40vw); pointer-events: auto;
  opacity: 0; visibility: hidden; will-change: transform, opacity;
}
.motion .tcard:nth-child(1) { inset-inline-start: 5%; top: 26%; }
.motion .tcard:nth-child(2) { inset-inline-end: 5%; top: 30%; }
.motion .tcard:nth-child(3) { inset-inline-start: 6%; top: 58%; }
.motion .tcard:nth-child(4) { inset-inline-end: 6%; top: 56%; }
@media (max-width: 699px) {
  .motion .tray { height: 320svh; }
  .motion .tcard,
  .motion .tcard:nth-child(n) {
    inset-inline: 7%; width: auto; top: auto; bottom: 16px; padding: 14px 16px;
  }
  .motion .tcard-big { font-size: 1.6rem; }
  .motion .roll[data-desktop-only] { display: none; }
  .motion .roll { --w: clamp(54px, 14vw, 80px); }
  .motion .tray-caption { font-size: 1rem; }
}

/* M4 */
.motion .wave { height: 300svh; background: var(--cotton); margin-top: 0; }
.motion .wave::before { display: none; }
.motion .wave .pin { min-height: 0; padding: 0 var(--pad); }
.motion .wave-shape {
  display: block; position: absolute; left: 50%; top: 50%; max-width: none;
  width: var(--ws, 160vmax); height: var(--ws, 160vmax);
  transform: translate(-50%, -50%) scale(.16) rotate(-16deg);   /* حالة البداية قبل GSAP */
  will-change: transform;
}
.motion .wave-text .w { display: inline-block; }

/* شاشة قصيرة (هاتف أفقي): الصفحة الثابتة، والصور لا تتجاوز ارتفاع الشاشة */
@media (max-height: 520px) {
  .stack-media { aspect-ratio: auto; height: 62svh; }
  .hero-card { min-height: max(300px, 82svh); }
}
