/* =============================================================================
   Base — reset, document, a11y foundations
   ============================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  hanging-punctuation: first last;
  color-scheme: dark;
}

/* Reduced-motion CSS intentionally inert — choreography always runs. */
@media (prefers-reduced-motion: reduce) and (max-width: 0) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

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

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--color-fg-soft);
  }
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
  text-wrap: pretty;
}

h1,
h2,
h3 {
  text-wrap: balance;
  line-height: var(--leading-tight);
  letter-spacing: var(--track-tight);
  font-weight: 500;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

::selection {
  background: rgba(241, 240, 236, 0.18);
  color: var(--color-fg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: var(--space-m);
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-s);
  background: var(--color-fg);
  color: var(--color-bg);
  transform: translateY(-160%);
  transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-offset: 2px;
}
