/* ==========================================================================
   Base — reset, document defaults and primitives shared by every page.
   Depends on: tokens.css
   ========================================================================== */

*,
*::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: var(--space-3xl);
}

body {
  min-height: 100svh;
  background-color: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img {
  height: auto;
}

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

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

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
  text-underline-offset: 0.2em;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

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

:target {
  scroll-margin-top: var(--space-3xl);
}

/* --- Focus ---------------------------------------------------------------
   One visible, high-contrast focus ring everywhere. Never remove it. */
:focus-visible {
  outline: 2px solid var(--brand-t);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--brand-t);
  color: var(--text-inverse);
}

/* --- Layout primitives ---------------------------------------------------- */

.container {
  width: min(100% - var(--gutter) * 2, var(--container));
  margin-inline: auto;
}

.container--narrow {
  --container: var(--container-narrow);
}

.section {
  padding-block: var(--space-4xl);
}

/* --- Accessibility helpers ------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: var(--z-skip-link);
  padding: var(--space-xs) var(--space-md);
  background: var(--brand-t);
  color: var(--text-inverse);
  font-weight: 600;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-out);
}

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

/* --- Motion preference ----------------------------------------------------
   Honour the OS setting. Scripts read the same query via prefersReducedMotion()
   so JS-driven effects are disabled in step with CSS ones. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
