/* StatsRaven design tokens. The rules behind every value are in docs/design/site-guideline.md.
   Pages and components use the role tokens (--bg, --fg, --s-*, --t-*), never the ramps directly. */

:root {
  /* Neutral ramp: mist (cool green grey) at the light end, raven (blue black) at the dark end. */
  --n-0: oklch(98.5% 0.004 165);
  --n-50: oklch(95.5% 0.007 165);
  --n-100: oklch(92.5% 0.006 165);
  --n-200: oklch(88% 0.008 165);
  --n-300: oklch(82.5% 0.011 165);
  --n-400: oklch(76% 0.012 165);
  --n-500: oklch(62% 0.012 170);
  --n-600: oklch(49% 0.012 170);
  --n-700: oklch(38% 0.012 165);
  --n-750: oklch(31% 0.01 220);
  --n-800: oklch(27% 0.01 220);
  --n-850: oklch(23% 0.009 220);
  --n-900: oklch(19% 0.008 220);
  --n-950: oklch(16.5% 0.008 220);
  --n-1000: oklch(14% 0.006 250);

  /* Eye: the raven's amber eye. The one warm colour, kept for action and for the single thing that matters. */
  --eye-100: oklch(94% 0.06 86);
  --eye-300: oklch(87% 0.12 85);
  --eye-500: oklch(81% 0.16 82);
  --eye-600: oklch(73% 0.155 76);
  --eye-700: oklch(66% 0.15 68);
  --eye-800: oklch(52% 0.11 68);
  --eye-900: oklch(30% 0.05 80);

  /* Sheen: the blue on a raven's feathers, and the complement of the amber eye. The one strong second colour: a few whole bands
     and the questions you can ask. Never a data series, never text on mist. */
  --sheen-200: oklch(86% 0.05 276);
  --sheen-400: oklch(54% 0.22 276);
  --sheen-500: oklch(44% 0.22 276);
  --sheen-700: oklch(34% 0.17 276);

  /* Data series, shared with the app (web/src/styles.css), so charts on the site and in screenshots match. */
  --d1: #0278e7; --d2: #d71481; --d3: #008679; --d4: #e23726; --d5: #8b46df; --d6: #408500;
  --good: oklch(46% 0.12 160);
  --bad: oklch(45% 0.15 28);

  /* Type */
  --display: "League Gothic", "Arial Narrow", Impact, sans-serif;
  --text: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;
  /* Display steps are fluid; text steps are fixed so reading sizes never drift. */
  --t-hero: min(12.1vw, 25vh);
  --t-d1: clamp(3.5rem, 8vw, 8.5rem);
  --t-d2: min(clamp(3rem, 5.4vw, 5.75rem), 11vh);
  --t-d3: clamp(2rem, 3.4vw, 3.5rem);
  --t-d4: clamp(1.75rem, 2.5vw, 2.5rem);
  --t-lead: clamp(1.1875rem, 1.45vw, 1.375rem);
  --t-body: 1.0625rem;
  --t-small: 0.9375rem;
  --t-micro: 0.8125rem;
  --lh-display: 0.92;
  --lh-tight: 1.25;
  --lh-text: 1.55;
  --measure: 34em;

  /* Space: one 4px based scale. Sections and blocks use the fluid steps. */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
  --s-block: clamp(32px, 4.5vw, 64px);
  --s-section: clamp(88px, 11vw, 176px);
  --edge: clamp(20px, 3.4vw, 56px);
  --gutter: clamp(16px, 2vw, 32px);
  --page: 1600px;

  /* Shape. Type, buttons and inputs are square. Only the real product gets corners, so a rounded frame always means "this is the app". */
  --r-0: 0;
  --r-frame: 10px;
  --branch: 6px;
  --rule: 2px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 0.84, 0.24, 1);
  --ease-move: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
  --dur-med: 240ms;
  --dur-slow: 700ms;
  /* Something arrives (a menu, an answer opening) and goes, always quicker than it came. Same as the app. */
  --dur-arrive: 180ms;
  --dur-leave: 130ms;

  /* Roles, light */
  --bg: var(--n-100);
  --fg: var(--n-1000);
  --muted: var(--n-700);
  /* Raised surfaces are paper, a clear step above the mist, so a box on the page reads as a sheet and never as a smudge. */
  --surface: var(--n-0);
  --sunk: var(--n-200);
  --line: var(--n-400);
  --ink-bg: var(--n-1000);
  --ink-fg: var(--n-200);
  --ink-muted: var(--n-400);
  --prompt: var(--n-700);
  --ink-prompt: var(--eye-500);
  --ink-line: var(--n-800);
  --ink-surface: var(--n-900);
  --signal-bg: var(--eye-500);
  --signal-fg: var(--n-1000);
  --sheen-bg: var(--sheen-500);
  --sheen-fg: var(--n-0);
  --sheen-muted: var(--sheen-200);
  --sheen-line: var(--sheen-700);
  --ask-bg: var(--sheen-500);
  --ask-fg: var(--n-0);
  --accent: var(--eye-500);
  --on-accent: var(--n-1000);
  --dot: var(--eye-700);
  --link: var(--n-1000);
  --focus: var(--n-1000);
  --frame-shadow: 0 1px 0 oklch(14% 0.006 250 / 0.08), 0 24px 60px -24px oklch(14% 0.006 250 / 0.45);
  /* Docs: code panels stay dark in both themes, so one set of syntax colours serves both. Amber marks what you replace. */
  --code-bg: var(--n-1000);
  --code-bar: var(--n-950);
  --code-fg: var(--n-100);
  --code-muted: var(--n-400);
  --code-line: var(--n-800);
  --code-hover: var(--n-850);
  --sx-key: oklch(79% 0.1 235);
  --sx-str: oklch(82% 0.12 152);
  --sx-num: oklch(81% 0.1 40);
  --sx-kw: oklch(79% 0.11 300);
  --sx-com: var(--n-400);
  --sx-ph: var(--eye-500);
  --chip-bg: var(--n-100);
  --chip-fg: var(--n-1000);
  --chip-line: var(--n-300);
  --link-line: var(--eye-700);
  color-scheme: light;
}

