*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--chalk); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
a { color: var(--blue); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(248,249,250,.88);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand b { font-size: 15px; font-weight: 650; white-space: nowrap; }
.brand .rule { width: 26px; height: 3px; background: var(--gold); border-radius: 2px; flex: none; }
.pub {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  background: var(--gold-wash); border: 1px solid var(--gold-edge);
  color: var(--gold-deep); border-radius: 999px; padding: 4px 11px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; white-space: nowrap;
  text-decoration: none;
}
.pub::before { content:""; width:6px; height:6px; border-radius:50%; background: var(--gold); }
.pub::after { content:"\2197"; font-size: 12px; }
.pub:hover { border-color: var(--gold); }
.pub:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── hero ────────────────────────────────────────────────────────────────── */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(26px, 3.4vw, 40px); max-width: 20ch; }
.hero .sub { color: var(--ink-3); margin-top: 12px; max-width: 68ch; font-size: 15.5px; }
.hero .meta { margin-top: 10px; font-size: 12.5px; color: var(--ink-4); }

.stats { display: grid; gap: 12px; margin: 26px 0 8px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow);
}
.stat.accent { background: var(--gold-wash); border-color: var(--gold-edge); }
.stat .k { font-family: var(--mono); font-size: 27px; font-weight: 600;
  letter-spacing: -.02em; display: block; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.stat .ci { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }

/* ── tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; margin: 30px 0 0; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 11px 15px; font: inherit; font-size: 14px; font-weight: 550;
  color: var(--ink-3); border-bottom: 2.5px solid transparent;
  white-space: nowrap; transition: color .15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 4px; }

/* ── panels ──────────────────────────────────────────────────────────────── */
.panel { padding: 26px 0 60px; }
.panel[hidden] { display: none; }
.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 20px; margin-top: 6px; }
.panel-head p { color: var(--ink-3); margin: 8px 0 0; max-width: 78ch; font-size: 14px; }

.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; }
.card-head .hint { font-size: 12.5px; color: var(--ink-4); margin-left: auto; }

/* ── controls ────────────────────────────────────────────────────────────── */
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--frost); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px; gap: 2px;
  flex-wrap: wrap; max-width: 100%; }
.seg button {
  appearance: none; border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 550; color: var(--ink-3);
  padding: 6px 11px; border-radius: 4px; white-space: nowrap; transition: all .12s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink);
  box-shadow: 0 1px 2px rgba(26,29,35,.10); }
.seg button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.ctl-label { font-size: 11px; font-weight: 600; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ink-4); margin-right: 2px; }

.chip {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 550;
  border: 1px solid var(--border); background: var(--white); color: var(--ink-3);
  border-radius: 999px; padding: 5px 11px; display: inline-flex; align-items: center; gap: 6px;
  transition: all .12s;
}
.chip:hover { border-color: var(--border-str); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ── chart surfaces ──────────────────────────────────────────────────────── */
.chart { width: 100%; overflow: visible; display: block; }
.chart text { font-family: var(--sans); fill: var(--ink-2); }
.chart .tick text { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-4); }
.chart .lbl { font-size: 11.5px; fill: var(--ink-2); }
.chart .val { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); font-weight: 500; }
.chart .axis-title { font-size: 11.5px; fill: var(--ink-3); }
.chart .grid line { stroke: var(--frost-deep); shape-rendering: crispEdges; }
.chart .bar { transition: opacity .15s; }
.chart .dim { opacity: .18; }
.chart .whisk { stroke: var(--ink-2); stroke-width: 1.2; }
.chart .phys-line { stroke: var(--physician); stroke-width: 1.6; stroke-dasharray: 5 4; }
.chart .phys-band { fill: var(--physician-band); }
.chart .phys-lbl { font-family: var(--mono); font-size: 10.5px; fill: var(--ink); font-weight: 600; }
.chart .pinned { stroke: var(--ink); stroke-width: 2; }
.grid-sm { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

/* ── tooltip ─────────────────────────────────────────────────────────────── */
.tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%) translateY(-10px);
  background: var(--white); border: 1px solid var(--border-str);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 12.5px; max-width: 290px; transition: opacity .1s;
}
.tip.on { opacity: 1; }
.tip .t { font-weight: 650; display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.tip .t .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip .r { display: flex; justify-content: space-between; gap: 18px; color: var(--ink-3);
  font-size: 12px; padding: 1.5px 0; }
.tip .r b { font-family: var(--mono); color: var(--ink); font-weight: 600; }
.tip .n { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--ink-4); }

/* ── notes / methods ─────────────────────────────────────────────────────── */
.note {
  background: var(--gold-wash); border: 1px solid var(--gold-edge);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px;
  color: var(--ink-2); margin-bottom: 16px;
}
.note b { color: var(--gold-deep); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3);
  align-items: center; margin-top: 12px; }
.legend i { display: inline-flex; align-items: center; gap: 6px; font-style: normal; }
.legend .sw { width: 11px; height: 11px; border-radius: 2px; }
.legend .sw.hatch { background: repeating-linear-gradient(45deg,var(--ink-4) 0 2px,transparent 2px 4px);
  border: 1px solid var(--ink-4); }
.legend .sw.dash { width: 18px; height: 0; border-top: 2px dashed var(--physician); border-radius: 0; }
.legend .sw.ring { background: var(--white); border: 2px solid var(--ink-4); }

.methods { border-top: 1px solid var(--border); padding: 30px 0 70px; }
.methods ul { margin: 12px 0 0; padding-left: 20px; color: var(--ink-3); font-size: 13.5px; }
.methods li { margin-bottom: 8px; max-width: 92ch; }
.methods .cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); margin-top: 16px; }
.methods h3 { font-size: 13px; margin-bottom: 6px; }
.methods p { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.methods p + h3 { margin-top: 18px; }
.methods .cite { overflow-wrap: anywhere; }

.empty { color: var(--ink-4); font-size: 13.5px; padding: 30px 0; text-align: center; }

@media (max-width: 720px) {
  .hero { padding-top: 26px; }
  .stat .k { font-size: 23px; }
  .card { padding: 14px 12px; }
  .topbar .wrap { height: 52px; }
  .brand b { font-size: 13.5px; }
  .pub { font-size: 10px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
