/* v3 base (base: claude-fable-5-1, round 2026-09-13)
   Reset, typography applied to elements, layout primitives and utilities.
   Consumes semantic tokens only (see tokens.css). */

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--color-line-strong) transparent; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: clip;
  caret-color: var(--color-accent);
}
img, svg, video, iframe { max-width: 100%; display: block; }
img { height: auto; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
ul, ol { padding-left: 1.25em; }
:target { scroll-margin-top: calc(var(--header-height) + var(--space-5)); }
::selection { background: var(--color-accent); color: var(--color-on-accent); }

/* ------------------------------------------------------------ type */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text);
  text-wrap: pretty;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-h1); text-wrap: balance; }
h2 { font-size: var(--text-h2); line-height: 1.2; }
h3 { font-size: var(--text-h3); line-height: 1.3; }
h4 { font-size: var(--text-body); line-height: 1.4; }
h1 em, h2 em { font-style: italic; font-weight: inherit; color: var(--color-accent); }
.display { font-size: var(--text-display); line-height: 1.05; }
p { text-wrap: pretty; }
small, .small { font-size: var(--text-small); }
.lead, .summary { font-size: var(--text-body-lg); line-height: 1.55; max-width: var(--measure); }
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); }
.mono, code, kbd, pre, samp { font-family: var(--font-mono); font-size: var(--text-mono); }
code { background: var(--color-surface-raised); border: var(--border-width) solid var(--color-line); border-radius: var(--radius-sm); padding: 0.1em 0.4em; color: var(--color-text); }
pre {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  line-height: 1.6;
  color: var(--color-text-muted);
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
hr { border: 0; border-top: var(--border-width) solid var(--color-line); margin: var(--space-6) 0; }
strong, b { font-weight: var(--weight-bold); color: var(--color-text); }
time { font-variant-numeric: tabular-nums; }

/* links: accent by default, ink with an underline border inside prose */
a { color: var(--color-accent); text-decoration: none; transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); }
a:hover { color: var(--color-accent-hover); }
.prose a, .facts a, .table a, .row-list a, .card__title a, .summary a, .byline a {
  color: var(--color-text);
  border-bottom: var(--border-width) solid var(--color-line-strong);
}
.prose a:hover, .facts a:hover, .table a:hover, .row-list a:hover, .card__title a:hover, .summary a:hover, .byline a:hover {
  color: var(--color-accent);
  border-color: currentColor;
}
.text-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  border-bottom: var(--border-width) solid var(--color-line-strong);
  /* the visible line stays a text link; the padding and negative margin grow the hit area to 44px without moving the layout */
  padding: 12px 0 13px;
  margin: -12px 0 -13px;
  line-height: 1.4;
}
.text-link:hover { color: var(--color-text); border-color: var(--color-text); }

/* ------------------------------------------------------------ focus and motion */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}
@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;
  }
}

/* ------------------------------------------------------------ layout primitives */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  width: 100%;
}
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-4)); }
.stack--sm { --stack-gap: var(--space-2); }
.stack--lg { --stack-gap: var(--space-6); }
.stack--xl { --stack-gap: var(--space-8); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster-gap, var(--space-3)); align-items: center; }
.cluster--between { justify-content: space-between; }
.grid {
  display: grid;
  gap: var(--grid-gap, var(--space-4));
  grid-template-columns: repeat(auto-fit, minmax(min(var(--grid-min, 260px), 100%), 1fr));
}
.grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 480px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose > h2 { margin-top: var(--space-7); }
.prose > h3 { margin-top: var(--space-6); }
.prose > h2 + *, .prose > h3 + * { margin-top: var(--space-3); }
.prose p, .prose li { color: var(--color-text-muted); font-size: var(--text-body); line-height: 1.7; }
.prose li + li { margin-top: var(--space-2); }
.prose ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
.prose ol.steps li { counter-increment: step; display: flex; gap: var(--space-4); }
.prose ol.steps li::before {
  content: counter(step, decimal-leading-zero) / "";
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  color: var(--color-accent);
  padding-top: 6px;
  flex: 0 0 24px;
}
/* A wide table scrolls inside its wrapper; the edge shadows appear only where there is more to scroll. */
.table-wrap {
  overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(90deg, var(--color-bg) 40%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--color-bg) 40%, transparent) right / 32px 100% no-repeat local,
    linear-gradient(90deg, color-mix(in srgb, var(--color-text) 14%, transparent), transparent) left / 12px 100% no-repeat scroll,
    linear-gradient(270deg, color-mix(in srgb, var(--color-text) 14%, transparent), transparent) right / 12px 100% no-repeat scroll;
}
.section { margin-top: var(--space-8); }
.section--tight { margin-top: var(--space-6); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
/* A page that ends on a band ends on the band. Only a bare container needs room before the footer. */
main { padding-bottom: 0; }
main > .container:last-child { padding-bottom: var(--space-9); }

/* ------------------------------------------------------------ utilities */
.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: -9999px; top: 0;
  z-index: calc(var(--z-header) + 1);
  background: var(--color-inverse-bg);
  color: var(--color-inverse-text);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
}
.skip-link:focus { left: var(--space-3); top: var(--space-3); }
.placeholder {
  font-family: var(--font-mono);
  font-size: max(0.85em, 12px);
  color: var(--color-text-faint);
  border: var(--border-width) dashed var(--color-line-strong);
  border-radius: var(--radius-sm);
  padding: 0 6px;
  white-space: normal;
}
.visually-hidden-until-focus:not(:focus) { position: absolute; left: -9999px; }
