/* =========================================================
   Base — reset, typography, utilities
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}

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

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

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur) var(--ease-out);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
  margin: 0 0 0.4em;
}

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

em {
  font-style: italic;
  color: var(--color-accent-ink);
}

::selection {
  background: var(--color-accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }

/* ---------- Section primitives ---------- */

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
}

.section--alt {
  background: var(--color-bg-warm);
}

.section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem);
}

.section__head--center {
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
}

.section__title {
  margin: 0;
  max-width: 24ch;
}

.section__head--center .section__title {
  max-width: 22ch;
}

.section__sub {
  color: var(--color-ink-muted);
  font-size: var(--fs-lede);
  max-width: 60ch;
  margin: 0.75rem 0 0;
  line-height: 1.55;
}

.section__head-aside {
  color: var(--color-ink-muted);
  max-width: 38ch;
  margin: 0;
  font-size: 1rem;
}

@media (max-width: 720px) {
  .section__head {
    flex-direction: column;
    align-items: start;
  }
}

/* ---------- Type utilities ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-sans);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin: 0 0 1.25rem;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.eyebrow--light {
  color: rgba(255, 255, 255, 0.78);
}

.lede {
  font-size: var(--fs-lede);
  line-height: 1.55;
  color: var(--color-ink-2);
  max-width: 56ch;
}

/* ---------- Accessibility helpers ---------- */

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-bg-dark);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

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

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

.hide-sm {
  display: none;
}

@media (min-width: 720px) {
  .hide-sm { display: inline-flex; }
}
