/* ============================================================
   tokens.css — design tokens, theming, and the two palettes this
   lesson runs on.

   There are exactly two colour systems here and they never mix:

   · BY FAMILY   — ten colours, one per group of elements. Used wherever
                   the question is "what kind of element is this".
   · BY BLOCK    — four colours, one per subshell. Used wherever the
                   question is "which subshell is filling here".

   A student who learns that the halogens are cyan in section 11 reads
   the same cyan in the trainer without being told; a student who learns
   that the d block is gold in section 05 sees the same gold on the
   Aufbau ladder in section 04. Introducing a third scheme for one panel
   would quietly undo both.
   ============================================================ */

:root {
  /* ---- The families ---- */
  --cat-alkali: #ff6b6b;
  --cat-alkaline: #ff9d4d;
  --cat-transition: #f6c453;
  --cat-post: #8fa0b8;
  --cat-metalloid: #c5d86d;
  --cat-nonmetal: #43cf7c;
  --cat-halogen: #35c3e0;
  --cat-noble: #7c8cff;
  --cat-lanthanide: #ff8fab;
  --cat-actinide: #c98bff;

  /* ---- The blocks ---- */
  --blk-s: #ff7a7a;
  --blk-p: #4cd7a0;
  --blk-d: #ffc94d;
  --blk-f: #c48cff;

  /* ---- Heat-map ramp ----
     Three stops, not two. A one-hue ramp at different opacities only
     says "more" and "less"; a cool end, a pale middle and a warm end
     lets a student see at a glance that the bottom-left corner and the
     top-right corner are opposite extremes, which is the whole point of
     every map in section 09. */
  --ramp-lo: #3b82f6;
  --ramp-mid: #d8dde6;
  --ramp-hi: #f4593f;

  /* ---- Atom drawing ---- */
  --nucleus: #ff7a5c;
  --shell: rgba(255, 255, 255, 0.22);
  --electron: #6ee7f0;
  --orbital: #a78bfa;
  --pull: #ff6b6b; /* nuclear attraction arrow */
  --shieldc: #7c8cff; /* shielding arrow */

  /* ---- Semantic accents ---- */
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(120deg, #7c5cff, #22d3ee);
  --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: #070a14;
  --bg-2: #0b1020;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-solid: #121829;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  --ink: #eaf0fb;
  --ink-2: #b4c0d8;
  --ink-3: #7d89a4;

  --glow: radial-gradient(900px 520px at 8% -10%, rgba(124, 92, 255, 0.28), transparent 62%),
    radial-gradient(760px 480px at 96% 2%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(720px 620px at 60% 106%, rgba(255, 143, 171, 0.09), 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: #f7f7f4;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef0ee;
  --surface-solid: #ffffff;
  --line: rgba(24, 28, 34, 0.12);
  --line-strong: rgba(24, 28, 34, 0.26);

  --ink: #161a20;
  --ink-2: #454d59;
  --ink-3: #6f7885;

  --accent: #5b34e6;
  --accent-2: #0b7d92;
  --accent-grad: linear-gradient(120deg, #5b34e6, #0b7d92);

  /* Every palette above needs darker, more saturated values on white.
     The dark-theme colours wash out completely against paper, and a heat
     map that washes out is a heat map that lies. */
  --cat-alkali: #d63b3b;
  --cat-alkaline: #c96a00;
  --cat-transition: #a37800;
  --cat-post: #56657b;
  --cat-metalloid: #6f8c15;
  --cat-nonmetal: #128a4a;
  --cat-halogen: #0e7f9c;
  --cat-noble: #4b56cc;
  --cat-lanthanide: #c43c6d;
  --cat-actinide: #8a45c4;

  --blk-s: #d63b3b;
  --blk-p: #10875a;
  --blk-d: #a37800;
  --blk-f: #8a45c4;

  --ramp-lo: #1d5fd4;
  --ramp-mid: #eceadf;
  --ramp-hi: #cf3418;

  --nucleus: #d94a26;
  --shell: rgba(24, 28, 34, 0.2);
  --electron: #0b7d92;
  --orbital: #6d3fd6;
  --pull: #d63b3b;
  --shieldc: #4b56cc;

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

  --glow: radial-gradient(900px 520px at 8% -10%, rgba(124, 92, 255, 0.13), transparent 60%),
    radial-gradient(760px 480px at 96% 2%, rgba(34, 211, 238, 0.13), transparent 58%);

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

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