/* ==========================================================================================================
   Lumbre's theme tokens. Every color Lumbre's pages paint comes from here, so a new theme is a new set of
   these values, never a redesign. A palette is two blocks: [data-palette="<id>"] (light, and its type
   pairing) and its dark. theme.js sets data-palette and data-mode on <html> before the page paints; the first
   palette, Walnut (the default, j160677), is also :root's, so even a page without script paints it.
   Any element can carry data-palette to show another palette: it takes the mode around it, unless it names
   its own with data-mode.

   Surfaces   --paper         the page                     --paper-raised  pills and sheets laid on it
              --paper-sunk    pressed and recessed         --hair, --rule  hairlines, then lines that must be seen
   Ink        --ink           the line being spoken, and titles (at least 7:1 on the paper)
              --ink-past-1    the line before it (4.5:1 or more: still easy to read back)
              --ink-past-2/3  older lines as they recede (3:1 or more: AA for caption-size type)
              --ink-soft      reading text (7:1+)          --ink-mute      small labels (4.5:1+)
   Signature  --accent        the flame, "Live", one word in a title (4.5:1+ on paper and raised)
              --accent-wash   the accent's tint            --flame-core    the flame's inner light
   Finish     --shadow        under floating pills         --grain         the paper's texture, as an opacity
   Type       --font-caption, --font-ui, --caption-factor (evens out x-heights), --caption-leading,
              --caption-tracking, --w-current, --w-past (the spoken line's weight, then history's), --ui-factor
   ========================================================================================================== */

