/* ============================================================
   tokens.css — design tokens, theming, the tectonic palette
   ============================================================ */

:root {
  /* ---- The boundary palette ----
     One colour per KIND OF PLATE BOUNDARY, used by every map, cross-section,
     legend, chip and button on the page. A student who learns that spreading
     is green on the world map reads the ridge cross-section without being
     told, and spots the same green again on the Philippine map. */
  --b-div: #2ee6a8; /* divergent — plates pulling apart, new crust */
  --b-con: #ff6b5b; /* convergent — plates colliding, crust destroyed */
  --b-tra: #a78bfa; /* transform — plates sliding past, nothing made or lost */

  /* ---- The evidence palette ----
     One colour per FAMILY OF CLUE, used by the evidence map layers, the
     legend, the sorting bins and the summary table. */
  --ev-fit: #7aa2ff; /* the shape of the coastlines */
  --ev-fossil: #ffc145; /* fossils of the same species on two continents */
  --ev-rock: #c084fc; /* matching rocks and mountain belts */
  --ev-climate: #67e8f9; /* ancient ice and ancient coal */

  /* One colour per FOSSIL SPECIES, so four bands can share a map without
     turning into one amber smear. */
  --fo-meso: #ffc145;
  --fo-cyno: #ff8a5b;
  --fo-lystro: #f472b6;
  --fo-gloss: #a3e635;

  /* ---- Earth materials ---- */
  --land: #8fae7a; /* continents on the map */
  --ocean: #1c3b57; /* the sea */
  --crust-c: #d9a566; /* continental crust — thick, light, old */
  --crust-o: #4d6f9a; /* oceanic crust — thin, dense, young */
  --mantle: #b4522f; /* the mantle */
  --astheno: #e08a4a; /* the soft layer the plates ride on */
  --magma: #ffb03a; /* melt rising into a volcano */

  /* ---- Semantic accents ---- */
  --accent: #d2603a;
  --accent-2: #22a699;
  --accent-grad: linear-gradient(120deg, #d2603a, #22a699);
  --ok: #34c759;
  --warn: #ffb020;
  --bad: #ff5d73;

  /* ---- Radii ---- */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ---- Spacing scale ---- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* ---- Type ---- */
  --font: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", ui-monospace, monospace;

  --t-xs: 0.78rem;
  --t-sm: 0.88rem;
  --t-base: 1rem;
  --t-md: 1.09rem;
  --t-lg: 1.35rem;
  --t-xl: 1.75rem;
  --t-2xl: 2.35rem;
  --t-3xl: 3.1rem;

  /* Reading comfort — this is a study tool, not a marketing page */
  --leading: 1.72;
  --measure: 68ch;

  --dur: 260ms;
  --ease: cubic-bezier(0.22, 0.75, 0.28, 1);
}

/* ---------------- DARK (default) ---------------- */
:root,
[data-theme="dark"] {
  --bg: #070c14;
  --bg-2: #0c1220;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-solid: #121a2c;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  --ink: #eaf1fb;
  --ink-2: #b4c1d8;
  --ink-3: #7c89a4;

  --glow: radial-gradient(900px 520px at 10% -10%, rgba(210, 96, 58, 0.26), transparent 62%),
    radial-gradient(760px 480px at 96% 4%, rgba(34, 166, 153, 0.18), transparent 60%),
    radial-gradient(700px 600px at 62% 104%, rgba(122, 162, 255, 0.1), transparent 62%);

  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --grid-line: rgba(255, 255, 255, 0.055);
  --grid-axis: rgba(255, 255, 255, 0.28);
  --plane-bg: rgba(255, 255, 255, 0.03);
}

/* ---------------- LIGHT (paper / study mode) ---------------- */
[data-theme="light"] {
  --bg: #f6f6f2;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1ea;
  --surface-solid: #ffffff;
  --line: rgba(28, 32, 24, 0.12);
  --line-strong: rgba(28, 32, 24, 0.24);

  --ink: #171d1a;
  --ink-2: #45514c;
  --ink-3: #737f78;

  --accent: #b04520;
  --accent-2: #0e7c70;

  /* Every palette above needs darker, more saturated values on white — the
     dark-theme colours wash out completely against paper. */
  --b-div: #0d8a5f;
  --b-con: #d2361f;
  --b-tra: #6d3fd6;

  --ev-fit: #2b53c4;
  --ev-fossil: #9a6100;
  --ev-rock: #7c34c4;
  --ev-climate: #0b7a95;

  --fo-meso: #9a6100;
  --fo-cyno: #c2400f;
  --fo-lystro: #b32a72;
  --fo-gloss: #4b7c0a;

  --land: #b9cda6;
  --ocean: #bcd7e6;
  --crust-c: #c9924a;
  --crust-o: #3d5c85;
  --mantle: #a2431f;
  --astheno: #cf7332;
  --magma: #cc7a00;

  --ok: #17913c;
  --warn: #b57400;
  --bad: #cf2740;

  --glow: radial-gradient(900px 520px at 10% -10%, rgba(210, 96, 58, 0.13), transparent 60%),
    radial-gradient(760px 480px at 96% 4%, rgba(34, 166, 153, 0.14), transparent 58%);

  --shadow: 0 12px 30px rgba(28, 32, 24, 0.09);
  --grid-line: rgba(28, 32, 24, 0.07);
  --grid-axis: rgba(28, 32, 24, 0.4);
  --plane-bg: rgba(28, 32, 24, 0.02);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur: 1ms;
  }
}
