/* ==========================================================================
   Insomniotters — design tokens
   Change the look here. styles.css should reference these and never hardcode
   a color or size.

   Palette: illuminated manuscript meets 4am. Indigo ground, gold leaf,
   candlelight, parchment. Every text/background pair below is annotated with
   its contrast ratio against its intended ground — all clear WCAG AA (4.5:1)
   for body text and AA Large (3:1) for display sizes.
   ========================================================================== */

:root {
  /* --- Ground: the night, in three depths ---------------------------------
     Sampled from the stained-glass art (moody_pachi, pachi_death): a deep
     teal-black rather than a blue-indigo. Warmer and greener than it looks. */
  --ink-abyss:      #060d13;  /* deepest — the spirit realm, Death panel */
  --ink:            #0b1620;  /* page ground */
  --ink-raised:     #142330;  /* cards, raised surfaces */
  --ink-hairline:   #24394a;  /* borders, rules */

  /* --- Gold leaf ----------------------------------------------------------
     The one color both art families share — the halos in the manuscript
     plates and the warm glass in the windows. This is what unifies the site. */
  --gold:           #e2ba6b;  /*  9.6:1 on --ink — display + emphasis */
  --gold-deep:      #c39a48;  /*  6.6:1 on --ink — rules, small accents */
  --gold-dim:       #83682f;  /*  3.0:1 — decorative only, NEVER text */

  /* --- Parchment: reading text ------------------------------------------- */
  --parchment:      #e8ddc7;  /* 12.6:1 on --ink — body copy */
  --parchment-soft: #b4ac9c;  /*  7.3:1 on --ink — secondary, captions */
  --parchment-mute: #877f72;  /*  4.5:1 on --ink — metadata. Floor for text. */

  /* --- Vellum: the manuscript plates' own ground -------------------------
     Used for transcription cards on the lore page so the real text sits on
     the same surface as the plate it came from. Dark ink on light here — the
     inverse of the rest of the site, deliberately. */
  --vellum:         #e9dcbc;
  --vellum-edge:    #cbb98f;
  --vellum-ink:     #221a10;  /* 13.9:1 on --vellum */
  --vellum-soft:    #5a4a33;  /*  6.4:1 on --vellum */
  --rubric:         #8e2f24;  /*  6.9:1 on --vellum — the red initials */

  /* --- Candlelight: warm signal -------------------------------------------
     Burnt orange, straight off the otter's chest and the cliffs at sunset. */
  --flame:          #d1703f;  /*  5.2:1 on --ink — "happening now", fire */

  /* --- Sanctuary: the register OUTSIDE the Pachi narrative ---------------
     Glass House and anything else marked outside_narrative uses this cooler,
     plainer set. Deliberately not gold — a sober space should not be dressed
     in the joke religion's vestments. */
  --sanctuary:      #9fc4d6;  /*  8.1:1 on --ink */
  --sanctuary-deep: #4a6b7c;

  /* --- Type -------------------------------------------------------------- */
  /* Scripture voice. Swap in Cormorant Garamond or EB Garamond as a
     self-hosted face later — drop the files in assets/fonts/ and prepend the
     family here. The system stack below is a genuine old-style serif on every
     platform, so the site looks intentional today with zero downloads. */
  --font-scripture: "Iowan Old Style", "Palatino Linotype", Palatino,
                    "Book Antiqua", Georgia, "Times New Roman", serif;

  /* Practical voice — times, locations, what to bring. */
  --font-plain:     ui-sans-serif, -apple-system, BlinkMacSystemFont,
                    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Fluid type scale. Small end = phone, large end = desktop. */
  --step--1:  clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:   clamp(1.00rem, 0.96rem + 0.20vw, 1.13rem);
  --step-1:   clamp(1.25rem, 1.16rem + 0.44vw, 1.52rem);
  --step-2:   clamp(1.56rem, 1.39rem + 0.85vw, 2.05rem);
  --step-3:   clamp(1.95rem, 1.64rem + 1.55vw, 2.76rem);
  --step-4:   clamp(2.44rem, 1.90rem + 2.68vw, 3.73rem);
  --step-5:   clamp(3.05rem, 2.15rem + 4.50vw, 5.03rem);

  --leading-tight: 1.15;
  --leading-body:  1.62;  /* long-form scripture wants room */
  --measure:       62ch;  /* max line length for readable prose */

  /* --- Space (1.5 ratio from 1rem) --------------------------------------- */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-s:   0.75rem;
  --space-m:   1.25rem;
  --space-l:   2rem;
  --space-xl:  3.25rem;
  --space-2xl: 5.25rem;
  --space-3xl: 8.5rem;

  /* --- Other ------------------------------------------------------------- */
  --radius:      2px;      /* near-square; manuscripts don't have rounded corners */
  --rule:        1px solid var(--ink-hairline);
  --rule-gold:   1px solid var(--gold-dim);
  --shadow-lift: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
  --ease:        cubic-bezier(0.2, 0, 0.2, 1);
}

/* Light theme — for anyone with a light OS preference, and for printing.
   Parchment ground, ink text: the manuscript in daylight rather than candlelight. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink-abyss:      #d8cdb4;
    --ink:            #f4ecd9;
    --ink-raised:     #fbf6ea;
    --ink-hairline:   #d6c9ab;

    --gold:           #7a5a12;  /*  6.8:1 on light ground */
    --gold-deep:      #8f6c1c;  /*  5.4:1 */
    --gold-dim:       #b8a068;  /* decorative only, NEVER text */

    --parchment:      #1c1a12;  /* 14.8:1 — body copy */
    --parchment-soft: #4a4535;  /*  8.1:1 */
    --parchment-mute: #6a6352;  /*  4.9:1 */

    --flame:          #a33c0d;  /*  6.2:1 */
    --sanctuary:      #1f4d63;  /*  7.4:1 */
    --sanctuary-deep: #6d94a8;

    --shadow-lift: 0 1px 2px rgb(90 70 30 / 0.18), 0 8px 24px rgb(90 70 30 / 0.12);
  }
}

/* Explicit overrides win in both directions — a theme toggle stamps
   data-theme on the root and must beat the media query. */
:root[data-theme="light"] {
  --ink-abyss: #d8cdb4; --ink: #f4ecd9; --ink-raised: #fbf6ea;
  --ink-hairline: #d6c9ab;
  --gold: #7a5a12; --gold-deep: #8f6c1c; --gold-dim: #b8a068;
  --parchment: #1c1a12; --parchment-soft: #4a4535; --parchment-mute: #6a6352;
  --flame: #a33c0d; --sanctuary: #1f4d63; --sanctuary-deep: #6d94a8;
}
