/* ============================================================
   Base  reset, typography baseline, layout primitives
   ============================================================ */

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

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

/* Viewport-height-keyed root scale (desktop only).
   The full-screen snap sections are tuned to look "full" when the viewport
   is short (the way a 125% browser zoom renders a 1080p screen). At 100%
   zoom the viewport is ~960-1016px tall, so the rem-based type/spacing left
   too much empty space (underflow). Scaling the root font with viewport
   height keeps the content/viewport ratio constant: sections fill one screen
   at 100% zoom, while short viewports (laptops, or 125% zoom) stay at 16px so
   nothing overflows. Width guard keeps mobile/tablet at the base size. */
@media (min-width: 1024px) {
  html {
    font-size: clamp(16px, calc(16px + 0.02 * (100vh - 760px)), 20px);
  }
}

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

body {
  background: var(--cd-canvas);
  color: var(--cd-body);
  font-family: var(--cd-font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* --- Heading scale --- */
h1, h2, h3, h4 {
  font-family: var(--cd-font-display);
  font-weight: 400;
  color: var(--cd-ink);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 6vw, 5.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.125rem); }
h4 { font-size: 1.25rem; }

p { max-width: 68ch; }

/* --- Links --- */
a {
  color: var(--cd-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}
a:hover { opacity: 0.7; }

/* --- Lists --- */
ul, ol { list-style: none; }

/* --- Layout primitive --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* --- Accessibility --- */
.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;
}

:focus-visible {
  outline: 2px solid var(--cd-ink);
  outline-offset: 3px;
}
