/* ==========================================================================
   Base stylesheet. Direction: "Firouzeh & Ink" (warm paper, indigo ink, turquoise + saffron); the learner screens
   add the "Kashi" layer in kashi.css (glazed eight-point star tiles, girih lattice).
   Rules: logical properties only (RTL-first), transform/opacity animations,
   motion tiers via html[data-motion="0|1|2|3"], no external requests.
   ========================================================================== */

@font-face {
  font-family: "Vazirmatn NL";
  src: url("../fonts/Vazirmatn-NL-wght.d9a4f66b2ce3.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter Var";
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Estedad";
  src: url("../fonts/estedad-arabic-wght.31b4bff49ffc.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC;
}
/* Latin for English learning text. ZWNJ/ZWJ/marks (U+200C-200F) are left to the Persian fonts so joining is never split. */
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next-latin-wght.825fabef695f.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-200B, U+2010-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FFFD;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next-latin-wght-italic.740db8084ae9.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-200B, U+2010-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FFFD;
}
:root {
  /* ---- colour: grouped grey ground, white cards, one accent (docs/DESIGN-APPLE.md §2) ---- */
  --paper: #f5f5f7;
  --paper-2: #ebebf0;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #636366;  /* secondary text: >= 4.5:1 on --card and on the grey fills (#ebebf0 5.0:1) */
  --indigo: #4f52e0;
  --on-indigo: #ffffff;
  --teal: #0a7d74;
  --teal-deco: #22b8ab;
  --saffron: #ffb627;
  --ok: #1a7f45;
  --bad: #d1302b;
  --line: #8e8e93;
  --hair: #e3e3e8;
  --sep: rgb(60 60 67 / 0.14);          /* inset list separators (Apple "separator") */
  --brand-a: #6c70f0; --brand-b: #22b8ab; /* logo A gradient */
  --tint: color-mix(in srgb, var(--indigo) 11%, transparent);  /* tinted buttons, selected rows */
  /* ---- «Soft Precision» (design system «الف · نرم و دقیق», founder decision 2026-10-28): the system's names for the
     palette above plus its semantic tones. One accent (indigo); turquoise only for progress; saffron only for rewards. ---- */
  --bg: var(--paper);                   /* page ground */
  --surface: var(--card);               /* cards, sheets */
  --surface-2: #f2f2f7;                 /* an inset well inside a card */
  --accent: var(--indigo);
  --on-accent: var(--on-indigo);
  --accent-soft: #ececfb;               /* soft accent fill: secondary buttons, the chosen row */
  --accent-ink: #4346d1;                /* accent text on --accent-soft (AA) */
  --fill-q: #7676801f;                  /* iOS tertiary fill (not --fill: media-player.css uses that name locally): quiet buttons, chips, segmented tracks */
  --field-bd: var(--line);              /* field borders: 3:1 against the card (WCAG 1.4.11) */
  --teal-ink: #0a7d74;                  /* progress text */
  --flame-ink: #b86a00;                 /* reward text (streak, XP) on light grounds */
  --ok-soft: #e4f4ea; --ok-ink: #156b3a;
  --bad-soft: #fce9e7; --bad-ink: #b3261e;
  --warn-soft: #fff1d6; --warn-ink: #8a5300;
  --toast-bg: #1d1d1f; --toast-ink: #f5f5f7; --toast-ok: #4bd487; --toast-acc: #a9abff;
  --seg-on: #ffffff;                    /* the selected segment */
  --sh-seg: 0 3px 8px rgb(0 0 0 / 0.12), 0 3px 1px rgb(0 0 0 / 0.04);
  --sh-card: 0 0 0 0.5px rgb(0 0 0 / 0.03), 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 14px -6px rgb(0 0 0 / 0.08);  /* = --e1, never pinned */
  --ring: var(--indigo); --ring-w: 3px; /* focus: a 3px accent ring, 2px off the control */
  --r-ctl: 12px; --r-card: 20px; --r-pop: 18px;
  --press: scale(0.97);

  --hero-a: #b9bbff;
  --hero-b: #a6e6df;
  --hero-c: #ffe2a8;
  --hero-bg: #f5f5f7;

  /* Persian: Vazirmatn for reading, Estedad for display. English: Atkinson Hyperlegible Next (clear I/l/1, built for
     low-vision readers, which suits learners decoding a new script). SF Pro is not licensable for the web. */
  --f-body: "Vazirmatn NL", "Atkinson Next", system-ui, sans-serif;
  --f-display: "Atkinson Next", "Estedad", "Vazirmatn NL", system-ui, sans-serif;

  /* ---- motion (docs/DESIGN-APPLE.md §5): critically damped springs by default, overshoot only when earned ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --ease-pop: cubic-bezier(0.3, 1.3, 0.5, 1);
  --spring: linear(0, 0.042 1.1%, 0.162 2.4%, 0.517 6.7%, 0.672 9.1%, 0.796 11.7%, 0.882 14.4%, 0.941 17.4%, 0.975 20.4%,
    1.003 25.6%, 1.009 29.6%, 1.005 39.7%, 1);
  --dur-1: 120ms; --dur-2: 240ms; --dur-3: 420ms;

  --gutter: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 18px 40px -16px rgb(0 0 0 / 0.16);

  /* ---- type (docs/DESIGN-APPLE.md §3). Persian is never letter-spaced; --ls-* apply to Latin runs only. ---- */
  --fs-2xs: 0.75rem;     /* 12  tab-bar labels, ticks, kbd */
  --fs-xs: 0.8125rem;    /* 13  captions, badges: the Persian floor */
  --fs-sm: 0.875rem;     /* 14  meta, help, table cells, small buttons */
  --fs-base: 1rem;       /* 16  body, buttons */
  --fs-md: 1.0625rem;    /* 17  card titles, long reading text (iOS body) */
  --fs-lg: 1.1875rem;    /* 19  section titles, sheet titles */
  --fs-xl: 1.375rem;     /* 22  key numbers, page title on small phones */
  --fs-2xl: 1.75rem;     /* 28  large title on phones */
  --fs-3xl: 2.25rem;     /* 36  marketing section titles, scores */
  --fs-4xl: 3.75rem;     /* 60  landing hero, desktop only */
  --fs-h1: clamp(1.75rem, 1.1vw + 1.4rem, 2.25rem);
  --fs-hero: clamp(2.125rem, 3.4vw + 1.1rem, var(--fs-4xl));
  --fs-h2-mkt: clamp(1.625rem, 2vw + 1rem, 2.75rem);
  --lh-body: 1.75; --lh-title: 1.4; --lh-display: 1.22;
  --ls-display: -0.03em; --ls-title: -0.018em; --ls-small: 0.008em;
  --ls-caps: 0.06em;     /* Latin labels only (IELTS, B2, codes) */
  /* controls: 40 with a pointer, 44 on touch; primary CTAs 52 */
  --ctl-sm: 34px; --ctl: 40px; --ctl-lg: 52px;
  /* radii: continuous-feeling corners, capsules for controls */
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --radius: var(--r-lg);
  /* elevation: resting cards get a soft lift (no outline), floating layers real shadow, sheets the deepest */
  --e1: 0 0 0 0.5px rgb(0 0 0 / 0.03), 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 14px -6px rgb(0 0 0 / 0.08);
  --e2: 0 0 0 0.5px rgb(0 0 0 / 0.05), 0 2px 6px rgb(0 0 0 / 0.05), 0 16px 40px -14px rgb(0 0 0 / 0.24);
  --e3: 0 -1px 0 rgb(0 0 0 / 0.04), 0 -12px 48px -8px rgb(0 0 0 / 0.22);
  --ledge: 0px;          /* the old Kashi "glazed tile" button ledge is retired (flat, pressed = scale) */

  /* ---- materials (chrome only: header, tab bar, sheets, sticky bars) ---- */
  --mat: color-mix(in srgb, var(--paper) 74%, transparent);
  --mat-card: color-mix(in srgb, var(--card) 78%, transparent);
  --mat-blur: saturate(180%) blur(20px);
  --scrim: rgb(0 0 0 / 0.32);
  --header-h: 52px;
  --tabbar-h: 72px;  /* the floating tab bar: 62px capsule + 10px above the bottom edge (ui.css .tabbar) */
  /* safe areas: the Android app (Capacitor SystemBars, insetsHandling "css") injects --safe-area-inset-* on <html>; they equal
     env() on WebView 140+ and stay the source of truth on older WebViews (and they zero the bottom while the keyboard is up) */
  --safe-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); --safe-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px)); --safe-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));

  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000;
    --paper-2: #2c2c2e;
    --card: #1c1c1e;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --indigo: #9a9cff;
    --on-indigo: #0b0b10;
    --teal: #3fd3c6;
    --teal-deco: #3fd3c6;
    --saffron: #ffc84d;
    --ok: #4bd487;
    --bad: #ff7b72;
    --line: #76767e;
    --hair: #38383a;
    --sep: rgb(84 84 88 / 0.55);
    --tint: color-mix(in srgb, var(--indigo) 18%, transparent);
    --hero-a: #3a3eb8;
    --hero-b: #0c6f68;
    --hero-c: #6b4a12;
    --hero-bg: #000000;
    --shadow: 0 0 0 0.5px rgb(255 255 255 / 0.06), 0 18px 40px -16px rgb(0 0 0 / 0.8);
    --e1: 0 0 0 0.5px rgb(255 255 255 / 0.07);
    --e2: 0 0 0 0.5px rgb(255 255 255 / 0.1), 0 16px 40px -12px rgb(0 0 0 / 0.8);
    --e3: 0 0 0 0.5px rgb(255 255 255 / 0.08), 0 -12px 48px -8px rgb(0 0 0 / 0.7);
    --mat: color-mix(in srgb, #161618 72%, transparent);
    --mat-card: color-mix(in srgb, #1c1c1e 80%, transparent);
    --scrim: rgb(0 0 0 / 0.55);
    --surface-2: #2c2c2e; --accent-soft: #24255c; --accent-ink: #a9abff; --fill-q: #7676803d; --teal-ink: #3fd3c6;
    --flame-ink: #ffc84d; --ok-soft: #12301f; --ok-ink: #5fdd95; --bad-soft: #3a1519; --bad-ink: #ff8f87;
    --warn-soft: #36290b; --warn-ink: #ffc84d; --toast-bg: #f5f5f7; --toast-ink: #1d1d1f; --toast-ok: #1a7f45; --toast-acc: #4346d1;
    --seg-on: #636366; --sh-seg: none; --sh-card: 0 0 0 0.5px rgb(255 255 255 / 0.07);
  }
}
:root[data-theme="dark"] {
  --paper: #000000;
  --paper-2: #2c2c2e;
  --card: #1c1c1e;
  --ink: #f5f5f7;
  --ink-2: #a1a1a6;
  --indigo: #9a9cff;
  --on-indigo: #0b0b10;
  --teal: #3fd3c6;
  --teal-deco: #3fd3c6;
  --saffron: #ffc84d;
  --ok: #4bd487;
  --bad: #ff7b72;
  --line: #76767e;
  --hair: #38383a;
  --sep: rgb(84 84 88 / 0.55);
  --tint: color-mix(in srgb, var(--indigo) 18%, transparent);
  --hero-a: #3a3eb8;
  --hero-b: #0c6f68;
  --hero-c: #6b4a12;
  --hero-bg: #000000;
  --shadow: 0 0 0 0.5px rgb(255 255 255 / 0.06), 0 18px 40px -16px rgb(0 0 0 / 0.8);
  --e1: 0 0 0 0.5px rgb(255 255 255 / 0.07);
  --e2: 0 0 0 0.5px rgb(255 255 255 / 0.1), 0 16px 40px -12px rgb(0 0 0 / 0.8);
  --e3: 0 0 0 0.5px rgb(255 255 255 / 0.08), 0 -12px 48px -8px rgb(0 0 0 / 0.7);
  --mat: color-mix(in srgb, #161618 72%, transparent);
  --mat-card: color-mix(in srgb, #1c1c1e 80%, transparent);
  --scrim: rgb(0 0 0 / 0.55);
  --surface-2: #2c2c2e; --accent-soft: #24255c; --accent-ink: #a9abff; --fill-q: #7676803d; --teal-ink: #3fd3c6;
  --flame-ink: #ffc84d; --ok-soft: #12301f; --ok-ink: #5fdd95; --bad-soft: #3a1519; --bad-ink: #ff8f87;
  --warn-soft: #36290b; --warn-ink: #ffc84d; --toast-bg: #f5f5f7; --toast-ink: #1d1d1f; --toast-ok: #1a7f45; --toast-acc: #4346d1;
  --seg-on: #636366; --sh-seg: none; --sh-card: 0 0 0 0.5px rgb(255 255 255 / 0.07);
}
/* ---- --sp-* names (the top bar, filter bar, review, profile and pricing were built with them first): aliases of the
   base tokens above, so light and true-black dark both come from one place ---- */
:root {
  --sp-fill: var(--fill-q); --sp-line: var(--hair); --sp-primary-soft: var(--accent-soft); --sp-primary-ink: var(--accent-ink);
  --sp-seg-on: var(--seg-on); --sp-sh-seg: var(--sh-seg); --sp-sh-float: var(--e2); --sp-r-ctl: var(--r-ctl); --sp-r-pop: var(--r-pop);
  --sp-ease: var(--ease-out); --sp-dur: var(--dur-2); --sp-press: var(--press);
  --sp-chrome: #f5f5f7c2;               /* frosted bars (with --mat-blur where it is cheap) */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sp-chrome: #161618b8; } }
:root[data-theme="dark"] { --sp-chrome: #161618b8; }
/* the kids section (children's pages .kz/.kzl, the parent area .kzp) keeps its look until its own Soft Precision pass:
   the shadow, hairline and soft-accent values it was built with */
:where(body.kz, body.kzp, body.kzl) {
  --e1: 0 0 0 0.5px rgb(0 0 0 / 0.03), 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 14px -6px rgb(0 0 0 / 0.07);
  --e2: 0 0 0 0.5px rgb(0 0 0 / 0.05), 0 2px 6px rgb(0 0 0 / 0.05), 0 16px 40px -14px rgb(0 0 0 / 0.22);
}
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"]) :is(body.kz, body.kzp, body.kzl)) { --hair: #2c2c30; --accent-soft: #22235a;
    --e1: 0 0 0 0.5px rgb(255 255 255 / 0.05); --e2: 0 0 0 0.5px rgb(255 255 255 / 0.08), 0 16px 40px -12px rgb(0 0 0 / 0.75); }
}
:where(:root[data-theme="dark"] :is(body.kz, body.kzp, body.kzl)) { --hair: #2c2c30; --accent-soft: #22235a;
  --e1: 0 0 0 0.5px rgb(255 255 255 / 0.05); --e2: 0 0 0 0.5px rgb(255 255 255 / 0.08), 0 16px 40px -12px rgb(0 0 0 / 0.75); }
@media (pointer: coarse) { :root { --ctl-sm: 36px; --ctl: 44px; } }
/* accessibility: solid materials when transparency is reduced or contrast is raised (docs/DESIGN-APPLE.md §5) */
@media (prefers-reduced-transparency: reduce) { :root { --mat: var(--paper); --mat-card: var(--card); --mat-blur: none; } }
@media (prefers-contrast: more) {
  :root { --mat: var(--paper); --mat-card: var(--card); --mat-blur: none; --hair: var(--line); --sep: var(--line); --ink-2: var(--ink); }
}
/* a weak device (motion tier 1: deviceMemory <= 2, the boot script in base.html) gets solid materials: a backdrop blur is
   re-rendered under the sticky header, menus and sheets on every scrolled frame, which made low-end Android stutter */
:root[data-motion="1"], :root[data-motion="1"][data-theme] { --mat: var(--paper); --mat-card: var(--card); --mat-blur: none; }
/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth;
  scroll-padding-block-start: calc(var(--header-h) + var(--safe-t) + 16px); background: var(--paper); }
html[data-motion="0"] { scroll-behavior: auto; }
body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
:lang(en) { line-height: 1.5; }
[lang="en"] { font-family: "Atkinson Next", "Vazirmatn NL", system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; font-family: var(--f-display); font-weight: 700; line-height: var(--lh-title); letter-spacing: 0; }
h1 { font-weight: 750; line-height: 1.3; }
h3 { font-weight: 650; }
/* Latin runs inside titles get size-specific tracking (Persian stays at 0: spacing breaks cursive joining) */
h1 :is(.en, [lang="en"]), h1:lang(en) { letter-spacing: var(--ls-title); }
h2 :is(.en, [lang="en"]) { letter-spacing: -0.01em; }
small :is(.en, [lang="en"]), .small :is(.en, [lang="en"]) { letter-spacing: var(--ls-small); }
p, li { text-wrap: pretty; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
/* touch: no 300ms delay / double-tap zoom on controls, no grey flash (pinch-zoom on content stays) */
a, button, summary, label, input, select, textarea, [role="button"], [role="tab"], [role="option"], [role="radio"], [role="checkbox"],
[role="switch"], [role="menuitem"], [role="link"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: color-mix(in srgb, var(--indigo) 24%, transparent); }
/* icons: one stroke family (Lucide), stroke set here so it can thin out at large sizes and thicken at small ones */
.ic { stroke-width: 1.75; fill: currentColor; } /* fill only reaches the few solid glyphs (play, pause, stop, star, flame); the rest set fill="none" */
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.en { direction: ltr; unicode-bidi: isolate; font-family: var(--f-display); display: inline-block; }
.wrap { inline-size: min(100% - 2 * var(--gutter) - var(--safe-l, 0px) - var(--safe-r, 0px), 1180px); margin-inline: auto; }
@media (min-width: 760px) { :root { --gutter: 24px; } }
.skip { position: absolute; inset-inline-start: 12px; inset-block-start: -80px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { inset-block-start: calc(12px + var(--safe-t)); }
/* ---- buttons: capsules; feedback on press (pointer-down), never a hover lift ---------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: var(--ctl); padding-inline: 20px; border-radius: 999px; border: 0; background: transparent;
  font-size: var(--fs-base); font-weight: 600; text-decoration: none; line-height: 1.3; text-align: center;
  transition: transform var(--dur-2) var(--spring), background-color var(--dur-2) var(--ease-std), color var(--dur-2) var(--ease-std),
    box-shadow var(--dur-2) var(--ease-std), filter var(--dur-2) var(--ease-std);
}
.btn:active:not([disabled]) { transform: scale(0.97); transition-duration: var(--dur-1); }
.btn .ic { inline-size: 18px; block-size: 18px; }
/* small controls keep a 44px touch target with an invisible hit area */
.btn-sm::before, .icon-btn::before { content: ""; position: absolute; inset: min(0px, calc((var(--ctl-sm) - 44px) / 2)); border-radius: inherit; }
.btn-sm::before { inset-inline: 0; }
.btn-primary { background: var(--indigo); color: var(--on-indigo); }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { filter: brightness(1.08); } }
/* secondary = tinted (Apple "gray/tinted" button): no outline, a soft accent fill */
.btn-ghost { background: var(--tint); color: var(--indigo); }
@media (hover: hover) and (pointer: fine) { .btn-ghost:hover { background: color-mix(in srgb, var(--indigo) 17%, transparent); } }
.btn-sm { min-block-size: var(--ctl-sm); padding-inline: 14px; font-size: var(--fs-sm); gap: 6px; }
.btn-sm .ic { inline-size: 16px; block-size: 16px; }
.btn-lg { min-block-size: var(--ctl-lg); padding-inline: 28px; font-size: var(--fs-md); }
.icon-btn {
  position: relative; inline-size: var(--ctl-sm); block-size: var(--ctl-sm); border-radius: 50%; border: 0; background: transparent; color: var(--ink-2);
  display: inline-grid; place-items: center; padding: 0;
  transition: transform var(--dur-2) var(--spring), background-color var(--dur-2) var(--ease-std), color var(--dur-2) var(--ease-std);
}
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); } }
.icon-btn:active { transform: scale(0.9); transition-duration: var(--dur-1); }
.icon-btn svg { inline-size: 21px; block-size: 21px; }
.icon-btn[aria-pressed="true"] { background: var(--tint); color: var(--indigo); }
/* ---- header: three zones (brand · sections · actions), transparent at rest, a material + hairline once content slides
   under. Pointer screens get the blurred glass; touch screens (phones, the Android app) a solid bar instead, because a
   backdrop-filter on a sticky bar is re-rendered on every scroll frame and stutters on mid-range Android WebViews (and a
   see-through bar without the blur only shows the text under it). ------------------------------------------------- */
