/* Design tokens — Forest & Amber (handoff source of truth).
   Light ("paper") is the default; dark ("forest") derives from the same base
   hexes via color-mix rather than hardcoding. Modern-browser-only app, so
   color-mix() and nesting are safe. */

:root {
  /* Core brand hexes */
  --c-green: #085041;
  --c-amber: #ba7517;
  --c-paper: #fbfaf6;
  --c-ink: #16241f;
  --c-on-green: #fbfaf6;

  /* Semantic aliases (components reference these) */
  --green: var(--c-green);
  --amber: var(--c-amber);
  --ink: var(--c-ink);
  --on-green: var(--c-on-green);
  --paper: var(--c-paper);

  /* Surfaces & text */
  --bg: var(--c-paper);
  --surface: #ffffff;
  --surface-alt: color-mix(in srgb, #1a140a 4%, var(--c-paper));
  --sub: #5c6660;
  --faint: #9aa49c;
  --line: rgba(8, 80, 65, 0.13);
  --line-strong: rgba(8, 80, 65, 0.22);
  --green-soft: color-mix(in srgb, var(--c-green) 10%, var(--bg));
  --amber-soft: color-mix(in srgb, var(--c-amber) 13%, var(--bg));
  --scrim: rgba(6, 36, 28, 0.42);

  /* Typography */
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  /* Radius */
  --radius: 16px;
  --radius-sm: 12px;   /* radius - 4 */
  --radius-lg: 20px;   /* radius + 4 */
  --radius-xl: 22px;   /* radius + 6 */
  --round: 999px;

  /* Shadows */
  --shadow-card: 0 6px 18px rgba(22, 36, 31, 0.05);
  --shadow-card-hover: 0 18px 40px rgba(22, 36, 31, 0.12);
  --shadow-float: 0 18px 44px rgba(22, 36, 31, 0.08);
  --shadow-sidebar: 0 10px 30px rgba(22, 36, 31, 0.07);
  --shadow-modal: 0 40px 90px rgba(0, 0, 0, 0.4);
  --shadow-btn: 0 8px 22px rgba(8, 80, 65, 0.3);

  /* Layout */
  --container: 1200px;
  --container-pad: clamp(20px, 4vw, 48px);
  --nav-h: 70px;
}

:root[data-theme="dark"] {
  --c-green: color-mix(in srgb, #085041 58%, #ffffff); /* mint */
  --c-amber: color-mix(in srgb, #ba7517 72%, #ffffff);
  --c-ink: #f2f0e8;
  --c-on-green: #06342a;

  --bg: #06342a;
  --surface: color-mix(in srgb, #ffffff 7%, #06342a);
  --surface-alt: color-mix(in srgb, #ffffff 11%, #06342a);
  --sub: rgba(242, 240, 232, 0.64);
  --faint: rgba(242, 240, 232, 0.42);
  --line: rgba(251, 250, 246, 0.14);
  --line-strong: rgba(251, 250, 246, 0.24);
  --green-soft: color-mix(in srgb, var(--c-green) 16%, var(--bg));
  --amber-soft: color-mix(in srgb, var(--c-amber) 18%, var(--bg));
  --scrim: rgba(3, 20, 16, 0.55);

  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 18px 40px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 18px 44px rgba(0, 0, 0, 0.35);
  --shadow-sidebar: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Respect system preference on first visit (the theme controller may override
   and persist an explicit choice). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --c-green: color-mix(in srgb, #085041 58%, #ffffff);
    --c-amber: color-mix(in srgb, #ba7517 72%, #ffffff);
    --c-ink: #f2f0e8;
    --c-on-green: #06342a;
    --bg: #06342a;
    --surface: color-mix(in srgb, #ffffff 7%, #06342a);
    --surface-alt: color-mix(in srgb, #ffffff 11%, #06342a);
    --sub: rgba(242, 240, 232, 0.64);
    --faint: rgba(242, 240, 232, 0.42);
    --line: rgba(251, 250, 246, 0.14);
    --line-strong: rgba(251, 250, 246, 0.24);
    --green-soft: color-mix(in srgb, var(--c-green) 16%, var(--bg));
    --amber-soft: color-mix(in srgb, var(--c-amber) 18%, var(--bg));
    --scrim: rgba(3, 20, 16, 0.55);
  }
}
