/* ==========================================================================
   Tokens: type, space, motion, colour.
   Dark is the default theme; light via [data-theme="light"]; print is
   always light (see the @media print block at the bottom).
   ========================================================================== */

:root {
  /* ---- Type families ---- */
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-text: "Reddit Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---- Type scale (text ratio ~1.25, display fluid) ---- */
  --fs-xs: 0.75rem;                                        /* 12  labels */
  --fs-sm: 0.875rem;                                       /* 14  meta, tables */
  --fs-md: 1.0625rem;                                      /* 17  body */
  --fs-lg: 1.3125rem;                                      /* 21  lead */
  --fs-xl: clamp(1.5rem, 1.15rem + 1.1vw, 1.9rem);         /* 24 to 30 */
  --fs-2xl: clamp(2.1rem, 1.3rem + 3vw, 3.6rem);           /* 34 to 58 */
  --fs-3xl: clamp(2.75rem, 1.6rem + 5vw, 5.75rem);         /* 44 to 92 */

  --lh-tight: 0.92;
  --lh-snug: 1.15;
  --lh-body: 1.6;              /* +0.05 for light-on-dark set per theme */

  --track-label: 0.08em;
  --track-display: -0.02em;

  /* ---- Space (4pt) ---- */
  --space-3xs: 0.25rem;  /* 4 */
  --space-2xs: 0.5rem;   /* 8 */
  --space-xs: 0.75rem;   /* 12 */
  --space-sm: 1rem;      /* 16 */
  --space-md: 1.5rem;    /* 24 */
  --space-lg: 2rem;      /* 32 */
  --space-xl: 3rem;      /* 48 */
  --space-2xl: 4rem;     /* 64 */
  --space-3xl: 6rem;     /* 96 */

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 3rem);
  --section-gap: clamp(6rem, 12vw, 11rem);
  --rail-width: 13.5rem;
  --content-max: 75rem;
  --measure: 66ch;

  /* ---- Shape ---- */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --hairline: 1px;

  /* ---- Motion ---- */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 160ms;
  --dur-2: 320ms;
  --dur-3: 640ms;
  --dur-4: 1100ms;

  /* ---- Layers ---- */
  --z-rail: 10;
  --z-sticky: 20;
  --z-tip: 50;

  /* ---- Accent (overridable from REPORT_DATA.meta.accent) ---- */
  --accent-base: oklch(0.66 0.235 35);
}

/* ---- Dark (default) ---- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.145 0.006 50);
  --surface-1: oklch(0.185 0.007 50);
  --surface-2: oklch(0.225 0.008 50);
  --surface-3: oklch(0.265 0.009 50);
  --line: oklch(0.29 0.008 50);
  --line-soft: oklch(0.235 0.007 50);
  --line-strong: oklch(0.4 0.01 55);

  --text: oklch(0.96 0.008 75);
  --text-2: oklch(0.78 0.012 70);
  --text-3: oklch(0.63 0.012 65);   /* >= 5:1 on bg, >= 4.7:1 on surface-2 */

  --accent: var(--accent-base);
  --accent-text: color-mix(in oklch, var(--accent-base) 82%, oklch(0.96 0.008 75));
  --accent-wash: color-mix(in oklch, var(--accent-base) 13%, transparent);
  --accent-wash-strong: color-mix(in oklch, var(--accent-base) 22%, transparent);

  --live: oklch(0.8 0.17 150);
  --live-wash: oklch(0.8 0.17 150 / 0.14);

  /* Chart neutrals: hi = most prominent, lo = closest to the background */
  --bone-hi: oklch(0.84 0.03 75);
  --bone-mid: oklch(0.66 0.025 70);
  --bone-lo: oklch(0.48 0.02 65);
  --bar-track: oklch(0.21 0.007 50);
  --grid: oklch(0.255 0.007 50);

  --mark-disc: oklch(0.96 0.008 75);
  --mark-glyph: oklch(0.145 0.006 50);

  --serp-page: oklch(0.2 0.007 50);
  --serp-ink: oklch(0.42 0.01 60);
  --serp-ink-soft: oklch(0.3 0.008 55);

  --shadow-pop: 0 1px 0 oklch(0.96 0.008 75 / 0.05) inset, 0 18px 40px -12px oklch(0.05 0.01 50 / 0.7);
  --lh-body-theme: calc(var(--lh-body) + 0.05);
  --hover-wash: oklch(0.96 0.008 75 / 0.045);
}

