/* ==========================================================================
   SKOOLES design tokens (v2: product-forward, deep navy, luminous)
   Source of truth for every visual value. Documented in DESIGN-TOKENS.md.
   Layers: 1. primitives  2. semantic  3. component
   ========================================================================== */

/* Geist (SIL OFL) for Latin, Alexandria (SIL OFL) for Arabic. Each file is a
   variable font; unicode-range means Arabic only downloads when used. */
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin-var.woff2") format("woff2");
  font-weight: 300 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-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alexandria";
  src: url("../fonts/alexandria-arabic-var.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

:root {
  /* ---------- 1. Primitives ---------- */

  /* Night: the deep navy of the wordmark, pushed toward midnight. */
  --night-950: #040917;
  --night-900: #060D22;
  --night-850: #0A1430;
  --night-800: #0E1A3C;
  --night-700: #16244D;
  --night-600: #22335F;

  /* Ink: navy text on light surfaces. */
  --ink-900: #0A1F44;
  --ink-700: #2A3B5E;
  --ink-600: #4A5670;
  --ink-500: #5E6A80;
  --ink-400: #98A3B8;
  --ink-300: #B8C2D3;

  /* Paper */
  --paper-0: #FFFFFF;
  --paper-50: #F5F7FB;
  --paper-100: #EAEFF6;
  --paper-200: #D8E0EC;

  /* Light: the infinity-loop blue, extended to cyan for luminous art. */
  --blue-700: #0B4FD1;
  --blue-600: #1463F0;
  --blue-500: #2E7BFF;
  --blue-400: #4C9DFF;
  --sky-400: #22B8FF;
  --cyan-300: #6BE3FF;
  --cyan-200: #A9F0FF;

  /* Spark: school-bus yellow. Tiny doses only (bus, live dots, badges). */
  --spark-400: #FFC933;

  /* Status */
  --green-500: #1FBF75;
  --green-600: #0E7A52;
  --red-500: #FF5A5F;

  /* ---------- 2. Semantic: colour ---------- */
  --surface-page: var(--paper-50);
  --surface-raised: var(--paper-0);
  --surface-sunken: var(--paper-100);
  --surface-inverse: var(--night-900);
  --surface-night: var(--night-900);
  --surface-night-raised: var(--night-850);
  --surface-night-card: rgb(255 255 255 / 0.035);
  /* Paper wash over photography so ink text stays AA (paper-50 at three strengths). */
  --scrim-paper-strong: rgb(245 247 251 / 0.9);
  --scrim-paper: rgb(245 247 251 / 0.78);
  --scrim-paper-soft: rgb(245 247 251 / 0.4);

  --text-primary: var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-tertiary: var(--ink-500);
  --text-on-night: #F4F7FF;
  --text-on-night-secondary: #A7B3CF;   /* 8.3:1 on night-900 */
  --text-on-night-tertiary: #7C89A8;    /* 5.1:1 on night-900 */
  --text-on-inverse: var(--paper-0);
  --text-on-inverse-muted: var(--ink-300);
  --text-link: var(--blue-600);
  --text-link-hover: var(--blue-700);
  --text-accent-on-night: var(--cyan-300);

  --border-subtle: var(--paper-200);
  --border-strong: var(--ink-900);
  --border-night: rgb(255 255 255 / 0.08);
  --border-night-strong: rgb(255 255 255 / 0.16);

  --gradient-brand: linear-gradient(100deg, var(--blue-500) 0%, var(--sky-400) 45%, var(--cyan-300) 100%);
  --gradient-text-night: linear-gradient(95deg, #9CC8FF 0%, var(--cyan-300) 50%, #FFFFFF 100%);
  --gradient-night-glow: radial-gradient(60% 50% at 50% 0%, rgb(46 123 255 / 0.28) 0%, rgb(6 13 34 / 0) 70%);

  --state-online: var(--green-500);
  --state-offline: var(--ink-400);
  --state-synced: var(--blue-500);
  --state-ok: var(--green-600);
  --state-error: var(--red-500);
  --transport: var(--spark-400);

  --focus-ring-color: var(--blue-500);
  --focus-ring: 0 0 0 2px var(--surface-page), 0 0 0 4px var(--focus-ring-color);

  /* ---------- 2. Semantic: typography ---------- */
  --font-sans: "Geist", "Alexandria", "Geist Fallback", "Segoe UI", system-ui, sans-serif;
  --font-arabic: "Alexandria", "Geist", system-ui, sans-serif;

  --text-display: clamp(2.625rem, 1.35rem + 5.2vw, 6rem);      /* 42 → 96 */
  --text-display-ar: clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem);     /* 24 → 40 */
  --text-h1: clamp(2.5rem, 1.76rem + 3.05vw, 4.5rem);           /* 40 → 72 */
  --text-h2: clamp(2.125rem, 1.4rem + 3vw, 4rem);               /* 34 → 64 */
  --text-index: clamp(1.625rem, 1.2rem + 1.75vw, 2.75rem);      /* 26 → 44 */
  --text-h3: clamp(1.375rem, 1.24rem + 0.57vw, 1.75rem);        /* 22 → 28 */
  --text-h4: clamp(1.125rem, 1.08rem + 0.19vw, 1.25rem);        /* 18 → 20 */
  --text-lede: clamp(1.125rem, 1.03rem + 0.38vw, 1.375rem);     /* 18 → 22 */
  --text-body: clamp(1rem, 0.98rem + 0.1vw, 1.0625rem);         /* 16 → 17 */
  --text-ui: 0.9375rem;                                          /* 15 */
  --text-small: 0.875rem;                                        /* 14 */
  --text-caption: 0.8125rem;                                     /* 13 */
  --text-micro: 0.75rem;                                         /* 12, UI mock-ups */

  --leading-display: 0.98;
  --leading-heading: 1.05;
  --leading-snug: 1.3;
  --leading-body: 1.6;
  --leading-ui: 1.25;
  --leading-arabic: 1.5;

  --tracking-display: -0.045em;
  --tracking-heading: -0.035em;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-ui: -0.005em;
  --tracking-caps: 0.08em;

  --weight-light: 350;
  --weight-body: 400;
  --weight-medium: 500;
  --weight-strong: 550;
  --weight-heading: 600;
  --weight-display: 600;

  --measure-prose: 40rem;
  --measure-lede: 36rem;
  --measure-summary: 36rem;
  --width-wide: 56rem;
  --size-touch: 2.75rem;

  /* ---------- 2. Semantic: space ---------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --space-section: clamp(5.5rem, 3.5rem + 8vw, 11rem);   /* 88 → 176 */
  --space-block: clamp(2.5rem, 1.8rem + 2.8vw, 4.5rem);  /* 40 → 72 */

  /* ---------- 2. Semantic: layout ---------- */
  --width-page: 80rem;                                    /* 1280 content */
  --gutter: clamp(1.25rem, 0.53rem + 2.95vw, 3.5rem);
  --grid-columns: 12;
  --grid-gap: clamp(1rem, 0.6rem + 1.6vw, 2rem);
  --header-height: 4.25rem;                               /* 68 */

  /* ---------- 2. Semantic: shape ---------- */
  --radius-0: 0;
  --radius-xs: 6px;
  --radius-control: 999px;  /* buttons are pills in v2 */
  --radius-sm: 10px;
  --radius-media: 16px;
  --radius-card: 24px;
  --radius-window: 18px;
  --radius-phone: 42px;
  --radius-round: 999px;
  --stroke-hairline: 1px;
  --stroke-route: 2px;

  /* ---------- 2. Semantic: elevation ---------- */
  --shadow-none: none;
  --shadow-card: 0 1px 2px rgb(10 31 68 / 0.04), 0 8px 24px -12px rgb(10 31 68 / 0.12);
  --shadow-float: 0 1px 2px rgb(10 31 68 / 0.06), 0 16px 40px -16px rgb(10 31 68 / 0.28);
  --shadow-sheet: 0 24px 64px -24px rgb(10 31 68 / 0.35);
  --shadow-window: 0 0 0 1px rgb(255 255 255 / 0.08), 0 40px 120px -30px rgb(0 0 0 / 0.7), 0 20px 50px -20px rgb(46 123 255 / 0.35);
  --shadow-toast: 0 0 0 1px rgb(255 255 255 / 0.1), 0 18px 40px -12px rgb(0 0 0 / 0.55);
  --glow-blue: 0 0 0 1px rgb(76 157 255 / 0.4), 0 8px 30px -6px rgb(46 123 255 / 0.65);

  /* ---------- 2. Semantic: stacking ---------- */
  --z-base: 0;
  --z-raised: 10;
  --z-header: 100;
  --z-menu: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-skip-link: 1000;

  /* ---------- 2. Semantic: motion (Transitions.dev scale + SKOOLES tiers) ---------- */
  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --duration-deliberate: 800ms;
  --duration-cinematic: 1200ms;

  --motion-instant: var(--duration-micro);
  --motion-fast: var(--duration-quick);
  --motion-standard: var(--duration-fast);
  --motion-deliberate: var(--duration-deliberate);
  --motion-cinematic: var(--duration-cinematic);

  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: ease-in-out;
  --ease-out: ease-out;
  --ease-linear: linear;
  --ease-travel: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);   /* checkmarks, status pills */

  --distance-micro: 4px;
  --distance-small: 6px;
  --distance-base: 8px;
  --distance-medium: 12px;
  --distance-reveal: 28px;
  --distance-large: 30px;

  --scale-large: 0.96;
  --scale-medium: 0.97;
  --scale-small: 0.98;
  --scale-tiny: 0.99;

  --blur-small: 2px;
  --blur-medium: 3px;
  --blur-reveal: 8px;
  --blur-large: 8px;

  /* ---------- 3. Component tokens ---------- */
  --button-height: 3rem;
  --button-padding-inline: 1.375rem;
  --button-primary-bg: var(--ink-900);
  --button-primary-bg-hover: var(--ink-700);
  --button-primary-text: var(--paper-0);
  --button-secondary-border: var(--ink-900);
  --button-glow-bg: var(--blue-500);

  --route-line: var(--ink-900);
  --route-line-offline: var(--ink-400);
  --route-dot-size: 0.8125rem;
  --route-bus-size: 1.125rem;
}

/* Astra's global palette follows ours so Astra/Spectra output inherits it. */
:root:root {
  --ast-global-color-0: var(--blue-600);
  --ast-global-color-1: var(--ink-700);
  --ast-global-color-2: var(--ink-900);
  --ast-global-color-3: var(--ink-600);
  --ast-global-color-4: var(--paper-50);
  --ast-global-color-5: var(--paper-0);
  --ast-global-color-6: var(--paper-100);
  --ast-global-color-7: var(--ink-900);
  --ast-global-color-8: var(--night-800);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-stagger: 0ms;
    --distance-micro: 0px;
    --distance-small: 0px;
    --distance-base: 0px;
    --distance-medium: 0px;
    --distance-reveal: 0px;
    --distance-large: 0px;
    --blur-small: 0px;
    --blur-medium: 0px;
    --blur-reveal: 0px;
    --blur-large: 0px;
  }
}
