/* ============================================================
   base.css — resets, element defaults, base typography
   Depends on tokens.css (load it first).
   ============================================================ */

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

* { margin: 0; }

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

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

body {
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img { background: var(--c-limestone); } /* warm placeholder while loading */

/* Form elements inherit type */
input, button, textarea, select { font: inherit; color: inherit; }

/* Remove list styling where we opt out via class; keep semantics */
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---- Typography defaults --------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-stretch: var(--display-stretch); /* Archivo width axis → expanded */
  color: var(--text-strong);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-heading);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--ls-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { text-wrap: pretty; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--c-ink); }

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

::selection { background: var(--c-brass); color: var(--c-bone); }

/* ---- Accessibility: visible keyboard focus --------------- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
/* don't show the ring on mouse click, only keyboard */
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100px;
  z-index: var(--z-overlay);
  background: var(--c-ink);
  color: var(--c-bone);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: top var(--dur-quick) var(--ease-standard);
}
.skip-link:focus { top: var(--space-md); color: var(--c-bone); }

/* ---- Layout primitives ----------------------------------- */
/* anchored sections land below the sticky header */
[id] { scroll-margin-top: 6.5rem; }

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

.section { padding-block: var(--space-section); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }
.section--dark { background: var(--bg-dark); color: var(--text-on-dark); }
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--text-on-dark); }
.section--surface { background: var(--bg-surface); }

/* utility text roles */
.overline {
  font-family: var(--font-mono);
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--accent-ink);
}
.section--dark .overline { color: var(--c-brass); }

.lede {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
  color: var(--text-body);
  max-width: 56ch;
}
.section--dark .lede { color: var(--text-on-dark-muted); }

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

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

/* visually hidden until reveal (JS adds .is-visible). Guarded
   for reduced-motion: content is shown immediately. */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out-soft),
              transform var(--dur-slow) var(--ease-out-soft);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

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