/* ============================================================================
 * base.css — reset, element defaults, fluid typography, layout primitives,
 * accessibility helpers, and the global reduced-motion contract.
 * Depends on tokens.css.
 * ==========================================================================*/

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--ink-soft);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

/* ---- Headings ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }

p { max-width: 68ch; }
strong, b { font-weight: 700; color: inherit; }
em { font-style: italic; }
small { font-size: var(--fs-xs); }

a { color: var(--blue-deep); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--blue); }

ul, ol { list-style: none; }

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

/* the hidden attribute must always win over component display rules */
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

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

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

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-mute); }

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

.section { padding-block: var(--section-y); }
.section.tight { padding-block: clamp(40px, 5vw, 72px); }

.stack > * + * { margin-top: var(--s5); }
.row { display: flex; gap: var(--s6); }
.row.wrap { flex-wrap: wrap; }
.row.center { align-items: center; }
.row.between { justify-content: space-between; align-items: center; }

/* ---- Section headers ---------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body);
  font-weight: 800; font-size: var(--fs-eyebrow);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--primary-deep);
}
.eyebrow::before { content: ""; width: 26px; height: 3px; border-radius: 3px; background: currentColor; opacity: 0.9; }
.eyebrow.teal    { color: var(--teal-deep); }
.eyebrow.green   { color: var(--green-deep); }
.eyebrow.amber   { color: var(--amber-deep); }
.eyebrow.purple  { color: var(--purple-deep); }
.eyebrow.magenta { color: var(--magenta-deep); }

.section-head { max-width: 44ch; margin-bottom: var(--s9); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .eyebrow { margin-bottom: var(--s4); }
.section-head .lead { margin-top: var(--s4); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--ink-mute);
  max-width: 54ch;
  font-weight: 500;
}

/* ---- Accessibility ------------------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-weight: 700; font-size: var(--fs-sm);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---- Reveal-on-scroll (driven by motion.js IntersectionObserver) -------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
  will-change: opacity, transform;
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---- Global reduced-motion contract ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