/* ---- Light ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: oklch(0.975 0.006 75);
  --surface-1: oklch(0.955 0.008 75);
  --surface-2: oklch(0.93 0.01 75);
  --surface-3: oklch(0.905 0.011 75);
  --line: oklch(0.885 0.01 70);
  --line-soft: oklch(0.925 0.008 72);
  --line-strong: oklch(0.78 0.012 65);

  --text: oklch(0.2 0.012 50);
  --text-2: oklch(0.42 0.014 55);
  --text-3: oklch(0.5 0.014 60);    /* >= 5.4:1 on paper */

  --accent: color-mix(in oklch, var(--accent-base) 90%, oklch(0.3 0.1 35));
  --accent-text: color-mix(in oklch, var(--accent-base) 74%, oklch(0.25 0.08 35));
  --accent-wash: color-mix(in oklch, var(--accent-base) 10%, transparent);
  --accent-wash-strong: color-mix(in oklch, var(--accent-base) 16%, transparent);

  --live: oklch(0.58 0.15 150);
  --live-wash: oklch(0.58 0.15 150 / 0.12);

  --bone-hi: oklch(0.42 0.02 60);
  --bone-mid: oklch(0.58 0.025 65);
  --bone-lo: oklch(0.72 0.025 70);
  --bar-track: oklch(0.935 0.009 75);
  --grid: oklch(0.91 0.009 72);

  --mark-disc: oklch(0.2 0.012 50);
  --mark-glyph: oklch(0.975 0.006 75);

  --serp-page: oklch(0.99 0.004 75);
  --serp-ink: oklch(0.8 0.01 70);
  --serp-ink-soft: oklch(0.9 0.008 72);

  --shadow-pop: 0 1px 2px oklch(0.3 0.02 50 / 0.06), 0 18px 40px -16px oklch(0.3 0.03 50 / 0.22);
  --lh-body-theme: var(--lh-body);
  --hover-wash: oklch(0.2 0.012 50 / 0.04);
}

/* ---- Print: always light ---- */
@media print {
  :root,
  :root[data-theme] {
    color-scheme: light;
    --bg: oklch(0.995 0.003 75);
    --surface-1: oklch(0.97 0.006 75);
    --surface-2: oklch(0.94 0.008 75);
    --surface-3: oklch(0.91 0.01 75);
    --line: oklch(0.86 0.01 70);
    --line-soft: oklch(0.92 0.008 72);
    --line-strong: oklch(0.72 0.012 65);
    --text: oklch(0.18 0.012 50);
    --text-2: oklch(0.38 0.014 55);
    --text-3: oklch(0.48 0.014 60);
    --accent: color-mix(in oklch, var(--accent-base) 90%, oklch(0.3 0.1 35));
    --accent-text: color-mix(in oklch, var(--accent-base) 74%, oklch(0.25 0.08 35));
    --accent-wash: color-mix(in oklch, var(--accent-base) 12%, transparent);
    --accent-wash-strong: color-mix(in oklch, var(--accent-base) 18%, transparent);
    --live: oklch(0.55 0.15 150);
    --live-wash: oklch(0.55 0.15 150 / 0.12);
    --bone-hi: oklch(0.42 0.02 60);
    --bone-mid: oklch(0.58 0.025 65);
    --bone-lo: oklch(0.72 0.025 70);
    --bar-track: oklch(0.94 0.008 75);
    --grid: oklch(0.9 0.009 72);
    --mark-disc: oklch(0.18 0.012 50);
    --mark-glyph: oklch(0.99 0.004 75);
    --serp-page: oklch(0.99 0.004 75);
    --serp-ink: oklch(0.8 0.01 70);
    --serp-ink-soft: oklch(0.9 0.008 72);
    --shadow-pop: none;
    --lh-body-theme: 1.5;
    --hover-wash: transparent;
  }
}
