/* ==========================================================================
   Emole — طبقة الحركة والتفاعل
   كل التأثيرات لا تعمل إلا بعد إضافة .js على <html>، فالمحتوى ظاهر بدونها.
   وكلها تُعطَّل مع prefers-reduced-motion.
   ========================================================================== */

/* ---------- شريط تقدّم القراءة ---------- */
.progress {
  position: fixed; inset-block-start: 0; inset-inline: 0; height: 3px; z-index: 90;
  background: transparent; pointer-events: none;
}
.progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 12px var(--brand-glow);
  transform-origin: right center;
}

/* ---------- الترويسة عند التمرير ---------- */
.site-head { transition: background .3s ease, box-shadow .3s ease, border-color .3s ease; }
.site-head.is-stuck {
  background: rgba(8,24,31,.94);
  box-shadow: 0 10px 34px rgba(0,0,0,.42);
  border-block-end-color: var(--line);
}
.nav a { position: relative; }
.nav a::after {
  content: ""; position: absolute; inset-block-end: 4px; inset-inline: 14px;
  height: 1.5px; background: var(--brand); border-radius: 2px;
  transform: scaleX(0); transform-origin: right center;
  transition: transform .28s cubic-bezier(.22,.9,.3,1);
}
.nav a:hover::after { transform: scaleX(.55); }
.nav a.is-current { color: var(--brand-2); }
.nav a.is-current::after { transform: scaleX(1); }

/* ---------- الظهور عند التمرير ---------- */
html.js [data-rv] { opacity: 0; transform: translateY(26px); will-change: opacity, transform; }
html.js [data-rv="fade"]  { transform: none; }
html.js [data-rv="right"] { transform: translateX(34px); }
html.js [data-rv="left"]  { transform: translateX(-34px); }
html.js [data-rv="zoom"]  { transform: scale(.94); }
html.js [data-rv].is-in {
  opacity: 1; transform: none;
  transition: opacity .72s cubic-bezier(.22,.9,.3,1), transform .72s cubic-bezier(.22,.9,.3,1);
  transition-delay: var(--rv-d, 0ms);
}

/* ---------- الهيرو ---------- */
html.js .hero-copy > * { opacity: 0; transform: translateY(22px); }
html.js .hero.is-ready .hero-copy > * {
  opacity: 1; transform: none;
  transition: opacity .8s cubic-bezier(.22,.9,.3,1), transform .8s cubic-bezier(.22,.9,.3,1);
}
html.js .hero.is-ready .hero-copy > :nth-child(1) { transition-delay: .05s }
html.js .hero.is-ready .hero-copy > :nth-child(2) { transition-delay: .16s }
html.js .hero.is-ready .hero-copy > :nth-child(3) { transition-delay: .27s }
html.js .hero.is-ready .hero-copy > :nth-child(4) { transition-delay: .38s }
html.js .hero.is-ready .hero-copy > :nth-child(5) { transition-delay: .49s }

html.js .hero-fig { opacity: 0; transform: translateY(34px) scale(.97); }
html.js .hero.is-ready .hero-fig {
  opacity: 1; transform: none;
  transition: opacity .95s cubic-bezier(.22,.9,.3,1) .22s, transform .95s cubic-bezier(.22,.9,.3,1) .22s;
}
.hero-fig .mock { animation: float 7s ease-in-out infinite 1.4s; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }

/* توهّج يتبع المؤشر */
.hero .glow { transition: transform .9s cubic-bezier(.2,.8,.3,1); }

/* ---------- الأعمدة البيانية ---------- */
.bars i { height: 0 !important; transition: height .9s cubic-bezier(.22,.9,.3,1); }
html:not(.js) .bars i { height: var(--h) !important; }
.bars.is-in i { height: var(--h) !important; }
.bars.is-in i:nth-child(1) { transition-delay: .05s } .bars.is-in i:nth-child(2) { transition-delay: .12s }
.bars.is-in i:nth-child(3) { transition-delay: .19s } .bars.is-in i:nth-child(4) { transition-delay: .26s }
.bars.is-in i:nth-child(5) { transition-delay: .33s } .bars.is-in i:nth-child(6) { transition-delay: .40s }
.bars.is-in i:nth-child(7) { transition-delay: .47s }

