/* Project page style: shares its tokens with qihangli.com so the two read as one site. */
:root{--bg:#fff;--fg:#1f2328;--muted:#6b7280;--link:#1a56a7;--rule:#e5e7eb;--accent:#b1292b;--ph:#f1f3f5;--soft:#f6f7f8}
:root[data-theme="dark"]{--bg:#14161a;--fg:#e6e8eb;--muted:#9aa3ad;--link:#6cb0ff;--rule:#2a2e35;--accent:#ff7b7e;--ph:#1d2026;--soft:#1a1d22;color-scheme:dark}
*{box-sizing:border-box}
html{scroll-behavior:smooth;scroll-padding-top:20px}
body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.65 "Open Sans",-apple-system,"Segoe UI",Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;transition:background .2s,color .2s}
a{color:var(--link);text-decoration:none}a:hover{text-decoration:underline}
img{display:block;max-width:100%;height:auto}
.wrap{max-width:888px;margin:0 auto;padding:56px 24px 40px}
.text{max-width:760px}
/* two widths: running text stays at a 760px measure; figures, panels and tables may use the full 840px. Both start at the same left edge. */
main section>*{max-width:840px}
main section>.text,main section>.note,main section>.tldr{max-width:760px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* header */
.back{font-size:.92rem;color:var(--muted)}
.back:hover{color:var(--link);text-decoration:none}
.kicker{margin:26px 0 6px;color:var(--muted);font-size:.92rem;letter-spacing:.02em}
h1{font-size:1.95rem;line-height:1.25;margin:0 0 .6em;letter-spacing:-.01em;max-width:820px}
.authors{font-size:1.02rem;margin:0 0 .15em}
.authors span{white-space:nowrap}
.authors span:not(:last-child)::after{content:", ";white-space:normal}
.authors a{color:inherit;border-bottom:1px dotted var(--muted)}
.authors a:hover{color:var(--link);text-decoration:none;border-bottom-color:var(--link)}
.affil{margin:0;font-size:.92rem;color:var(--muted)}
.affil span+span{margin-left:1.1em}
.links{margin:.9em 0 0;font-size:.97rem}
.links a{margin-right:.9em}
.links a::before{content:"["}.links a::after{content:"]"}

/* sections */
h2{font-size:1.35rem;margin:48px 0 12px;font-weight:700}
h3{font-size:1rem;margin:0 0 .2em}
p{margin:.7em 0}
.tldr{margin:1.1em 0 0;padding-left:14px;border-left:3px solid var(--rule);color:var(--muted)}
.tldr strong{font-weight:400;opacity:.8}
.lead{color:var(--muted);margin:0 0 .4em}

/* method */
figure{margin:22px 0 0}
figure img{width:100%;border-radius:6px;background:#fff;cursor:zoom-in}
figcaption{margin-top:8px;font-size:.9rem;color:var(--muted)}
/* figure.side: image on the left, caption beside it (desktop); stacks on phones. Keeps tall figures from filling the screen. */
figure.side{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:8px 28px;align-items:center}
figure.side figcaption{margin-top:0}
/* .pair: two figures next to each other, each with its own header line and caption below (stacks on phones). */
.pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 28px;margin-top:26px;align-items:start}
.label{margin:0 0 2px;font-size:1.02rem;font-weight:600;line-height:1.65}
.table-label{margin-top:34px}
.pair .seg,.pair .sub{margin:0 0 10px;font-size:.97rem;line-height:1.65}
.pair .sub{color:var(--muted)}
.pair figure{margin:0}
.steps{display:grid;grid-template-columns:repeat(3,1fr);gap:28px;margin-top:26px}
.step{border-top:1px solid var(--rule);padding-top:10px}
.step .num{color:var(--muted);font-size:.85rem;font-variant-numeric:tabular-nums}
.step p{margin:.2em 0 0;font-size:.95rem}

/* results */
.table-wrap{margin-top:8px;overflow-x:auto;border-top:1px solid var(--rule);border-bottom:1px solid var(--rule);-webkit-overflow-scrolling:touch}
table{border-collapse:collapse;width:100%;font-size:.8rem;font-variant-numeric:tabular-nums}
th,td{padding:4px 8px;text-align:right;white-space:nowrap}
thead th{font-weight:600;border-bottom:1px solid var(--rule);text-align:center}
thead tr:first-child th+th{border-left:1px solid var(--rule)}
tbody th{text-align:left;font-weight:600;position:sticky;left:0;background:var(--bg)}
thead th:first-child{text-align:left;position:sticky;left:0;background:var(--bg)}
tbody tr+tr th,tbody tr+tr td{border-top:1px solid var(--rule)}
tr.muted td,tr.muted th{color:var(--muted)}
tr.ours td,tr.ours th{font-weight:700}
table.grouped tbody td:nth-child(3n+2),table.grouped thead tr:first-child th+th{border-left:1px solid var(--rule)}
table.grouped thead tr:nth-child(2) th:nth-child(3n+1){border-left:1px solid var(--rule)}
td b{font-weight:700}
td u{text-decoration-thickness:1px;text-underline-offset:2px}
tr.ours td{color:var(--accent)}
table.compact th,table.compact td{padding:4px 6px}
.hint{display:none}
.note{margin:.5em 0 0;font-size:.85rem;color:var(--muted)}
.seg{margin:26px 0 0;font-size:.97rem}
.seg button{font:inherit;color:var(--link);background:none;border:0;padding:0;cursor:pointer}
.seg button:hover{text-decoration:underline}
.seg button.is-active{color:var(--fg);font-weight:600;text-decoration:underline;cursor:default}
.seg button:not(:last-child)::after{content:"/";color:var(--muted);font-weight:400;display:inline-block;margin:0 .6em;text-decoration:none}
.seg button.is-active:not(:last-child)::after{text-decoration:none}

/* video */
.video-frame{position:relative;aspect-ratio:16/9;margin-top:12px;background:var(--ph);border-radius:6px;overflow:hidden}
.video-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:0}

/* citation */
.bib{position:relative;margin-top:12px}
.bib pre{margin:0;padding:14px 16px;background:var(--soft);border:1px solid var(--rule);border-radius:6px;overflow-x:auto;font:.82rem/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.copy{position:absolute;top:8px;right:8px;font:.8rem "Open Sans",sans-serif;color:var(--link);background:var(--bg);border:1px solid var(--rule);border-radius:4px;padding:2px 10px;cursor:pointer}
.copy:hover{border-color:var(--muted)}
.copy-status{display:block;min-height:1.2em;font-size:.82rem;color:var(--muted)}
footer{text-align:center;color:var(--muted);font-size:.85rem;margin-top:56px;padding-top:18px;border-top:1px solid var(--rule)}

/* theme toggle + lightbox (same as the homepage) */
.theme-toggle{position:fixed;top:16px;right:16px;width:38px;height:38px;border-radius:50%;border:1px solid var(--rule);background:var(--bg);color:var(--fg);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;z-index:10}
.theme-toggle:hover{border-color:var(--muted)}
.theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .moon{display:block}.theme-toggle .sun{display:none}
:root[data-theme="dark"] .theme-toggle .moon{display:none}
:root[data-theme="dark"] .theme-toggle .sun{display:block}
:root[data-theme="dark"] figure img{filter:brightness(.84) contrast(.96)}
.lb{position:fixed;inset:0;z-index:50;display:none;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.88);cursor:zoom-out}
.lb.open{display:flex}
.lb img{max-width:100%;max-height:100%;object-fit:contain;background:#fff;border-radius:4px}

@media(max-width:720px){
 .pair{grid-template-columns:1fr}
 .pair .cell+.cell{margin-top:28px}
 figure.side{display:block}
 figure.side figcaption{margin-top:8px}
 .hint{display:block;margin:.4em 0 0;font-size:.82rem;color:var(--muted)}
 body{font-size:15.5px}
 .wrap{padding:60px 20px 32px}
 h1{font-size:1.5rem}
 h2{margin-top:40px}
 .steps{grid-template-columns:1fr;gap:18px}
 .theme-toggle{position:absolute;top:14px;right:14px;width:34px;height:34px}
 .theme-toggle svg{width:16px;height:16px}
 .affil span{display:block;margin-left:0}
 .affil span+span{margin-left:0}
}

/* Method figure with a highlighted region: tabs move the .hl box over the image and swap the step text below. */
.hlfig .frame{position:relative;overflow:hidden;border-radius:6px;line-height:0}
.hlfig .frame img{display:block}
.hl{position:absolute;left:0;top:0;width:100%;height:100%;border:2px solid var(--accent);border-radius:4px;box-shadow:0 0 0 100vmax rgba(255,255,255,.58);pointer-events:none;transition:left .35s ease,top .35s ease,width .35s ease,height .35s ease}
:root[data-theme="dark"] .hl{box-shadow:0 0 0 100vmax rgba(20,20,20,.6)}
.hl.off{opacity:0}
.step-text{margin-top:12px}
.step-text p{margin:.2em 0 0;font-size:.95rem}
@media (prefers-reduced-motion:reduce){.hl{transition:none}}
/* .panel: rounded box around a switchable block (pill tabs + figure/video + caption). .panel.plain keeps a fixed block aligned with it. */
.panel{border:1px solid var(--rule);border-radius:10px;padding:12px 14px 14px;background:var(--soft)}
.panel.plain{border-color:transparent;background:none}
.panel .seg{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 12px}
.panel .seg button{padding:2px 12px;border:1px solid transparent;border-radius:999px;line-height:1.6}
.panel .seg button::after{content:none}
.panel .seg button:hover{text-decoration:none;background:var(--bg)}
.panel .seg button.is-active{background:var(--bg);border-color:var(--rule);color:var(--fg);font-weight:600;text-decoration:none}
.panel .sub{margin:2px 0 12px;padding:2px 0;line-height:1.6}
.panel>figure{margin:0}
.panel .video-frame{margin-top:0}
.panel .note{margin:.6em 0 0}
@media(max-width:720px){
 .panel.plain{padding:0;border:0}
 .panel{padding:10px 10px 12px}
 .panel .seg{gap:0}
 .panel .seg button{padding:2px 8px;font-size:.9rem}
}
/* .xscroll: a wide figure that scrolls sideways on phones instead of shrinking to unreadable size. */
@media (max-width:720px){.xscroll{overflow-x:auto;-webkit-overflow-scrolling:touch}.xscroll img{width:680px;max-width:none}.xscroll figcaption{position:sticky;left:0;width:calc(100vw - 32px)}}
/* Definition list for short method/baseline descriptions; .finding = one-sentence answer under a question label; .toggle = small pill button. */
.defs{margin:0;font-size:.92rem;line-height:1.5}
.defs dt{margin-top:.65em;font-weight:600}
.defs dt:first-child{margin-top:0}
.defs dd{margin:.1em 0 0;color:var(--muted)}
.finding{margin:.2em 0 0}
/* .split: text on the left, a figure on the right (stacks on phones). .more: collapsible extra figure. */
.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:8px 28px;align-items:center;margin-top:8px}
.split figure{margin:0}
.more{margin-top:22px}
.more summary{cursor:pointer;color:var(--link);font-size:.97rem;line-height:1.6}
.more summary:hover{text-decoration:underline}
.more[open] summary{margin-bottom:10px}
@media (max-width:720px){.split{display:block}.split figure{margin-top:12px}}
.split.overview{grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);align-items:start;margin-top:0}
.split.overview .text p:first-child{margin-top:0}
.split.overview figure figcaption{margin-top:6px}
@media (max-width:720px){.split.overview{display:block}}
/* Hover/tap tooltip for table headers (see project.js): <th class="tipped" tabindex="0" data-tip-title data-tip-text data-tip-set>. */
.tipped{cursor:help;text-decoration:underline dotted var(--muted);text-underline-offset:3px}
.tip{position:fixed;z-index:60;max-width:280px;padding:10px 12px;background:var(--bg);border:1px solid var(--rule);border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.14);font-size:.85rem;line-height:1.5;text-align:left;font-weight:400;color:var(--fg);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s}
.tip.on{opacity:1;visibility:visible}
.tip strong{display:block;margin-bottom:2px}
.tip .set{display:block;margin-top:6px;color:var(--muted)}
.split.demo{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start;margin-top:0}
.split.demo .label{margin-top:0}
.flow{margin:6px 0 0;padding-left:1.25em;font-size:.95rem}
.flow li{margin-top:.55em}
.flow li:first-child{margin-top:0}
@media (max-width:720px){.split.demo{display:block}.split.demo>div{margin-top:14px}}

