/* Chemistry Atlas — design tokens. Light is the default; [data-theme="dark"] overrides.
   Chapter authors: use these variables (never raw colours) in any inline style; sims use simkit palette(). */

/* Canvas text: Greek letters from the (vendored) KaTeX maths fonts, so α, π, ν, ω never look like a, n, v, w
   (the UI font's geometric Greek does). Lowercase Greek is italic as in maths, except μ (also the micro
   prefix, which must stay upright); capitals (Δ, Ω, Σ) upright.
   Used first in simkit palette().font(); other characters fall through to the UI font. */
@font-face { font-family: "Atlas Greek"; font-style: normal; font-weight: 100 600; src: url("../vendor/katex/fonts/KaTeX_Math-Italic.woff2") format("woff2"); unicode-range: U+03B1-03BB, U+03BD-03C9, U+03D1, U+03D5, U+03F5; }
@font-face { font-family: "Atlas Greek"; font-style: normal; font-weight: 650 900; src: url("../vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2") format("woff2"); unicode-range: U+03B1-03BB, U+03BD-03C9, U+03D1, U+03D5, U+03F5; }
@font-face { font-family: "Atlas Greek"; font-style: normal; font-weight: 100 600; src: url("../vendor/katex/fonts/KaTeX_Main-Regular.woff2") format("woff2"); unicode-range: U+0391-03A9; }
@font-face { font-family: "Atlas Greek"; font-style: normal; font-weight: 650 900; src: url("../vendor/katex/fonts/KaTeX_Main-Bold.woff2") format("woff2"); unicode-range: U+0391-03A9; }
:root {
  /* type */
  --font-prose: Charter, "Bitstream Charter", "Sitka Text", "Iowan Old Style", Cambria, Georgia, serif;
  --font-ui: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-0: 0.8125rem;  /* small UI */
  --fs-1: 0.9375rem;  /* UI */
  --fs-2: 1.0625rem;  /* prose */
  --fs-3: 1.25rem;
  --fs-4: 1.6rem;
  --fs-5: 2.15rem;
  --lh-prose: 1.68;

  /* space & shape */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;
  --radius-s: 6px; --radius: 10px; --radius-l: 16px;
  --measure: 46rem;      /* prose column */
  --wide: 60rem;         /* sims, labs */
  --sidebar: 296px;
  --topbar: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* colour — light ("paper") */
  --bg: #f5f3ed;
  --surface: #fffdf8;
  --raised: #ffffff;
  --sunken: #eeebe3;
  --ink: #1e2329;
  --ink-2: #444c56;
  --muted: #636b77;   /* ≥ 4.5:1 on --bg and --surface */
  --line: #e2ddd1;
  --line-strong: #cbc4b4;
  --accent: #1d6b73;          /* deep teal */
  --accent-2: #144f55;
  --accent-soft: #dcefee;
  --on-accent: #ffffff;
  --focus: #e0a526;
  --good: #24835a; --good-soft: #e1f3e9;
  --bad: #c03c4f;  --bad-soft: #fbe6e8;
  --warn: #946010;   /* ≥ 4.5:1 as text */ --warn-soft: #fbf0d9;
  --shadow-1: 0 1px 2px rgba(40, 32, 16, .06), 0 1px 1px rgba(40, 32, 16, .04);
  --shadow-2: 0 6px 24px -8px rgba(40, 32, 16, .18), 0 2px 6px rgba(40, 32, 16, .06);

  /* units: Structure S1–S3 are cool hues (blue, bluish green, violet), Reactivity R1–R3 warm hues
     (vermilion, reddish purple, ochre) — based on the Okabe–Ito colour-blind-safe set, darkened to ≥ 4.5:1 on --bg. */
  --unit-S1: #1f5fa8; --unit-S1-soft: #e2ecf8;
  --unit-S2: #0b7a6c; --unit-S2-soft: #dcf1ec;
  --unit-S3: #6a4fb5; --unit-S3-soft: #ebe6f8;
  --unit-R1: #b8501a; --unit-R1-soft: #f8e6db;
  --unit-R2: #a3336d; --unit-R2-soft: #f6e2ec;
  --unit-R3: #876500; --unit-R3-soft: #f5edd5;
  --group-structure: #2a5d8f; --group-reactivity: #a4482a;
  --hl: #b13e5c; --hl-soft: #f7e3e8;
  --unit: var(--accent); --unit-soft: var(--accent-soft);

  /* callouts */
  --c-key: #1d6b73;     --c-key-soft: #e1f1f0;
  --c-exam: #a8681a;    --c-exam-soft: #fbf1df;
  --c-context: #2f6db5; --c-context-soft: #e5eef9;
  --c-nos: #2a8259;     --c-nos-soft: #e2f2e9;
  --c-tok: #6650b0;     --c-tok-soft: #eeeafa;
  --c-link: #6c7480;    --c-link-soft: #efede7;
  --c-warn: #c03c4f;    --c-warn-soft: #fbe8ea;
  --c-im: #0b7a6c;      --c-im-soft: #dff2ee;
  --c-safety: #8f5d00;  --c-safety-soft: #fcefcf;

  /* simkit palette (read by lib/simkit/palette.js) */
  --sk-bg: #fbfaf6;
  --sk-surface: #fffefb;
  --sk-ink: #1e2329;
  --sk-muted: #5f6873;
  --sk-faint: #a9afb6;
  --sk-grid: #ebe7dd;
  --sk-axis: #59626d;
  --sk-accent: #1d6b73;
  --sk-good: #24835a; --sk-bad: #c03c4f; --sk-warn: #c7861f;
  --sk-fill: rgba(29, 107, 115, .13);
  --sk-c1: #2a6fdb; --sk-c2: #e07a1f; --sk-c3: #24935f; --sk-c4: #c2417a; --sk-c5: #7a5cc7; --sk-c6: #8a7a2a;
  --sk-sum: #1e2329;
  --sk-pos: #d1495b; --sk-neg: #2a6fdb; --sk-field: #7a5cc7;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #11151a;
  --surface: #171c22;
  --raised: #1d232a;
  --sunken: #0d1014;
  --ink: #e7e4dd;
  --ink-2: #bfc4ca;
  --muted: #8d959e;
  --line: #29313a;
  --line-strong: #3a444f;
  --accent: #5bb5bb;
  --accent-2: #86cdd1;
  --accent-soft: #173538;
  --on-accent: #0b1a1c;
  --focus: #f2c14e;
  --good: #5cc796; --good-soft: #15302a;
  --bad: #f07a8a;  --bad-soft: #3a1c22;
  --warn: #e8b552; --warn-soft: #382c14;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 10px 30px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);

  --unit-S1: #74a9ec; --unit-S1-soft: #162536;
  --unit-S2: #4fc4b0; --unit-S2-soft: #12302b;
  --unit-S3: #ab98f0; --unit-S3-soft: #241f3a;
  --unit-R1: #f08f58; --unit-R1-soft: #35221a;
  --unit-R2: #e985b8; --unit-R2-soft: #361c2a;
  --unit-R3: #dbb64e; --unit-R3-soft: #302814;
  --group-structure: #8db8e6; --group-reactivity: #ee9a78;
  --hl: #ea8098; --hl-soft: #371c25;

  --c-key: #5bb5bb;     --c-key-soft: #14292b;
  --c-exam: #e3ad5a;    --c-exam-soft: #2c2415;
  --c-context: #74a6e6; --c-context-soft: #16212f;
  --c-nos: #66c495;     --c-nos-soft: #142821;
  --c-tok: #a593ea;     --c-tok-soft: #1f1b33;
  --c-link: #a3abb4;    --c-link-soft: #1d2329;
  --c-warn: #f07a8a;    --c-warn-soft: #301a1f;
  --c-im: #4fc4b0;      --c-im-soft: #12302b;
  --c-safety: #f0c04a;  --c-safety-soft: #33280f;

  --sk-bg: #141920;
  --sk-surface: #161b21;
  --sk-ink: #e7e4dd;
  --sk-muted: #9aa2ab;
  --sk-faint: #4f5862;
  --sk-grid: #232a32;
  --sk-axis: #8d959e;
  --sk-accent: #5bb5bb;
  --sk-good: #5cc796; --sk-bad: #f07a8a; --sk-warn: #e8b552;
  --sk-fill: rgba(91, 181, 187, .16);
  --sk-c1: #6ea8ff; --sk-c2: #ffa257; --sk-c3: #5cd39a; --sk-c4: #f37fb0; --sk-c5: #b49cff; --sk-c6: #d6c56a;
  --sk-sum: #f2efe8;
  --sk-pos: #ff7b8c; --sk-neg: #6ea8ff; --sk-field: #b49cff;

  color-scheme: dark;
}

[data-unit="S1"] { --unit: var(--unit-S1); --unit-soft: var(--unit-S1-soft); }
[data-unit="S2"] { --unit: var(--unit-S2); --unit-soft: var(--unit-S2-soft); }
[data-unit="S3"] { --unit: var(--unit-S3); --unit-soft: var(--unit-S3-soft); }
[data-unit="R1"] { --unit: var(--unit-R1); --unit-soft: var(--unit-R1-soft); }
[data-unit="R2"] { --unit: var(--unit-R2); --unit-soft: var(--unit-R2-soft); }
[data-unit="R3"] { --unit: var(--unit-R3); --unit-soft: var(--unit-R3-soft); }
