/* =====================================================================
   BASE — reset, document defaults, typography primitives, utilities.
   Every value here comes from tokens.css.
   ===================================================================== */

/* ---------- 1. Reset ---------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keep anchored sections clear of the fixed header */
  scroll-padding-top: calc(var(--header-height) + var(--space-lg));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background-color: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img { height: auto; }

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

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

ul[class],
ol[class] { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

/* The hidden attribute must win over component display rules (.btn, etc.) */
[hidden] { display: none !important; }

/* ---------- 2. Typography ---------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--color-ink-900);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p { text-wrap: pretty; }

strong, b { font-weight: var(--weight-semibold); }

/* ---------- 3. Accessibility ---------- */

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

/* Visually hidden, still read by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: var(--z-modal);
  padding: var(--space-sm) var(--space-lg);
  background-color: var(--color-accent);
  color: var(--color-ink-900);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-out);
}

.skip-link:focus-visible { transform: translateY(0); }

/* ---------- 4. Layout primitives ---------- */

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

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

.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-tight); }
.section--sunk { background-color: var(--color-canvas-sunk); }

/* ---------- 5. Shared type patterns ---------- */

/* Small uppercase kicker that sits above a section heading */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-primary);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background-color: var(--color-accent);
  border-radius: var(--radius-pill);
}

.eyebrow--on-dark { color: var(--color-accent); }
.eyebrow--on-dark::before { background-color: var(--color-accent); }

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: var(--measure);
}

.lede--on-dark { color: var(--color-text-on-dark-muted); }

/* Highlighted words inside a heading */
.accent-text { color: var(--color-primary); }
.accent-text--yellow { color: var(--color-accent-text); }

/* A hand-drawn-feeling underline used on one key phrase per section */
.underline-sweep {
  position: relative;
  white-space: nowrap;
}

.underline-sweep::after {
  content: "";
  position: absolute;
  left: -0.06em;
  right: -0.06em;
  bottom: 0.02em;
  height: 0.3em;
  background-color: var(--color-accent);
  opacity: 0.42;
  border-radius: var(--radius-pill);
  z-index: -1;
}

/* ---------- 6. Scroll-reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

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

/* Stagger helper for groups of revealed items */
.reveal[data-delay="1"] { transition-delay: 90ms; }
.reveal[data-delay="2"] { transition-delay: 180ms; }
.reveal[data-delay="3"] { transition-delay: 270ms; }
.reveal[data-delay="4"] { transition-delay: 360ms; }

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