:root.paper {
  /* Reading pages (docs, blog, changelog, legal) sit on paper, not mist. Long text needs the brightest page the eye can rest on:
     a brighter page narrows the pupil, which sharpens type and tires the eye less. See "Long text" in docs/design/site-guideline.md.
     Light only: the dark blocks below come later and win. */
  --bg: var(--n-0);
  --sunk: var(--n-100);
  --paper-edge: var(--line);
}

:root[data-theme="dark"], .theme-dark {
  --bg: var(--n-900);
  --paper-edge: transparent;
  --focus: var(--eye-500);
  --fg: var(--n-200);
  --muted: var(--n-400);
  --surface: var(--n-850);
  --sunk: var(--n-950);
  --line: var(--n-750);
  --ink-bg: var(--n-200);
  --ink-fg: var(--n-1000);
  --ink-muted: var(--n-700);
  --prompt: var(--eye-500);
  --ink-prompt: var(--n-700);
  --ink-line: var(--n-400);
  --ink-surface: var(--n-300);
  --dot: var(--eye-500);
  --link: var(--n-200);
  --frame-shadow: 0 1px 0 oklch(0% 0 0 / 0.3), 0 24px 60px -24px oklch(0% 0 0 / 0.7);
  --d1: #42a3fd; --d2: #f462a4; --d3: #1dcbbc; --d4: #fa6a57; --d5: #b082f7; --d6: #7fc851;
  --good: oklch(76% 0.12 160);
  --bad: oklch(75% 0.14 30);
  --code-line: var(--n-750);
  --code-bar: var(--n-950);
  --chip-bg: var(--n-800);
  --chip-fg: var(--n-100);
  --chip-line: var(--n-750);
  --link-line: var(--eye-500);
  --ask-bg: var(--sheen-400);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--n-900);
  --paper-edge: transparent;
    --focus: var(--eye-500);
    --fg: var(--n-200);
    --muted: var(--n-400);
    --surface: var(--n-850);
    --sunk: var(--n-950);
    --line: var(--n-750);
    --ink-bg: var(--n-200);
    --ink-fg: var(--n-1000);
    --ink-muted: var(--n-700);
    --prompt: var(--eye-500);
    --ink-prompt: var(--n-700);
    --ink-line: var(--n-400);
    --ink-surface: var(--n-300);
    --dot: var(--eye-500);
    --link: var(--n-200);
    --frame-shadow: 0 1px 0 oklch(0% 0 0 / 0.3), 0 24px 60px -24px oklch(0% 0 0 / 0.7);
    --d1: #42a3fd; --d2: #f462a4; --d3: #1dcbbc; --d4: #fa6a57; --d5: #b082f7; --d6: #7fc851;
    --good: oklch(76% 0.12 160);
    --bad: oklch(75% 0.14 30);
    --code-line: var(--n-750);
    --code-bar: var(--n-950);
    --chip-bg: var(--n-800);
    --chip-fg: var(--n-100);
    --chip-line: var(--n-750);
    --link-line: var(--eye-500);
    --ask-bg: var(--sheen-400);
    color-scheme: dark;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-med: 0ms; --dur-slow: 0ms; --dur-arrive: 0ms; --dur-leave: 0ms; }
}
