/* ============================================================
   base.css — design tokens, reset, typography, primitives
   Theme: editorial / print-inspired (warm, typographic)
   ============================================================ */

/* ---- Light palette (default) ------------------------------ */
:root {
  --bg:          #f6f2ea;  /* warm paper */
  --bg-elev:     #fffdf8;  /* raised cards */
  --surface:     #efe8db;  /* subtle warm panel */
  --text:        #374151;  /* softer body text — WCAG AA on cream */
  --text-heading:#232019;  /* original warm ink — headings only */
  --text-soft:   #5c554a;
  --text-faint:  #8a8175;
  --border:      #e4ddcf;
  --border-strong:#d6ccb9;
  --accent:      #b4472e;  /* burnt sienna */
  --accent-ink:  #9c3a22;  /* links */
  --accent-soft: rgba(180, 71, 46, 0.10);

  /* The physical "paper sheet" keeps its own palette in BOTH themes
     so it always reads as a real sheet of paper. */
  --sheet-bg:    #ffffff;
  --sheet-ink:   #1b1b1b;
  --sheet-soft:  #565148;
  --sheet-line:  #e7e2d6;
  --sheet-accent:#b4472e;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "Cascadia Code", "SF Mono", "Consolas", "Roboto Mono", ui-monospace, monospace;

  --shadow-sm: 0 1px 2px rgba(35, 32, 25, 0.06), 0 1px 3px rgba(35, 32, 25, 0.05);
  --shadow-md: 0 4px 14px rgba(35, 32, 25, 0.08), 0 2px 6px rgba(35, 32, 25, 0.06);
  --shadow-lg: 0 18px 50px rgba(35, 32, 25, 0.16), 0 6px 18px rgba(35, 32, 25, 0.10);

  --radius:    10px;
  --radius-lg: 16px;
  --measure:   68ch;         /* comfortable reading width */
  --container:  1100px;
  --nav-h:      64px;

  color-scheme: light;
}

/* ---- Dark palette ----------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #16140f;
    --bg-elev:     #1e1b15;
    --surface:     #221e17;
    --text:        #ece7dc;
    --text-heading:#ece7dc;
    --text-soft:   #b3aa9a;
    --text-faint:  #857c6c;
    --border:      #322c22;
    --border-strong:#443c2f;
    --accent:      #e0764f;
    --accent-ink:  #ec8b66;
    --accent-soft: rgba(224, 118, 79, 0.14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:          #16140f;
  --bg-elev:     #1e1b15;
  --surface:     #221e17;
  --text:        #ece7dc;
  --text-heading:#ece7dc;
  --text-soft:   #b3aa9a;
  --text-faint:  #857c6c;
  --border:      #322c22;
  --border-strong:#443c2f;
  --accent:      #e0764f;
  --accent-ink:  #ec8b66;
  --accent-soft: rgba(224, 118, 79, 0.14);
  color-scheme: dark;
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Typography -------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-heading);
}
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p  { color: var(--text); }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }

/* Small-caps editorial label used for section eyebrows / tags */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Layout primitives ------------------------------------ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }
.section { padding-block: clamp(48px, 8vw, 96px); }
.section--tight { padding-block: clamp(32px, 5vw, 56px); }
.divider { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.95rem;
  padding: 0.66em 1.25em; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface); }

/* ---- Pills / tags ----------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: var(--font-sans); font-size: 0.78rem; font-weight: 600;
  padding: 0.28em 0.7em; border-radius: 999px;
  background: var(--surface); color: var(--text-soft);
  border: 1px solid var(--border);
}
.pill--accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* ---- Accessibility helpers -------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--accent); color: #fff; padding: 0.6em 1em; border-radius: 8px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
