:root {
  --bg: #fcfcfb;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink2: #55554f;
  --ink3: #86867f;
  --line: #e7e7e3;
  --soft: #f4f3f0;
  --sl: #8a8a8a;
  --mojo: #7d3f98;
  --mojo-soft: #f3ecf7;
  --unl: #3b7dd8;
  --joint: #159a72;
  --alt: #b5651d;
  --ref: #c2c2c2;
  --radius: 14px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--mojo); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.m { font-family: var(--mono); font-size: .9em; letter-spacing: -.01em; }
.muted { color: var(--ink3); }
sub { font-size: .7em; }

/* nav */
.topnav { position: sticky; top: 0; z-index: 20; background: rgba(252,252,251,.86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topnav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-weight: 800; letter-spacing: .04em; color: var(--ink); opacity: 0; transition: opacity .2s; }
.topnav.scrolled .brand { opacity: 1; }
.nav-links { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--ink2); font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { background: var(--soft); color: var(--ink); text-decoration: none; }
.nav-links a.nav-code { background: var(--ink); color: #fff; }
.nav-links a.nav-code:hover { background: #000; color: #fff; }

/* hero */
.hero { padding: 56px 0 40px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background:
  radial-gradient(600px 260px at 50% 0%, rgba(125,63,152,.10), transparent 70%); pointer-events: none; }
.hero .wrap { position: relative; }
.venue { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mojo); background: var(--mojo-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 20px; }
.hero h1 { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.12; letter-spacing: -.025em; font-weight: 800; margin: 0 auto 14px; max-width: 900px; }
.acronym { font-size: 19px; color: var(--ink2); margin: 0 0 26px; letter-spacing: .01em; }
.acronym b { color: var(--mojo); font-weight: 800; }
.authors { font-size: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; margin-bottom: 10px; }
.authors a { color: var(--ink); font-weight: 500; }
.author { white-space: nowrap; }
.authors sup { color: var(--ink3); font-size: 11px; margin-left: 1px; }
.affils { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; font-size: 14.5px; color: var(--ink2); margin-bottom: 6px; }
.affils span { display: inline-flex; align-items: center; gap: 6px; }
.affils img { height: 20px; width: auto; }
.affils.small { font-size: 13px; color: var(--ink3); margin-bottom: 26px; }
.affils sup { color: var(--ink3); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px; transition: transform .12s, box-shadow .12s, border-color .12s; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.07); border-color: #d6d6d0; }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-dark:hover { background: #000; border-color: #000; }

/* tl;dr */
.tldr { padding-top: 8px; }
.lead { font-size: 20px; line-height: 1.6; color: var(--ink); max-width: 860px; margin: 0 auto 32px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--mojo); line-height: 1.1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.stat-value span { font-size: 16px; font-weight: 500; color: var(--ink3); letter-spacing: 0; }
.stat-label { font-size: 14px; color: var(--ink2); line-height: 1.45; }

.contrib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.c-item { display: flex; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--soft); }
.c-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--mojo); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; margin-top: 2px; }
.c-item h4 { margin: 0 0 4px; font-size: 16px; }
.c-item p { margin: 0; font-size: 14.5px; color: var(--ink2); line-height: 1.5; }

