/* ============================================================
   base.css
   Reset, document defaults, and raw-element typography.
   No components here, just how bare HTML elements behave.
   ============================================================ */

*, *::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; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

/* A faint, fixed grain layer for a tactile, printed feel across the whole
   site. Fixed + pointer-events:none so it never repaints on scroll and never
   intercepts input; a single shared texture rather than per-section noise. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
@media (prefers-reduced-transparency: reduce) {
  body::after { display: none; }
}

input, button, textarea, select { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

/* Headings use the display serif with restraint */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--navy);
}

h1 { font-size: var(--step-4); letter-spacing: -0.015em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); font-weight: 600; }

/* Italic emphasis within display headings needs descender clearance so
   letters like "y" don't clip against the tight heading line-height. */
h1 em, h2 em {
  font-style: italic;
  line-height: 1.15;
  display: inline-block;
  padding-bottom: 0.05em;
}

p { text-wrap: pretty; }

strong { font-weight: 600; }

::selection { background: var(--amber); color: var(--paper); }

/* Visible, on-brand keyboard focus everywhere */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -3rem;
  z-index: 200;
  background: var(--navy);
  color: var(--on-navy);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--sp-4); }
