/* ==========================================================================
   SETTINGS · THEME DARK — "After Hours / the humidor". The same reading room
   once the staff have gone home: a single brass lamp, the cordovan club chair,
   the humidor open, oxblood now reading as wine in lamplight. NOT black — black
   is austerity, the opposite of the decadence Epidaurus trades on. This is deep
   tanned leather and espresso, lit from within.

   It re-pitches the ENTIRE look by overriding ONLY the raw pigments from
   _color-palette.css (plus the two shadow tints that can't auto-flip). Every
   semantic role in _color-semantic.css is a color-mix() derivation of these, so
   washes, keylines, band fills, muted text and the inverse CTA all follow for
   free — exactly as the light theme re-pitches from one file.

   The paper stack INVERTS its depth logic: in daylight a raised sheet is
   *lighter* than the page and a sunken well *darker*; under the lamp a raised
   surface is the one *closest* to the light (lighter), the well recedes (darker).

   Sorts last among the colour partials (after _color-palette + _color-semantic)
   so the prefers-color-scheme override at :root wins on source order; the
   [data-theme] selectors out-specify regardless. This file holds NO component
   rules — it is settings only.

   PDF NOTE: dark mode is a screen concern. The print pipeline (lib/pdf/print.css)
   is a deliberately separate, always-light document and must never read these.
   ========================================================================== */

/* The pigment overrides, authored once and applied through three gates:
   the OS preference, an explicit data-theme="dark", and (so a forced choice
   beats the OS) data-theme="dark" inside a dark-preferring OS. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* — The leather stack: sunken well → page → lamp-lit card — */
    --paper:         #1E1611; /* the dark-stained desk (page ground) */
    --leaf:          #2A201A; /* tanned hide, lifted into the lamp (cards, sheet) */
    --deckle:        #160F0B; /* the unlit well (footer, table zebra, callouts) */

    /* — The ink, inverted to candlelight on cream; never #FFF, as light never #000 — */
    --ink:           #ECE0CB; /* aged parchment — body text, rules at strength */
    --ink-secondary: #A6957A; /* muted brass / tobacco — captions, metadata */
    --hairline:      #4A3C2E; /* a dim seam in the leather */

    /* — The ONE sacred spot lifts oxblood → garnet so it still glows + clears AA — */
    --rubric:        #C45561; /* wine in lamplight */

    /* — Score bands: the same archival inks, lifted to read on the dark grounds — */
    --myrtle:        #7FB089; /* good     — bottle-green under glass */
    --ochre:         #D4A24E; /* moderate — brass / cognac (the most decadent hue) */
    --ochre-ink:     #D9AC5C; /* moderate — gilt lettering; brighter, contrast is vs. dark now */
    --brick:         #D06450; /* poor     — embers */
    --ash:           #6E6151; /* no-data  — the dim hatch */

    /* — A "freshly printed sheet" inside a field is a fresh leaf of tobacco — */
    --quire:         #322519;

    /* — Depth can't auto-flip: shadows mix --ink, now cream, into glowing halos.
         Re-tint to a near-black deeper than the well, and make the letterpress
         highlight a warm lifted leather rather than paper-white. _shadows.css
         consumes these two tokens. — */
    --shadow-tint:   #0A0705;
    --emboss-light:  #3A2C1E;

    color-scheme: dark;
  }
}

/* Explicit opt-in (the manual toggle) — wins over the OS in either direction. */
:root[data-theme="dark"] {
  --paper:         #1E1611;
  --leaf:          #2A201A;
  --deckle:        #160F0B;

  --ink:           #ECE0CB;
  --ink-secondary: #A6957A;
  --hairline:      #4A3C2E;

  --rubric:        #C45561;

  --myrtle:        #7FB089;
  --ochre:         #D4A24E;
  --ochre-ink:     #D9AC5C;
  --brick:         #D06450;
  --ash:           #6E6151;

  --quire:         #322519;

  --shadow-tint:   #0A0705;
  --emboss-light:  #3A2C1E;

  color-scheme: dark;
}