:root { --bar-solid: var(--paper); }
.site-header { position: sticky; inset-block-start: 0; z-index: 50; padding-block-start: var(--safe-t);
  transition: background-color var(--dur-3) var(--ease-std), box-shadow var(--dur-3) var(--ease-std); }
.site-header.scrolled { background: var(--bar-solid); box-shadow: 0 0.5px 0 var(--sep); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  @media (hover: hover) and (pointer: fine) {
    .site-header.scrolled { background: var(--sp-chrome); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); }
  }
}
@media (prefers-reduced-transparency: reduce) { .site-header.scrolled { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.nav { position: relative; display: flex; align-items: center; gap: 4px; min-block-size: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 8px; min-block-size: 44px; font-weight: 800; font-size: 1.0625rem; text-decoration: none; margin-inline-end: auto;
  transition: opacity var(--dur-2) var(--ease-std), visibility var(--dur-2); }
/* brand lockup (design/logo, mark A): mark at the start, Persian name, then the Latin name after a hairline (>= 600px).
   The top bar keeps the mark and the Persian name only (the Latin name was one more grey word competing with the
   sections); the footer keeps the full lockup. */
.brand-mark { inline-size: 28px; block-size: 28px; flex: none; }
.brand-mark .bm-l { fill: var(--brand-a); }
.brand-mark .bm-r { fill: var(--brand-b); }
.brand { color: var(--ink); }
.brand-fa { font-family: "Estedad", var(--f-body); font-weight: 800; font-size: 1.125rem; line-height: 1; }
.brand-en { display: none; font-family: "Atkinson Next", sans-serif; font-weight: 700; font-size: 1rem; line-height: 1;
  letter-spacing: -0.02em; padding-inline-start: 10px; border-inline-start: 1px solid var(--sep); color: var(--ink-2); }
@media (min-width: 600px) { .brand-en { display: inline; } }
[dir="rtl"] .site-header .brand-en { display: none; }
.brand-foot { margin-block-end: 8px; }
.brand-foot .brand-mark { inline-size: 32px; block-size: 32px; }
/* sections (Soft Precision): secondary-label text, the current one in the primary label colour on a quiet fill */
.nav-links { display: none; gap: 2px; }
.nav-links a { position: relative; display: inline-flex; align-items: center; min-block-size: 36px; padding-inline: 13px; border-radius: 999px; text-decoration: none;
  white-space: nowrap; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
  transition: color var(--sp-dur) var(--sp-ease), background-color var(--sp-dur) var(--sp-ease), transform var(--sp-dur) var(--sp-ease); }
@media (hover: hover) and (pointer: fine) { .nav-links a:hover { color: var(--ink); } }
.nav-links a:active { transform: var(--sp-press); transition-duration: var(--dur-1); }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--sp-fill); }
@media (min-width: 900px) {
  .nav-links { display: flex; }
  /* brand and actions take equal sides, so the sections sit at the true centre of the bar */
  .nav { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); gap: 16px; }
  .nav > .brand { justify-self: start; margin-inline-end: 0; }
  .nav > .nav-actions { justify-self: end; }
}
@media (prefers-contrast: more) { .nav-links a[aria-current="page"] { box-shadow: inset 0 0 0 1.5px currentColor; } }
.nav-actions { display: flex; align-items: center; gap: 6px; }
/* the bell and account menus are <details>: as blocks their inline-grid <summary> sat on a text line (37.5px box, icon 2px
   high); as flex boxes they line up with the other 34px buttons */
