/* Design tokens — change a value here and it propagates everywhere. */
:root {
  --accent: oklch(0.62 0.19 255);
  --accent-fg: oklch(0.99 0 0);
  --accent-soft: oklch(0.62 0.19 255 / 0.10);

  /* Course status badges (course.yaml `status:`) — edit hues here. */
  --status-in-progress-fg: var(--accent);
  --status-in-progress-bg: var(--accent-soft);
  --status-not-started-fg: oklch(0.50 0.22 25);
  --status-not-started-bg: oklch(0.60 0.22 25 / 0.08);
  --status-finished-fg: oklch(0.45 0.16 165);
  --status-finished-bg: oklch(0.55 0.16 165 / 0.10);

  --bg: oklch(0.985 0 0);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0 0);
  --fg: oklch(0.20 0 0);
  --fg-strong: oklch(0.10 0 0);
  --muted: oklch(0.50 0 0);
  --border: oklch(0.90 0 0);
  --border-strong: oklch(0.78 0 0);

  --code-bg: oklch(0.96 0 0);
  --code-fg: oklch(0.25 0 0);
  --code-border: oklch(0.90 0 0);

  --kbd-bg: oklch(0.95 0 0);

  --link: var(--accent);
  --link-hover: oklch(0.50 0.20 255);

  --selection-bg: oklch(0.62 0.19 255 / 0.25);

  /* Highlight color for example-style math + prose (\excol macro, .example-text). */
  --excol: oklch(0.55 0.22 305);

  /* Intuition blocks: text-only accent (see .admonition.intuition — no callout bg). */
  --intuition-fg: oklch(0.48 0.14 55);

  /* Admonition (callout) palette - one accent per type, theme-aware.
   * fg = title + accent border, bg = body tint. Adjust here, restyle everywhere. */
  --admon-example-fg:   oklch(0.50 0.22 305);
  --admon-example-bg:   oklch(0.55 0.22 305 / 0.07);

  --admon-note-fg:      oklch(0.50 0.20 255);
  --admon-note-bg:      oklch(0.62 0.19 255 / 0.07);

  --admon-tip-fg:       oklch(0.45 0.16 165);
  --admon-tip-bg:       oklch(0.55 0.16 165 / 0.07);

  --admon-warning-fg:   oklch(0.55 0.16 75);
  --admon-warning-bg:   oklch(0.70 0.16 75 / 0.10);

  --admon-danger-fg:    oklch(0.50 0.22 25);
  --admon-danger-bg:    oklch(0.60 0.22 25 / 0.08);

  --admon-definition-fg: oklch(0.40 0.06 235);
  --admon-definition-bg: oklch(0.55 0.06 235 / 0.07);

  --admon-theorem-fg:   oklch(0.42 0.18 285);
  --admon-theorem-bg:   oklch(0.55 0.18 285 / 0.07);

  /* Chart tokens — hex/rgba on purpose. Plotly and function-plot do not parse
   * `oklch(...)`, so the chart layer cannot consume the same tokens as the
   * rest of the design system. charts.js reads these (and ONLY these).
   *
   * Light theme: bright "data surface" card. Dark theme overrides below in
   * `[data-theme="dark"]` flip the card to a soft dark surface. */
  --chart-fg:      #1d1d1f;
  --chart-muted:   #5e6470;
  /* Lines through x=0 / y=0 — slightly stronger than minor grid, no plot border box. */
  --chart-axis:    rgba(0, 0, 0, 0.26);
  --chart-grid:    rgba(0, 0, 0, 0.10);
  --chart-surface: #f7f8fa;
  --chart-border:  rgba(0, 0, 0, 0.08);

  /* Qualitative 6-color series palette (Vega tableau10-tuned, colorblind-safe).
   * Reads on both the light and dark chart surfaces. */
  --chart-series-1: #4c78a8;
  --chart-series-2: #f58518;
  --chart-series-3: #54a24b;
  --chart-series-4: #e45756;
  --chart-series-5: #b279a2;
  --chart-series-6: #eeca3b;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  /* Display / editorial headings (serif stack — same as prose family). */
  --font-display: var(--font-serif);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs--1: clamp(0.82rem, 0.78rem + 0.18vw, 0.92rem);
  --fs-0:  clamp(0.97rem, 0.93rem + 0.22vw, 1.06rem);
  --fs-1:  clamp(1.15rem, 1.05rem + 0.45vw, 1.35rem);
  --fs-2:  clamp(1.45rem, 1.25rem + 0.95vw, 1.95rem);
  --fs-3:  clamp(1.85rem, 1.45rem + 1.80vw, 2.85rem);
  --fs-4:  clamp(2.30rem, 1.70rem + 2.80vw, 3.80rem);

  --lh-tight: 1.2;
  --lh-snug: 1.4;
  --lh-normal: 1.55;
  --lh-relaxed: 1.7;

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 6rem;

  --measure: 70ch;
  --content-max: 80rem;

  /* Note pages: left TOC width — wider => more room for headings + pushes prose right. */
  --note-sidebar-width: 18rem;

  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.05);
  --shadow-sm: 0 2px 4px oklch(0 0 0 / 0.06), 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-md: 0 8px 24px oklch(0 0 0 / 0.08);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.10), 0 4px 12px oklch(0 0 0 / 0.05);

  /* Bottom vignette on cover-card images (light theme). */
  --card-cover-vignette: linear-gradient(to top, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 55%);

  --transition: 150ms ease;
  --transition-slow: 250ms ease;

  --header-height: 3.5rem;
}

