/* AranID design tokens: frosted-glass system. The single source of truth; no raw values in components.
   Themes: light (default), dark, and "system" (follows the OS). The choice is stored in localStorage and
   applied as <html data-theme="light|dark"> by /js/theme.js before first paint. No attribute = follow the OS. */

@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 500; font-display: swap; src: url('/fonts/bricolage-grotesque-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url('/fonts/bricolage-grotesque-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }

/* ── Light: cool blue-grey ──────────────────────────────────── */
:root {
  color-scheme: light;

  /* Backdrop: four soft hues painted as blurred pools behind everything */
  --bg: #E7EDF3;
  --blob-1: #DDE7F2;   /* seafoam, barely there */
  --blob-2: #E7ECF1;   /* sand, barely there */
  --blob-3: #DAE3F0;   /* dusty blue, barely there (the darkest spot: contrast is tested against this) */
  --blob-4: #EBE8EC;   /* clay, barely there */

  /* One glass recipe, three levels: base (the frame), raised (cards), selected */
  --glass-1: rgba(255, 255, 255, 0.35);
  --glass-2: rgba(255, 255, 255, 0.88);
  --glass-3: rgba(255, 255, 255, 0.97);
  --solid-1: #E6ECF2;   /* opaque stand-ins when blur is unavailable or transparency is reduced */
  --solid-2: #EEF2F7;
  --solid-3: #F8FAFC;
  --border-glass: rgba(20, 32, 43, 0.06);   /* barely-there edge: depth, not outlines, separates components */
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --shadow-soft: 0 1px 2px rgba(25, 40, 70, 0.05), 0 8px 24px rgba(25, 40, 70, 0.08), 0 22px 48px rgba(25, 40, 70, 0.06);   /* a soft, layered float */
  --shadow-lift: 0 2px 4px rgba(25, 40, 70, 0.06), 0 14px 34px rgba(25, 40, 70, 0.13), 0 28px 56px rgba(25, 40, 70, 0.08);   /* hover: rises a little further */
  --shadow-pop: 0 28px 80px rgba(25, 40, 70, 0.28);

  --text: #14202B;
  --muted: #3A4B5D;
  --accent: #1B5FBF;            /* the one "active / on" colour: blue */
  --accent-hi: #5B9BEA;         /* gradient end, hero rings only */
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(27, 95, 191, 0.10);
  --warm: #8A5200;              /* needs attention */
  --warm-soft: rgba(138, 82, 0, 0.12);
  --danger: #A3314A;
  --danger-soft: rgba(163, 49, 74, 0.11);
  --surface: rgba(20, 32, 43, 0.06);          /* chips and tracks, drawn on top of glass */
  --surface-strong: rgba(20, 32, 43, 0.12);
  --rule: rgba(20, 32, 43, 0.12);
  --scrim: rgba(10, 20, 31, 0.40);
  --focus: #1B5FBF;

  --code-bg: #1A2330;
  --code-text: #E6ECF4;
  --code-rule: transparent;
}

