/* ==========================================================================
   ONCE CONTENT — BASE
   Reset, element defaults, typography, layout primitives, utilities.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--brown-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, video {
  max-width: 100%;
  display: block;
}

svg { fill: currentColor; }

a { color: inherit; }

ul, ol { padding: 0; margin: 0; list-style: none; }

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

button { cursor: pointer; background: none; border: none; }

h1, h2, h3, h4, h5, .serif {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  color: var(--brown-ink);
  margin: 0;
  letter-spacing: 0.002em;
}

p { margin: 0; }

/* ---- Focus visibility (never remove without replacing) ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: var(--space-sm);
  top: -60px;
  background: var(--brown);
  color: var(--on-brown);
  padding: 0.85em 1.4em;
  font-size: var(--fs-small);
  letter-spacing: var(--tracking-wide);
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-editorial);
}
.skip-link:focus { top: var(--space-sm); }

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow { max-width: var(--container-narrow); }
.container--mid { max-width: 58rem; }

.section {
  padding-block: var(--space-2xl);
}
.section--tight { padding-block: var(--space-xl); }
.section--top-tight { padding-top: var(--space-xl); }
.section--bottom-tight { padding-bottom: var(--space-xl); }

.section--cream-light { background: var(--cream-light); }
.section--brown {
  background: var(--brown);
  color: var(--on-brown);
}
.section--brown h1, .section--brown h2, .section--brown h3, .section--brown h4, .section--brown .serif {
  color: var(--on-brown);
}

/* ---- Typography helpers ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--taupe);
  font-weight: 500;
}
.eyebrow::before {
  content: '';
  width: 1.6em;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.eyebrow--center { justify-content: center; }
.eyebrow--plain::before { display: none; }

.display { font-size: var(--fs-display); }
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); }
.h4 { font-size: var(--fs-h4); font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.01em; }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--brown-soft);
  font-weight: 400;
}

.italic { font-style: italic; }

.text-muted { color: var(--brown-soft); }
.text-on-brown-muted { color: var(--on-brown-muted); }

.numeral {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--taupe);
  font-size: 1.15em;
}

.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;
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
}
.divider--brown { border-top: 1px solid rgba(244,238,227,0.22); }

/* ---- Grids ---- */
.grid {
  display: grid;
  gap: var(--space-md);
}
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---- Reveal-on-scroll ----
   Safe by default: content is fully visible unless JS confirms it can
   animate it in. The "js" class is added synchronously in <head>, before
   first paint, so there's no flash of hidden content either way. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-editorial), transform var(--dur-slow) var(--ease-editorial);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Aspect-ratio media frames ---- */
.frame { position: relative; overflow: hidden; background: var(--cream-deep); }
.frame img, .frame video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.frame--portrait { aspect-ratio: 4 / 5; }
.frame--tall { aspect-ratio: 9 / 16; }
.frame--wide { aspect-ratio: 16 / 10; }
.frame--square { aspect-ratio: 1 / 1; }

.frame-caption {
  position: absolute;
  left: var(--space-sm);
  bottom: var(--space-sm);
  color: var(--on-brown);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-wide);
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
