/* Reset, typography and shared components. Tokens only. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--step-0); line-height: 1.47; letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-optical-sizing: auto;
}
img, svg, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 var(--s4); text-wrap: balance; }
h1 { font-size: var(--step-4); line-height: 1.03; letter-spacing: -0.035em; }
h2 { font-size: var(--step-3); line-height: 1.07; letter-spacing: -0.03em; }
h3 { font-size: var(--step-2); line-height: 1.12; letter-spacing: -0.022em; }
h4 { font-size: var(--step-1); line-height: 1.2; letter-spacing: -0.018em; }
p, ul, ol { margin: 0 0 var(--s4); }
p, li { text-wrap: pretty; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: oklch(0.56 0.2 256 / 0.28); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s4); top: -4rem; background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); z-index: 100; border-radius: var(--r1); }
.skip:focus { top: var(--s3); }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.num { font-variant-numeric: tabular-nums; }
.label { font-weight: 600; font-size: var(--step--1); color: var(--text-muted); letter-spacing: 0; }
.mono { font-variant-numeric: tabular-nums; }

/* buttons: pill, 48px tap target */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0;
  min-height: var(--tap); padding: 0 1.5rem; border-radius: var(--pill); border: 1px solid transparent;
  font: 500 var(--step-0)/1 var(--font); letter-spacing: -0.012em;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast);
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn [data-price] { margin-left: .35em; }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--accent); }
.btn.ghost:hover { background: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: var(--surface-2); color: var(--text); }
.btn.quiet:hover { background: var(--line); }
.btn.small { min-height: 2.5rem; padding: 0 1.1rem; font-size: .9375rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.more { font-size: var(--step-0); font-weight: 400; display: inline-flex; align-items: center; min-height: var(--tap); }
.more::after { content: "›"; margin-left: .3em; font-size: 1.3em; line-height: 1; transition: transform var(--t-fast) var(--ease); }
.more:hover::after { transform: translateX(3px); }

.chip { display: inline-flex; align-items: center; gap: .4em; padding: .1em .65em; border-radius: 999px; font-size: var(--step--1); font-weight: 600; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.chip.ok { color: var(--good); background: color-mix(in oklch, var(--good) 14%, transparent); }
.chip.warn { color: var(--caution); background: color-mix(in oklch, var(--caution) 16%, transparent); }
.chip.stop { color: var(--danger); background: color-mix(in oklch, var(--danger) 14%, transparent); }

/* fact tokens with citation popover */
.fact { font-weight: 600; border-bottom: 1.5px dotted var(--accent); cursor: help; }
.fact.nw { white-space: nowrap; }
.fact:focus-visible { outline-offset: 3px; }
.fact sup { font-size: .6em; color: var(--accent); margin-left: 2px; font-weight: 700; }
.fact.conflict { border-bottom-color: var(--caution); }
.fact-pop {
  position: absolute; z-index: 60; max-width: min(22rem, calc(100vw - 2rem)); padding: var(--s4);
  background: oklch(0.2 0.004 260 / 0.94); color: oklch(0.97 0.002 260); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid oklch(0.97 0.002 260 / 0.16); border-radius: var(--r3); box-shadow: var(--shadow-lg);
  font-size: .875rem; line-height: 1.45; font-weight: 400; white-space: normal; letter-spacing: -0.006em;
}
.fact-pop b { color: oklch(0.97 0.002 260); font-weight: 600; }
.fact-pop a { color: oklch(0.74 0.15 250); }
.fact-pop .mono { color: oklch(0.74 0.008 260); }

/* callouts: rounded tinted blocks, label on top. No side stripes. */
.callout { background: color-mix(in oklch, var(--accent) 7%, var(--surface)); padding: var(--s4) var(--s5); border-radius: var(--r3); margin: var(--s5) 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .label { display: block; margin-bottom: var(--s1); color: var(--accent); font-weight: 600; }
.callout.warn { background: color-mix(in oklch, var(--caution) 11%, var(--surface)); } .callout.warn .label { color: var(--caution); }
.callout.stop { background: color-mix(in oklch, var(--danger) 9%, var(--surface)); } .callout.stop .label { color: var(--danger); }
.callout.fine { background: transparent; border: 1px dashed var(--line); } .callout.fine .label::before { content: "§ "; }

table { border-collapse: collapse; width: 100%; font-size: .9375rem; margin: 0 0 var(--s5); }
th, td { text-align: left; padding: var(--s3) var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: .8125rem; }
.tablewrap { overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r2); min-height: var(--tap); padding: 0 var(--s4); width: 100%; letter-spacing: -0.012em;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 22%, transparent); outline: none; }
textarea { padding: var(--s3) var(--s4); min-height: 8rem; }
label { display: block; font-weight: 600; margin-bottom: var(--s2); font-size: .9375rem; }
.hint { font-size: .875rem; color: var(--text-muted); margin-top: var(--s1); letter-spacing: -0.006em; }

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