/* ═══════════════════════════════════════════
   MODULE 4 — Alive & Active · palette
   ═══════════════════════════════════════════

   Loaded AFTER tokens.css and overrides colour only. Structure, the type
   scale, layout and motion all stay shared — a module is its own world in how
   it looks, not in how it is built.

   THIS MODULE BREAKS THE PATTERN THE OTHER THREE FOLLOW, DELIBERATELY.

   Modules 1 to 3 each tint their GROUND toward their own accent: gold on a
   warm cream (hue 42 on 40), teal on a cool off-white (180 on 165), sage on a
   faint green (140 on 120). Applying that rule here produced a module nobody
   could tell from Module 1, and the measurements said exactly why —

       ground   Module 1  hue  40      Module 4  hue  30      10° apart
       accent   Module 1  hue  42      Module 4  hue  16      26° apart
       ink      Module 1  hue  36      Module 4  hue  18      18° apart

   — because terracotta simply sits near gold on the wheel. Tinting the ground
   toward it made the whole palette a small rotation of Module 1's rather than
   a different room. Modules 2 and 3 are safe from this only because their
   accents are 100°+ away to begin with.

   So the ground goes the OTHER way: a cool neutral stone at hue 210, which is
   170° from Module 1's — the largest separation of any pair in the course. The
   accent stays terracotta, because the platform's own Module 4 card is
   #C76D4A and walking from the card into the module has to keep its colour
   (§7). Warm on cool also carries a temperature contrast that warm on warm
   cannot, so the terracotta reads as the only colour in the room rather than
   as a slightly different brown.

   EVERY VALUE HERE WAS MEASURED, NOT PICKED.
   Light on --paper #f6f7f8: --ink 16.76:1, --ink2 10.73:1, --ink3 6.22:1,
   --gold 5.48:1, --gold2 4.56:1. Dark on --paper #0e1114: 16.70, 12.41, 7.09,
   8.73, 7.19. The sidebar and mind-map figures are below, beside the tokens
   they belong to.

   --gold-ui measures 3.43:1 light and 4.26:1 dark, and --gold3 2.29:1 light.
   Both are DECORATIVE ONLY and neither may ever carry text — the same
   arrangement Modules 1 to 3 use. `--paper` on `--gold` is the pairing that
   holds in both themes; `--ink` on `--gold` does not, which was live across
   every module until it was measured at 1.64:1 (§12.8).

   A NOTE ON THE TOKEN NAMES

   `--gold*` holds terracotta here, and that reads wrong. The names date from
   when there was one module and the accent really was gold. Renaming them to
   `--accent*` is 150 sites across four stylesheets and is the right fix; it is
   still a separate decision rather than something folded into a theme file.
   Until then: `--gold` is "the accent that is safe as text", `--gold-ui` is
   "the decorative accent", regardless of hue.  */

