/* QAPT project page — enhancements layered on top of the Academic Project Page template.
   Everything here is additive: remove this file's <link> (and qapt.js) to get the plain template back. */

:root {
  --q-ink: #363636;
  --q-text: #4a4a4a;
  --q-muted: #767676;
  --q-line: #e8e8e8;
  --q-radius: 10px;
  --q-shadow: 0 1px 2px rgba(10, 10, 10, .05), 0 6px 20px rgba(10, 10, 10, .06);
  --q-shadow-lift: 0 2px 4px rgba(10, 10, 10, .06), 0 14px 34px rgba(10, 10, 10, .12);
  --q-ease: cubic-bezier(.2, .7, .2, 1);
  --c-diffuse: #8cc270;       /* component colours from the dataset figure */
  --c-glossy: #e5de4d;
  --c-trans: #d59d5d;
  --c-u: #6a6fd0;             /* module colours from the pipeline figure */
  --c-d: #4a8db5;
  --c-vlm: #3f9a4d;
  --c-train: #6b6b6b;         /* two-pass training has no module of its own in the figure: neutral */
  --q-bg: #fff;               /* page colour behind a chart; grey sections override it */
  --sans: 'Google Sans', 'Noto Sans', sans-serif;          /* the template's fonts: all headings, text and labels */
  --serif: Constantia, Georgia, 'Times New Roman', serif;  /* questions and emphasis only (a system font, nothing to download) */
}