[data-theme="dark"] {
  /* Comfortable dark palette — Sonoma/GitHub Dark Dimmed territory. The page
   * background is intentionally NOT near-black; surfaces are elevated by
   * *raising* lightness (cards lighter than bg) so depth is visible without
   * relying on shadows. Text is soft off-white (no pure #fff) to avoid OLED
   * halation. Cool-blue undertone (hue 255) matches the accent. */
  --accent: oklch(0.74 0.15 255);
  --accent-fg: oklch(0.14 0.005 255);
  --accent-soft: oklch(0.74 0.15 255 / 0.16);

  --status-in-progress-fg: var(--accent);
  --status-in-progress-bg: var(--accent-soft);
  --status-not-started-fg: oklch(0.80 0.18 25);
  --status-not-started-bg: oklch(0.60 0.22 25 / 0.13);
  --status-finished-fg: oklch(0.80 0.14 165);
  --status-finished-bg: oklch(0.55 0.16 165 / 0.13);

  /* Perceptual-neutral neutrals: hue 245, very low chroma. The slight cool
   * whisper compensates for the warm bias most LCD/OLED panels show at low
   * brightness, so the chrome *reads* as pure gray on screen. The accent
   * (hue 255, chroma 0.15) stays blue and unchanged — that contrast is what
   * makes the blue eyebrow / links pop. */
  --bg: oklch(0.215 0.002 245);
  --surface: oklch(0.255 0.002 245);
  --surface-2: oklch(0.295 0.002 245);
  --fg: oklch(0.90 0.002 245);
  --fg-strong: oklch(0.95 0.002 245);
  --muted: oklch(0.66 0.003 245);
  --border: oklch(0.34 0.002 245);
  --border-strong: oklch(0.46 0.002 245);

  --code-bg: oklch(0.265 0.002 245);
  --code-fg: oklch(0.90 0.002 245);
  --code-border: oklch(0.36 0.002 245);

  --kbd-bg: oklch(0.31 0.002 245);

  --link: var(--accent);
  --link-hover: oklch(0.84 0.12 255);

  --selection-bg: oklch(0.74 0.15 255 / 0.32);

  --excol: oklch(0.78 0.18 305);

  --intuition-fg: oklch(0.82 0.12 65);

  --admon-example-fg:    oklch(0.82 0.18 305);
  --admon-example-bg:    oklch(0.55 0.22 305 / 0.14);

  --admon-note-fg:       oklch(0.78 0.16 255);
  --admon-note-bg:       oklch(0.62 0.19 255 / 0.13);

  --admon-tip-fg:        oklch(0.80 0.14 165);
  --admon-tip-bg:        oklch(0.55 0.16 165 / 0.13);

  --admon-warning-fg:    oklch(0.85 0.14 75);
  --admon-warning-bg:    oklch(0.70 0.16 75 / 0.13);

  --admon-danger-fg:     oklch(0.80 0.18 25);
  --admon-danger-bg:     oklch(0.60 0.22 25 / 0.13);

  --admon-definition-fg: oklch(0.85 0.04 235);
  --admon-definition-bg: oklch(0.55 0.06 235 / 0.13);

  --admon-theorem-fg:    oklch(0.82 0.14 285);
  --admon-theorem-bg:    oklch(0.55 0.18 285 / 0.13);

  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-sm: 0 2px 4px oklch(0 0 0 / 0.5), 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 8px 24px oklch(0 0 0 / 0.55);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.55), 0 4px 12px oklch(0 0 0 / 0.30);

  --card-cover-vignette: linear-gradient(to top, rgba(0, 0, 0, 0.40), rgba(0, 0, 0, 0) 55%);

  /* Chart tokens for dark mode — still a notch darker than the page --bg so
   * the chart reads as a distinct "data surface", but no longer near-black
   * (would otherwise look like a hole on the new lighter page bg). Text is
   * a soft gray so titles/tick labels don't compete with the data series. */
  --chart-fg:      #b0b3b8;
  --chart-muted:   #74787e;
  --chart-axis:    rgba(255, 255, 255, 0.30);
  --chart-grid:    rgba(255, 255, 255, 0.14);
  --chart-surface: #181a1d;
  --chart-border:  rgba(255, 255, 255, 0.10);
}
