/* ==========================================================================
   base — reset, typography, layout primitives, textures, utilities
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-body);
  background: var(--surface-page);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-underline-offset: 0.25em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
summary { cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  color: var(--text-heading);
  text-transform: lowercase;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); line-height: var(--leading-tight); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h1 em, h2 em { font-style: italic; color: var(--color-terracotta); }
p { text-wrap: pretty; }

:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: var(--space-sm); top: -4rem; z-index: 100;
  padding: var(--space-xs) var(--space-md);
  background: var(--color-ink); color: var(--text-on-dark);
  border-radius: var(--radius-pill); text-decoration: none;
  transition: top var(--duration-fast) var(--ease-soft);
}
.skip-link:focus { top: var(--space-sm); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- layout primitives ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - 2 * var(--gutter), var(--container-narrow)); margin-inline: auto; }

.section { position: relative; overflow-x: clip; padding-block: var(--space-2xl); isolation: isolate; }
.section--has-wave { padding-bottom: calc(var(--space-2xl) + var(--wave-height) * 0.6); }
.section__intro { max-width: 40rem; display: grid; gap: var(--space-sm); margin-bottom: var(--space-xl); }
.eyebrow {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow); text-transform: lowercase;
  color: var(--text-muted);
  display: inline-flex; align-items: center; gap: var(--space-xs);
}
.eyebrow::before { content: ""; width: 2.25rem; height: 2px; border-radius: 2px; background: currentColor; opacity: 0.6; }
.lead { font-size: var(--text-lg); line-height: 1.6; }

/* ---------- paper-grain overlay (sits above backgrounds, below content) ---------- */
.grain { position: relative; }
.grain::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--texture-grain); background-size: 300px; opacity: 0.16; mix-blend-mode: multiply;
}

/* ---------- curved wave divider ---------- */
.wave {
  position: absolute; left: 0; right: 0; bottom: -1px; z-index: 0;
  height: var(--wave-height); line-height: 0; pointer-events: none;
}
.wave svg { width: 100%; height: 100%; }
.wave path { fill: var(--wave-fill, var(--surface-page)); }

/* ---------- decorative helpers ---------- */
.deco { position: absolute; pointer-events: none; user-select: none; }
.blob { border-radius: var(--radius-blob-a); }
.wash { background: currentColor; border-radius: var(--radius-blob-a); filter: blur(1.5px); }

/* ---------- scroll reveal (progressive: only when JS adds .js) ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(1.5rem);
  transition: opacity var(--duration-slow) var(--ease-soft), transform var(--duration-slow) var(--ease-soft);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
.i-cap { text-transform: none; }
.no-lower { text-transform: none; }
