:root {
  --ink: #1f2830;
  --ink-2: #4b5761;
  --muted: #6b757e;
  --accent: #164a82;
  --accent-2: #3f74ab;
  --tint: #c9d8e8;
  --tint-2: #eef2f6;
  --line: #e1e5ea;
  --warn: #9a4a12;
  --warn-bg: #fbf3ec;
  --bg: #fff;
  --sans: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --col: 720px;
  --wide: 1060px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.75 var(--serif); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, pre:focus-visible, summary:focus-visible { outline: 3px solid #c07a26; outline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
sup { line-height: 0; }
code { font: .82em var(--mono); background: var(--tint-2); padding: 1px 5px; border-radius: 3px; }
.skip { position: absolute; top: -100px; left: 20px; z-index: 30; background: #fff; padding: 10px 14px; }
.skip:focus { top: 10px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px max(28px, calc((100% - var(--wide)) / 2)); background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font: 13px var(--sans); }
.site-header .home { color: var(--ink); font-weight: 700; white-space: nowrap; }
.site-header .home span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.topnav { display: flex; gap: 22px; }
.topnav a { color: var(--muted); }
.topnav a.active { color: var(--accent); font-weight: 600; }

/* ---------- layout ---------- */
main > section { margin: 0 auto; padding: 0 28px; }
.prose { max-width: calc(var(--col) + 56px); margin-left: auto; margin-right: auto; }
.wide { width: min(var(--wide), calc(100vw - 56px)); margin-left: 50%; transform: translateX(-50%); }
section { margin-bottom: 84px; }

/* ---------- type ---------- */
.kicker, .eyebrow { font: 700 11px/1.4 var(--sans); letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
h1 { font: 700 clamp(40px, 6vw, 68px)/1.04 var(--sans); letter-spacing: -2px; margin: 0 0 24px; }
h2 { font: 650 clamp(26px, 3vw, 33px)/1.22 var(--sans); letter-spacing: -.7px; margin: 0 0 22px; }
h3 { font: 650 19px/1.4 var(--sans); letter-spacing: -.2px; margin: 34px 0 12px; }
p { margin: 0 0 20px; }
blockquote { margin: 34px 0 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent); font-size: 22px; line-height: 1.5; font-style: italic; color: #33475a; }
.fine { font: 12.5px/1.7 var(--sans); color: var(--muted); }

/* ---------- hero ---------- */
.hero { max-width: calc(var(--wide) + 56px); padding-top: 76px !important; margin-bottom: 76px; }
.hero .dek { font-size: 21px; line-height: 1.6; color: var(--ink-2); max-width: 780px; margin-bottom: 30px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 52px; }
.btn { font: 600 13px/1 var(--sans); padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; }
.btn:hover { border-color: var(--accent-2); text-decoration: none; color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0f3a68; color: #fff; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { padding: 20px 20px 18px 0; }
.facts div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.facts dt { font: 700 34px/1 var(--sans); letter-spacing: -1px; color: var(--accent); margin-bottom: 8px; }
.facts dd { margin: 0; font: 13px/1.5 var(--sans); color: var(--ink-2); }

/* ---------- concept figure ---------- */
figure { margin: 36px 0; }
figcaption { font: 13px/1.65 var(--sans); color: var(--muted); margin-top: 12px; }
.mask-concept { padding: 26px 0 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 40px; margin-bottom: 40px; }
.concept-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: start; }
.concept-head { display: flex; flex-direction: column; font: 13px/1.45 var(--sans); margin-bottom: 10px; }
.concept-head b { font-size: 15px; }
.concept-head span { color: var(--muted); }
.concept-svg svg { width: auto; max-width: 100%; height: auto; display: block; }
.mask text, .concept-svg text { font-family: var(--sans); }
.eq { font: italic 17px var(--serif); color: var(--ink-2); margin: 12px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font: 12.5px var(--sans); color: var(--ink-2); margin-top: 18px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 14px; height: 14px; border-radius: 2px; display: inline-block; }
.sw.fixed { background: var(--accent); }
.sw.shown { background: #8eb0d3; }
.sw.gen { background: var(--tint-2); border: 1px solid #d3dbe4; }

/* ---------- loop ---------- */
.loop { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0; margin: 28px 0 0; }
.loop li { counter-increment: s; position: relative; padding: 16px 16px 16px; background: var(--tint-2); border-radius: 8px; font: 13px/1.55 var(--sans); color: var(--ink-2); }
.loop li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; margin-bottom: 10px; }
.loop li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 16px; color: var(--accent-2); font-size: 15px; }
.loop li:last-child::after { content: "↺ back to 1"; position: absolute; right: 14px; top: 18px; color: var(--accent-2); font-size: 11px; }
.loop b { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 4px; }

/* ---------- demo ---------- */
.demo-section { background: linear-gradient(#f5f8fb, #f5f8fb); padding: 70px 28px 46px !important; max-width: none; }
.explorer { max-width: var(--wide); margin: 10px auto 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(20,40,60,.04), 0 8px 30px rgba(20,40,60,.06); overflow: hidden; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.tabs button { font: 600 12.5px/1 var(--sans); padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.tabs button:hover { border-color: var(--accent-2); color: var(--accent); }
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs button.flag { border-style: dashed; border-color: #d9b597; color: var(--warn); }
.tabs button.flag[aria-selected="true"] { background: var(--warn); border-color: var(--warn); border-style: solid; color: #fff; }
.tab-sep { font: 700 10px var(--sans); letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin: 0 4px 0 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.scenario { display: grid; grid-template-columns: minmax(0, 4.6fr) minmax(0, 6fr); gap: 34px; padding: 28px 30px 26px; }
.js .scenario[hidden] { display: none; }
.scenario + .scenario { border-top: 1px solid var(--line); }
.js .scenario + .scenario { border-top: 0; }
.step { display: flex; align-items: center; gap: 8px; font: 700 11px var(--sans); letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.step span { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--accent-2); color: var(--accent); font-size: 10.5px; letter-spacing: 0; }
.request { font-size: 19px; line-height: 1.5; font-style: italic; color: var(--ink); margin-bottom: 22px; }
.chips { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font: 12.5px/1.3 var(--sans); padding: 6px 10px; border-radius: 6px; background: var(--accent); color: #fff; }
.chips b { font-weight: 700; }
.mask svg { width: 100%; height: auto; display: block; }
.mask-count { font: 12.5px/1.5 var(--sans); color: var(--ink-2); margin: 8px 0 22px; }
.mask-count b { color: var(--accent); }
.note { font: 14.5px/1.65 var(--sans); color: var(--ink-2); margin: 0; }
.note.warn { background: var(--warn-bg); border-left: 3px solid var(--warn); padding: 12px 14px; border-radius: 0 6px 6px 0; color: #4a3527; }
.second-look .chips li { background: var(--warn); }
.scn-fig { margin: 0; position: sticky; top: 76px; align-self: start; }
.scn-fig img { border: 1px solid var(--line); border-radius: 6px; }
.scn-fig a { cursor: zoom-in; }
.mask-legend { max-width: var(--wide); margin: 0; padding: 0 30px 20px; }
.no-js-hide { display: none; }

/* ---------- interface ---------- */
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 30px; margin-bottom: 30px; }
.door { margin: 0; display: flex; flex-direction: column; }
.door-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 13px var(--sans); border-bottom: 2px solid var(--accent); padding-bottom: 8px; margin-bottom: 14px; }
.door-head b { font-size: 15px; }
.door-head span { color: var(--muted); }
.door img { border: 1px solid var(--line); border-radius: 6px; }
.json { flex: 1; margin: 0; padding: 16px 18px; background: #0f2236; color: #d8e3ee; border-radius: 6px; font: 12px/1.55 var(--mono); overflow-x: auto; white-space: pre; }
.json .k { color: #9cc7f0; }
.json .c { color: #8ea3b8; font-style: italic; }

.chart-fig { margin: 40px 0; }
.chart-title { font: 600 14px/1.45 var(--sans); margin-bottom: 12px; }
.chart-title span { font-weight: 400; color: var(--muted); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--sans); }

.table-wrap { overflow-x: auto; margin: 24px 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font: 13px/1.55 var(--sans); font-variant-numeric: tabular-nums; text-align: left; }
caption { caption-side: bottom; text-align: left; font-size: 12px; color: var(--muted); padding-top: 10px; }
thead { border-top: 2px solid #6e7d8c; border-bottom: 1px solid #a2adb8; }
th, td { padding: 10px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
th:first-child { padding-left: 0; }
thead th { font-weight: 600; font-size: 12px; color: var(--ink-2); }
tbody th { font-weight: 400; }
td b { color: var(--accent); }
.backbones tbody th { font-weight: 700; color: var(--accent); border-right: 1px solid var(--line); }
.backbones td small { display: block; color: var(--muted); font-size: 11.5px; }
.backbones td:first-of-type { white-space: nowrap; font-weight: 600; }

/* ---------- evidence ---------- */
.qgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px; margin-bottom: 10px; }
.q { border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 6px; font: 13.5px/1.6 var(--sans); color: var(--ink-2); }
.q .qn { font: 700 11px var(--sans); letter-spacing: 1.2px; color: var(--accent); margin: 0 0 6px; }
.q h3 { font-size: 15.5px; line-height: 1.35; margin: 0 0 10px; color: var(--ink); }
.q p { margin-bottom: 12px; }
details.tables { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
details.tables summary { cursor: pointer; font: 600 14px var(--sans); color: var(--accent); }
details.tables[open] summary { margin-bottom: 6px; }

/* ---------- limits & papers ---------- */
.limits { padding: 0; list-style: none; margin: 0 0 24px; }
.limits li { padding: 14px 0 14px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.limits li:first-child { border-top: 1px solid var(--line); }
.limits b { font-family: var(--sans); font-size: 15.5px; margin-right: 4px; }
.timeline { list-style: none; padding: 0; margin: 0 0 20px; border-left: 2px solid var(--tint); }
.timeline li { position: relative; padding: 0 0 30px 26px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.timeline li:last-child::before { background: var(--accent); }
.timeline .when { font: 700 12px var(--sans); letter-spacing: .5px; color: var(--accent); margin: 0 0 6px; }
.timeline .when span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.timeline h3 { margin: 0 0 8px; font-size: 18px; }
.timeline p { font: 14px/1.65 var(--sans); margin: 0 0 6px; }
.authors { color: var(--ink-2); }
.contrib { color: var(--ink); }
.links, .pending { color: var(--muted); }

/* Expandable citations, matching the homepage publication controls. */
.bibtex-toggle { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.bibtex-toggle:hover { text-decoration: underline; text-underline-offset: 4px; }
.bibtex-toggle[aria-expanded="true"] span { display: inline-block; transform: rotate(180deg); }
.papers .bibtex { margin-top: 10px; }
.copy-bibtex-button { padding: 5px 10px; border: 1px solid #a2adb8; border-radius: 4px; background: #fff; color: var(--ink-2); font: 12px/1.5 var(--sans); cursor: pointer; }
.copy-bibtex-button:hover { background: var(--tint-2); }
.copy-status { margin-left: 8px; font: 12px var(--sans); color: var(--muted); }
.bibtex-box { margin: 8px 0 0; padding: 14px; border: 1px solid var(--line); background: #f7f7f7; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 var(--mono); }
.bibtex-box code { padding: 0; background: none; border-radius: 0; font: inherit; }

.site-footer { display: flex; justify-content: space-between; max-width: calc(var(--col) + 56px); margin: 0 auto; padding: 24px 28px 40px; border-top: 1px solid var(--line); font: 12px var(--sans); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .scn-fig { position: static; }
  .qgrid { grid-template-columns: 1fr 1fr; }
  .scenario { grid-template-columns: 1fr; gap: 22px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .topnav { display: none; }
  .concept-grid { grid-template-columns: 1fr; gap: 22px; }
  .loop { grid-template-columns: 1fr 1fr; }
  .loop li::after { display: none; }
  .two-up { grid-template-columns: 1fr; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .tab-sep { white-space: nowrap; }
  .scenario { padding: 22px 18px; }
  .mask-legend { padding: 0 18px 18px; }
  .demo-section { padding: 54px 16px 36px !important; }
}
@media (max-width: 520px) {
  .qgrid, .facts { grid-template-columns: 1fr; }
  .facts div, .facts div + div { padding-left: 0; border-left: 0; }
  .facts div + div { border-top: 1px solid var(--line); }
  .loop { grid-template-columns: 1fr; }
  .hero { padding-top: 48px !important; }
  .site-header .home span { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
