/* ---------- responsive ---------- */
/* five header links: tighten them before they hide at 1020px */
@media (max-width: 1180px) {
  .nav { gap: 18px; font-size: 0.88rem; }
}

@media (max-width: 1020px) {
  .rs-layout { grid-template-columns: minmax(0, 1fr); }
  .rs-phone { width: min(250px, 62%); margin-inline: auto; }
  .nav { display: none; }
  .header-actions { margin-inline-start: auto; }
  .sol-grid { grid-template-columns: 1fr; }
  .lp-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wt-panel { grid-template-columns: minmax(0, 1fr); }
  .wt-demo { order: -1; font-size: clamp(7px, 1.25vw, 10.5px); }
  .wt-work { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .fact-rating { grid-column: 1 / -1; }
  .panel { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
}

@media (max-width: 760px) {
  :root { --gutter: 18px; --header-h: 60px; }
  body { font-size: 16px; }
  .header-row { gap: 14px; }
  .header-actions { gap: 8px; }
  .lang-switch { padding: 0 0.85em; }
  .hero { padding-bottom: 96px; }
  .hero-cta { flex-direction: column; align-items: stretch; width: 100%; max-width: 340px; }
  .sol-live, .sol-resto { grid-template-columns: 1fr; gap: 26px; }
  .rs-feats { grid-template-columns: 1fr; }
  .sol-visual { order: -1; padding-top: 6px; }
  .phone-sm { width: 176px; }

  .journey { grid-template-columns: 1fr; gap: 0; }
  .journey-stage { grid-column: 1; grid-row: 1; position: sticky; top: var(--header-h); z-index: 3; height: 54svh; align-self: start; }
  .journey-steps { grid-column: 1; grid-row: 1; padding-bottom: 8svh; }
  .stage-inner {
    position: relative; top: 0; height: 100%; padding-top: 8px;
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink) 86%, rgba(13, 10, 26, 0));
  }
  .phone-lg { width: min(200px, calc((54svh - 40px) / 2.2)); }
  .tablet-pop { width: 44%; left: 3%; bottom: 24%; }
  .bell { right: auto; left: -12px; width: 38px; height: 38px; }
  .receipt { top: calc(100% - 12px); font-size: 0.7rem; padding: 8px 10px 12px; }
  .receipt b { font-size: 0.76rem; }
  .journey-steps { padding-top: 56svh; }
  .journey-steps { --la: calc(56svh + 42px); --lb: calc(48svh - 42px); }
  .journey-steps::before, .journey-steps::after { inset-inline-start: 19px; }
  .jstep, .jstep:first-child { min-height: 44svh; justify-content: flex-start; padding-top: 22px; padding-inline-start: 60px; }
  .jnum, .jstep:first-child .jnum { top: 22px; margin-top: 0; width: 40px; height: 40px; font-size: 1rem; }
  .jstep:last-child { min-height: 40svh; }
  @keyframes fly {
    0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
    15% { opacity: 1; transform: translate(-10px, -20px) scale(1); }
    100% { transform: translate(-80px, 110px) scale(0.5); opacity: 0; }
  }

  .panel { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .tabs { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; scroll-snap-align: start; padding: 10px 16px; border-radius: 999px; border-color: var(--line); grid-template-rows: auto; }
  .tab b { font-size: 0.98rem; }
  .tab span { display: none; }
  .tab.is-active { grid-template-rows: auto; }
  .tab-caption { display: block; margin-top: 12px; min-height: 3.4em; }
  .tablet-lg { max-width: 360px; }

  .facts { grid-template-columns: 1fr; gap: 12px; }
  /* start-aligned (not space-between) so every card's text sits right next to its number */
  .fact { flex-direction: row; align-items: center; justify-content: flex-start; min-height: 0; padding: 18px 20px; gap: 18px; }
  .fact-num { font-size: 58px; width: 1.15em; flex: none; text-align: center; }
  .fact p { flex: 1; min-width: 0; }
  .fact-rating { grid-template-columns: 1fr; }
  .fact-rating img { grid-column: 1; grid-row: auto; max-width: 260px; justify-self: center; }

  .phone-fan[data-pos="1"] { --x: -56%; }
  .phone-fan[data-pos="3"] { --x: 56%; }
  .fan { height: 430px; }

  .steps { grid-template-columns: 1fr; gap: 26px; }
  .steps::before { top: 30px; bottom: 60px; inset-inline: 31px auto; width: 3px; height: auto; background: linear-gradient(180deg, var(--violet), var(--fuchsia)); transform-origin: top; }
  html.js .steps::before { transform: scaleY(0); }
  html.js .steps.in::before { transform: scaleY(1); }
  .step { display: grid; grid-template-columns: 66px 1fr; column-gap: 18px; align-items: start; }
  .node { grid-row: 1 / span 2; margin-bottom: 0; }
  .step h3 { margin-top: 12px; }

  /* phone: the teacher's screen on top, the student's phone overlapping its lower corner */
  .lp-stage { display: flex; flex-direction: column; padding: 0; }
  .browser { border-radius: 12px; }
  .browser-bar { height: 26px; gap: 5px; padding-inline: 10px; }
  .browser-bar i { width: 7px; height: 7px; }
  .browser-bar span { font-size: 0.66rem; padding: 0 10px; }
  .lp-student { position: relative; inset: auto; width: 44%; margin-top: -16%; margin-inline-start: auto; margin-inline-end: 4%; }
  .lp-student figcaption { display: none; }
  .lp-feats { grid-template-columns: 1fr; gap: 12px; margin-top: 36px; }
  .lp-feat { display: grid; grid-template-columns: 46px 1fr; column-gap: 16px; padding: 18px 18px 20px; }
  .lp-ico { grid-row: 1 / span 2; margin-bottom: 0; }

  .wt-demo { font-size: min(1.85vw, 8px); gap: 0.8em; padding: 4em 1.4em 3.2em; }
  .wt-demo figcaption { font-size: 0.78rem; }
  .wt-arrow { width: 4.6em; }
  .wt-step { padding: 16px 18px; gap: 14px; grid-template-columns: 42px 1fr; }
  .wt-num { width: 42px; height: 42px; font-size: 1.05rem; }
  .wt-work { gap: 12px; }
  .wt-shot { padding: 7px; }
  .wt-shot img { border-radius: 10px; }
  .wt-shot figcaption { padding: 9px 4px 2px; }
  .wt-shot b { font-size: 0.92rem; }
  .wt-shot span { font-size: 0.8rem; }
  .wt-cta, .demo-cta { flex-direction: column; align-items: stretch; text-align: center; }
  .wt-cta .btn, .demo-cta .btn { width: 100%; }
  .demo-cta .cta-btns { flex-direction: column; }

  .final-card { grid-template-columns: 1fr; padding: 34px 22px 38px; border-radius: 28px; text-align: center; }
  .final-mark { margin-inline: auto; }
  .final-copy .btn { width: 100%; }
  .qr { display: none; }

  .footer-row { flex-direction: column; align-items: flex-start; }
  .foot-meta { margin-inline-start: 0; }
}

@media (max-width: 380px) {
  .word-ar { font-size: 64px; }
  .mark-anim { width: 80px; }
}

/* very narrow phones: the header WhatsApp button keeps only its icon (label stays for screen readers);
   the floating WhatsApp button is always on screen too */
@media (max-width: 340px) {
  /* the hero logo fits inside the side padding on 320px phones */
  .word-ar { font-size: 56px; }
  .mark-anim { width: 70px; }
  .header-actions .btn-wa-outline { width: 40px; padding: 0; }
  .header-actions .btn-wa-outline span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- English page (LTR) ----------
   Scoped to html[dir="ltr"] so the Arabic page is untouched (it has dir="ltr" only on
   small inline bits like the phone number, never on <html>). Everything here mirrors an
   RTL decision above: things that grow from the reading start, "outer side" decorations,
   tilts, the marquee flow and the brand fan's next/previous sides. */
html[dir="ltr"] { --grad-flow: var(--grad); --start-side: left; }

/* Latin type: tighter leading than the Arabic setting, slight negative tracking on display sizes */
html[lang="en"] body { line-height: 1.68; }
html[lang="en"] :is(.hero-title, .sec-head h2, .final h2) { line-height: 1.12; letter-spacing: -0.02em; }
html[lang="en"] :is(.sub-title, .sol-card h3, .jstep h4) { line-height: 1.22; letter-spacing: -0.012em; }
html[lang="en"] .step h3 { line-height: 1.3; }
html[lang="en"] .hero-title { max-width: 14em; }
html[lang="en"] .jstep p { text-wrap: pretty; }
html[lang="en"] :is(.jstep h4, .sol-card h3) { text-wrap: balance; }
html[lang="en"] .final-copy { min-width: 0; }
html[lang="en"] .final-copy p { margin-top: 14px; }
html[lang="en"] .fact p { line-height: 1.55; }
/* header wordmark: the logo's Latin form (Alexandria, tracked capitals) */
.brand-latin { font-family: "Alexandria", "Readex Pro", sans-serif; font-size: 1.12rem; letter-spacing: 0.3em; margin-inline-end: -0.3em; padding-top: 0.08em; }

html[dir="ltr"] .phone-sm { transform: rotate(4deg); }
html[dir="ltr"] .fact-rating img { transform: rotate(2deg); }

/* marquee runs right-to-left so the next item enters from the reading end */
html[dir="ltr"] .marquee-list { direction: ltr; }
html[dir="ltr"] .marquee-track { animation-direction: reverse; }

/* order journey: the cashier tablet pops on the outer (right) side and the order flies to it */
html[dir="ltr"] .tablet-pop { left: auto; right: 2%; transform: translate(0, 40px) rotate(5deg) scale(0.85); }
html[dir="ltr"] .journey[data-active="3"] .tablet-pop { transform: rotate(3deg); }
html[dir="ltr"] .bell { right: auto; left: -14px; }
html[dir="ltr"] .receipt { left: auto; right: 14%; }
html[dir="ltr"] .journey[data-active="3"] .flyer { animation-name: fly-ltr; }
@keyframes fly-ltr {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15% { opacity: 1; transform: translate(20px, -40px) scale(1); }
  100% { transform: translate(150px, 170px) scale(0.5); opacity: 0; }
}

/* course platform: the student's phone sits on the reading-end side, tilted the other way */
html[dir="ltr"] .phone-lp { transform: rotate(3deg); }

/* WordTech before → after reads left to right: the arrow points right and the tilts mirror */
html[dir="ltr"] .wt-arrow { transform: scaleX(-1); }
html[dir="ltr"] .wt-photo { transform: rotate(-5deg); }
html[dir="ltr"] .wt-sheet { transform: rotate(3deg); }

/* brand fan: the next brand waits on the right */
html[dir="ltr"] .phone-fan[data-pos="1"] { --x: 66%; --r: 8deg; }
html[dir="ltr"] .phone-fan[data-pos="3"] { --x: -66%; --r: -8deg; }

/* final card glow sits behind the copy, which is on the left in LTR */
html[dir="ltr"] .final-card { background: radial-gradient(ellipse 70% 90% at 30% 20%, #2a1450, var(--ink-2) 70%); }
html[dir="ltr"] .final-card::before { background: conic-gradient(from var(--a, 0deg) at 70% 110%, rgba(232, 121, 249, 0.25), rgba(167, 139, 250, 0.05), rgba(232, 121, 249, 0.25)); }

@media (max-width: 374px) {
  html[lang="en"] .header-actions .btn-wa-outline { width: 40px; padding: 0; }
  html[lang="en"] .header-actions .btn-wa-outline span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* floating WhatsApp button on the reading-end corner */
html[dir="ltr"] .wa-float { left: auto; right: max(16px, env(safe-area-inset-right)); }

@media (max-width: 760px) {
  html[lang="en"] .brand-latin { font-size: 0.95rem; letter-spacing: 0.2em; margin-inline-end: -0.2em; }
  html[lang="en"] .receipt { width: 68%; }
  html[dir="ltr"] .tablet-pop { right: 3%; }
  html[dir="ltr"] .bell { left: auto; right: -12px; }
  @keyframes fly-ltr {
    0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
    15% { opacity: 1; transform: translate(10px, -20px) scale(1); }
    100% { transform: translate(80px, 110px) scale(0.5); opacity: 0; }
  }
  html[dir="ltr"] .phone-fan[data-pos="1"] { --x: 56%; }
  html[dir="ltr"] .phone-fan[data-pos="3"] { --x: -56%; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  .marquee-track { animation: none !important; width: auto; }
  .marquee-list { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; justify-content: center; row-gap: 8px; padding-inline: var(--gutter); }
  .marquee-list li { white-space: normal; }
  .marquee-list[aria-hidden="true"] { display: none; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
  .scan-line, .flyer, .wt-scan { display: none; }
  html.js .wt-sheet > * { opacity: 1; transform: none; }
  .mark-anim .dot-ring { opacity: 0; }
  html.js [data-reveal], html.js [data-stagger] > *, html.js .step { opacity: 1; transform: none; }
}
