/* base.css — reset + base element styles. Loads after fonts.css + tokens.css.
   Foundational only; component/section styling lives in components.css / sections.css. */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;   /* sticky header height + breathing room for anchor jumps */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-weight: var(--w-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Headings — display face, tokenised weight/tracking. Sizes set by components/sections. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--disp);
  font-weight: var(--w-semi);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-heading);
}

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

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

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

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

/* Keyboard focus only — never suppress without a replacement. */
:focus-visible {
  outline: 2px solid var(--green-deep);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- Layout container ---- */
.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---- A11y utilities ---- */
.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;
}
.skip-link {
  position: absolute;
  left: var(--space-4); top: -100%;
  z-index: calc(var(--z-modal) + 1);
  background: var(--paper);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-4);
}
.skip-link:focus { top: var(--space-4); }

/* ---- Motion utilities (the site's one signature: staggered fade-up + scroll reveal) ---- */
@media (prefers-reduced-motion: no-preference) {
  /* on-load stagger (hero) */
  .anim { opacity: 0; transform: translateY(14px); animation: up var(--dur-reveal) both var(--ease); }
  .anim.d1 { animation-delay: .08s; }
  .anim.d2 { animation-delay: .18s; }
  .anim.d3 { animation-delay: .28s; }
  .anim.d4 { animation-delay: .38s; }
  /* scroll reveal — only hidden when JS is present (ui.js adds .in when in view);
     without JS the .js class is never set, so content stays visible. */
  .js .reveal { opacity: 0; transform: translateY(18px); }
  .js .reveal.in { animation: up var(--dur-reveal) both var(--ease); }
}
@keyframes up { to { opacity: 1; transform: none; } }

/* ---- Reduced-motion safety net (JS also gates reveals) ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