/* the solid stop of an alpha mask (the caption fade): never painted as a color */
:root { --opaque: #000; }

/* ── Walnut: walnut pews, brass and beeswax. The evening service, warm and low. ───────────────────────── */
:root, [data-palette="walnut"] {
  --font-caption: "Vollkorn", Georgia, serif;
  --font-ui: "Libre Franklin", "Franklin Gothic", system-ui, sans-serif;
  --caption-factor: 1; --caption-leading: 1.2; --caption-tracking: -0.006em;
  --w-current: 600; --w-past: 400; --ui-factor: 0.96;

  --paper: #F0E6D4; --paper-raised: #F8F1E6; --paper-sunk: #E6DCCA; --hair: #D7CCBB; --rule: #BAAE9E;
  --ink: #2B1E14; --ink-past-1: #6E6153; --ink-past-2: #7F7264; --ink-past-3: #8B7F71;
  --ink-soft: #4A3C31; --ink-mute: #695C4F;
  --accent: #785515; --accent-wash: #DFD1B9; --flame-core: #B39B76;
  --shadow: rgb(43 30 20 / 0.09); --grain: 0.07;
}
[data-palette="walnut"][data-mode="dark"], [data-mode="dark"] [data-palette="walnut"]:not([data-mode="light"]) {
  --paper: #1D1710; --paper-raised: #272017; --paper-sunk: #16110B; --hair: #332C23; --rule: #494135;
  --ink: #F3E4C9; --ink-past-1: #908573; --ink-past-2: #7C7262; --ink-past-3: #706657;
  --ink-soft: #BFB29C; --ink-mute: #958A78;
  --accent: #AA8950; --accent-wash: #362B1C; --flame-core: #D2BA92;
  --shadow: rgb(0 0 0 / 0.38); --grain: 0.05;
}

/* ── Linen: unbleached linen, walnut ink, a madder-red rubric. Set like a prayer book. ──────────────────── */
[data-palette="linen"] {
  --font-caption: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --font-ui: "Jost", "Avenir Next", Futura, system-ui, sans-serif;
  --caption-factor: 1.1; --caption-leading: 1.15; --caption-tracking: -0.003em;
  --w-current: 600; --w-past: 400; --ui-factor: 1.02;

  --paper: #F4F0E8; --paper-raised: #FAF8F3; --paper-sunk: #E9E5DD; --hair: #DAD5CE; --rule: #BCB7B0;
  --ink: #211B16; --ink-past-1: #6D6761; --ink-past-2: #7F7972; --ink-past-3: #8B867F;
  --ink-soft: #49433D; --ink-mute: #69635D;
  --accent: #984A49; --accent-wash: #E8D8D0; --flame-core: #C99B95;
  --shadow: rgb(33 27 22 / 0.08); --grain: 0.07;
}
[data-palette="linen"][data-mode="dark"], [data-mode="dark"] [data-palette="linen"]:not([data-mode="light"]) {
  --paper: #1B1916; --paper-raised: #24221E; --paper-sunk: #141210; --hair: #302D29; --rule: #45423D;
  --ink: #F0EADF; --ink-past-1: #8B877F; --ink-past-2: #78746D; --ink-past-3: #6C6862;
  --ink-soft: #B9B4AB; --ink-mute: #908C84;
  --accent: #BC807D; --accent-wash: #372C28; --flame-core: #DABAB2;
  --shadow: rgb(0 0 0 / 0.35); --grain: 0.05;
}

/* ── Stone: limestone and slate, a chapel's cool quiet, and one slate-blue. ───────────────────────────── */
[data-palette="stone"] {
  --font-caption: "Spectral", "Iowan Old Style", Georgia, serif;
  --font-ui: "Albert Sans", "Helvetica Neue", system-ui, sans-serif;
  --caption-factor: 1; --caption-leading: 1.2; --caption-tracking: -0.012em;
  --w-current: 600; --w-past: 400; --ui-factor: 1;

  --paper: #E7E8E4; --paper-raised: #F2F3F0; --paper-sunk: #DDDEDA; --hair: #CDCECC; --rule: #AFB1B0;
  --ink: #1B2025; --ink-past-1: #606467; --ink-past-2: #727577; --ink-past-3: #7E8283;
  --ink-soft: #3B4044; --ink-mute: #5B5F62;
  --accent: #475F74; --accent-wash: #CFD4D4; --flame-core: #94A1AB;
  --shadow: rgb(27 32 37 / 0.08); --grain: 0.07;
}
[data-palette="stone"][data-mode="dark"], [data-mode="dark"] [data-palette="stone"]:not([data-mode="light"]) {
  --paper: #14181B; --paper-raised: #1C2024; --paper-sunk: #0F1215; --hair: #292D2F; --rule: #3E4243;
  --ink: #E6E7E2; --ink-past-1: #838685; --ink-past-2: #717474; --ink-past-3: #656868;
  --ink-soft: #B2B4B1; --ink-mute: #898C8A;
  --accent: #7791A3; --accent-wash: #262D33; --flame-core: #B3C0C5;
  --shadow: rgb(0 0 0 / 0.4); --grain: 0.05;
}

/* ── Clay: adobe plaster and burnt umber, with terracotta. A mission church in the afternoon. ──────────── */
[data-palette="clay"] {
  --font-caption: "Alegreya", "Iowan Old Style", Georgia, serif;
  --font-ui: "Alegreya Sans", "Gill Sans", system-ui, sans-serif;
  --caption-factor: 1.04; --caption-leading: 1.17; --caption-tracking: -0.004em;
  --w-current: 600; --w-past: 400; --ui-factor: 1.1;

  --paper: #F3E8DF; --paper-raised: #FAF3EE; --paper-sunk: #EADED5; --hair: #DBCDC4; --rule: #C0AFA6;
  --ink: #3A2119; --ink-past-1: #766057; --ink-past-2: #877269; --ink-past-3: #927E75;
  --ink-soft: #533B32; --ink-mute: #725B52;
  --accent: #8E4C22; --accent-wash: #E5D1C4; --flame-core: #C29880;
  --shadow: rgb(58 33 25 / 0.08); --grain: 0.07;
}
[data-palette="clay"][data-mode="dark"], [data-mode="dark"] [data-palette="clay"]:not([data-mode="light"]) {
  --paper: #24150F; --paper-raised: #2E1D16; --paper-sunk: #1B0F0A; --hair: #3A2A23; --rule: #4F3F37;
  --ink: #F5E6DA; --ink-past-1: #93837A; --ink-past-2: #817168; --ink-past-3: #75655C;
  --ink-soft: #C1B1A7; --ink-mute: #99897F;
  --accent: #BA835E; --accent-wash: #3F281D; --flame-core: #DBB9A1;
  --shadow: rgb(0 0 0 / 0.35); --grain: 0.05;
}

/* ── Olive: olive wood and leaf, with the clearest pair of typefaces for older eyes. ──────────────────── */
[data-palette="olive"] {
  --font-caption: "Literata", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --caption-factor: 0.95; --caption-leading: 1.22; --caption-tracking: -0.014em;
  --w-current: 600; --w-past: 400; --ui-factor: 0.98;

  --paper: #ECECE0; --paper-raised: #F5F5EC; --paper-sunk: #E2E2D6; --hair: #D1D2C6; --rule: #B3B4A8;
  --ink: #22261A; --ink-past-1: #64675B; --ink-past-2: #76786C; --ink-past-3: #838579;
  --ink-soft: #3F4337; --ink-mute: #5F6255;
  --accent: #5E612C; --accent-wash: #D7D7C6; --flame-core: #A2A484;
  --shadow: rgb(34 38 26 / 0.08); --grain: 0.07;
}
[data-palette="olive"][data-mode="dark"], [data-mode="dark"] [data-palette="olive"]:not([data-mode="light"]) {
  --paper: #161811; --paper-raised: #1F2219; --paper-sunk: #10120C; --hair: #2B2D25; --rule: #404239;
  --ink: #E9EADB; --ink-past-1: #85877B; --ink-past-2: #727469; --ink-past-3: #66685D;
  --ink-soft: #B3B4A7; --ink-mute: #8A8C80;
  --accent: #8F915E; --accent-wash: #2B2D1F; --flame-core: #BFC1A2;
  --shadow: rgb(0 0 0 / 0.35); --grain: 0.05;
}
