/* يلا رووم: حركة الصفحة الرئيسية، فلتر الألعاب، وشريط الموبايل. كل الحركة بتقف مع prefers-reduced-motion. */

/* ── شريط التقدم في القراية (المتصفحات اللي بتدعم الحركة مع السكرول) ── */
.top::after { content:""; position:absolute; inset:auto 0 -1px 0; height:3px; background:linear-gradient(90deg, var(--pink), var(--lime)); transform-origin:right; transform:scaleX(0); }
@supports (animation-timeline: scroll()) {
  .top::after { animation:progress linear both; animation-timeline:scroll(root); }
  @keyframes progress { to { transform:scaleX(1); } }
}

/* ── القسم الحالي في الشريط ── */
.top nav a { position:relative; padding:6px 0; transition:color .2s; }
.top nav a::after { content:""; position:absolute; inset:auto 0 0 0; height:2px; border-radius:2px; background:var(--lime); transform:scaleX(0); transition:transform .25s; }
.top nav a.on { color:var(--text); }
.top nav a.on::after { transform:scaleX(1); }

/* الموبايل: الأقسام شريط بيتسحب تحت العنوان بدل ما تختفي */
@media (max-width: 820px) {
  .top .wrap { flex-wrap:wrap; height:auto; padding-top:10px; row-gap:6px; }
  .top nav { display:flex; order:3; width:100%; overflow-x:auto; gap:20px; padding:2px 2px 10px; scrollbar-width:none; white-space:nowrap; }
  .top nav::-webkit-scrollbar { display:none; }
  section[id], header[id] { scroll-margin-top:112px; }
}
section[id] { scroll-margin-top:78px; }

/* ── الأزرار ── */
.btn { transition:transform .18s, box-shadow .18s, border-color .18s; }
.btn.lime { position:relative; overflow:hidden; }
.btn.lime:hover { transform:translateY(-2px); box-shadow:0 10px 28px rgba(200,245,58,.28); }
.btn:active { transform:translateY(0) scale(.97); }

/* ── فلتر الألعاب ── */
.finder { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:22px; }
.finder input { flex:1 1 220px; max-width:340px; background:var(--card); border:1.5px solid var(--line); border-radius:99px; padding:12px 20px; color:var(--text); font:400 1rem/1.4 "Readex Pro", sans-serif; }
.finder input::placeholder { color:var(--mute); }
.finder input:focus { outline:none; border-color:var(--lime); }
.chips { display:flex; gap:8px; overflow-x:auto; padding:2px; scrollbar-width:none; }
.chips::-webkit-scrollbar { display:none; }
.chip { flex:none; border:1.5px solid var(--line); background:transparent; color:var(--soft); border-radius:99px; padding:9px 18px; font:500 .95rem/1.2 "Readex Pro", sans-serif; cursor:pointer; transition:background .2s, color .2s, border-color .2s; }
.chip:hover { border-color:var(--soft); color:var(--text); }
.chip[aria-pressed="true"] { background:var(--lime); border-color:var(--lime); color:var(--ink); font-weight:700; }
.finder output { color:var(--mute); font-size:.92rem; margin-inline-start:auto; }
.games .none { grid-column:1 / -1; text-align:center; color:var(--soft); padding:36px 12px; border:2px dashed var(--line); border-radius:var(--r); }
.game[hidden] { display:none !important; }
.games.filtered .game.big { grid-column:auto; display:block; }
.games.filtered .game.big img { aspect-ratio:4/3; height:auto; }
.games.filtered .game.big div { padding:14px 18px 18px; }
.games.filtered .game.big h3 { font-size:1.15rem; }

/* ── كروت بتتحرك تحت الصباع ── */
.game, .feat, .step, .cat { transition:transform .25s, border-color .25s, box-shadow .25s; }
.game img, .cat img { transition:transform .5s; }
.game:hover { transform:translateY(-5px); box-shadow:0 18px 40px rgba(0,0,0,.35); }
.game:hover img, .cat:hover img { transform:scale(1.06); }
.game > img, .game.big > img { overflow:hidden; }
.feat:hover, .step:hover { transform:translateY(-4px); border-color:rgba(200,245,58,.55); }
.feat svg { transition:transform .3s; }
.feat:hover svg { transform:scale(1.15) rotate(-6deg); }
.cat:hover { transform:translateY(-3px); }

/* ── لقطات الشاشة: أسهم ── */
.shots-wrap { position:relative; }
.shot-nav { position:absolute; top:42%; z-index:2; width:46px; height:46px; border-radius:50%; border:0; background:var(--lime); color:var(--ink); font-size:1.5rem; line-height:1; cursor:pointer; box-shadow:0 8px 24px rgba(0,0,0,.4); transition:transform .18s, opacity .2s; }
.shot-nav:hover { transform:scale(1.08); }
.shot-nav[disabled] { opacity:0; pointer-events:none; }
.shot-nav.prev { right:-10px; }
.shot-nav.next { left:-10px; }
@media (max-width: 700px) { .shot-nav { display:none; } }
.shots figure { transition:transform .3s; }
.shots figure:hover { transform:translateY(-6px); }

