/* Reset, document typography, links, focus, skip link and utilities (docs/DESIGN.md 2, 4.2, 7). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: inline-block; vertical-align: middle; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; color: var(--text-1); font-weight: 600; letter-spacing: var(--tracking-tight); }
h1 { font-size: var(--text-2xl); line-height: var(--lh-2xl); }
h2 { font-size: var(--text-xl); line-height: var(--lh-xl); }
h3 { font-size: var(--text-lg); line-height: var(--lh-lg); }
h4 { font-size: var(--text-base); line-height: var(--lh-base); }
p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }
small { font-size: var(--text-sm); }
strong, b { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
ul, ol { margin: 0 0 var(--space-4); padding-left: var(--space-6); }

/* ---- links (4.2) */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--dur-fast) var(--ease), text-decoration-color var(--dur-fast) var(--ease);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

/* ---- code */
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .9em; }
code {
  padding: 1px var(--space-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875em;
  overflow-wrap: anywhere;
}
pre code { padding: 0; background: none; border: 0; font-size: inherit; }
kbd {
  font-size: var(--text-xs); padding: 0 var(--space-2); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: var(--radius-sm); background: var(--surface);
}

/* ---- focus (7): every interactive element shows the ring on :focus-visible */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
a:focus-visible { border-radius: var(--radius-sm); }

/* ---- skip link */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-5); background: var(--surface); color: var(--text-1);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  font-weight: 500; text-decoration: none;
}
.skip-link:focus-visible { top: var(--space-4); }

/* ---- utilities */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--font-mono); font-size: .9em; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.text-sm { font-size: var(--text-sm); line-height: var(--lh-sm); }
.text-xs { font-size: var(--text-xs); line-height: var(--lh-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-3); }
.stack--lg { gap: var(--space-7); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--space-4); } .mt-6 { margin-top: var(--space-6); } .mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.grid-2 { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1280px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.measure { max-width: 70ch; }
.form-col { max-width: var(--form-max); }

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