/* ============================================================
   THEME TOKENS
   Swap a theme by changing this file only — app.css never
   references raw colors, only these custom properties.
   ============================================================ */

:root {
  /* --- default (paper) theme --- */
  --paper: #ece4d3;
  --paper-raised: #f6f1e6;
  --ink: #201c16;
  --ink-soft: #55503f;
  --rule: #c9bb9c;
  --accent: #a13c2c;
  --accent-soft: #d99a86;
  --inkwell: #2c4a52;
  --gold: #a17f34;
  --code-bg: #211d17;
  --code-fg: #e9e2ce;

  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Newsreader', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-dyslexic: 'Atkinson Hyperlegible', Verdana, Arial, sans-serif;

  --measure: 34rem;
  --line-height: 1.65;
  --para-gap: 1.1rem;
  --user-scale: 1;
  --motion: 0.15s;
}

/* --- dark theme --- */
[data-theme="dark"] {
  --paper: #191a1c;
  --paper-raised: #232427;
  --ink: #e9e6de;
  --ink-soft: #a8a496;
  --rule: #3a3b3e;
  --accent: #e08a66;
  --accent-soft: #7a4230;
  --inkwell: #7fb2c0;
  --gold: #d1ab5e;
  --code-bg: #0f0f10;
  --code-fg: #e9e2ce;
}

/* --- ink & paper (e-reader) theme ---
   Mimics an e-ink display: soft off-white background, warm
   dark-gray "ink" instead of true black, minimal color use,
   slightly higher line-height to match e-reader defaults. */
[data-theme="ereader"] {
  --paper: #e9e7e0;
  --paper-raised: #e2e0d8;
  --ink: #3a3a36;
  --ink-soft: #6b6a63;
  --rule: #c7c5bc;
  --accent: #5c5a52;
  --accent-soft: #9a988e;
  --inkwell: #4a4944;
  --gold: #6b6a63;
  --code-bg: #dedcd3;
  --code-fg: #3a3a36;
  --font-display: 'Newsreader', Georgia, serif;
  --line-height: 1.75;
}

/* --- sepia theme --- */
[data-theme="sepia"] {
  --paper: #f1e4c9;
  --paper-raised: #ead9b5;
  --ink: #3f2f1c;
  --ink-soft: #6b5636;
  --rule: #cbb488;
  --accent: #8a4a2c;
  --accent-soft: #c98f5e;
  --inkwell: #5c4423;
  --gold: #96731f;
  --code-bg: #2c2013;
  --code-fg: #ead9b5;
}

/* --- slate theme (cool dark, screen-friendly at night) --- */
[data-theme="slate"] {
  --paper: #1b2229;
  --paper-raised: #232c35;
  --ink: #dbe3ea;
  --ink-soft: #8a97a3;
  --rule: #34404a;
  --accent: #6fb3d9;
  --accent-soft: #35566a;
  --inkwell: #9ad1a8;
  --gold: #d9b96f;
  --code-bg: #11161b;
  --code-fg: #dbe3ea;
}

/* --- forest theme (muted, warm-green reading mode) --- */
[data-theme="forest"] {
  --paper: #e7e9df;
  --paper-raised: #dee2d4;
  --ink: #2b3327;
  --ink-soft: #5c6654;
  --rule: #b9c2ac;
  --accent: #4c6b3f;
  --accent-soft: #9db38d;
  --inkwell: #3d5c6b;
  --gold: #8a7a35;
  --code-bg: #232b1f;
  --code-fg: #e2e6d8;
}

/* --- high contrast (layers on top of whichever theme is active) --- */
[data-contrast="high"] {
  --ink: #000000;
  --ink-soft: #000000;
  --rule: #000000;
  --paper: #ffffff;
  --paper-raised: #ffffff;
  --accent: #a10000;
  --inkwell: #003a8c;
}
[data-theme="dark"][data-contrast="high"] {
  --ink: #ffffff;
  --ink-soft: #ffffff;
  --rule: #ffffff;
  --paper: #000000;
  --paper-raised: #000000;
  --accent: #ff9466;
  --inkwell: #8fd6ea;
}
[data-theme="slate"][data-contrast="high"] {
  --ink: #ffffff;
  --ink-soft: #ffffff;
  --rule: #ffffff;
  --paper: #000000;
  --paper-raised: #000000;
  --accent: #7fd0ff;
  --inkwell: #a8ffb8;
}

/* --- dyslexia-friendly typeface --- */
[data-font="dyslexic"] {
  --font-display: var(--font-dyslexic);
  --font-body: var(--font-dyslexic);
  --font-mono: var(--font-dyslexic);
}

/* --- line spacing --- */
[data-spacing="compact"] { --line-height: 1.45; --para-gap: 0.8rem; }
[data-spacing="cozy"]    { --line-height: 1.65; --para-gap: 1.1rem; }
[data-spacing="relaxed"] { --line-height: 1.95; --para-gap: 1.5rem; }

/* --- measure (line length) --- */
[data-measure="narrow"] { --measure: 28rem; }
[data-measure="medium"] { --measure: 34rem; }
[data-measure="wide"]   { --measure: 42rem; }

/* --- reduced motion --- */
[data-motion="reduce"] { --motion: 0s; }
