/* Reset, body theming, typography defaults, layout primitives. Requires design-system.css. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--duration-base) ease, color var(--duration-base) ease;
}

img, svg, video, picture { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--text-display); }
h2 { font-size: clamp(var(--text-2xl), 1.2rem + 2vw, 2.75rem); }
h3 { font-size: var(--text-xl); line-height: var(--leading-snug); }
p { text-wrap: pretty; }
p + p { margin-top: var(--space-4); }

a { color: var(--primary-color); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: var(--tracking-mono);
}

::selection { background: var(--secondary-color); color: #2A2420; }

/* Focus: visible for keyboard only */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--md { max-width: var(--container-md); }
.container--lg { max-width: var(--container-lg); }

.section { padding-block: var(--section-y); }
.section--alt { background-color: var(--bg-secondary); }

.lead {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 60ch;
}
.text-muted { color: var(--text-secondary); }

/* Accessibility helpers */
.sr-only {
  position: absolute !important;
  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(--space-4);
  top: var(--space-2);
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

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