/* ── الأسئلة الشائعة ── */
.faq details { transition:border-color .2s, background .2s; }
.faq details[open] { border-color:rgba(200,245,58,.55); }
.faq summary::after { transition:transform .25s; }
.faq details[open] summary::after { transform:rotate(180deg); }

/* ── زرار التحميل الثابت على الموبايل ── */
.dock { position:fixed; inset:auto 12px 12px 12px; z-index:20; display:none; justify-content:center; transform:translateY(140%); transition:transform .35s cubic-bezier(.2,.8,.2,1); }
.dock .btn { width:100%; max-width:420px; justify-content:center; box-shadow:0 14px 40px rgba(0,0,0,.55); }
.dock.show { transform:none; }
@media (max-width: 820px) { .dock { display:flex; } footer { padding-bottom:96px; } }

@media (prefers-reduced-motion: no-preference) {
  /* ── الواجهة: الكلام بيدخل بالدور ── */
  .js .hero h1, .js .hero .tag, .js .hero p.lead, .js .hero .ctas, .js .hero .facts { animation:rise .7s cubic-bezier(.2,.8,.2,1) both; }
  .js .hero .tag { animation-delay:.1s; }
  .js .hero p.lead { animation-delay:.2s; }
  .js .hero .ctas { animation-delay:.3s; }
  .js .hero .facts { animation-delay:.4s; }
  .js .hero h1 b { display:inline-block; animation:pop .6s .35s cubic-bezier(.3,1.6,.5,1) both; }
  @keyframes rise { from { opacity:0; transform:translateY(26px); } }
  @keyframes pop { from { transform:scale(.6) rotate(-6deg); opacity:0; } }

  /* القعدة: الدايرة بتلف، والكراسي بتطلع واحد واحد وتتهز */
  .stage .ring { animation:spin 70s linear infinite; }
  @keyframes spin { to { transform:rotate(-360deg); } }
  .js .phone { animation:phone-in .9s cubic-bezier(.2,.8,.2,1) both, float 6s 1s ease-in-out infinite; }
  @keyframes phone-in { from { opacity:0; transform:rotate(8deg) translateY(60px) scale(.9); } to { opacity:1; transform:rotate(-4deg); } }
  .js .seat { animation:seat-in .55s cubic-bezier(.3,1.6,.5,1) both, bob 4.5s ease-in-out infinite; translate:calc(var(--px, 0) * var(--d, 10px)) calc(var(--py, 0) * var(--d, 10px)); transition:translate .3s ease-out; }
  .js .seat.a { animation-delay:.5s, 1.1s; --d:16px; }
  .js .seat.b { animation-delay:.62s, 1.6s; --d:-12px; animation-duration:.55s, 5.2s; }
  .js .seat.c { animation-delay:.74s, 1.3s; --d:20px; animation-duration:.55s, 3.9s; }
  .js .seat.d { animation-delay:.86s, 1.9s; --d:-18px; animation-duration:.55s, 4.8s; }
  .js .seat.e { animation-delay:.98s, 1.5s; --d:12px; animation-duration:.55s, 5.6s; }
  @keyframes seat-in { from { transform:scale(0); opacity:0; } }
  @keyframes bob { 50% { transform:translateY(-9px); } }
  .js .phone { translate:calc(var(--px, 0) * -8px) calc(var(--py, 0) * -8px); transition:translate .3s ease-out; }

  /* ── العناصر بتظهر وإنت نازل ── */
  .js .rv { opacity:0; transform:translateY(28px); transition:opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1); transition-delay:calc(var(--i, 0) * 70ms); }
  .js .rv.in { opacity:1; transform:none; }
  .js .rv.in.game, .js .rv.in.feat, .js .rv.in.step, .js .rv.in.cat { transition-delay:0s; } /* بعد الظهور الحركة تحت الصباع تبقى فورية */

  /* رقم الخطوة بينط لما الكارت يظهر */
  .js .step.in::before { animation:pop .5s calc(var(--i, 0) * 70ms + .15s) cubic-bezier(.3,1.6,.5,1) both; }

  /* لمعة بتعدّي على زرار التحميل */
  .btn.lime::after { content:""; position:absolute; inset:0; background:linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%); transform:translateX(120%); animation:shine 4.5s 2s ease-in-out infinite; }
  @keyframes shine { 0%, 70% { transform:translateX(120%); } 100% { transform:translateX(-120%); } }

  /* الأسئلة: الإجابة بتنزل بهدوء */
  .faq details[open] p { animation:rise .3s ease-out both; }

  /* الختام: الأيقونة بتطفو والخلفية بتنبض */
  .final img.logo { animation:float-logo 5s ease-in-out infinite; }
  @keyframes float-logo { 50% { transform:translateY(-10px) rotate(3deg); } }
  .final { background-size:140% 140%; animation:breathe 9s ease-in-out infinite; }
  @keyframes breathe { 50% { background-size:170% 170%; } }

  /* الكارت اللي بيتفلتر بيظهر بنعومة */
  .games.filtered .game:not([hidden]) { animation:rise .35s ease-out both; }
}