.nav-actions > details.menu { display: flex; align-items: center; }
/* the member's account button: their initial on the logo's gradient, so it never reads as one more grey icon */
.avatar-btn .um-avatar { inline-size: 34px; block-size: 34px; font-size: 0.9375rem; transition: box-shadow var(--dur-2) var(--ease-std); }
.menu[open] > summary.avatar-btn, .menu > summary.avatar-btn:hover { background: transparent; }
.menu[open] > summary.avatar-btn .um-avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px color-mix(in srgb, var(--indigo) 55%, transparent); }
@media (hover: hover) and (pointer: fine) { .avatar-btn:hover .um-avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent); } }
/* ---- language pill «فا | EN» (templates/_lang_toggle.html, fx.js) -----------------------------------------------
   The trailing control of the menu's language row: a small glazed track; the thumb wears the logo's two colours and sits
   under the current language. On a switch it travels to the other side with a stretch (squash and stretch, like a drop
   of glaze), then the wipe below takes over. The whole row is the button (.lang-row, ui.css). */
.lang-pill-form { margin: 0; display: inline-flex; }
.lang-pill { --lp-dir: 1; position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; align-items: stretch; inline-size: 62px; block-size: 30px;
  flex: none; padding: 0; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2);
  font: inherit; isolation: isolate; transition: background-color var(--dur-2) var(--ease-std), transform var(--dur-2) var(--spring); }
