/* ==========================================================================
   Base — fonts, document defaults, typography, links, focus
   ========================================================================== */

/* --------------------------------------------------------------------------
   Self-hosted fonts (variable, latin subset, woff2)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Urbanist";
  src: url("../fonts/urbanist-var.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Metric-tuned local fallbacks to minimize swap layout shift */

@font-face {
  font-family: "Urbanist Fallback";
  src: local("Arial");
  size-adjust: 98%;
  ascent-override: 96%;
  descent-override: 25%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Open Sans Fallback";
  src: local("Arial");
  size-adjust: 105%;
  ascent-override: 101%;
  descent-override: 28%;
  line-gap-override: 0%;
}

/* --------------------------------------------------------------------------
   Document
   -------------------------------------------------------------------------- */

html {
  /* Breathing room above anchor targets; header is not sticky, so nothing
     can obscure focused elements (WCAG 2.4.12) */
  scroll-padding-block-start: var(--space-md);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color: var(--color-text-body);
  background-color: var(--color-surface-page);
}

::selection {
  background-color: var(--color-action-primary);
  color: var(--color-action-on-primary);
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-heading);
  text-wrap: balance;
}

p {
  max-inline-size: 70ch;
}

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

a {
  color: var(--color-action-primary);
  text-decoration-thickness: from-font;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-action-primary-hover);
}

/* --------------------------------------------------------------------------
   Focus (WCAG 2.4.11–2.4.13) — never removed, 3:1+ ring, encloses target
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   Reduced motion (WCAG 2.3.3) — kill transforms/smooth scroll globally
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}