/* ---------- الأزرار ---------- */
.btn { position: relative; overflow: hidden; }
.btn--gold::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: -60%;
  width: 45%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-18deg); opacity: 0;
}
.btn--gold:hover::before { animation: shine .85s ease; }
@keyframes shine { 0% { inset-inline-start:-60%; opacity:1 } 100% { inset-inline-start:120%; opacity:0 } }
.btn:active { transform: translateY(0) scale(.98); }

/* ---------- البطاقات ---------- */
.card, .chan, .addon, .plan, .hub-t, .feat, .app-f, .goal {
  transition: transform .34s cubic-bezier(.22,.9,.3,1), border-color .28s ease,
              background .28s ease, box-shadow .34s ease;
}
.card::after, .chan::before, .plan::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx,50%) var(--my,0%), rgba(201,160,99,.1), transparent 42%);
  opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.card, .plan { position: relative; }
.card:hover::after, .chan:hover::before, .plan:hover::after { opacity: 1; }
.card:hover .ico-box, .addon:hover .ico-box { transform: translateY(-3px) rotate(-5deg); }
.card .ico-box, .addon .ico-box { transition: transform .35s cubic-bezier(.3,1.4,.5,1); }

/* ---------- التبويبات ---------- */
.tab { position: relative; overflow: hidden; }
.tab::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--brand-dim); opacity: 0; transition: opacity .25s ease;
}
.tab:hover::before { opacity: .6; }
.tab > * { position: relative; }
.tab[aria-selected="true"] { transform: translateY(-1px); }
.tab .ico { transition: transform .3s cubic-bezier(.3,1.4,.5,1); }
.tab[aria-selected="true"] .ico { transform: scale(1.12); }

html.js .tabpanel { animation: panelIn .5s cubic-bezier(.22,.9,.3,1) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
html.js .tabpanel .feat, html.js .tabpanel .acc > .ab { animation: itemIn .5s cubic-bezier(.22,.9,.3,1) both; }
@keyframes itemIn { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: none } }
html.js .tabpanel .feat:nth-child(1), html.js .tabpanel .ab:nth-child(1) { animation-delay: .04s }
html.js .tabpanel .feat:nth-child(2), html.js .tabpanel .ab:nth-child(2) { animation-delay: .09s }
html.js .tabpanel .feat:nth-child(3), html.js .tabpanel .ab:nth-child(3) { animation-delay: .14s }
html.js .tabpanel .feat:nth-child(4), html.js .tabpanel .ab:nth-child(4) { animation-delay: .19s }
html.js .tabpanel .feat:nth-child(5), html.js .tabpanel .ab:nth-child(5) { animation-delay: .24s }
html.js .tabpanel .feat:nth-child(6), html.js .tabpanel .ab:nth-child(6) { animation-delay: .29s }
html.js .tabpanel .feat:nth-child(n+7), html.js .tabpanel .ab:nth-child(n+7) { animation-delay: .34s }

