/* ==========================================================================
   Base — reset, defaults, accessibility primitives
   ========================================================================== */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--text-on-light);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga' 1, 'kern' 1;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

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

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--electric);
  color: var(--white);
}

/* ---------- Scrollbar (progressive enhancement, webkit only) ---------- */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--ice);
}
::-webkit-scrollbar-thumb {
  /* Was brand-pale (1.36:1) — failed the 3:1 UI-component contrast
     minimum against the ice track. This is a soft medium blue-gray
     tuned to pass (3.45:1) while staying visually quiet. */
  background: #6B87B0;
  border-radius: var(--radius-full);
  border: 3px solid var(--ice);
}
::-webkit-scrollbar-thumb:hover {
  /* Was brand-mid (2.39:1, same failure). electric-dim is already
     established elsewhere on the site and passes comfortably (4.84:1). */
  background: var(--electric-dim);
}

/* ---------- Focus states (never remove without replacing) ---------- */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--electric);
  outline-offset: 3px;
  border-radius: 4px;
}
.on-dark :focus-visible {
  outline-color: var(--electric-2);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-2);
  z-index: var(--z-modal);
  background: var(--electric);
  color: var(--white);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-2);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Visually hidden (accessible text) ---------- */
.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;
}
