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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-weight: var(--w-semibold);
  letter-spacing: -0.014em;
  line-height: 1.25;
  text-wrap: balance;
}
h1 { font-size: var(--t-24); letter-spacing: -0.02em; }
h2 { font-size: var(--t-17); }
h3 { font-size: var(--t-15); }
h4 { font-size: var(--t-13); }

p { text-wrap: pretty; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img, svg, video { display: block; max-width: 100%; }
svg { flex: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

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

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

/* ---- Focus: visible, consistent, never removed ------------------------ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: fixed;
  top: var(--s-2);
  left: var(--s-2);
  z-index: var(--z-tooltip);
  padding: var(--s-2) var(--s-4);
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  transform: translateY(calc(-100% - var(--s-4)));
  transition: transform var(--d-base) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---- Scrollbars: restrained, not reinvented --------------------------- */
* { scrollbar-color: var(--ink-4) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--ink-4) 55%, transparent);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-3); background-clip: content-box; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* ---- Text utilities --------------------------------------------------- */
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.t-11 { font-size: var(--t-11); }
.t-12 { font-size: var(--t-12); }
.t-13 { font-size: var(--t-13); }
.t-17 { font-size: var(--t-17); }
.t-20 { font-size: var(--t-20); }
.medium { font-weight: var(--w-medium); }
.semibold { font-weight: var(--w-semibold); }
.tnum { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.prose { max-width: 68ch; }
.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;
}

/* ---- Layout utilities ------------------------------------------------- */
.row { display: flex; align-items: center; gap: var(--s-2); }
.row-3 { display: flex; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }

/* ---- Boot ------------------------------------------------------------- */
.boot {
  height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s-4);
}
.boot-mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}
.boot-text { color: var(--ink-3); font-size: var(--t-13); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes shimmer {
  from { background-position: -420px 0; }
  to { background-position: 420px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .boot-mark { animation: none; border-top-color: var(--hairline-strong); }
}
