/* ───────── Fonts (self-hosted, no external requests) ───────── */
@font-face {
  font-family: 'Estedad';
  src: url('/fonts/estedad-arabic.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+2010-2011, U+204F, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Estedad';
  src: url('/fonts/estedad-latin.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Lalezar';
  src: url('/fonts/lalezar-arabic.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Lalezar';
  src: url('/fonts/lalezar-latin.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF;
}

/* ───────── Brand tokens ───────── */
:root {
  --lajvard: #2F2BEA;
  --firoozeh: #12D6C3;
  --zaferan: #FFB020;
  --anar: #FF3B5C;
  --ink: #14123A;
  --paper: #F5F6FF;

  --bg: var(--paper);
  --surface: #FFFFFF;
  --surface-2: #EEEEFB;
  --text: var(--ink);
  --muted: #5B5980;
  --line: #E1E0F2;
  --accent: var(--lajvard);
  --accent-bg: var(--lajvard);
  --accent-text: #FFFFFF;
  --accent-soft: #E7E6FF;
  --danger: #D21F45;
  --danger-soft: #FFE7EC;
  --success: #0B8A6B;
  --success-soft: #DDF8F1;
  --warn: #9A5B00;
  --warn-soft: #FFF2D6;
  --focus: #2F2BEA;

  --font: 'Estedad', 'Vazirmatn', Tahoma, system-ui, sans-serif;
  --font-display: 'Lalezar', 'Estedad', Tahoma, sans-serif;

  /* type scale (1.25 ratio, base 16) */
  --fs-xs: 0.8125rem;  /* 13 */
  --fs-sm: 0.9375rem;  /* 15 */
  --fs-md: 1rem;       /* 16 */
  --fs-lg: 1.25rem;    /* 20 */
  --fs-xl: 1.5625rem;  /* 25 */
  --fs-2xl: 1.9375rem; /* 31 */
  --fs-3xl: 2.4375rem; /* 39 */

  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 11px;
  --shadow-pop: 0 18px 40px -18px rgba(20, 18, 58, .45);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0C2A;
    --surface: #18163F;
    --surface-2: #221F52;
    --text: #F2F1FF;
    --muted: #A9A7D3;
    --line: #2D2A62;
    --accent: #8F8CFF;
    --accent-bg: #4A46F2;
    --accent-soft: #2A2770;
    --danger: #FF6B85;
    --danger-soft: #3D1730;
    --success: #3FE0BC;
    --success-soft: #0F3A3A;
    --warn: #FFC75C;
    --warn-soft: #3A2C10;
    --focus: #8F8CFF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0C2A; --surface: #18163F; --surface-2: #221F52; --text: #F2F1FF; --muted: #A9A7D3; --line: #2D2A62;
  --accent: #8F8CFF; --accent-bg: #4A46F2; --accent-soft: #2A2770; --danger: #FF6B85; --danger-soft: #3D1730; --success: #3FE0BC;
  --success-soft: #0F3A3A; --warn: #FFC75C; --warn-soft: #3A2C10; --focus: #8F8CFF; color-scheme: dark;
}

/* ───────── Reset ───────── */
*, *::before, *::after { box-sizing: border-box; }
/* The page never scrolls sideways. Set on html, the viewport takes it, so a page's own body { overflow-x: clip }
   really clips its contents; set only on body, it would move to the viewport and the body would clip nothing,
   letting a wide decoration stretch the page on phones (it then wobbles sideways while scrolling). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .625rem 1.25rem;
  border: 0; border-radius: var(--r-sm);
  background: var(--accent-bg); color: var(--accent-text);
  font-weight: 700; font-size: var(--fs-sm); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn .i { width: 20px; height: 20px; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-plain { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 38px; padding: .375rem .875rem; font-size: var(--fs-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* ───────── Forms ───────── */
.field { display: grid; gap: .5rem; }
.field + .field { margin-top: 1.125rem; }
.label { font-weight: 700; font-size: var(--fs-sm); }
.hint { color: var(--muted); font-size: var(--fs-xs); line-height: 1.7; }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: .75rem .9rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  font-size: var(--fs-md); line-height: 1.6;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-ltr { direction: ltr; text-align: left; }
.input-code { letter-spacing: .5em; text-align: center; font-size: var(--fs-xl); font-weight: 800; direction: ltr; }
.field-error { color: var(--danger); font-size: var(--fs-xs); font-weight: 600; }

/* ───────── Checkboxes and radio buttons ─────────
   Drawn by the site so they move: ticking fills the box from its centre with a small bounce, the tick draws itself
   (the short stroke, then the long one) and a ring of light leaves the box; unticking takes it back quickly.
   A radio button's dot grows the same way. Pressing squeezes the box a little. (Firefox keeps its own boxes.) */
@supports not (-moz-appearance: none) {
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"]) {
    -webkit-appearance: none; appearance: none; flex: none; position: relative; display: inline-block; vertical-align: middle;
    width: var(--tick, 20px); height: var(--tick, 20px); margin: var(--tick-m, 0); border-radius: 7px; cursor: pointer;
    background: rgba(255, 255, 255, .06);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .32), 0 0 0 0 rgba(18, 214, 195, .55);
    transition: box-shadow .15s ease, transform .4s cubic-bezier(.34, 1.56, .64, 1);
    -webkit-tap-highlight-color: transparent;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[type="radio"] { border-radius: 50%; }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"])::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(135deg, #12D6C3, #3B37F0);
    opacity: 0; transform: scale(.25);
    transition: transform .18s ease-in, opacity .18s ease-in;
  }
  /* the tick: an L turned 45°, uncovered from its foot upward */
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[type="checkbox"]::after {
    content: ''; position: absolute; left: 50%; top: 45%; width: 28%; height: 52%; pointer-events: none;
    border: solid #FFFFFF; border-width: 0 2.5px 2.5px 0; border-radius: 1px;
    transform: translate(-50%, -50%) rotate(45deg);
    clip-path: inset(100% 0 0 0);
    transition: clip-path .14s ease-in;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[type="radio"]::after {
    content: ''; position: absolute; left: 50%; top: 50%; width: 40%; height: 40%; border-radius: 50%; pointer-events: none;
    background: #FFFFFF; transform: translate(-50%, -50%) scale(0);
    transition: transform .16s ease-in;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"]):checked {
    box-shadow: inset 0 0 0 1.5px transparent, 0 0 0 9px rgba(18, 214, 195, 0);
    transition: box-shadow .55s cubic-bezier(.16, 1, .3, 1), transform .4s cubic-bezier(.34, 1.56, .64, 1);
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"]):checked::before {
    opacity: 1; transform: none;
    transition: transform .42s cubic-bezier(.34, 1.56, .64, 1), opacity .12s ease-out;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[type="checkbox"]:checked::after {
    clip-path: inset(0 0 0 0);
    transition: clip-path .3s cubic-bezier(.65, 0, .35, 1) .1s;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[type="radio"]:checked::after {
    transform: translate(-50%, -50%) scale(1);
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1) .08s;
  }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"]):active { transform: scale(.86); }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:is([type="checkbox"], [type="radio"]):focus-visible { outline: 2px solid #12D6C3; outline-offset: 3px; }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row):hover > input:is([type="checkbox"], [type="radio"]):not(:checked) { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55), 0 0 0 0 rgba(18, 214, 195, .55); }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input[aria-invalid="true"]:not(:checked) { box-shadow: inset 0 0 0 1.5px var(--danger, #FF5A7A), 0 0 0 0 rgba(18, 214, 195, .55); }
  :is(.check-row, .adm-perm, .of-terms, .pe-fit, .cta-choice label, .ord-state, label.row) > input:disabled { opacity: .45; cursor: not-allowed; }
}

/* ───────── Notices ───────── */
.notice { display: flex; gap: .625rem; align-items: flex-start; padding: .875rem 1rem; border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.7; }
.notice .i { margin-top: 2px; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--success-soft); color: var(--success); }
.notice-info { background: var(--accent-soft); color: var(--accent); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }

/* ───────── Toast ───────── */
.toast {
  position: fixed; inset-inline: 0; bottom: calc(96px + env(safe-area-inset-bottom)); margin-inline: auto;
  width: max-content; max-width: calc(100% - 32px);
  padding: .625rem 1.125rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: var(--fs-sm); font-weight: 600;
  box-shadow: var(--shadow-pop); z-index: 50;
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
