/* ==========================================================================
   Base — reset, typography, primitives
   ========================================================================== */

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.018em;
}

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}
a:hover { text-decoration-color: currentColor; }

strong, b { font-weight: 650; }

sup { font-size: .68em; line-height: 0; vertical-align: super; }

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

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

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-sm);
}

::selection {
  background: color-mix(in srgb, var(--c-accent) 34%, transparent);
  color: var(--ink);
}

/* ---- Utility ------------------------------------------------------------ */

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

.u-num {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-num lining-nums;
  font-feature-settings: "tnum" 1;
}

.u-nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: .84rem;
  padding: .7rem 1.2rem;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ---- Reveal-on-scroll --------------------------------------------------- */

/* Only hide content once JS has confirmed it can reveal it again. Without
   this guard a script failure would leave the page blank. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
