/* Reset + base typography + accessibility primitives. */

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

::selection { background: var(--selection); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-3);
  color: var(--fg);
}

h1 { font-size: clamp(2rem, 5vw, var(--fs-4xl)); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.4vw, var(--fs-2xl)); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p, ul, ol { margin: 0 0 var(--sp-4); }
ul, ol { padding-left: var(--sp-5); }
li + li { margin-top: var(--sp-1); }

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }

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

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

/* Inline icons: default to text-line size, follow currentColor, sit on the baseline.
   Components override via .icon-btn svg / .btn svg / .chip svg for larger sizes. */
svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

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

.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;
  top: -100px;
  left: var(--sp-3);
  background: var(--accent);
  color: var(--accent-fg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  z-index: 10000;
  transition: top var(--dur-base) var(--ease);
}
.skip-link:focus { top: var(--sp-3); }
