/* ================================================================================================
   theme.css — Rob (2026-09-05). THE SITE'S COLOUR TOKENS, in one place, for every page outside the
   game.

   Until now each page outside `/city` stated its own palette: `Blog.razor.css` said as much in its
   own header ("the tokens are stated rather than imported … if they ever become shared variables,
   all five pages move together"). This is that file, and they now do. Thirteen stylesheets plus the
   landing page's inline block read from here; nothing states a chrome colour of its own any more.

   WHAT IS A TOKEN AND WHAT IS NOT
   -------------------------------
   Tokenised: CHROME — panels, hairlines, ink, labels, links, buttons, code blocks, rails, chips.
   These are the surfaces whose whole job is to be the page, and they flip with the theme.

   NOT tokenised, deliberately: OBJECTS WITH A COLOUR OF THEIR OWN. A post-it is yellow paper, a
   postcard is warm stock, the START button is amber, a danger button is red, and text laid over a
   photograph or a film is white on a dark scrim. Those are pictures of things, not chrome; making
   them "theme-aware" would mean a yellow post-it that is not yellow. They keep their literals, and
   the media overlays keep their dark scrims in BOTH themes — a light scrim over moving footage is
   what makes video backgrounds unreadable.

   THE TWO CHANNELS. Two tokens carry an rgb TRIPLET rather than a colour, because the glass idiom
   this site is built on is `rgba(255,255,255,.08)` fills over a dark ground — a hundred of them, at
   ten different alphas. Naming a hundred alpha steps would be absurd, so instead:

       --tc-tint   the "lighten" channel: borders, hover fills, dividers   (dark 255,255,255)
       --tc-shade  the "darken" channel: shadows                           (dark 0,0,0)
       --tc-halo   the channel a text-shadow uses UNDER text on a photo — the opposite polarity
                   to the ink, so it is black on the dark theme and white on the light one

   and every rule writes `rgba(var(--tc-tint), .08)` with its own alpha kept exactly as it was. In
   the light theme `--tc-tint` becomes a dark slate, so the same rule that drew a faint white line
   on navy draws a faint grey line on paper, at the same weight, with no rule rewritten.

   GROUND AND GLASS ARE TWO TOKENS, NOT ONE. In the dark theme they are 7/255 apart — #0b1016 and
   #121820 — and it is tempting to fold them. They must not be: a panel reads as a card because it
   is LIGHTER than the page it sits on, and on paper that means white glass on a grey-white ground.
   Fold them and every panel on the light theme disappears. Measured, the first time round.

   DEFAULT IS LIGHT (Rob, 2026-09-06). `:root` is the LIGHT theme now, and the dark one is the
   block behind `[data-theme="dark"]`. That is a one-line change of which selector carries which
   table, and it is deliberately the whole mechanism: a visitor with nothing stored — and every page
   in the instant before `js/theme.js` has written the attribute — gets paper rather than navy, and
   no rule anywhere else had to know. `prefers-color-scheme` is still NOT consulted: the theme is a
   choice, not a detection. The choice lives in `localStorage['tc-theme']` and is applied to
   `<html data-theme>` by `js/theme.js` from the document HEAD, before the body paints, so there is
   no flash of the wrong theme.

   ROLLBACK to a dark-first site: swap the two selectors below back (`:root` carries the dark table,
   `:root[data-theme="light"]` the light one), swap the two `color-scheme` lines at the foot, and
   set `FALLBACK` in `js/theme.js` back to 'dark'.

   ROLLBACK: remove the <link> and the <script> from `App.razor`. Every var() below then resolves to
   nothing and the pages lose their colours — so rollback is the two lines AND `git checkout` of the
   stylesheets, which is why this landed as one commit.
   ================================================================================================ */

/* ================================================================================================
   THE LIGHT THEME, and the DEFAULT — see the header. It is the bare `:root` block, so it is what
   every page resolves to before `js/theme.js` has written an attribute and what an unset, corrupted
   or hand-edited stored value degrades to.
   ================================================================================================ */
