/* =========================================================================
   Marginalia skins. Each theme is a set of custom properties on [data-theme].
   Structural styles (application.css, chat.css) only ever read these tokens,
   so adding a new skin means adding one block here — nothing else changes.
   ========================================================================= */

:root {
  --folio-opacity: 0;       /* skins opt in; unknown skin = no folio */
  --folio-filter: none;
  --grain-opacity: 0;       /* skins opt in; unknown skin = no texture */
  --grain-blend:   normal;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 44rem;
  --step: 1.62; /* type scale */
}

/* ---- Manuscript — warm, literary, printed-page calm (default) ---------- */
[data-theme="manuscript"] {
  color-scheme: light;
  --bg:          #f6f1e7;
  --bg-grain:    #efe7d7;
  --surface:     #fffdf8;
  --surface-2:   #f3ecdd;
  --ink:         #26221b;
  --ink-soft:    #5c5346;
  --ink-faint:   #928772;
  --accent:      #b4562f;   /* terracotta */
  --accent-ink:  #ffffff;
  --accent-soft: #f0d9cb;
  --border:      #e2d7c1;
  --border-soft: #ece3d1;
  --ring:        rgba(180, 86, 47, 0.35);
  --shadow:      0 1px 2px rgba(60,46,25,.06), 0 10px 30px rgba(60,46,25,.08);
  --verse-bar:   #b4562f;
  --glow:        rgba(255, 252, 242, 0.95); /* warm light down the page */
  --folio-opacity: 0.30;
  --folio-filter: sepia(.4) saturate(.75) contrast(1.05);
  --grain-opacity: 0.055;   /* paper tooth; multiply darkens the cream slightly */
  --grain-blend:   multiply;
  --display-font: var(--serif);
  --display-weight: 600;
}

/* ---- Nocturne — quiet, modern dark, a little glow --------------------- */
[data-theme="nocturne"] {
  color-scheme: dark;
  --bg:          #0d0f14;
  --bg-grain:    #0a0c11;
  --surface:     #161a22;
  --surface-2:   #1d222c;
  --ink:         #e9ecf2;
  --ink-soft:    #a7aec0;
  --ink-faint:   #6f7789;
  --accent:      #8b8cf0;   /* soft indigo */
  --accent-ink:  #0d0f14;
  --accent-soft: #23263a;
  --border:      #252b37;
  --border-soft: #1c212b;
  --ring:        rgba(139, 140, 240, 0.45);
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 18px 50px rgba(0,0,0,.45);
  --verse-bar:   #8b8cf0;
  --glow:        rgba(162, 176, 255, 0.30); /* soft light in the dark */
  --folio-opacity: 0.22;
  --folio-filter: invert(.92) sepia(.35) hue-rotate(185deg) saturate(.6);
  --grain-opacity: 0.045;   /* on near-black, multiply would erase it */
  --grain-blend:   soft-light;
  --display-font: var(--sans);
  --display-weight: 620;
}

/* ---- Meadow — earthy, restful, wellness-adjacent ---------------------- */
[data-theme="meadow"] {
  color-scheme: light;
  --bg:          #eef0e6;
  --bg-grain:    #e6e9db;
  --surface:     #fbfcf7;
  --surface-2:   #eef1e4;
  --ink:         #232a22;
  --ink-soft:    #4f5a4a;
  --ink-faint:   #7e8a76;
  --accent:      #3f7d54;   /* sage green */
  --accent-ink:  #ffffff;
  --accent-soft: #d9e7d8;
  --border:      #d6ddc9;
  --border-soft: #e3e8d7;
  --ring:        rgba(63, 125, 84, 0.32);
  --shadow:      0 1px 2px rgba(35,42,34,.06), 0 12px 34px rgba(35,42,34,.10);
  --verse-bar:   #3f7d54;
  --glow:        rgba(253, 253, 244, 0.95); /* soft daylight */
  --folio-opacity: 0.24;
  --folio-filter: sepia(.3) hue-rotate(25deg) saturate(.8);
  --grain-opacity: 0.05;
  --grain-blend:   multiply;
  --display-font: var(--serif);
  --display-weight: 600;
}

/* Respect a first-time visitor's OS preference before they pick a skin. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; }
}