/* ── Dark: deep navy, designed rather than inverted ─ */
/* NOTE: these values appear twice (OS preference, and an explicit choice). tests/design-tokens.test.js
   fails if the two blocks ever drift apart. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0B1219;
    --blob-1: #101F2C;   /* the lightest spot: contrast is tested against this */
    --blob-2: #0E1A25;
    --blob-3: #111C2C;
    --blob-4: #16171F;

    --glass-1: rgba(24, 32, 42, 0.40);
    --glass-2: rgba(30, 40, 52, 0.88);
    --glass-3: rgba(40, 53, 68, 0.97);
    --solid-1: #19212B;
    --solid-2: #202A36;
    --solid-3: #2A3644;
    --border-glass: rgba(255, 255, 255, 0.06);
    --edge: inset 0 1px 0 rgba(255, 255, 255, 0.10);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.40), 0 10px 28px rgba(0, 0, 0, 0.34), 0 24px 48px rgba(0, 0, 0, 0.26);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.40), 0 16px 36px rgba(0, 0, 0, 0.45), 0 30px 60px rgba(0, 0, 0, 0.30);
    --shadow-pop: 0 28px 80px rgba(0, 0, 0, 0.60);

    --text: #E8EEF4;
    --muted: #A9B8C8;
    --accent: #8DB4F5;
    --accent-hi: #BBD3FA;
    --accent-ink: #0A1B33;
    --accent-soft: rgba(141, 180, 245, 0.16);
    --warm: #E8B866;
    --warm-soft: rgba(232, 184, 102, 0.14);
    --danger: #F59AAB;
    --danger-soft: rgba(245, 154, 171, 0.14);
    --surface: rgba(255, 255, 255, 0.07);
    --surface-strong: rgba(255, 255, 255, 0.13);
    --rule: rgba(255, 255, 255, 0.10);
    --scrim: rgba(0, 0, 0, 0.60);
    --focus: #8DB4F5;

    --code-bg: #0B1219;
    --code-text: #E3EAF2;
    --code-rule: rgba(255, 255, 255, 0.08);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0B1219;
  --blob-1: #101F2C;
  --blob-2: #0E1A25;
  --blob-3: #111C2C;
  --blob-4: #16171F;

  --glass-1: rgba(24, 32, 42, 0.40);
  --glass-2: rgba(30, 40, 52, 0.88);
  --glass-3: rgba(40, 53, 68, 0.97);
  --solid-1: #19212B;
  --solid-2: #202A36;
  --solid-3: #2A3644;
  --border-glass: rgba(255, 255, 255, 0.06);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.40), 0 10px 28px rgba(0, 0, 0, 0.34), 0 24px 48px rgba(0, 0, 0, 0.26);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.40), 0 16px 36px rgba(0, 0, 0, 0.45), 0 30px 60px rgba(0, 0, 0, 0.30);
  --shadow-pop: 0 28px 80px rgba(0, 0, 0, 0.60);

  --text: #E8EEF4;
  --muted: #A9B8C8;
  --accent: #8DB4F5;
  --accent-hi: #BBD3FA;
  --accent-ink: #0A1B33;
  --accent-soft: rgba(141, 180, 245, 0.16);
  --warm: #E8B866;
  --warm-soft: rgba(232, 184, 102, 0.14);
  --danger: #F59AAB;
  --danger-soft: rgba(245, 154, 171, 0.14);
  --surface: rgba(255, 255, 255, 0.07);
  --surface-strong: rgba(255, 255, 255, 0.13);
  --rule: rgba(255, 255, 255, 0.10);
  --scrim: rgba(0, 0, 0, 0.60);
  --focus: #8DB4F5;

  --code-bg: #0B1219;
  --code-text: #E3EAF2;
  --code-rule: rgba(255, 255, 255, 0.08);
}

/* ── Theme-independent tokens ──────────────────────────── */
:root {
  /* Type: 2 families + mono */
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.875rem;  /* 14 */
  --fs-md: 1rem;      /* 16 */
  --fs-lg: 1.25rem;   /* 20 */
  --fs-xl: 1.75rem;   /* 28 */
  --fs-2xl: 2.5rem;   /* 40 */
  --fs-stat: 2.75rem; /* 44: the loudest thing on a stat card */
  --lh-tight: 1.15;
  --lh-body: 1.6;

  /* Space: 4px grid */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Shape: frame 32, card 24, inner 16, pill. No other radii. */
  --r-frame: 2rem;
  --r-card: 1.5rem;
  --r-inner: 1rem;
  --r-pill: 999px;
  --hairline: 1px solid var(--rule);
  --glass-line: 1px solid var(--border-glass);
  --blur: blur(26px) saturate(140%);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 150ms;
  --dur-med: 260ms;
  --dur-slow: 520ms;
  --dur-ring: 900ms;

  /* Layout */
  --rail-w: 5rem;
  --rail-w-wide: 14.5rem;
  --strip-h: 4.5rem;
  --tabbar-h: 4.75rem;
  --tap: 2.875rem; /* 46px: comfortable touch target */
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-med: 0ms; --dur-slow: 0ms; --dur-ring: 0ms; }
  * { scroll-behavior: auto !important; }
}
