/* Precise · Measured & Said 2.0 · design tokens. One file.
   :root is light. [data-theme="light"] repeats the light colours so a light surface can sit inside a dark one.
   [data-theme="dark"] overrides them. Themes nest: set data-theme on the page or on any section.
   [data-density="simple" | "advanced"] on any container changes row, control and figure sizes.
   To change a colour: edit :root, mirror it in [data-theme="light"], then the dark override. tokens.json mirrors this file. */
:root {
  color-scheme: light;

  /* Color. Ink is measured and structural. Indigo is forecast and proposed. Accents mark exceptions only. */
  --ground: #f6f5fb;
  --ground-canvas: #e9e8ef;
  --sheet: #ffffff;
  --well: #efedf7;
  --sheet-elevated: #ffffff;
  --row-hover: #f9f8fc;
  --row-selected: #f3f2f9;
  --rule: #d9d6e6;
  --hair: #e6e4ee;
  --hair-faint: #f0eff5;
  --muted: #5f5c72;
  --muted-deep: #3d3b4d;
  --axis: #9d99b3;
  --ghost: #8f8ba6;
  --chart-grid: #d9d6e6;
  --chart-axis: #9d99b3;
  --chart-text: #5f5c72;
  --ink: #14121f;
  --ink-hover: #2b2842;
  --ink-pressed: #000000;
  --ink-line: rgba(20, 18, 31, 0.32);
  --on-ink: #ffffff;
  --said: #5535c9;
  --said-hover: #3f27a3;
  --said-soft: rgba(85, 53, 201, 0.12);
  --said-soft-strong: rgba(85, 53, 201, 0.2);
  --said-line: rgba(85, 53, 201, 0.42);
  --emerald: #0d7a56;
  --amber: #9a5b08;
  --crimson: #9e2a2b;
  --emerald-soft: rgba(13, 122, 86, 0.1);
  --amber-soft: rgba(154, 91, 8, 0.1);
  --crimson-soft: rgba(158, 42, 43, 0.08);
  --selection-bg: rgba(20, 18, 31, 0.12);
  --scrim: rgba(20, 18, 31, 0.18);
  --ink-measured: var(--ink);
  --ink-said: var(--said);
  --text-body: var(--ink);
  --text-explain: var(--muted-deep);
  --text-muted: var(--muted);
  --text-disabled: var(--ghost);
  --text-said: var(--said);
  --surface-ground: var(--ground);
  --surface-sheet: var(--sheet);
  --border-region: var(--rule);
  --border-row: var(--hair);
  --border-staged: var(--said);
  --focus-ring: var(--ink);
  --selection-rail: var(--ink);
  --nav-active: var(--ink);
  --link: var(--ink);
  --link-hover: var(--ink-hover);
  --mark-measured: var(--ink);
  --mark-said: var(--said);
  --band-said: var(--said-soft);
  --mark-miss: var(--muted);
  --mark-modeled: var(--ghost);
  --accent-ahead: var(--emerald);
  --accent-pace-risk: var(--amber);
  --accent-blocked: var(--crimson);

  /* Type. Display: Bricolage Grotesque. UI: Hanken Grotesk. Figures: JetBrains Mono, tabular. */
  --font-display: "Bricolage Grotesque", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-framing: var(--font-display);
  --font-prose: var(--font-ui);
  --font-figure: var(--font-mono);
  --display-weight: 600; /* @kind other */
  --display-tracking: -0.02em;
  --display-leading: 1.12; /* @kind other */
  --text-display-2xl: 72px;
  --text-display-xl: 56px;
  --text-display-lg: 44px;
  --text-display-md: 30px;
  --text-display-sm: 22px;
  --text-display-xs: 18px;
  --text-ui-lg: 17px;
  --text-ui-md: 15.5px;
  --text-ui-sm: 14px;
  --text-ui-xs: 13px;
  --text-label: 12px;
  --text-micro: 11px;
  --leading-ui: 1.5; /* @kind other */
  --leading-caption: 1.45; /* @kind other */
  --leading-tight: 1.3; /* @kind other */
  --text-fig-2xl: 64px;
  --text-fig-xl: 44px;
  --text-fig-lg: 32px;
  --text-fig-md: 15px;
  --text-fig-sm: 13px;
  --text-fig-xs: 12px;
  --text-fig-chart: 11.5px;
  --fig-tracking-lg: -0.03em;
  --figure-numeric: tabular-nums; /* @kind other */
  --text-tag: 10.5px;
  --tag-tracking: 0.06em;
  --label-tracking: 0.06em;
  --weight-regular: 400; /* @kind other */
  --weight-medium: 500; /* @kind other */
  --weight-semibold: 600; /* @kind other */

  /* Space and density (Simple is the default) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 14px;
  --space-5: 20px;
  --space-6: 28px;
  --space-7: 36px;
  --space-8: 48px;
  --space-9: 64px;
  --space-10: 96px;
  --gutter: 32px;
  --page-max: 1400px;
  --thread-max: 860px;
  --prose-max: 62ch;
  --hit-min: 44px;
  --row-h: 44px;
  --row-pad-x: 16px;
  --row-font: 15px;
  --row-fig: 15px;
  --cell-gap: 16px;
  --head-h: 34px;
  --head-font: 11px;
  --control-h: 40px;
  --control-pad-x: 16px;
  --control-font: 15px;
  --figure-display: 44px;
  --sheet-pad: 24px;
  --stack-gap: 20px;

  /* Radii, rules, layers and the one elevation */
  --radius-sheet: 4px;
  --radius-control: 3px;
  --radius-chip: 2px;
  --hairline: 1px;
  --rail-width: 2px;
  --underline-width: 2px;
  --rule-record-width: 2px;
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --z-sticky: 5; /* @kind other */
  --z-popover: 30; /* @kind other */
  --z-drawer: 40; /* @kind other */
  --z-palette: 50; /* @kind other */
  --elevation-1: 0 1px 0 rgba(20, 18, 31, 0.03), 0 12px 24px -8px rgba(20, 18, 31, 0.14), 0 32px 64px -24px rgba(20, 18, 31, 0.2);

  /* Motion. Strong ease-out, under 240ms, press 0.97, enter from 0.95 */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* @kind other */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* @kind other */
  --ease: var(--ease-out); /* @kind other */
  --dur-0: 0ms; /* @kind other */
  --dur-hover: 120ms; /* @kind other */
  --dur-press: 120ms; /* @kind other */
  --dur-popover: 140ms; /* @kind other */
  --dur-exit: 140ms; /* @kind other */
  --dur-enter: 180ms; /* @kind other */
  --dur-drawer: 220ms; /* @kind other */
  --dur-ceiling: 240ms; /* @kind other */
  --dur-state: 120ms; /* @kind other */
  --dur-land: 180ms; /* @kind other */
  --scale-press: 0.97; /* @kind other */
  --scale-enter: 0.95; /* @kind other */

  /* Charts */
  --chart-label-size: 11.5px;
  --chart-axis-width: 1px;
  --chart-measured-width: 2px;
  --chart-said-width: 1.5px;
  --chart-challenger-width: 2.5px;
  --chart-control-width: 1.25px;
  --chart-dot-r: 3.5px;
  --chart-ring-r: 5.5px;
  --chart-ring-width: 1.5px;
  --chart-bar-h: 10px;
  --chart-halo-width: 4px;
  --chart-modeled-dash: 5 4; /* @kind other */
  --chart-staged-dash: 3 2.5; /* @kind other */
}

