/* =====================================================================
   brand/motion.css — حركة ATHLOR الموحّدة · ATHLOR motion (11 Oct 2026)
   المرجع: DESIGN-STANDARDS.md §6 (مبادئ Emil Kowalski · MIT).
   - لا مكتبات. نحرّك transform/translate/scale/opacity فقط.
   - كل القواعد بأدنى أولويّة (:where) فلا تكسر تصميم أيّ شاشة.
   - html[data-motion=full|light|off] — إعداد الجهاز (motion.js)،
     و«خفيفة» تلقائياً لمن طلب حركة أقلّ من إعدادات جهازه.
   - شاشة إدخال درجات الحكم لا تقرأ هذا الملفّ (تتكرّر مئات المرّات).
   ===================================================================== */
:root{
  --ath-ease-out:cubic-bezier(.23,1,.32,1);
  --ath-ease-move:cubic-bezier(.77,0,.175,1);
  --ath-ease-drawer:cubic-bezier(.32,.72,0,1);
  --ath-d-press:140ms; --ath-d-fast:200ms; --ath-d-sheet:300ms; --ath-d-move:320ms;
}

/* ① الضغطة — الزرّ يصغر قليلاً فتشعر أنه انضغط (scale منفصل عن transform فلا يكسر تموضعاً) */
:where(button,[role=button],a.cta,a.ghost,a.b,a.tile,a.ev,a.door,.chip,.tile,.door,.go,.stbtn,.gn-it){
  transition:scale var(--ath-d-press) var(--ath-ease-out);
}
:where(button,[role=button],a.cta,a.ghost,a.b,a.tile,a.ev,a.door,.chip,.tile,.door,.go,.stbtn,.gn-it):not(:disabled):active{scale:.97}

/* ② الأدراج والنوافذ */
@keyframes ath-fade{from{opacity:0}}
@keyframes ath-up{from{translate:0 100%}}
@keyframes ath-pop{from{opacity:0;scale:.96}}
@keyframes ath-rise{from{opacity:0;translate:0 10px}}
.sheet.on{animation:ath-fade var(--ath-d-sheet) var(--ath-ease-out)}
.sheet.on>.in{animation:ath-up var(--ath-d-sheet) var(--ath-ease-drawer)}
.askov{animation:ath-fade var(--ath-d-fast) var(--ath-ease-out)}
.askov .askbx{animation:ath-pop 240ms var(--ath-ease-out)}
html .gn-side{transition-duration:var(--ath-d-sheet);transition-timing-function:var(--ath-ease-drawer)}

/* ③ الرسائل — النجاح يظهر بنعومة، والخطأ يتلاشى للداخل بلا اهتزاز */
/* (في التطبيق فقط #body — شاشات القاعة تعيد رسم حالاتها كل ثانية فلا نحرّكها) */
#body .note.new,#body>.ok{animation:ath-pop 260ms var(--ath-ease-out)}
#body>.err{animation:ath-fade var(--ath-d-fast) var(--ath-ease-out)}
.toast div{translate:0 12px;transition:opacity .22s var(--ath-ease-out),translate .22s var(--ath-ease-out)}
.toast.on div{translate:0 0}

/* ④ دخول الصفحة — البطاقات تصعد متتابعة (30–80 ms) عند التنقّل فقط */
.ath-enter>*{animation:ath-rise var(--ath-d-move) var(--ath-ease-out) both}
.ath-enter>*:nth-child(2){animation-delay:40ms}
.ath-enter>*:nth-child(3){animation-delay:80ms}
.ath-enter>*:nth-child(4){animation-delay:120ms}
.ath-enter>*:nth-child(5){animation-delay:160ms}
.ath-enter>*:nth-child(6){animation-delay:200ms}
.ath-enter>*:nth-child(n+7){animation-delay:240ms}
.ath-rise{animation:ath-rise var(--ath-d-move) var(--ath-ease-out) both}

/* ⑤ شريط التنقّل — الخطّ الذهبي يمتدّ والأيقونة تنبض مرّة */
@keyframes ath-bar{from{scale:0 1}}
@keyframes ath-tab{from{scale:.86}}
.bot [aria-current="true"]:before{animation:ath-bar 260ms var(--ath-ease-out)}
.bot [aria-current="true"] .i,.gn-tab button.on svg{animation:ath-tab 280ms var(--ath-ease-out)}