[dir="rtl"] .lang-pill { --lp-dir: -1; }
.lang-row:active .lang-pill { transform: scale(0.94); transition-duration: var(--dur-1); }
.lp-opt { position: relative; z-index: 1; display: grid; place-items: center; font-size: 0.78rem; font-weight: 750; line-height: 1; color: var(--ink);
  transition: color var(--dur-2) var(--ease-std); }
.lp-opt[lang="fa"] { font-family: "Estedad", var(--f-body); font-size: 0.82rem; padding-block-end: 1px; }
.lp-opt[lang="en"] { font-family: "Atkinson Next", sans-serif; letter-spacing: 0.03em; }
.lp-thumb { position: absolute; inset-block: 3px; inset-inline-start: 3px; inline-size: calc(50% - 3px); border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18), 0 2px 8px -2px color-mix(in srgb, var(--brand-a) 60%, transparent), inset 0 1px 0 rgb(255 255 255 / 0.35); }
.lang-pill.is-en .lp-thumb { inset-inline-start: 50%; }
.lang-pill:not(.is-en) .lp-opt[lang="fa"], .lang-pill.is-en .lp-opt[lang="en"] { color: #fff; }
/* the switch (fx.js adds .is-switching): the thumb runs to the other slot and the labels trade colours */
.lang-pill { --lp-to: calc(var(--lp-dir) * (100% + 3px)); }
.lang-pill.is-en { --lp-to: calc(var(--lp-dir) * -1 * (100% + 3px)); }
.lang-pill.is-switching .lp-thumb { animation: lp-run 300ms var(--ease-std) forwards; }
.lang-pill.is-switching .lp-opt { color: var(--ink); }
.lang-pill.is-switching:not(.is-en) .lp-opt[lang="en"], .lang-pill.is-switching.is-en .lp-opt[lang="fa"] { color: #fff; transition-delay: 120ms; }
@keyframes lp-run {
  0% { transform: translateX(0) scaleX(1); }
  45% { transform: translateX(calc(var(--lp-to) * 0.5)) scaleX(1.35); }
  80% { transform: translateX(calc(var(--lp-to) * 1.03)) scaleX(0.95); }
  100% { transform: translateX(var(--lp-to)) scaleX(1); }
}
/* the wipe: a disc in the logo's colours grows from the pill, the white khatam turns a quarter in the middle of the screen;
   on the next page base.html's boot script puts the same disc up before the first paint, centred on where the pill is now
   (the other side: the direction flipped), and it shrinks back into it at once. Transform and opacity only: the disc is
   sized to reach the farthest corner (--lw-r, set in px by fx.js / the boot script) and scaled, so the compositor runs it
   (the old full-screen clip-path repainted every frame and stuttered on phones). */
.lang-wipe, html.lang-arrive::before { content: ""; position: fixed; z-index: 1000; pointer-events: none;
  left: calc(var(--lw-x, 50vw) - var(--lw-r, 150vmax)); top: calc(var(--lw-y, 0px) - var(--lw-r, 150vmax));
  inline-size: calc(var(--lw-r, 150vmax) * 2); block-size: calc(var(--lw-r, 150vmax) * 2); border-radius: 50%;
  background: radial-gradient(closest-side, var(--brand-a), var(--brand-b) 85%); will-change: transform; backface-visibility: hidden; }
.lang-mark, html.lang-arrive::after { content: ""; position: fixed; z-index: 1001; top: 50%; left: 50%;
  inline-size: 84px; block-size: 84px; margin: -42px 0 0 -42px; pointer-events: none; will-change: transform, opacity;
  background: url("../icons/mark-white.2efea69176c2.svg") center / contain no-repeat; }
.lang-wipe { transform: scale(0); animation: lw-grow 440ms cubic-bezier(0.65, 0, 0.35, 1) 60ms forwards; }
.lang-mark { opacity: 0; animation: lw-mark-in 440ms var(--ease-std) 60ms forwards; }
@keyframes lw-grow { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes lw-mark-in { from { opacity: 0; transform: rotate(-90deg) scale(0.4); } 40% { opacity: 0; } to { opacity: 1; transform: none; } }
/* arrival: opens straight away (no wait for a script); the boot script already knows where the pill landed */
html.lang-arrive::before { animation: lw-shrink 460ms cubic-bezier(0.65, 0, 0.35, 1) 80ms forwards; }
html.lang-arrive::after { animation: lw-mark-out 340ms var(--ease-std) 40ms forwards; }
@keyframes lw-shrink { from { transform: scale(1); } to { transform: scale(0); visibility: hidden; } }
@keyframes lw-mark-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: rotate(90deg) scale(0.4); visibility: hidden; } }
html[data-motion="0"] .lang-wipe, html[data-motion="0"] .lang-mark, html[data-motion="0"].lang-arrive::before, html[data-motion="0"].lang-arrive::after { display: none; }
@media print { .lang-pill-form { display: none; } }
/* compact title: the page's large title moves here once it scrolls under the header (ui.js), phones only */
.nav-title { position: absolute; inset-inline: 96px; inset-block: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
  font-weight: 650; font-size: var(--fs-md); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transform: translateY(6px); transition: opacity var(--dur-2) var(--ease-std), transform var(--dur-3) var(--spring); }
.nav-title > span { overflow: hidden; text-overflow: ellipsis; max-inline-size: 100%; }
@media (max-width: 899px) {
  .site-header.titled .nav-title { opacity: 1; transform: none; }
  .site-header.titled .brand { opacity: 0; visibility: hidden; }
}
/* split words (Persian is split by WORD only, never by letter: keeps joining intact) */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-block: 0.22em 0.12em; margin-block: -0.22em -0.12em; }
.wi { display: inline-block; }
html.js:not([data-motion="0"]) [data-split]:not(.is-in) .wi { transform: translateY(115%); }
[data-split] .wi { transition: transform 800ms var(--ease-out); transition-delay: calc(var(--i, 0) * 55ms + 120ms); }
html.ready-all [data-split] .wi { transform: none !important; }
.lead { font-size: clamp(var(--fs-md), 0.4vw + 0.95rem, 1.25rem); color: var(--ink-2); max-inline-size: 34em; line-height: 1.75; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 28px; }
.bar { flex: 1; block-size: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.bar > i { display: block; block-size: 100%; inline-size: 100%; background: var(--teal-deco); border-radius: inherit; transform-origin: right center; transform: scaleX(var(--p, 0)); transition: transform var(--dur-3) var(--spring); }
[dir="ltr"] .bar > i, .bar.ltr > i { transform-origin: left center; }
.streak { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--ink); }
.streak svg { inline-size: 18px; block-size: 18px; color: #ff9f0a; }
.streak.tick svg { animation: flame-pop 700ms var(--ease-pop); }
.xp-pop {
  position: absolute; z-index: 5; pointer-events: none; font-weight: 800; color: #1d1d1f; background: var(--saffron); padding: 2px 12px; border-radius: 999px; font-family: var(--f-display);
  animation: xp-rise 900ms var(--ease-out) forwards;
}
/* ---- sections ------------------------------------------------------------ */
.section { padding-block: clamp(64px, 9vw, 128px); }
.section-head { max-inline-size: 42rem; margin-block-end: clamp(28px, 4vw, 48px); }
.section-head h2 { font-size: var(--fs-h2-mkt); margin-block: 8px 12px; line-height: 1.3; font-weight: 750; }
.kicker { color: var(--indigo); font-weight: 650; font-size: var(--fs-sm); }
.badge { font-size: 0.8rem; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: color-mix(in srgb, var(--teal-deco) 16%, transparent); color: var(--teal); font-family: var(--f-body); }
.badge.soon { background: var(--paper-2); color: var(--ink-2); }
/* reading: highlight sweep */
.lines { display: grid; gap: 10px; inline-size: 72%; }
.lines i { display: block; block-size: 10px; border-radius: 6px; background: linear-gradient(to right, var(--saffron) 0 0) no-repeat, var(--hair); background-size: 0% 100%, 100% 100%; }
.lines i:nth-child(2) { inline-size: 88%; }
.lines i:nth-child(3) { inline-size: 64%; }
.lines i:nth-child(1) { background-size: 100% 100%, 100% 100%; }
html[data-motion="2"] .in-view .lines i, html[data-motion="3"] .in-view .lines i { animation: sweep 3.6s var(--ease-std) infinite; }
html[data-motion="2"] .in-view .lines i:nth-child(2), html[data-motion="3"] .in-view .lines i:nth-child(2) { animation-delay: 0.5s; }
html[data-motion="2"] .in-view .lines i:nth-child(3), html[data-motion="3"] .in-view .lines i:nth-child(3) { animation-delay: 1s; }
.fine { border-block-start: 0.5px solid var(--sep); padding-block-start: 18px; color: var(--ink-2); font-size: var(--fs-sm); display: grid; gap: 6px; }
.sheet { border-radius: var(--r-lg); padding: 14px 18px; display: grid; gap: 8px; border: 1.5px solid var(--hair); background: var(--paper-2); }
.sheet.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--paper)); }
.sheet.no { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--paper)); }
html[data-motion="2"] .sheet, html[data-motion="3"] .sheet { animation: sheet-up 280ms var(--ease-out); }
.sheet strong { font-size: var(--fs-md); }
.sheet.ok strong { color: var(--ok); }
.sheet.no strong { color: var(--bad); }
.sheet .ans { font-family: var(--f-display); font-weight: 700; }
.done { text-align: center; display: grid; gap: 14px; justify-items: center; padding-block: 20px; }
.done h2 { font-size: clamp(var(--fs-xl), 1.5vw + 1rem, 2rem); }
.done .stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stat { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 10px 18px; min-inline-size: 112px; }
.stat b { display: block; font-family: var(--f-display); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; direction: ltr; line-height: 1.3; }
.stat span { color: var(--ink-2); font-size: var(--fs-sm); }
#fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; inline-size: 100%; block-size: 100%; }
/* ---- keyframes ----------------------------------------------------------- */
@keyframes wave { from { transform: scaleY(0.35); } to { transform: scaleY(1.15); } }
@keyframes ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.3); opacity: 0; } }
@keyframes sweep { 0% { background-size: 0% 100%, 100% 100%; } 45%, 80% { background-size: 100% 100%, 100% 100%; } 100% { background-size: 0% 100%, 100% 100%; } }
@keyframes wrong-out { 0%, 40% { opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes right-in { 0%, 45% { opacity: 0; transform: translateY(6px); } 60%, 90% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes flip { 0%, 35% { transform: rotateY(0); } 50%, 85% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
@keyframes timer-run { from { stroke-dashoffset: 0; } to { stroke-dashoffset: var(--len, 339.3); } }
@keyframes slot-pop { 0% { transform: scale(0.6) translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes xp-rise { 0% { transform: translateY(0) scale(0.7); opacity: 0; } 20% { opacity: 1; transform: translateY(-10px) scale(1.05); } 100% { transform: translateY(-64px) scale(1); opacity: 0; } }
@keyframes flame-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes chip-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes opt-pop { 0% { transform: scale(0.97); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes sheet-up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
/* ---- view transitions (progressive enhancement; Chromium/Safari) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 260ms; animation-timing-function: var(--ease-std); }
/* ---- reduced motion / tier 0 --------------------------------------------- */
html[data-motion="0"] *, html[data-motion="0"] *::before, html[data-motion="0"] *::after {
  animation: none !important; scroll-behavior: auto !important;
}
html[data-motion="0"] .btn, html[data-motion="0"] .chip, html[data-motion="0"] .bcard, html[data-motion="0"] .note, html[data-motion="0"] .opt { transition-duration: 0.01ms; }
@media (hover: hover) and (pointer: fine) { html[data-motion="0"] .bcard:hover, html[data-motion="0"] .btn:hover, html[data-motion="0"] .chip:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
/* ---- lesson catalogue ---- */
.lessons-page { padding-block: 28px 64px; display: grid; gap: 28px; }
.lessons-head { display: grid; gap: 8px; max-inline-size: 60ch; }
.lessons-head h1 { font-size: var(--fs-h1); margin: 0; }
.lgroup { display: grid; gap: 12px; }
.lgroup h2 { font-size: var(--fs-lg); margin: 0; display: flex; gap: 8px; align-items: baseline; }
select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 8px 12px; }
select:focus-visible, textarea:focus-visible, .stile:focus-visible, .rate:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.badge { display: inline-grid; place-items: center; inline-size: 22px; block-size: 22px; border-radius: 50%; background: var(--indigo); color: var(--on-indigo); font-weight: 700; font-size: var(--fs-2xs); }
.check { padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--hair); font-size: var(--fs-sm); }
.check.ok { border-color: var(--ok); }
.check.warn { border-color: var(--bad); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* a notice paragraph is inline text: as a grid its leading icon took a row of its own and every link split the text
   into separate rows */
p.sheet:not(.hint) { display: block; }
p.sheet:not(.hint) > .ic:first-child { vertical-align: -0.2em; margin-inline-end: 4px; }
.foot-copy { margin-block: 0; padding-block: 14px calc(14px + env(safe-area-inset-bottom)); color: var(--ink-2); font-size: var(--fs-xs); text-align: center; border-block-start: 0.5px solid var(--sep); }