/* Section navigation (built by project.js from each <section><h2>). Wide screens: sits in the left margin, open by default.
   Narrower screens: a button opens it as a small floating panel. */
.toc-btn{position:fixed;top:16px;left:16px;z-index:41;width:38px;height:38px;padding:0;border-radius:50%;border:1px solid var(--rule);background:var(--bg);color:var(--fg);cursor:pointer;display:flex;align-items:center;justify-content:center}
.toc-btn:hover{border-color:var(--muted)}
.toc-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.toc{position:fixed;top:68px;left:16px;z-index:40;width:150px;display:none;font-size:.88rem;line-height:1.4}
.toc.open{display:block}
.toc-title{margin:0 0 8px;font-size:.74rem;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.toc ol{list-style:none;margin:0;padding:0;border-left:1px solid var(--rule)}
.toc a{display:block;padding:5px 0 5px 12px;margin-left:-1px;border-left:2px solid transparent;color:var(--muted)}
.toc a:hover{color:var(--fg);text-decoration:none}
.toc a.is-active{color:var(--fg);font-weight:600;border-left-color:var(--accent)}
@media(max-width:1299px){.toc{width:210px;padding:14px 16px 10px;background:var(--bg);border:1px solid var(--rule);border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,.14)}}
@media(max-width:720px){.toc-btn{top:auto;bottom:16px;left:14px;width:40px;height:40px;box-shadow:0 2px 10px rgba(0,0,0,.12)}.toc{top:auto;bottom:66px;left:14px}}
@media print{.toc,.toc-btn{display:none!important}}