/* Light, re-declared so a light surface can sit inside a dark one. Generated from :root for every token the dark theme overrides. Keep in step with :root. */
[data-theme="light"] {
  color-scheme: light;
  --ground: #f6f5fb;
  --ground-canvas: #e9e8ef;
  --sheet: #ffffff;
  --well: #efedf7;
  --sheet-elevated: #ffffff;
  --row-hover: #f9f8fc;
  --row-selected: #f3f2f9;
  --rule: #d9d6e6;
  --hair: #e6e4ee;
  --hair-faint: #f0eff5;
  --muted: #5f5c72;
  --muted-deep: #3d3b4d;
  --axis: #9d99b3;
  --ghost: #8f8ba6;
  --chart-grid: #d9d6e6;
  --chart-axis: #9d99b3;
  --chart-text: #5f5c72;
  --ink: #14121f;
  --ink-hover: #2b2842;
  --ink-pressed: #000000;
  --ink-line: rgba(20, 18, 31, 0.32);
  --on-ink: #ffffff;
  --said: #5535c9;
  --said-hover: #3f27a3;
  --said-soft: rgba(85, 53, 201, 0.12);
  --said-soft-strong: rgba(85, 53, 201, 0.2);
  --said-line: rgba(85, 53, 201, 0.42);
  --emerald: #0d7a56;
  --amber: #9a5b08;
  --crimson: #9e2a2b;
  --emerald-soft: rgba(13, 122, 86, 0.1);
  --amber-soft: rgba(154, 91, 8, 0.1);
  --crimson-soft: rgba(158, 42, 43, 0.08);
  --selection-bg: rgba(20, 18, 31, 0.12);
  --scrim: rgba(20, 18, 31, 0.18);
  --ink-measured: var(--ink);
  --ink-said: var(--said);
  --text-body: var(--ink);
  --text-explain: var(--muted-deep);
  --text-muted: var(--muted);
  --text-disabled: var(--ghost);
  --text-said: var(--said);
  --surface-ground: var(--ground);
  --surface-sheet: var(--sheet);
  --border-region: var(--rule);
  --border-row: var(--hair);
  --border-staged: var(--said);
  --focus-ring: var(--ink);
  --selection-rail: var(--ink);
  --nav-active: var(--ink);
  --link: var(--ink);
  --link-hover: var(--ink-hover);
  --mark-measured: var(--ink);
  --mark-said: var(--said);
  --band-said: var(--said-soft);
  --mark-miss: var(--muted);
  --mark-modeled: var(--ghost);
  --accent-ahead: var(--emerald);
  --accent-pace-risk: var(--amber);
  --accent-blocked: var(--crimson);
  --elevation-1: 0 1px 0 rgba(20, 18, 31, 0.03), 0 12px 24px -8px rgba(20, 18, 31, 0.14), 0 32px 64px -24px rgba(20, 18, 31, 0.2);
}

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

  /* Color */
  --ground: #0e0c17;
  --ground-canvas: #08070d;
  --sheet: #161324;
  --well: #1a1728;
  --sheet-elevated: #221e35;
  --row-hover: #1b182b;
  --row-selected: #211d33;
  --rule: #464066;
  --hair: #322d4a;
  --hair-faint: #1c192d;
  --muted: #9c97b3;
  --muted-deep: #c5c1d8;
  --axis: #5f5a7a;
  --ghost: #6f6a8a;
  --chart-grid: #5f5a7a;
  --chart-axis: #7d7799;
  --chart-text: #9c97b3;
  --ink: #f4f3fa;
  --ink-hover: #dcd9e9;
  --ink-pressed: #ffffff;
  --ink-line: rgba(244, 243, 250, 0.34);
  --on-ink: #0e0c17;
  --said: #a38cf8;
  --said-hover: #bcaafb;
  --said-soft: rgba(163, 140, 248, 0.16);
  --said-soft-strong: rgba(163, 140, 248, 0.26);
  --said-line: rgba(163, 140, 248, 0.5);
  --emerald: #34d399;
  --amber: #fbbf24;
  --crimson: #f87171;
  --emerald-soft: rgba(52, 211, 153, 0.12);
  --amber-soft: rgba(251, 191, 36, 0.12);
  --crimson-soft: rgba(248, 113, 113, 0.12);
  --selection-bg: rgba(244, 243, 250, 0.16);
  --scrim: rgba(4, 3, 9, 0.62);

  /* Semantic aliases, re-resolved for this theme */
  --ink-measured: var(--ink);
  --ink-said: var(--said);
  --text-body: var(--ink);
  --text-explain: var(--muted-deep);
  --text-muted: var(--muted);
  --text-disabled: var(--ghost);
  --text-said: var(--said);
  --surface-ground: var(--ground);
  --surface-sheet: var(--sheet);
  --border-region: var(--rule);
  --border-row: var(--hair);
  --border-staged: var(--said);
  --focus-ring: var(--ink);
  --selection-rail: var(--ink);
  --nav-active: var(--ink);
  --link: var(--ink);
  --link-hover: var(--ink-hover);
  --mark-measured: var(--ink);
  --mark-said: var(--said);
  --band-said: var(--said-soft);
  --mark-miss: var(--muted);
  --mark-modeled: var(--ghost);
  --accent-ahead: var(--emerald);
  --accent-pace-risk: var(--amber);
  --accent-blocked: var(--crimson);

  /* Elevation */
  --elevation-1: 0 12px 24px -8px rgba(0, 0, 0, 0.55), 0 32px 64px -24px rgba(0, 0, 0, 0.7);
}

[data-density="simple"] {
  --row-h: 44px;
  --row-pad-x: 16px;
  --row-font: 15px;
  --row-fig: 15px;
  --cell-gap: 16px;
  --head-h: 34px;
  --head-font: 11px;
  --control-h: 40px;
  --control-pad-x: 16px;
  --control-font: 15px;
  --figure-display: 44px;
  --sheet-pad: 24px;
  --stack-gap: 20px;
}

[data-density="advanced"] {
  --row-h: 28px;
  --row-pad-x: 10px;
  --row-font: 13px;
  --row-fig: 12.5px;
  --cell-gap: 12px;
  --head-h: 26px;
  --head-font: 10.5px;
  --control-h: 28px;
  --control-pad-x: 10px;
  --control-font: 13px;
  --figure-display: 28px;
  --sheet-pad: 14px;
  --stack-gap: 12px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-press: 0ms; /* @kind other */
    --dur-popover: 0ms; /* @kind other */
    --dur-exit: 0ms; /* @kind other */
    --dur-enter: 0ms; /* @kind other */
    --dur-drawer: 0ms; /* @kind other */
    --dur-land: 0ms; /* @kind other */
    --scale-press: 1; /* @kind other */
    --scale-enter: 1; /* @kind other */
  }
}
