/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Anchor targets must clear the 72px sticky site header (62px <= 640px). */
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  /* `clip` (not `hidden`) so the page does not become a scroll container,
     which would prevent `.site-header { position: sticky }` from sticking. */
  overflow-x: clip;
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 76px;
  }
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--bg-page);
  min-height: 100vh;
  width: 100%;
  /* `clip` keeps the sticky site header working (see html rule above). */
  overflow-x: clip;
  position: relative;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--get-blue-600);
  color: #ffffff;
}

/* Accessible Skip to Content Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--get-blue-800);
  color: var(--milk-000);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus {
  top: 16px;
  outline: 3px solid var(--warning);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 700;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 {
  font-size: clamp(1.85rem, 4.5vw, 3.25rem);
  font-weight: 800;
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: 1.1rem;
}

p {
  margin-bottom: var(--space-4);
  max-width: var(--measure);
  overflow-wrap: break-word;
}

small, .text-sm {
  font-size: 0.875rem;
  line-height: 1.5;
}

strong, b {
  font-weight: 600;
  color: var(--text-main);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
a:hover {
  color: var(--color-primary-hover);
}

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

ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}
li {
  margin-bottom: var(--space-1);
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (max-width: 380px) {
  .container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1200px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* Focus Visibility (WCAG 2.1 AA) */
:focus-visible {
  outline: 3px solid var(--get-blue-600);
  outline-offset: 2px;
}

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

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