/* ---------- Typography ---------- */
html { scroll-behavior: smooth; }
body { text-rendering: optimizeLegibility; }
.title { text-wrap: balance; }
body, button, input, select, textarea { font-family: var(--sans); }
.title { letter-spacing: -.01em; }
.hero.is-light { --q-bg: #f5f5f5; }
.publication-title { font-weight: 700; letter-spacing: -.022em; line-height: 1.14; }
.publication-authors { font-weight: 500; }
.subtitle, .content p, .step-panel li { text-wrap: pretty; }
.lead { text-wrap: balance; }
.has-text-justified { hyphens: auto; -webkit-hyphens: auto; }
.teaser .subtitle { line-height: 1.42; }
section[id] { scroll-margin-top: 64px; }

.lead { max-width: 57rem; margin: 0 auto 1.3rem; font-size: 1.05rem; line-height: 1.55; color: var(--q-text); }
.q { font-family: var(--serif); font-style: italic; font-size: 1.05em; }
.q b { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.note { font-size: .8rem; color: var(--q-muted); line-height: 1.45; }

/* ---------- Scroll progress + floating section nav ---------- */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; transform-origin: 0 50%; transform: scaleX(0);
  background: var(--q-ink); pointer-events: none;
}
.page-nav {
  position: fixed; top: 12px; left: 50%; z-index: 50; display: flex; gap: 2px; padding: 5px;
  max-width: calc(100vw - 20px); overflow-x: auto; scrollbar-width: none;
  border: 1px solid rgba(0, 0, 0, .06); border-radius: 999px; background: rgba(255, 255, 255, .84);
  -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px);
  box-shadow: var(--q-shadow); opacity: 0; transform: translate(-50%, -150%);
  transition: transform .45s var(--q-ease), opacity .3s;
}
.page-nav::-webkit-scrollbar { display: none; }
.page-nav.is-visible { opacity: 1; transform: translate(-50%, 0); }
.page-nav a {
  padding: .5rem .8rem; border-radius: 999px; white-space: nowrap; color: var(--q-text);
  font: 500 .8125rem/1 var(--sans); transition: background-color .2s, color .2s;
}
.page-nav a:hover { background: rgba(0, 0, 0, .06); color: var(--q-ink); }
.page-nav a.is-active { background: var(--q-ink); color: #fff; }

/* ---------- Reveal on scroll (only once qapt.js is running) ---------- */
.js-ready .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--q-ease), transform .7s var(--q-ease); transition-delay: var(--d, 0s); }
.js-ready .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Header: dark, under render noise that converges (initDenoise in qapt.js) ---------- */
.qapt-hero { position: relative; overflow: hidden; isolation: isolate; }
.qapt-hero.is-dark { background: #1b1b1c radial-gradient(ellipse 78% 115% at 50% 40%, #343538 0%, #202122 56%, #141415 100%); }
.qapt-hero .hero-body { position: relative; z-index: 1; }
.qapt-hero.is-dark .publication-authors { color: rgba(255, 255, 255, .88); }
.qapt-hero.is-dark .publication-links .button { background-color: #f1f1f1; color: #1c1c1c; }
.qapt-hero.is-dark .publication-links .button:hover { background-color: #fff; color: #000; box-shadow: 0 8px 22px rgba(0, 0, 0, .55); }
/* The noise lies above the text but lets every click through. It never paints a colour of its own:
   the first layer is black with alpha (true colour x gain below 1), the second is grey in
   colour-dodge mode (true colour x gain above 1). */
.denoise-field { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; }
.denoise-field.is-gain { z-index: 3; mix-blend-mode: color-dodge; }
.sample-hint {
  position: absolute; right: 1rem; bottom: .6rem; z-index: 4; font: italic .8rem var(--serif); color: rgba(255, 255, 255, .55);
  opacity: 0; transition: opacity .6s; pointer-events: none;
}
.qapt-hero.is-live .sample-hint { opacity: 1; }
.publication-authors a { background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1.5px; transition: background-size .3s var(--q-ease); }
.publication-authors a:hover { text-decoration: none; background-size: 100% 1.5px; }
.publication-links .button { transition: transform .25s var(--q-ease), box-shadow .25s, background-color .2s; }
.publication-links .button:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(10, 10, 10, .22); }
.publication-links .button .icon { transition: transform .3s var(--q-ease); }
.publication-links .button:hover .icon { transform: scale(1.14) rotate(-6deg); }

/* ---------- Media frames + figures ---------- */
.media-frame { border-radius: var(--q-radius); overflow: hidden; background: #000; line-height: 0; box-shadow: var(--q-shadow); transition: box-shadow .35s, transform .35s var(--q-ease); }
.media-frame:hover { box-shadow: var(--q-shadow-lift); transform: translateY(-2px); }
.fig { position: relative; margin: 0; padding: .75rem; border: 1px solid var(--q-line); border-radius: 12px; background: #fff; box-shadow: var(--q-shadow); transition: box-shadow .35s, transform .35s var(--q-ease); }
.fig:hover { box-shadow: var(--q-shadow-lift); transform: translateY(-2px); }
.fig img { display: block; width: 100%; height: auto; border-radius: 4px; }
.zoomable { cursor: zoom-in; }

/* ---------- Key numbers ----------
   One row of figures with hairlines between them. The number of columns is a parameter:
     <div class="stat-row" style="--cols:3">            columns per row (default 4)
     <div class="stat-row" style="--cols:5; --cols-phone:3">   and on phones (default 2)
   With more items than columns the row wraps and the last line is centred. */
.stat-row { display: flex; flex-wrap: wrap; justify-content: center; row-gap: 1.1rem; margin-top: 1.5rem; text-align: center; }
.stat { flex: 0 0 calc(100% / var(--cols, 4)); min-width: 0; padding: .1rem .9rem; border-left: 1px solid var(--q-line); }
.stat:first-child, .stat.is-row-start { border-left-color: transparent; }
.stat-num { font: 700 2rem/1 var(--sans); color: var(--q-ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: .3rem; font: 700 .95rem/1 var(--sans); color: var(--q-ink); }
.stat p { margin-top: .5rem; font-size: .8rem; line-height: 1.4; color: #666; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .7rem; border: 1px solid #e2e2e2; border-radius: 999px;
  background: #fff; color: var(--q-text); font: 500 .75rem/1.2 var(--sans); cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s, color .2s, opacity .2s;
}
.chip i { width: .62rem; height: .62rem; border-radius: 3px; background: var(--c, #999); flex: none; }
.chip:hover, .chip.is-on { border-color: var(--c, #999); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, #999) 22%, transparent); color: var(--q-ink); }
.chip.is-off { opacity: .45; }
.chip:focus-visible, .step:focus-visible, .qbtn:focus-visible, .cmp-handle:focus-visible, .thumb:focus-visible { outline: 2px solid var(--q-ink); outline-offset: 2px; }

/* ---------- SVG charts ---------- */
.chart { position: relative; margin: 0 auto; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.chart .axis { stroke: #2b2b2b; fill: none; }
.chart .grid { stroke: #e3e3e3; fill: none; }
.hero.is-light .chart .grid { stroke: #dcdcdc; }
.chart .tick { fill: #4a4a4a; }
.chart .ser { transition: opacity .25s; cursor: pointer; }
.chart.has-focus .ser:not(.is-focus) { opacity: .16; }
.chart .hit { fill: transparent; stroke: transparent; }
.chart .line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: var(--len, 0); stroke-dashoffset: var(--len, 0); }
.chart.is-in .line { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s var(--q-ease) var(--d, 0s); }
.chart .pop { transform-box: fill-box; transform-origin: center; transform: scale(0); }
.chart.is-in .pop { transform: scale(1); transition: transform .5s var(--q-ease) var(--d, 0s); }
.chart .grow { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.chart.is-in .grow { transform: scaleY(1); transition: transform .8s var(--q-ease) var(--d, 0s); }
.chart .fade { opacity: 0; }
.chart.is-in .fade { opacity: 1; transition: opacity .5s var(--d, 0s); }
.chart .lbl { pointer-events: none; paint-order: stroke; stroke: var(--q-bg); stroke-width: 3.5px; stroke-linejoin: round; }
.chart.is-in .lbl.is-hid { opacity: 0; transition: opacity .2s; }
.chart.is-in .is-focus .lbl.is-hid { opacity: 1; }
.chart .halo { transform-box: fill-box; transform-origin: center; animation: halo 2.4s ease-out infinite; }
@keyframes halo { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }
.tip {
  position: absolute; z-index: 5; left: 0; top: 0; max-width: 260px; padding: .45rem .6rem; border-radius: 7px; background: rgba(40, 40, 40, .96); color: #fff;
  font: 400 .75rem/1.4 var(--sans); text-align: left; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 10px));
  transition: opacity .15s; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); white-space: nowrap;
}
.tip.is-on { opacity: 1; }
.tip b { font-weight: 700; }
.tip span { opacity: .75; }

/* ---------- Abstract highlights ---------- */
mark.hl { padding: 0 .1em; color: inherit; background: linear-gradient(transparent 58%, rgba(255, 162, 0, 0.537) 58%) no-repeat 0 0 / 0 100%; transition: background-size .55s var(--q-ease); }
p:hover > mark.hl { background-size: 100% 100%; }
#abstract .content p:not(:last-child) { margin-bottom: 1.5em; } /* one blank line, as the <br><br> gave before the split */

/* ---------- Method: pipeline figure + steps ----------
   The figure is the paper's vector drawing, inlined in the page. Each module is a group
   (<g class="part" data-part="u|d|vlm">) holding its trained network (.mod) and everything else (.rest).
   qapt.js puts data-spot on the figure while a module or a step card is pointed at; the others fade.
   Step 4 (training) keeps the three trained networks and fades the rest. */
.pipe { display: block; width: 100%; height: auto; }
.pipe text { white-space: pre; }   /* the labels keep their spaces, as in the source */
.pipe .part, .pipe .rest { transition: opacity .35s var(--q-ease); }
[data-spot="u"] .part:not([data-part="u"]),
[data-spot="d"] .part:not([data-part="d"]),
[data-spot="vlm"] .part:not([data-part="vlm"]),
[data-spot="train"] .rest { opacity: .18; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-top: 1rem; text-align: left; }
.step {
  position: relative; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; width: 100%; height: 100%;
  padding: .85rem .9rem .9rem; border: 1px solid var(--q-line); border-radius: var(--q-radius); background: #fff;
  color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-appearance: none; appearance: none; overflow: hidden;
  transition: transform .3s var(--q-ease), box-shadow .3s, border-color .3s, background-color .3s;
}
.step::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); transform: scaleX(0); transform-origin: 0 50%; transition: transform .4s var(--q-ease); }
.step:hover, .step.is-hover, .step.is-active { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 45%, #fff); box-shadow: var(--q-shadow); }
.step:hover::before, .step.is-hover::before, .step.is-active::before { transform: scaleX(1); }
.step.is-active { box-shadow: var(--q-shadow-lift); border-color: var(--c); background: color-mix(in srgb, var(--c) 5%, #fff); }
.step-head { display: flex; align-items: center; }
.step-no { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; margin-right: .5rem; flex: none; border-radius: 50%; background: var(--c); color: #fff; font: 700 .75rem/1 var(--sans); }
.step-name { font: 700 1rem/1.2 var(--sans); color: var(--q-ink); }
.step-q { display: block; margin-top: .45rem; font: italic .95rem/1.3 var(--serif); color: color-mix(in srgb, var(--c) 78%, #000); }
.step-desc { display: block; margin-top: .4rem; font-size: .8rem; line-height: 1.42; color: #5c5c5c; overflow-wrap: anywhere; }

/* Details of the selected step: a sub-heading and a content block, like any other part of the template */
.step-panels { margin-top: 1.75rem; text-align: left; }
.step-panel { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; align-items: center; min-height: 362px; }
.step-panel + .step-panel { margin-top: 2.5rem; }
.js-ready .step-panel { display: none; margin-top: 0; }
.js-ready .step-panel.is-active { display: grid; animation: panel-in .5s var(--q-ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
.step-panel .title { display: flex; align-items: center; margin-bottom: .8rem; }
.step-panel .content ul { margin: 0 0 0 1.15em; }
.step-panel .content li + li { margin-top: .5em; }
.step-panel .content li::marker { color: var(--c, var(--q-ink)); }
.math { font-family: var(--serif); font-style: italic; font-size: 1.08em; font-variant-numeric: lining-nums; white-space: nowrap; }
.math sub, .math sup { font-size: .72em; font-style: normal; line-height: 0; }
.math .rm { font-style: normal; }
.kbd { display: inline-block; padding: 0 .4em; border-radius: 4px; background: #f4f4f4; font: 500 .78em/1.6 var(--sans); color: var(--q-ink); white-space: nowrap; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.thumbs + .thumbs { margin-top: .5rem; }
.thumbs figure { position: relative; margin: 0; border-radius: 7px; overflow: hidden; background: #111; line-height: 0; transition: transform .3s var(--q-ease), box-shadow .3s; }
.thumbs figure:hover { transform: scale(1.04); box-shadow: var(--q-shadow-lift); z-index: 2; }
.thumbs img { display: block; width: 100%; height: auto; }
.thumbs figcaption, .cap { position: absolute; left: .35rem; bottom: .35rem; padding: .16rem .42rem; border-radius: 4px; background: rgba(20, 20, 20, .72); color: #fff; font: 500 .68rem/1.3 var(--sans); }
.thumbs figcaption i { display: inline-block; width: .5rem; height: .5rem; margin-right: .3rem; border-radius: 2px; background: var(--c); }
.flow-label { margin: 0 0 .35rem; font: 700 .7rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--q-muted); }
.flow-arrow { margin: .3rem 0; text-align: center; color: var(--c-u); font-size: .95rem; line-height: 1; }

/* Budget dial */
.budget { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.budget figure { position: relative; margin: 0; border-radius: 7px; overflow: hidden; background: #000; aspect-ratio: 1; }
.budget img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; }
.budget img.is-on { opacity: 1; }
.budget-ctl { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; margin-top: .35rem; }
.budget-read { font: 700 1.05rem/1 var(--sans); color: var(--q-ink); min-width: 4.4rem; font-variant-numeric: tabular-nums; }
.budget-read small { display: block; margin-top: .25rem; font: 500 .7rem/1 var(--sans); color: var(--q-muted); }
.budget-acc { font: 700 .75rem/1.2 var(--sans); color: var(--q-ink); text-align: right; min-width: 5.2rem; font-variant-numeric: tabular-nums; }
.budget input[type=range] { width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.budget input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--q-ink) var(--p, 60%), #ddd var(--p, 60%)); }
.budget input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #ddd; }
.budget input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--q-ink); }
.budget input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%; background: var(--q-ink); box-shadow: 0 1px 5px rgba(0, 0, 0, .3); }
.budget input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--q-ink); box-shadow: 0 1px 5px rgba(0, 0, 0, .3); }

/* Patch grid (asymmetric attention) */
.patches { position: relative; max-width: 384px; margin: 0 auto; border-radius: 7px; overflow: hidden; background: #000; line-height: 0; }
.patches img { display: block; width: 100%; height: auto; }
.patches svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.patches .cell { fill: color-mix(in srgb, var(--c-vlm) 26%, transparent); stroke: var(--c-vlm); stroke-width: .06; opacity: 0; }
.patches.is-in .cell { opacity: 1; transition: opacity .5s var(--d, 0s); }
.patches .gridline { stroke: rgba(255, 255, 255, .13); stroke-width: .03; }
.patch-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; margin-top: .55rem; font: 500 .75rem/1.3 var(--sans); color: #5c5c5c; }
.patch-legend i { display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; border-radius: 2px; vertical-align: -1px; }

/* Two-pass training diagram */

/* ---------- Demo: same scene, different questions ---------- */
/* scene tabs above the demo: plain chips, the chosen one in ink and bold (same width either way) */
.scene-tabs { margin: 0 0 1.1rem; }
.scene-tab { --c: var(--q-ink); min-width: 5.3rem; justify-content: center; }
.scene-tab.is-on { font-weight: 700; }
.demo { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; text-align: left; }
.cmp { position: relative; aspect-ratio: 4 / 3; border-radius: var(--q-radius); overflow: hidden; background: #000; box-shadow: var(--q-shadow-lift); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize; }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.cmp-top { clip-path: inset(0 calc(100% - var(--x, 50%)) 0 0); }
.cmp-top img { opacity: 0; transition: opacity .35s; }
.cmp-top img.is-on { opacity: 1; }
.cmp-base img { opacity: 0; transition: opacity .35s; }
.cmp-base img.is-on { opacity: 1; }
.cmp-base, .cmp-top { position: absolute; inset: 0; }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.cmp-handle::after {
  content: '‹ ›'; position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--q-ink); font: 700 .95rem/1 var(--sans); letter-spacing: .05em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35); transition: transform .2s var(--q-ease);
}
.cmp:hover .cmp-handle::after, .cmp.is-drag .cmp-handle::after { transform: scale(1.1); }
.cmp-tag { position: absolute; top: .6rem; padding: .28rem .55rem; border-radius: 5px; background: rgba(20, 20, 20, .72); color: #fff; font: 500 .75rem/1.25 var(--sans); pointer-events: none; }
.cmp-tag.is-l { left: .6rem; font-weight: 700; }
.cmp-tag.is-r { right: .6rem; }
.cmp-q { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; padding: .45rem .7rem; border-radius: 7px; background: rgba(20, 20, 20, .72); color: #fff; font: italic 1rem/1.35 var(--serif); pointer-events: none; }
.cmp-q b { font-weight: 700; }
.demo-side h3 { margin: 0 0 .45rem; font: 700 .7rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--q-muted); }
.demo-side h3:not(:first-child) { margin-top: 1.05rem; }
.qbtn {
  display: flex; gap: .6rem; align-items: baseline; width: 100%; margin-bottom: .4rem; padding: .55rem .7rem; border: 1px solid #e2e2e2; border-radius: 9px; background: #fff;
  color: var(--q-text); font: inherit; text-align: left; cursor: pointer; -webkit-appearance: none; appearance: none; transition: border-color .2s, box-shadow .2s, transform .25s var(--q-ease);
}
.qbtn:hover { border-color: #b5b5b5; transform: translateX(2px); }
.qbtn.is-on { border-color: var(--q-ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .08); }
.qbtn-no { font: 700 .8rem/1 var(--sans); color: var(--q-ink); }
.qbtn .q { font-size: .98rem; line-height: 1.3; color: var(--q-ink); }
.views { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 7px; overflow: hidden; background: #000; cursor: pointer; line-height: 0; -webkit-appearance: none; appearance: none; transition: border-color .2s, opacity .2s, transform .25s var(--q-ease); opacity: .6; }
.thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumb:hover { transform: translateY(-2px); opacity: 1; }
.thumb.is-on { border-color: var(--q-ink); opacity: 1; }
.thumb.is-on span { font-weight: 700; }
.thumb span { position: absolute; inset: auto 0 0 0; padding: .7rem .2rem .2rem; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); color: #fff; font: 500 .62rem/1.15 var(--sans); text-align: center; }
.readout { display: flex; gap: 1.1rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid #e4e4e4; }
.readout div { font: 500 .7rem/1.3 var(--sans); color: var(--q-muted); }
.hero .readout strong { display: block; font: 700 1.25rem/1.15 var(--sans); color: var(--q-ink); font-variant-numeric: tabular-nums; }

/* ---------- Dataset ---------- */
.dataset { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; text-align: left; }
.scene { position: relative; margin: 0; border-radius: var(--q-radius); overflow: hidden; line-height: 0; box-shadow: var(--q-shadow); }
.scene img { display: block; width: 100%; height: auto; transition: transform 1.2s var(--q-ease); }
.scene:hover img { transform: scale(1.035); }
.scene figcaption { position: absolute; left: .7rem; top: .6rem; color: #fff; font: 400 .9rem/1.35 var(--sans); text-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
.scene figcaption b { display: block; font: 700 1rem/1.3 var(--sans); }
.comp-key { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 0; font-size: .8rem; line-height: 1.4; color: var(--q-text); list-style: none; }
.comp-key i { display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; border-radius: 3px; background: var(--c); vertical-align: -1px; }
.qtype { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .55rem 0; border-bottom: 1px solid var(--q-line); }
.qtype:first-child { padding-top: 0; }
.hero .qtype strong { font: 700 .95rem/1.3 var(--sans); color: var(--q-ink); }
.qtype .q { grid-column: 1 / -1; font-size: .95rem; line-height: 1.3; color: #555; }
.dots { display: flex; gap: 3px; align-items: center; }
.dots i { width: .8rem; height: .8rem; border-radius: 3px; background: var(--c); }

/* ---------- Results ---------- */
.subsec { text-align: left; }
.subsec .title { margin-bottom: .4rem; }
.subsec > .note { margin-bottom: .75rem; }
.cards { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 2.5rem; margin-top: 2.25rem; }
.bars { display: grid; gap: .42rem; }
.bar { display: grid; grid-template-columns: var(--lab, 9.5rem) 1fr 3.1rem; align-items: center; gap: .5rem; font: 500 .75rem/1.25 var(--sans); color: var(--q-text); }
.bar-track { height: .62rem; border-radius: 4px; background: rgba(0, 0, 0, .07); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: calc(var(--v) * 1%); border-radius: 4px; background: var(--c, #b9b9b9); transform-origin: 0 50%; }
.js-ready .bar-fill { transform: scaleX(0); transition: transform 1s var(--q-ease) var(--d, 0s); }
.js-ready .is-in .bar-fill { transform: scaleX(1); }
.bar-val { text-align: right; font-weight: 700; color: var(--q-ink); font-variant-numeric: tabular-nums; }
.bar.is-ours { color: var(--q-ink); font-weight: 700; }
.bar.is-ref { color: #999; }
.bar.is-ref .bar-val { color: #999; font-weight: 500; }
.bar-group { margin-top: .6rem; font: 700 .7rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--q-muted); }
.bars .bar { transition: opacity .2s; }
.bars:hover .bar:not(:hover) { opacity: .45; }

/* ---------- Applications ---------- */
.apps { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 1.75rem; }
.app-q { margin: .1rem 0 .65rem; font: italic .95rem/1.35 var(--serif); color: #555; }
.bar-head { display: grid; grid-template-columns: var(--lab, 4rem) 1fr 3.1rem 3.4rem; gap: .5rem; margin-bottom: .3rem; font: 700 .68rem/1 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--q-muted); }
.bar.has-time { grid-template-columns: var(--lab, 4rem) 1fr 3.1rem 3.4rem; }
.bar-time { text-align: right; color: var(--q-muted); font-variant-numeric: tabular-nums; }
.bar.is-ours .bar-time { color: var(--q-ink); font-weight: 700; }
details.more { margin-top: 1.25rem; text-align: left; border: 1px solid var(--q-line); border-radius: 10px; background: #fafafa; }
details.more summary { padding: .7rem 1rem; font: 700 .9rem/1.3 var(--sans); color: var(--q-ink); cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '+'; float: right; font-weight: 500; color: var(--q-muted); transition: transform .3s var(--q-ease); }
details.more[open] summary::after { transform: rotate(45deg); }
details.more div { padding: 0 1rem .9rem; font-size: .9rem; line-height: 1.6; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 2.5vmin; background: rgba(18, 18, 18, .88); opacity: 0; pointer-events: none; transition: opacity .25s; cursor: zoom-out; }
.lightbox.is-on { opacity: 1; pointer-events: auto; }
.lightbox img, .lightbox svg { max-width: 100%; max-height: 95vh; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); transform: scale(.96); transition: transform .3s var(--q-ease); }
.lightbox svg { box-sizing: border-box; width: 100%; padding: 1.2vmin; }   /* a copy of an inline vector figure */
.lightbox.is-on img, .lightbox.is-on svg { transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; gap: 1.75rem; }
  .demo, .dataset { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /* phones: keep the page compact — one-line chip rows, collapsed step cards, tighter cards */
  #method, #demo, #dataset, #results, #applications { padding-top: 1.75rem; padding-bottom: 1.75rem; }
  .teaser .subtitle { line-height: 1.28; }
  .chart[data-chart="acc"], .chart[data-chart="time"] { max-width: 270px !important; }
  .stat-row { row-gap: .9rem; }
  .stat { flex-basis: calc(100% / var(--cols-phone, 2)); padding: 0 .5rem; }
  .stat-num { font-size: 1.5rem; }
  .stat-unit { font-size: .85rem; }
  .stat p { margin-top: .3rem; font-size: .7rem; line-height: 1.3; }
  /* width 0 + min-width 100%: the one-line row scrolls sideways instead of stretching the page */
  .chips[data-group-chips] { flex-wrap: nowrap; justify-content: flex-start; width: 0; min-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 4px; }
  .chips[data-group-chips]::-webkit-scrollbar { display: none; }
  .chip { flex: none; white-space: nowrap; }
  .hint, .only-wide { display: none; }
  .step:not(.is-active) .step-desc { display: none; }
  .step { padding: .7rem .8rem .75rem; }
  .step-panels { margin-top: 1.25rem; }
  .step-panel { grid-template-columns: 1fr; min-height: 0; gap: .8rem; }
  .patches { max-width: 300px; }
  .budget { max-width: 320px; margin: 0 auto; }
  .qtype { padding: .4rem 0; }
  .qtype .q { font-size: .9rem; }
  .demo-side h3:not(:first-child) { margin-top: .8rem; }
  .scene-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; margin-bottom: .9rem; }
  .scene-tab { min-width: 0; padding: .42rem .2rem; }
  .bars { gap: .3rem; }
  .bar-group { margin-top: .4rem; }
  .apps { grid-template-columns: 1fr; gap: 1.5rem; }
  .page-nav { left: 10px; right: 10px; transform: translateY(-150%); max-width: none; }
  .page-nav.is-visible { transform: none; }
  .sample-hint { display: none; }
  .lead { font-size: .93rem; line-height: 1.48; margin-bottom: 1rem; }
  .lightbox.is-wide { display: block; overflow-x: auto; padding: 22vh 0 0; white-space: nowrap; }
  .lightbox.is-wide img, .lightbox.is-wide svg { max-width: none; max-height: none; height: 46vh; margin: 0 4vw; }
  .lightbox.is-wide svg { display: inline-block; width: auto; }   /* width follows from the aspect-ratio set by qapt.js */
}
@media (max-width: 600px) {
  .steps { grid-template-columns: 1fr; gap: .5rem; }
  .step-q { margin-top: .25rem; }
}
@media (max-width: 480px) {
  .section { padding-left: 1rem; padding-right: 1rem; }
  .bar { --lab: 7.6rem; }
}
@media (hover: none) { .sample-hint { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