/* ⑥ التحميل — هيكل رمادي يلمع مكان المحتوى بدل الشاشة الفارغة */
@keyframes ath-shimmer{from{background-position:150% 0}to{background-position:-50% 0}}
.ath-skel{display:block;border-radius:14px;margin-top:10px;min-height:56px;
  background:linear-gradient(100deg,rgba(127,127,127,.12) 30%,rgba(127,127,127,.24) 50%,rgba(127,127,127,.12) 70%);
  background-size:200% 100%;animation:ath-shimmer 1.2s linear infinite}

/* ⑦ الاحتفال — للحظات النادرة: هدية، بطاقة، فوز (motion.js يرسم الشرر) */
.ath-burst{position:fixed;inset:0;pointer-events:none;z-index:99999;overflow:hidden}
.ath-burst i{position:absolute;width:8px;height:8px;border-radius:2px;background:var(--gold,#E2C550)}
.ath-burst i:nth-child(3n){background:var(--gold-2,var(--gold,#E2C550));opacity:.8}
.ath-burst i:nth-child(4n){border-radius:50%}
@keyframes ath-glow{0%{box-shadow:0 0 0 0 rgba(226,197,80,.55)}100%{box-shadow:0 0 0 14px rgba(226,197,80,0)}}
.ath-glow{animation:ath-glow 700ms var(--ath-ease-out)}

/* ⑧ المؤشّر الحالي للإعداد — رمز + كلمة (لعمى الألوان) */
[data-motion-set][aria-pressed="true"]::before{content:"✓ "}

/* ===== خفيفة: تلاشٍ فقط، بلا انتقال ولا تكبير ===== */
html[data-motion=light] .sheet.on>.in,
html[data-motion=light] .askov .askbx,
html[data-motion=light] #body .note.new,html[data-motion=light] #body>.ok,
html[data-motion=light] .ath-enter>*,html[data-motion=light] .ath-rise{animation-name:ath-fade;animation-delay:0s}
html[data-motion=light] .bot [aria-current="true"]:before,
html[data-motion=light] .bot [aria-current="true"] .i,
html[data-motion=light] .gn-tab button.on svg{animation:none}
html[data-motion=light] .toast div{translate:0 0}
html[data-motion=light] :where(button,[role=button],a,.chip,.tile,.door,.go,.stbtn,.gn-it):active{scale:1}
html[data-motion=light] .ath-skel{animation-duration:2.4s}

/* ===== بلا: كل حركاتنا ثابتة (حركات الشاشات الوظيفية كشريط الأخبار لا تُمسّ) ===== */
html[data-motion=off] .sheet.on,html[data-motion=off] .sheet.on>.in,
html[data-motion=off] .askov,html[data-motion=off] .askov .askbx,
html[data-motion=off] #body .note.new,html[data-motion=off] #body>.ok,html[data-motion=off] #body>.err,
html[data-motion=off] .ath-enter>*,html[data-motion=off] .ath-rise,html[data-motion=off] .ath-glow,
html[data-motion=off] .bot [aria-current="true"]:before,html[data-motion=off] .bot [aria-current="true"] .i,
html[data-motion=off] .gn-tab button.on svg,html[data-motion=off] .ath-skel{animation:none}
html[data-motion=off] .toast div{translate:0 0;transition:none}
html[data-motion=off] :where(button,[role=button],a,.chip,.tile,.door,.go,.stbtn,.gn-it){transition:none}
html[data-motion=off] :where(button,[role=button],a,.chip,.tile,.door,.go,.stbtn,.gn-it):active{scale:1}
html[data-motion=off] .gn-side{transition:none}

/* بلا جافاسكربت بعد: نحترم طلب الجهاز مباشرة */
@media (prefers-reduced-motion:reduce){
  html:not([data-motion]) .sheet.on>.in,html:not([data-motion]) .askov .askbx,
  html:not([data-motion]) .ath-enter>*,html:not([data-motion]) .ath-rise{animation-name:ath-fade;animation-delay:0s}
  html:not([data-motion]) :where(button,[role=button],a,.chip,.tile,.door,.go,.stbtn,.gn-it):active{scale:1}
}
