/* ════════════════════════════════════════════════════════════════════════════
   وَصل — حركةُ الصفحة الزرقاء (D-240 · `docs/WASL-LANDING-MOTION-PLAN.md`)

   تُحمَّل بعد `landing-blue.css` على الرئيسيّة وحدها. القاعدةُ كلُّها:

   • **الحالةُ الثابتةُ هي الأصل.** بلا JS وتحت `prefers-reduced-motion: reduce` يُرى كلُّ شيءٍ مكتملًا في مكانه —
     لا شيءَ مخفيٌّ ينتظر حدثًا. الحركةُ كلُّها داخل `@media (prefers-reduced-motion: no-preference)`.
   • **الإخفاءُ لا يحدث إلا بعد أن يعلن السكربتُ استلامَه** (`html.mo-ready`)، فسكربتٌ لم يُحمَّل لا يترك صفحةً مخفيّة.
   • **المستمرُّ منها `transform` و`opacity` فقط.** والمتكرّرُ يتوقّف خارج الشاشة (`.mo-paused`).
   • **الزخرفةُ `pointer-events: none`** فلا تغطّي زرَّ واتساب ولا الاتصال ولا النموذج.
   • على الجوّال أقلُّ: موجةٌ واحدة، بلا طفوٍ للوسوم، وسلّمُ ظهورٍ أقصر.
   ════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════ الموجات (ثابتةٌ افتراضًا) ═══════════════════ */
.lb-waves { position: absolute; inset-inline: 0; inset-block-end: 56px; block-size: 140px; z-index: 0; pointer-events: none; overflow: hidden; }
.lb-wave { position: absolute; inset-inline-start: 0; inset-block-end: 0; inline-size: 200%; block-size: 100%; }
.lb-wave-a path { fill: rgba(51, 214, 255, .13); }
.lb-wave-b path { fill: rgba(0, 137, 255, .22); }
.lb-hero-in { position: relative; z-index: 1; }

/* ═══════════════════ العصفور — ثابتٌ افتراضًا ═══════════════════ */
.lb-bird { transform-origin: 50% 100%; }

/* ═══════════════════ الحكاية فوق لقطة الكاشير ═══════════════════
   اللقطةُ نفسُها غيرُ مقلوبةٍ في الاتجاهين والسلّةُ فيها يسارًا — فالغطاءُ مثبَّتٌ بإحداثيٍّ فيزيائيّ لا منطقيّ. */