:root {
    --tc-bg: #e7edf3;
    --tc-bg-2: #dde5ee;
    --tc-ground: 231, 237, 243;
    --tc-glass: 255, 255, 255;
    /* A well is a hole, and a hole on paper is faint. Black at .34 sinks a code block into navy;
       slate at .34 would lay a slab on top of a white card, which is the opposite reading. */
    --tc-well: rgba(20, 38, 54, 0.055);
    --tc-tint: 20, 38, 54;
    --tc-shade: 46, 68, 92;
    --tc-line: rgba(20, 38, 54, 0.16);
    --tc-ink: #0d1620;
    --tc-ink-2: #16222e;
    --tc-text: #384754;
    --tc-label: #5b6874;
    --tc-dim: #6d7985;
    --tc-dimmer: #79858f;
    --tc-faint: #9aa5af;
    --tc-accent: #0d7d97;
    --tc-accent-rgb: 13, 125, 151;
    --tc-accent-hi: #075f75;
    --tc-on-accent: #ffffff;
    --tc-amber: #a86a10;
    --tc-amber-rgb: 168, 106, 16;
    --tc-amber-hi: #7a5518;
    --tc-text-hi: #2a3846;
    --tc-media: #dee4eb;
    --tc-halo: 255, 255, 255;
    --tc-danger: #9c2d13;
    --tc-danger-rgb: 196, 60, 28;
    --tc-error: #8a1f1f;
    --tc-error-rgb: 190, 66, 66;
}

/* ================================================================================================
   THE DARK THEME — the one a visitor opts INTO now. Same structure, same alphas, different channels.

   The accent MOVES between the two rather than merely lightening: `#5ad0e8` on white is 1.6:1 and
   unreadable, so the light theme's cyan is a deeper teal that keeps the hue and clears 4.5:1 on
   paper, and `--tc-accent-hi` is DARKER than `--tc-accent` there rather than brighter — "hi" means
   *more emphatic*, and on a light ground more emphatic is darker. Every rule that used it for a
   heading or a hover still reads as the emphatic one, which is why nothing needed rewriting.
   ================================================================================================ */
:root[data-theme="dark"] {
    /* ---- ground ------------------------------------------------------------------------------ */
    --tc-bg: #0b1016; /* the page ground; also `html`'s background */
    --tc-bg-2: #070a0f; /* the far end of the page gradient */
    --tc-ground: 11, 16, 22; /* the ground as a triplet: scrims, and fades into the page */
    --tc-glass: 18, 24, 32; /* what a panel is FILLED with, always at .72 + a blur */
    --tc-well: rgba(0, 0, 0, 0.34); /* a surface SUNK below its panel: code blocks, listings */
    --tc-tint: 255, 255, 255; /* the lighten channel — see the header */
    --tc-shade: 0, 0, 0; /* the darken channel */
    --tc-line: rgba(255, 255, 255, 0.12); /* the default hairline */
    /* ---- ink --------------------------------------------------------------------------------- */
    --tc-ink: #f2f5f8; /* brightest — h1, the wordmark */
    --tc-ink-2: #e6edf4; /* headings and strong text */
    --tc-text: #c8d3dd; /* body copy */
    --tc-label: #aab4bf; /* labels, captions, muted prose */
    --tc-dim: #8b96a2; /* the quietest text on the page */
    --tc-dimmer: #7f8b96; /* small print under that */
    --tc-faint: #56626d; /* quieter than small print: a code listing's line-number gutter */
    /* ---- accent ------------------------------------------------------------------------------ */
    --tc-accent: #5ad0e8; /* the cyan: links, rules, focus */
    --tc-accent-rgb: 90, 208, 232;
    --tc-accent-hi: #9fe8f6; /* the brighter cyan: headings, hovers */
    --tc-on-accent: #05252c; /* text laid ON an accent fill */
    /* ---- amber ------------------------------------------------------------------------------- */
    --tc-amber: #e8a33d;
    --tc-amber-rgb: 232, 163, 61;
    --tc-amber-hi: #e9dcc6; /* the warm ink used for amber-keyed prose */

    --tc-text-hi: #dde5ec; /* prose that wants to be brighter than body copy: ledes, code, quotes */
    --tc-media: #0d1218; /* the plate behind a screenshot or a video, seen while it loads */
    --tc-halo: 0, 0, 0; /* text-shadow UNDER text laid over a photograph or a film */
    --tc-danger: #ffb4a0; /* the armed-delete ink */
    --tc-danger-rgb: 232, 90, 61;
    --tc-error: #ffd9d9; /* the wizards' bad-file notice */
    --tc-error-rgb: 255, 120, 120;
}

/* The form controls the wizards use are the browser's own, and a browser paints a <select>, a
   scrollbar and a focus ring from the document's declared colour scheme rather than from ours. One
   line per theme keeps those in step with everything above. */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
