/* ==========================================================================
   Base: reset, document, typography, layout primitives, motion foundation
   ========================================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--ink-900);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* Body copy line-length cap */
.prose { max-width: 68ch; }

/* --- Focus visibility (accessibility) --- */
:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: var(--z-toast);
  background: var(--primary);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: var(--r-sm);
  transition: top var(--dur-fast) var(--ease-out-quart);
}
.skip-link:focus { top: var(--sp-4); color: #fff; }

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

.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section-tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

.stack > * + * { margin-top: var(--sp-4); }

/* Section intro (NO uppercase eyebrow — a real subhead instead) */
.section-intro { max-width: 62ch; margin-bottom: var(--sp-7); }
.section-intro.center { margin-inline: auto; text-align: center; }
.section-intro h2 { font-size: var(--fs-h2); margin-bottom: var(--sp-3); }
.section-intro p { font-size: var(--fs-lead); color: var(--muted); }

.u-hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Motion foundation: reveal enhances an ALREADY-VISIBLE default --- */
.reveal { opacity: 1; }
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out-expo),
              transform var(--dur-slow) var(--ease-out-expo);
  will-change: opacity, transform;
}
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal[data-delay="1"] { transition-delay: 80ms; }
.js .reveal[data-delay="2"] { transition-delay: 160ms; }
.js .reveal[data-delay="3"] { transition-delay: 240ms; }
.js .reveal[data-delay="4"] { transition-delay: 320ms; }

/* Reduced motion: instant, no transform, no infinite animations */
@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;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
