/* ═══════════════════════════════════════════════════════════════════════════
   !HouseStyle — the Lukeatron token layer.

   THE GROUND CONTRACT (the one rule to read before anything else)
     :root is LIGHT, and this app has no dark override (app-decisions.md,
     Rule exceptions). Never a `:root.light` override class — that inverts the
     base and makes paper the exception, which breaks print.

     Why light is the base: paper is always light. A light :root makes the print
     path the BASE path — no inversion, no ink substitution, nothing to undo.
     Full reasoning in reference/aesthetic.md, "The ground contract".

   NAMING
     --bg / --ink / --line / --acc are not invented here. Four of Lukeatron's five
     existing token layers already use them; this file ratifies the majority rather
     than adding a sixth dialect. wiki-page.css is the one dissenter and is EXEMPT.

   TYPE SCALE — GRANDFATHERED, NOT ENDORSED
     The values below are lifted verbatim from wiki-page.css so the two never drift.
     The scale is NOT modular: --t-h3 (1.02rem) is SMALLER than --t-body (1.0625rem),
     so an h3 renders smaller than body text. That is a real defect. It is inherited
     deliberately — wiki-page.css is a Key Template and fixing it is its own gated
     job. Do not "correct" this silently; do not read it as drift.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── ground-relative: ground and surfaces ─────────────────────────────── */
  --bg:          #F7F6F1;   /* warm off-white. Never pure white */
  --bg-sunk:     #EFEEE7;   /* recessed: wells, code blocks, table stripes */
  --bg-raised:   #FFFFFF;   /* raised: cards, popovers, the one content plane */

  /* ── ground-relative: ink ─────────────────────────────────────────────── */
  --ink:         #16130D;   /* primary text. Never pure black */
  --ink-2:       #5F5E5A;   /* secondary: labels, meta, table headers */
  --ink-3:       #6F6D63;   /* tertiary: placeholders, counts, footers.
                               4.80:1 on --bg — WCAG 1.4.3 floor is 4.5:1 and
                               placeholders are real text. The warmer #8A887F
                               measured 3.28:1 and was rejected. */

  /* ── ground-relative: rules ───────────────────────────────────────────── */
  --line:        #D8D6CB;   /* default 1px borders and dividers */
  --line-faint:  #E5E3DA;   /* the rule you should barely notice */
  --line-strong: #C9C7BD;   /* inputs, buttons, popovers */

  /* ── ground-relative: the ONE accent ──────────────────────────────────── */
  /* One accent, one semantic red. A second accent is a budget breach —
     see the flourish budget in aesthetic.md. */
  --acc:         #185FA5;
  --acc-wash:    #E6F1FB;
  --acc-ink:     #FFFFFF;   /* text ON the accent */
  --danger:      #C0392B;
  --danger-wash: #FBE3E1;

  /* ── ground-relative: shading ─────────────────────────────────────────── */
  /* Depth is a shadow. Two-part shadows read crisper than one. */
  --shade-raised: 0 1px 2px rgba(22,19,13,.06), 0 2px 6px rgba(22,19,13,.05);
  --shade-float:  0 2px 4px rgba(22,19,13,.07), 0 8px 24px rgba(22,19,13,.09);
  --shade-edge:   inset 0 0 0 1px var(--line);

  /* ── ground-relative: focus ───────────────────────────────────────────── */
  --focus:       #A8843C;   /* ochre — deliberately NOT --acc, so "where am I"
                               and "what is active" are never the same signal */
  --focus-ring:  0 0 0 3px rgba(168,132,60,.32);

  /* ══ ground-INVARIANT below this line. These never change with the ground. ══ */

  /* ── spacing — the only legal values ──────────────────────────────────── */
  /* !DesignCheck visual lens: the constrained scale. An arbitrary value is an audit failure.
     Space BETWEEN groups must exceed space WITHIN groups. */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --s-7: 64px;

  /* ── type (grandfathered — see header) ────────────────────────────────── */
  --t-display: 2.9rem;
  --t-h2:      1.34rem;
  --t-h3:      1.02rem;
  --t-body:    1.0625rem;
  --t-small:   0.8125rem;
  --t-micro:   0.6875rem;

  --lh-tight:  1.15;        /* headings */
  --lh-body:   1.62;        /* prose */
  --lh-ui:     1.45;        /* dense UI: rows, chips, labels */

  --measure:     38rem;     /* 45-75 characters. Never let prose run wider */
  --margin-col:  13rem;     /* the Tufte side column */

  /* Two families, never three. Serif for prose, system sans for UI chrome. */
  --font-prose: "Source Serif 4", Charter, Georgia, serif;
  --font-ui:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius:      8px;
  --radius-sm:   4px;

  /* ── motion — the flourish that must not become noise ─────────────────── */
  /* Three durations. If you need a fourth, you are animating something that
     should not move. --m-slow is for entrances only, never for feedback. */
  --m-fast:  90ms;          /* state echo: hover, press, check */
  --m-base:  180ms;         /* reveal: popover, chip, row expand */
  --m-slow:  320ms;         /* entrance: a panel arriving for the first time */

  --ease-out: cubic-bezier(.22,.61,.36,1);    /* things arriving — decelerate */
  --ease-in:  cubic-bezier(.55,.06,.68,.19);  /* things leaving — accelerate */
  --ease-mid: cubic-bezier(.42,0,.58,1);      /* things moving in place */

  /* ── glyphs ───────────────────────────────────────────────────────────── */
  /* One stroke width across the whole set. Mismatched stroke is the single
     most common tell of borrowed icons. */
  --glyph-sm:     14px;
  --glyph-md:     18px;
  --glyph-lg:     24px;
  --glyph-stroke: 1.5px;

  /* ── print (ground-invariant: print is always the light path) ─────────── */
  /* NOTE: page size and margin are deliberately NOT tokens. The @page rule does
     not inherit custom properties from :root in any current engine, so
     `size: var(--print-page)` silently does nothing. Write A4 and 18mm literally
     inside @page — see print.md. A token that cannot be honoured is worse than
     no token, because it reads as configured when it is not. */
  --print-ink:       #000000;         /* on paper, black IS correct */
  --print-rule:      #999999;
  --print-shade:     #EDEDED;         /* the substitute for every screen shadow */
  --print-measure:   32rem;
}

/* ═══ THE MOTION FLOOR — not optional, not a preference ═════════════════ */
/* WCAG 2.2. Every animation in the house style is decorative by definition:
   if removing it loses information, it was carrying information it should not. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══ AltHistoryMap — map ground and layout tokens ══════════════════════
   The map is the only colourful thing on screen; sea, land, coast and
   water stay neutral so painted territory stands out against both.
   --border is the political border colour drawn on the canvas. */

:root {
  --map-sea:   #C3D8E6;
  --map-land:  #F3F1E8;
  --map-coast: #8D8A7D;
  --map-water: #4F8DB8;
  --border:    #2B2118;
  --font-map:  Georgia, "Source Serif 4", serif;
  --flag-white: #FFFFFF;

  /* Looks: shares from 0 to 1. Culture is mixed toward white by --culture-tint; in Edit mode
     on Culture, Political keeps --political-fade of its strength and Culture lies over it at
     --culture-blend. */
  --culture-tint:   0.6;
  --culture-blend:  0.7;
  --political-fade: 0.35;

  --panel-w:   200px;
  --stage-pad: 12px;
}
