/* ─────────────────────────────────────────────
   Shared foundation for every page: tokens, reset, focus, skip link.
   Contrast (WCAG AA) against --paper #F3E4C9:
     --ink   #573D2E  7.93:1  body text, headings
     --mute  #79583E  5.11:1  secondary text (5.59:1 on --bone)
     --brand #8A5F41  4.42:1  large display text and decoration ONLY
   On --night #43301F: --paper 9.96:1, --night-mute #D8C49E 7.32:1.
───────────────────────────────────────────── */
:root {
  --paper: #F3E4C9;
  --bone: #F8EFD9;
  --line: #D8C49E;
  --ink: #573D2E;
  --mute: #79583E;
  --brand: #8A5F41;
  --night: #43301F;
  --footer-bg: #895E40;
  --night-mute: #D8C49E;
  --night-line: rgba(243, 228, 201, 0.22);
  --focus: #43301F;
  --gut: clamp(1.25rem, 5vw, 5rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; }
[hidden] { display: none !important; }

/* Keyboard focus: always visible, high contrast, never clipped. */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 1px; }
.on-night :focus-visible { outline-color: var(--paper); }

.skip {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  background: var(--ink); color: var(--paper);
  font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; letter-spacing: 0.04em;
  padding: 0.75rem 1.1rem;
}
.skip:focus { top: 1rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; padding-inline: var(--gut); }

/* Decorative grain stays behind content and never intercepts input. */
.grain {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ico { width: 1em; height: 1em; flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--line); border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--mute); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
