/* ==========================================================================
   base.css — reset, element defaults, typography
   Depends on tokens.css. No literal colours, sizes, or spacing here.
   ========================================================================== */

/* --- Reset --------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header instead of hiding beneath it. */
  scroll-padding-top: calc(var(--header-height) + var(--space-m));
}

body {
  min-height: 100svh;
  background-color: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

/* --- Typography ---------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-normal);
  line-height: var(--leading-tight);
  text-wrap: balance;
}

h1 {
  font-family: var(--font-display);
  font-size: var(--step-4);
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  letter-spacing: var(--tracking-tight);
}

h3 {
  font-family: var(--font-body);
  font-size: var(--step-2);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

h4 {
  font-family: var(--font-body);
  font-size: var(--step-1);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

p,
li {
  max-width: var(--measure);
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-s);
}

strong {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--step--1);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--surface-sunken);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-s);
}

/* An eyebrow label above a section heading. */
.eyebrow {
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.lead {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

.text-muted {
  color: var(--text-muted);
}

/* --- Links --------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

/* --- Focus ----------------------------------------------------------------
   A single, always-visible focus treatment. Never remove it: keyboard
   operation is a launch gate, not a nicety. */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-s);
}

/* --- Selection ----------------------------------------------------------- */

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

/* --- Utilities ----------------------------------------------------------- */

/* Visible only to screen readers — until it is focused, which is how the
   skip link reveals itself. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.visually-hidden:focus-visible {
  position: fixed;
  top: var(--space-s);
  left: var(--space-s);
  z-index: 100;
  width: auto;
  height: auto;
  padding: var(--space-2xs) var(--space-s);
  overflow: visible;
  clip-path: none;
  background-color: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
}

/* --- Reduced motion -------------------------------------------------------
   One rule, applied globally, so no component can reintroduce motion for a
   visitor who has asked for none. */

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