/* ==========================================================================
   DESIGN TOKENS — the one file to edit when changing the look.
   Everything else (base.css) only reads these variables.

   Switch looks by setting attributes on <html>, e.g.
     <html data-palette="warm" data-type="editorial" data-density="comfortable">
   or open any page with ?tune to get a live panel (see js/tuner.js).
   ========================================================================== */

/* ---- Self-hosted heading font: Source Serif 4 (SIL Open Font License), variable 400–600 ---- */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ss4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/ss4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- Colour (default palette: "warm") ---- */
  --bg:           #F7F4EF;  /* page background (warm ivory)        */
  --surface:      #FFFDF9;  /* raised surfaces, placeholders       */
  --text:         #2D2925;  /* body text (warm charcoal)           */
  --text-muted:   #74675D;  /* secondary text (muted brown)        */
  --line:         #E7D9CB;  /* hairlines, borders (soft sand)      */
  --accent:       #B45C37;  /* terracotta: decoration, rules       */
  --accent-text:  #9A4A28;  /* terracotta darkened for small text  */
  --accent-mid:   #D9906B;  /* muted orange: illustrations         */
  --accent-soft:  #F4DDCB;  /* pastel apricot: callout background  */
  --tile:         #EFE3D6;  /* illustration tiles                  */
  --on-accent:    #FFFDF9;  /* text on solid accent                */

  /* ---- Typography ---- */
  --font-display: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-base:      1.0625rem;   /* ~17px */
  --fs-small:     0.875rem;
  --fs-h1:        clamp(2.4rem, 5vw, 3.25rem);
  --fs-h2:        1.5rem;
  --lh-body:      1.6;
  --h1-weight:    400;
  --h2-weight:    450;

  /* ---- Layout & rhythm ---- */
  --page-width:   62rem;    /* max content width                 */
  --gutter:       clamp(1.25rem, 4vw, 2rem);
  --section-gap:  clamp(3rem, 7vw, 4.5rem);  /* between sections */
  --stack:        1rem;     /* default vertical rhythm           */
  --radius:       0.75rem;  /* callout, figures                  */
  --radius-sm:    0.4rem;
  --rule:         1px;
}

/* ---------------- Palettes ---------------- */

[data-palette="sand"] {
  --bg: #FAF6EE; --surface: #FFFFFF; --text: #33291F; --text-muted: #7A6A58;
  --line: #EADFCB; --accent: #C2693E; --accent-text: #9C4A25; --accent-mid: #E2A37A;
  --accent-soft: #F8E3CC; --tile: #F3E7D6;
}

[data-palette="clay"] {
  --bg: #F2EBE3; --surface: #FBF7F2; --text: #2A2420; --text-muted: #6E6056;
  --line: #DDCDBD; --accent: #9C4A2C; --accent-text: #8F4125; --accent-mid: #C98160;
  --accent-soft: #EBD3C0; --tile: #E6D8C9;
}

[data-palette="cream"] {
  --bg: #FFFBF4; --surface: #FFFFFF; --text: #2D2925; --text-muted: #7B6E63;
  --line: #F0E4D4; --accent: #D07A4B; --accent-text: #A9531F; --accent-mid: #E6A47E;
  --accent-soft: #FCE8D5; --tile: #F8ECDD;
}

[data-palette="night"] {
  --bg: #211D19; --surface: #2B2621; --text: #F1E9DF; --text-muted: #B3A596;
  --line: #3C342D; --accent: #E39A72; --accent-text: #EDA982; --accent-mid: #C27A55;
  --accent-soft: #3A2D25; --tile: #332B25; --on-accent: #211D19;
}

/* ---------------- Type pairings ---------------- */

[data-type="classic"] {  /* serif throughout */
  --font-body: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

[data-type="modern"] {   /* sans throughout */
  --font-display: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --h1-weight: 600; --h2-weight: 600;
}

[data-type="humanist"] { /* rounder, friendlier serif headings */
  --font-display: "Charter", "Bitstream Charter", "Sitka Text", Cambria, serif;
  --h1-weight: 600; --h2-weight: 600;
}

/* ---------------- Density ---------------- */

[data-density="compact"] {
  --fs-base: 1rem; --section-gap: clamp(2rem, 5vw, 3rem); --stack: 0.75rem;
}

[data-density="airy"] {
  --fs-base: 1.125rem; --section-gap: clamp(3.5rem, 9vw, 6rem); --stack: 1.25rem; --lh-body: 1.7;
}

/* ---------------- Width ---------------- */

[data-width="narrow"] { --page-width: 52rem; }
[data-width="wide"]   { --page-width: 72rem; }