[data-module="4"] {
  /* ── Ink / surface (light) ── cool, and that is the whole point ── */
  --ink:       #14171b;
  --ink2:      #333a42;   /* ALSO the sidebar ground in the light theme */
  /* --ink3 is measured against the DARKEST surface it lands on, not the page.
     At #5f6873 it cleared --paper at 5.27 and the structure lab's plate at
     4.48 — under the floor by two hundredths, on the one surface nobody thinks
     to check. */
  --ink3:      #555d67;   /* 6.22 on --paper, 5.29 on the lab plate */
  --cream:     #eceef1;
  --cream2:    #e2e5ea;
  --cream3:    #d2d7de;

  /* The sidebar is a fixed dark surface in BOTH themes, so these three hold
     one value each and are themed here like everything else. Without the
     override a terracotta module wears Module 1's gold in every hover, focus
     ring and active pill — which is exactly how Module 2 shipped gold once.
     Measured on the sidebar ground #333a42: 5.48:1 and 5.35:1. */

  /* --accent-rgb is the WASH colour, and it is deliberately not the same as
     --gold-on-dark. It is used at 6-16% alpha behind the mind map's centre
     node and its halos, so a LIGHT value lifts that ground and the text on top
     loses contrast: with the light terracotta here the centre node measured
     4.08:1. The mid terracotta lifts it less and brings it to 4.63. The two
     tokens do different jobs and only one of them is ever text. */
  --accent-rgb: 199,109,74;
  --gold-on-dark: #e6a483;
  --ink-on-dark:  #a8b2bd;

  /* ── the mind map's four branch hues ──
     The mind map is a DARK panel in both themes, like the sidebar and the
     formula box, so the page's categorical colours cannot be used on it —
     --rust, --teal and --emerald are calibrated for the page and go invisible
     there (bug #26, §12.7). These four are dark-panel values held constant in
     BOTH themes, because the surface is. Measured: 5.35-6.51:1 on the
     light-theme panel, 9.04-11.01:1 on the dark one. */
  --mm-1: #e6a483;  --mm-2: #8fbd97;  --mm-3: #7cb8dd;  --mm-4: #e0c060;

  /* ── Accents ──
     --gold is text-safe on the stone ground; --gold-ui is decorative only.
     The split is the same one Module 1 makes, and for the same reason: one
     terracotta cannot be both readable as body text and bright enough for a
     rule. */
  --gold:      #a8462a;   /* text-safe terracotta */
  --gold-ui:   #C76D4A;   /* the platform's Module 4 accent, exactly */
  --gold2:     #b85232;
  --gold3:     #d69777;   /* DECORATIVE — 2.29:1, never text */

  /* Categorical, for the dashboard cards. Shifted off the other modules' sets
     so they stay distinguishable beside a terracotta brand accent — a
     card-rust identical to the accent would flatten the grid. */
  --rust:      #8d4a2c;
  --teal:      #26697f;
  --emerald:   #1f6b52;

  /* ── Surfaces ── cool stone, not cream ── */
  --paper:     #f6f7f8;
  --card-bg:   #ffffff;
  --hero-bg:   #eef0f3;
  --main-bg:   #f6f7f8;
  --section-bg:#ffffff;
  --quiz-bg:   #1b2027;

  /* ── Lines / shadow ── cool-tinted to match the ground ── */
  --line:      rgba(20,23,27,0.14);
  --line2:     rgba(20,23,27,0.07);
  --shadow:    0 1px 2px rgba(20,23,27,0.05), 0 4px 14px rgba(20,23,27,0.06);
  --shadow2:   0 4px 12px rgba(20,23,27,0.09), 0 18px 48px rgba(20,23,27,0.13);
}

/* Dark is art-directed, never an inversion: light-on-dark accents need
   RAISING or they sink into the ground. Same rule Modules 1 to 3 follow —
   and the ground stays cool here too, so the module is still recognisable
   after dark rather than becoming another warm near-black. */
[data-theme="dark"][data-module="4"] {
  --ink:       #eef1f4;
  --ink2:      #cbd2d9;
  --ink3:      #93a0ac;   /* AA on dark --paper */
  --cream:     #161a1f;
  --cream2:    #1e242b;
  --cream3:    #2b333c;

  --gold:      #ef9c74;   /* raised for light-on-dark */
  --gold-ui:   #b75f3e;
  --gold2:     #e08a60;
  --gold3:     #f5bb9c;

  --rust:      #e0966f;
  --teal:      #6bb0d1;
  --emerald:   #6cc79c;

  --paper:     #0e1114;
  --card-bg:   #171c22;
  --hero-bg:   #12161a;
  --main-bg:   #0e1114;
  --section-bg:#151a20;
  --quiz-bg:   #090b0e;

  --line:      rgba(238,241,244,0.13);
  --line2:     rgba(238,241,244,0.07);
  --shadow:    0 1px 2px rgba(0,0,0,0.4), 0 4px 14px rgba(0,0,0,0.3);
  --shadow2:   0 4px 12px rgba(0,0,0,0.45), 0 18px 48px rgba(0,0,0,0.55);
}