.lb-shot { container-type: inline-size; }
.lb-demo { position: absolute; inset: 0; pointer-events: none; font-size: clamp(10.5px, 2.05cqw, 14px); line-height: 1.35; color: #0B2250; }
.lb-demo > * { position: absolute; left: 1.6%; inline-size: 28.5%; }
.lb-demo-tag { top: auto; bottom: 2.5%; inline-size: auto !important; padding: 2px 9px; border-radius: 999px; background: rgba(255, 101, 17, .95); color: #031D55; font-weight: 800; font-size: .82em; }
.lb-demo-toast { top: 41%; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 12px; background: #fff; box-shadow: 0 8px 20px rgba(0, 20, 70, .35); font-weight: 800; }
.lb-demo-toast .ic { color: var(--btn-blue); inline-size: 1.25em; block-size: 1.25em; }
.lb-demo-cart { top: 41%; display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.lb-demo-cart li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 9px; border-radius: 9px; background: #FFF1DC; border: 1px solid #FFC989; font-weight: 700; }
.lb-demo-cart b { color: #7A3F00; font-weight: 900; }
.lb-demo-bill { top: 63%; display: grid; gap: 5px; padding: 9px 11px 12px; background: #fff; border-radius: 4px 4px 10px 10px; box-shadow: 0 10px 24px rgba(0, 20, 70, .4); transform-origin: top center; }
.lb-demo-bill b { display: flex; align-items: center; gap: 6px; font-weight: 900; color: var(--navy); }
.lb-demo-bill .ic { color: var(--btn-blue); inline-size: 1.2em; block-size: 1.2em; }
.lb-demo-bill i { display: block; block-size: 5px; border-radius: 3px; background: #D3E5F9; }
.lb-demo-bill i:nth-of-type(2) { inline-size: 70%; }
.lb-demo-bill i:nth-of-type(3) { inline-size: 45%; }

@media (max-width: 960px) {
  .lb-demo { font-size: clamp(11px, 3.1cqw, 14px); }
  .lb-demo > * { inline-size: 46%; }
  .lb-demo-toast, .lb-demo-cart, .lb-demo-bill { top: 36%; }
  .lb-demo-bill { inline-size: 46%; }
}

/* خطُّ مسار الطلب (زخرفة) — مرسومٌ كاملًا بلا سكربت */
.lb-route-wrap { position: relative; margin-block-start: 22px; }
.lb-route-wrap .lb-list { margin-block-start: 0; position: relative; z-index: 1; }
.lb-route { position: absolute; inset-block: 0; inset-inline-start: 38px; inline-size: 3px; block-size: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.lb-route path { fill: none; stroke: var(--orange); stroke-width: 3px; stroke-linecap: round; }

@media print { .mo-rv { opacity: 1 !important; transform: none !important; } }

/* ═══════════════════ الحركة ═══════════════════ */
@media (prefers-reduced-motion: no-preference) {

  .mo-paused, .mo-paused * { animation-play-state: paused !important; }

  /* ── الموجات: إزاحةٌ بطيئة ── */
  .lb-wave-a { animation: mo-wave 34s linear infinite; }
  .lb-wave-b { animation: mo-wave 22s linear infinite; }
  @keyframes mo-wave { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

  /* ── دخولُ نصّ البطل (دون العنوان: لا يتأخّر أكبرُ نصٍّ في الصفحة) ── */
  .lb-eyebrow, .lb-lead, .lb-from, .lb-ctas, .lb-assure { animation: mo-rise .7s cubic-bezier(.2, .7, .2, 1) backwards; }
  .lb-lead { animation-delay: .08s; } .lb-from { animation-delay: .14s; } .lb-ctas { animation-delay: .2s; } .lb-assure { animation-delay: .28s; }
  @keyframes mo-rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } to { opacity: 1; transform: none; } }

  /* ── العصفور: يطير فيدخل ثم يرفرف ويرمش ويتمايل ── */
  .lb-bird { --wb-from: -150%; animation: wb-fly 1.4s cubic-bezier(.22, .8, .24, 1) backwards; }
  [dir="ltr"] .lb-bird { --wb-from: 150%; }
  @keyframes wb-fly {
    0%   { opacity: 0; transform: translate3d(var(--wb-from), -60%, 0) rotate(-12deg) scale(.7); }
    18%  { opacity: 1; }
    72%  { transform: translate3d(4%, 6%, 0) rotate(3deg) scale(1.04); }
    100% { opacity: 1; transform: none; }
  }
  /* العصفور من ثلاث طبقات: الدخولُ بالطيران ثمّ تمايلٌ وميلٌ بالخصائص المستقلّة `translate` و`rotate` فلا تتصادم مع `transform` الدخول،
     والجناحُ يرفرف دفعةً كلَّ بضع ثوانٍ حول كتفه، والجفنُ يرمش — `transform` وحده. على الجوّال الصغير يبقى الرمشُ والتمايلُ فقط. */
  .lb-bird { animation: wb-fly 1.4s cubic-bezier(.22, .8, .24, 1) backwards, wb-bob 3.2s ease-in-out 1.4s infinite alternate; }
  .lb-bird .lb-bird-wing { animation: wb-flap 5.2s ease-in-out 2s infinite; }
  .lb-bird .lb-bird-lid { animation: wb-blink 4.3s ease-in-out 2.6s infinite; }
  @keyframes wb-flap {
    0%, 58%, 100% { transform: rotate(0); }
    63% { transform: rotate(-3deg); } 69% { transform: rotate(3.5deg); } 75% { transform: rotate(-2.5deg); } 81% { transform: rotate(2deg); } 88% { transform: rotate(0); }
  }
  @keyframes wb-blink { 0%, 90%, 100% { transform: scaleY(0); } 94% { transform: scaleY(.96); } 97.5% { transform: scaleY(0); } }
  @media (max-width: 560px) { .lb-bird .lb-bird-wing { animation: none; } }
  @keyframes wb-bob { from { translate: 0 0; } to { translate: 0 -14px; } }
  .lb-bird { transition: rotate .35s cubic-bezier(.3, 1.4, .5, 1); }
  .lb-bird.is-near { rotate: 7deg; }

  /* ── حكاية الكاشير: ٩ ثوانٍ تدور: طلبٌ يصل ← تمتلئ السلة ← تخرج الفاتورة ── */
  .lb-demo-toast { animation: mo-toast 9s ease-in-out infinite; }
  .lb-demo-cart li:nth-child(1) { animation: mo-line-1 9s ease-in-out infinite; }
  .lb-demo-cart li:nth-child(2) { animation: mo-line-2 9s ease-in-out infinite; }
  .lb-demo-cart li:nth-child(3) { animation: mo-line-3 9s ease-in-out infinite; }
  .lb-demo-bill { animation: mo-bill 9s ease-in-out infinite; }
  @keyframes mo-toast {
    0%, 3%    { opacity: 0; transform: translate3d(-14px, 0, 0); }
    8%, 24%   { opacity: 1; transform: none; }
    30%, 100% { opacity: 0; transform: translate3d(0, -8px, 0); }
  }
  @keyframes mo-line-1 { 0%, 28% { opacity: 0; transform: translate3d(-12px, 0, 0); } 34%, 91% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
  @keyframes mo-line-2 { 0%, 37% { opacity: 0; transform: translate3d(-12px, 0, 0); } 43%, 91% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
  @keyframes mo-line-3 { 0%, 46% { opacity: 0; transform: translate3d(-12px, 0, 0); } 52%, 91% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
  @keyframes mo-bill   { 0%, 60% { opacity: 0; transform: translate3d(0, -14px, 0) scaleY(.2); } 70%, 91% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }

  /* وسوم البطل تطفو على الحاسوب وحده */
  @media (min-width: 961px) {
    .lb-tag { animation: mo-float 5s ease-in-out infinite alternate; }
    .lb-t2 { animation-delay: -1.2s; } .lb-t3 { animation-delay: -2.4s; } .lb-t4 { animation-delay: -3.6s; }
    @keyframes mo-float { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -7px, 0); } }
  }
  @media (max-width: 960px) {
    .lb-wave-b { display: none; } .lb-wave-a { animation-duration: 46s; }
    /* على الضيّق السلّةُ والفاتورةُ في مكانٍ واحد: تُخلي السلّةُ لها قبل أن تخرج */
    .lb-demo-cart li:nth-child(1) { animation-name: mo-line-1m; }
    .lb-demo-cart li:nth-child(2) { animation-name: mo-line-2m; }
    .lb-demo-cart li:nth-child(3) { animation-name: mo-line-3m; }
    @keyframes mo-line-1m { 0%, 28% { opacity: 0; transform: translate3d(-12px, 0, 0); } 34%, 54% { opacity: 1; transform: none; } 58%, 100% { opacity: 0; } }
    @keyframes mo-line-2m { 0%, 37% { opacity: 0; transform: translate3d(-12px, 0, 0); } 43%, 54% { opacity: 1; transform: none; } 58%, 100% { opacity: 0; } }
    @keyframes mo-line-3m { 0%, 46% { opacity: 0; transform: translate3d(-12px, 0, 0); } 52%, 54% { opacity: 1; transform: none; } 58%, 100% { opacity: 0; } }
  }

  /* ── الظهور بالتمرير (بعد أن يعلن السكربتُ استلامه فقط) ── */
  html.mo-ready .mo-rv { opacity: 0; transform: translate3d(0, 26px, 0); transition: opacity .6s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
  html.mo-ready .mo-rv.mo-in { opacity: 1; transform: none; }
  @media (max-width: 560px) { html.mo-ready .mo-rv { transform: translate3d(0, 14px, 0); } }

  /* أيقونةٌ تنبض مرّةً واحدةً حين يظهر صاحبُها */
  .mo-in .lb-ico > svg { animation: mo-pop .7s cubic-bezier(.3, 1.5, .5, 1) .25s backwards; }
  @keyframes mo-pop { from { opacity: 0; transform: scale(.5) rotate(-14deg); } to { opacity: 1; transform: none; } }
}