/* sections */
.section { padding-top: 72px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--mojo); margin-bottom: 6px; }
h2 { font-size: clamp(26px, 3.2vw, 34px); letter-spacing: -.02em; line-height: 1.2; margin: 0 0 12px; font-weight: 750; }
h3 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.005em; }
h4 { font-size: 16px; margin: 0 0 6px; }
.intro { font-size: 17px; color: var(--ink2); max-width: 820px; margin: 0 0 24px; }
.intro b { color: var(--ink); }
.callout { border-left: 3px solid var(--mojo); background: var(--mojo-soft); padding: 14px 18px; border-radius: 0 10px 10px 0; font-size: 15.5px; color: var(--ink); margin: 18px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 16px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head.col { flex-direction: column; gap: 10px; }
.card-head.col > div:first-child { flex: none; }
.card-head > div:first-child { min-width: 0; flex: 1 1 380px; }
.sub { margin: 0; font-size: 14px; color: var(--ink3); line-height: 1.45; }
.caption { font-size: 14px; color: var(--ink2); margin: 10px 0 4px; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .card + .grid-2 { margin-top: 18px; }
.align-start { align-items: start; }

/* controls */
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: 500 14px var(--sans); color: var(--ink2); padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.03); }
.seg.small button { font-size: 13px; padding: 5px 10px; }
.controls-row { display: flex; gap: 10px; flex-wrap: wrap; }
.select-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink2); }
select { font: 500 14px var(--sans); color: var(--ink); background: var(--soft); border: 0; border-radius: 9px; padding: 7px 30px 7px 12px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2355554f' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.btn-sm { border: 1px solid var(--line); background: var(--card); font: 500 13.5px var(--sans); padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--ink); }
.btn-sm:hover { border-color: #cfcfca; background: var(--soft); }
.slider { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink2); }
.slider input { accent-color: var(--mojo); width: 130px; }
.slider output { font-family: var(--mono); font-size: 13px; color: var(--ink); min-width: 26px; }

/* legends */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink2); margin: 2px 0 8px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.hollow { border: 2px solid #a3a3a3; background: var(--card); }
.sq { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tick-key { width: 0; height: 13px; border-left: 1.5px dashed var(--ink3); display: inline-block; margin: 0 4px; }
.dash-key { width: 18px; height: 0; border-top: 1.5px dashed var(--ink); display: inline-block; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* charts */
.chart { width: 100%; position: relative; }
.chart.center { display: flex; justify-content: center; }
svg.chart { display: block; overflow: visible; font-family: var(--sans); }
svg .tick { font-size: 12px; fill: var(--ink3); font-variant-numeric: tabular-nums; }
svg .axis-label { font-size: 12.5px; fill: var(--ink2); }
svg .row-label { font-size: 13px; fill: var(--ink); }
svg .row-label.mono { font-family: var(--mono); font-size: 12px; }
svg .row-label.ref { fill: var(--ink3); }
svg .group-label { font-size: 13px; fill: var(--ink); font-weight: 500; }
svg .delta, svg .value { font-size: 12px; fill: var(--ink2); font-variant-numeric: tabular-nums; }
svg .end-label { font-size: 12px; fill: var(--ink2); font-family: var(--mono); }
svg .sig { font-size: 15px; fill: var(--ink); font-weight: 600; }
svg .cell-val { font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
svg .panel-title { font-size: 13.5px; font-weight: 600; fill: var(--ink); }
svg .panel-sub { font-size: 12px; fill: var(--ink3); }
svg .row.hover .row-label { font-weight: 600; }
svg .row .bar { transition: opacity .12s; }
svg .row.hover .bar { opacity: .8; }
svg .cell:hover rect { stroke: var(--ink); stroke-width: 1.5; }
.multiples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 18px; }
.multiples .panel h5 { margin: 6px 0 0; font-size: 14px; font-weight: 600; }
.multiples .panel .ps { font-size: 12.5px; color: var(--ink3); margin-bottom: 2px; }

.chart-tip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.12); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; line-height: 1.55; max-width: 300px; font-variant-numeric: tabular-nums; }
.chart-tip b { font-weight: 600; }

details.data { margin-top: 6px; }
details.data summary { cursor: pointer; font-size: 13px; color: var(--ink3); list-style: none; display: inline-block; padding: 2px 0; }
details.data summary::before { content: '▸ '; }
details.data[open] summary::before { content: '▾ '; }
details.data summary:hover { color: var(--ink); }
details.data > div { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; width: 100%; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink2); font-weight: 600; background: var(--soft); }

/* explainer */
.explainer .controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 14px; }
.ex-canvas { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ex-canvas svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
.ex-canvas .chunk-hit { cursor: pointer; }
.ex-canvas .lane-label { font-size: 13px; font-weight: 600; fill: var(--ink); }
.ex-canvas .lane-sub { font-size: 11.5px; fill: var(--ink3); }
.ex-canvas .ghost { opacity: .18; transition: opacity .25s; }
.ex-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink2); margin-top: 10px; }
.ex-legend span { display: inline-flex; align-items: center; }

.design-points { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.design-points > div { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.design-points h4 { font-size: 15px; margin-bottom: 4px; }
.design-points p { margin: 0; font-size: 14px; color: var(--ink2); line-height: 1.5; }

.figure { margin: 18px 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.figure img { width: 100%; height: auto; display: block; }
.figure figcaption { font-size: 14px; color: var(--ink2); margin-top: 12px; line-height: 1.5; }

.text-cols ul { margin: 0; padding-left: 20px; color: var(--ink2); }
.text-cols li { margin-bottom: 8px; }

/* bib */
.bib { position: relative; background: #17161a; border-radius: var(--radius); padding: 16px 18px 6px; }
.bib .seg { background: rgba(255,255,255,.08); }
.bib .seg button { color: #bdbdc4; }
.bib .seg button.on { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; }
.bib .copy { position: absolute; top: 16px; right: 18px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #e8e8ec; }
.bib .copy:hover { background: rgba(255,255,255,.16); }
.bib pre { margin: 12px 0 10px; overflow-x: auto; }
.bib code { font: 13px/1.65 var(--mono); color: #e7e3ee; }
.related { font-size: 15px; color: var(--ink2); margin-top: 18px; }
.related code { font-family: var(--mono); font-size: .9em; }

footer { margin-top: 80px; border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--ink2); }
footer p { margin: 4px 0; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .design-points { grid-template-columns: repeat(2, 1fr); }
  .multiples { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .grid-2, .contrib { grid-template-columns: 1fr; }
  .grid-2 > .card { margin-bottom: 0; }
  .nav-links a:not(.nav-code) { display: none; }
  .brand { opacity: 1; }
}
@media (max-width: 520px) {
  .ex-canvas svg { min-width: 720px; }
  .ex-scroll-hint { display: block !important; }
  .wrap { padding: 0 16px; }
  .stats, .design-points { grid-template-columns: 1fr; }
  .lead { font-size: 17.5px; text-align: left; }
  .card { padding: 16px 14px 12px; }
  .hero { padding-top: 36px; }
}

.ex-scroll-hint { display: none; font-size: 12.5px; color: var(--ink3); margin: 4px 0 0; }
.figure a { display: block; cursor: zoom-in; }