/* ---------- الأكورديون ---------- */
/* details لا يُصيّر محتواه وهو مغلق، فالانتقال لا يعمل — نستخدم إطارات مفاتيح عند الفتح */
.ab-body, .qa .ans-wrap { display: grid; grid-template-rows: 1fr; }
html.js .ab[open] .ab-body, html.js .qa[open] .ans-wrap { animation: accIn .42s cubic-bezier(.22,.9,.3,1); }
html.js .ab .ab-body > *, html.js .qa .ans-wrap > * { min-height: 0; }
@keyframes accIn {
  from { grid-template-rows: 0fr; opacity: 0 }
  to   { grid-template-rows: 1fr; opacity: 1 }
}
.ab > summary, .qa summary { transition: color .25s ease, background .25s ease; }
.ab > summary:hover, .qa summary:hover { background: rgba(255,255,255,.03); }
.ab > summary .n { transition: transform .3s cubic-bezier(.3,1.4,.5,1), background .25s ease; }
.ab[open] > summary .n { transform: scale(1.08); background: var(--brand); color: #04202B; }

/* ---------- المحادثة الحيّة ---------- */
html.js .chat-body .bub { opacity: 0; transform: translateY(12px) scale(.97); }
html.js .chat-body .bub.is-shown {
  opacity: 1; transform: none;
  transition: opacity .42s cubic-bezier(.22,.9,.3,1), transform .42s cubic-bezier(.22,.9,.3,1);
}
html.js .chat-body .typing { display: none; }
html.js .chat-body .typing.is-shown { display: inline-flex; }
.chat-top .av { animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(201,160,99,.35) } 60% { box-shadow: 0 0 0 9px rgba(201,160,99,0) } }

/* ---------- معالج التجهيز ---------- */
.step .dot { transition: transform .4s cubic-bezier(.3,1.4,.5,1), background .35s ease, color .35s ease, box-shadow .35s ease; }
.step.is-on .dot { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #04202B; transform: scale(1.14); box-shadow: 0 8px 24px var(--brand-glow); }
.step.is-on b { color: var(--brand-2); }
.stepper.is-in .step::before { animation: lineIn .7s ease both; }
@keyframes lineIn { from { transform: scaleX(0) } to { transform: scaleX(1) } }
.step::before { transform-origin: right center; }
.goal { cursor: pointer; }
.goal.is-on { border-color: var(--brand); background: var(--brand-dim); }
.goal.is-on .ico { transform: scale(1.14); }
.goal .ico { transition: transform .3s cubic-bezier(.3,1.4,.5,1); }

/* ---------- الجوال واللوحة ---------- */
.devices .phone { animation: floatPhone 8s ease-in-out infinite 1s; }
@keyframes floatPhone { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }
.wpanel { transition: transform .5s cubic-bezier(.22,.9,.3,1); }
.devices:hover .wpanel { transform: perspective(1400px) rotateY(2.4deg) rotateX(1.2deg); }
.wp-li { transition: background .25s ease, color .25s ease, padding-inline-start .25s ease; }
.wp-li:not(.on):hover { background: rgba(255,255,255,.07); color: #E6F1F6; }

/* ---------- زر العودة للأعلى ---------- */
.totop {
  position: fixed; inset-block-end: calc(22px + env(safe-area-inset-bottom, 0px));
  inset-inline-start: calc(22px + env(safe-area-inset-left, 0px));
  width: 46px; height: 46px; border-radius: 15px; z-index: 80;
  display: grid; place-items: center; cursor: pointer;
  background: var(--panel); color: var(--brand-2);
  border: 1px solid var(--line); box-shadow: var(--sh);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .3s ease, transform .3s cubic-bezier(.3,1.4,.5,1), background .25s ease;
}
.totop.is-on { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { background: var(--brand); color: #04202B; }
.totop .ico { transform: rotate(90deg); }

/* ---------- العدّادات ---------- */
.num { font-variant-numeric: tabular-nums; }

/* ---------- احترام تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js [data-rv] { opacity: 1 !important; transform: none !important; }
  html.js .hero-copy > *, html.js .hero-fig { opacity: 1 !important; transform: none !important; }
  html.js .chat-body .bub { opacity: 1 !important; transform: none !important; }
  html.js .chat-body .typing { display: none !important; }
  .bars i { height: var(--h) !important; transition: none !important; }
  .hero-fig .mock, .devices .phone, .chat-top .av, .ticker-run { animation: none !important; }
  html.js .tabpanel, html.js .tabpanel .feat, html.js .tabpanel .ab { animation: none !important; }
  html.js .ab[open] .ab-body, html.js .qa[open] .ans-wrap { animation: none !important; }
  .devices:hover .wpanel { transform: none !important; }
}
