/* =========================================================
   Reset + base typography + layout primitives.
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; cursor: pointer; }

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 var(--s-4);
}
h1 { font-size: clamp(2.25rem, 4vw + 1rem, var(--fs-4xl)); font-weight: 500; }
h2 { font-size: clamp(1.75rem, 2vw + 1rem, var(--fs-2xl)); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--s-4); color: var(--ink-soft); }
p.lead {
  font-size: var(--fs-md);
  color: var(--muted);
  line-height: 1.7;
  max-width: 56ch;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
a:hover { color: var(--gold-deep); border-color: var(--gold-light); }

small, .meta {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

hr.rule {
  border: none;
  border-top: 1px solid var(--gold);
  width: 48px;
  margin: var(--s-5) 0;
  opacity: 0.7;
}

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
@media (min-width: 720px) { .container { padding: 0 var(--s-7); } }

.section { padding: var(--s-9) 0; }
.section--tight { padding: var(--s-8) 0; }
.section--alt { background: var(--bg-alt); }
.section--deep { background: var(--bg-deep); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--divider);
}
.section-head h2 { margin: 0; }
.section-head .meta { white-space: nowrap; }

.grid { display: grid; gap: var(--s-6); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Fade-in helper for IntersectionObserver */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Skip link */
.skip {
  position: absolute; left: -9999px;
  background: var(--charcoal); color: var(--bg);
  padding: var(--s-3) var(--s-5);
}
.skip:focus { left: var(--s-3); top: var(--s-3); z-index: 100; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
