:root {
  --bg: #fbfbfa;
  --fg: #16181d;
  --muted: #5b616e;
  --accent: #3070b3;
  --rule: #e3e4e8;
  --btn-bg: #ffffff;
  --btn-hover: #f0f1f4;
  --card: #ffffff;
  --frustum: #3070b3;
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --fg: #eceef2;
  --muted: #9aa1ae;
  --accent: #6ea4dc;
  --rule: #262a33;
  --btn-bg: #171a20;
  --btn-hover: #20242c;
  --card: #171a20;
  --frustum: #7fb2e5;
}
* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; --header-h: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 600px) { html { --header-h: 68px; } }
[id$="-title"], #top { scroll-margin-top: calc(var(--header-h) + 8px); }
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  transition: background-color .25s ease, color .25s ease;
}

header {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: transform .3s ease, border-color .2s ease, background-color .25s ease;
}
header.is-scrolled { border-bottom-color: var(--rule); }
header.is-hidden:not(:focus-within) { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { header { transition: none; } }
.tum { display: inline-flex; color: var(--accent); }
.tum svg { height: 30px; width: auto; display: block; }
.logos { display: flex; align-items: center; gap: 22px; }
.mcml { display: inline-flex; color: var(--fg); }
.mcml svg { height: 17px; width: auto; display: block; }

.theme-toggle {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--btn-bg);
  color: var(--fg);
  width: 40px; height: 40px;
  border-radius: 999px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { background: var(--btn-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.toc { position: relative; z-index: 50; }
.toc-btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--rule); border-radius: 4px;
  background: var(--btn-bg); color: var(--fg);
  font: inherit; font-size: .9rem; font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.toc-btn svg { width: 16px; height: 16px; }
.toc-btn:hover, .toc-btn[aria-expanded="true"] { background: var(--btn-hover); }
.toc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toc-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 190px; margin: 0; padding: 6px;
  list-style: none;
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(20, 24, 32, .10);
  opacity: 0; transform: translateY(-4px); visibility: hidden;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
:root[data-theme="dark"] .toc-menu { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.toc.open .toc-menu { opacity: 1; transform: none; visibility: visible; }
.toc-menu a {
  display: block; padding: 8px 12px; border-radius: 4px;
  color: var(--muted); text-decoration: none; font-size: .95rem;
  border-left: 2px solid transparent;
}
.toc-menu a:hover { background: var(--btn-hover); color: var(--fg); }
.toc-menu a.active { color: var(--fg); font-weight: 700; border-left-color: var(--accent); border-radius: 0 4px 4px 0; }
.toc-menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 600px) {
  .header-tools { gap: 8px; }
  header { padding: 14px 16px; }
  .toc-btn { width: 40px; padding: 0; justify-content: center; }
  .toc-btn span { display: none; }
}
@media (min-width: 900px) {
  .header-tools { gap: 18px; }
  .toc-btn { display: none; }
  .toc-menu {
    position: static; display: flex; gap: 4px;
    min-width: 0; padding: 0;
    background: none; border: 0; box-shadow: none;
    opacity: 1; transform: none; visibility: visible; transition: none;
  }
  :root[data-theme="dark"] .toc-menu { box-shadow: none; }
  .toc-menu a {
    padding: 8px 12px; border-left: 0; border-radius: 4px;
    font-weight: 700; font-size: .92rem;
    box-shadow: inset 0 -2px 0 transparent;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
  }
  .toc-menu a.active { color: var(--fg); border-radius: 4px 4px 0 0; box-shadow: inset 0 -2px 0 var(--accent); }
}

main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 16px 64px;
}
.hero { width: 100%; max-width: 980px; text-align: center; }

h1 { margin: 0; line-height: 1.12; letter-spacing: -0.015em; }
h1 .name {
  display: block;
  font-weight: 900;
  font-size: clamp(2.75rem, 8vw, 5.25rem);
  color: var(--accent);
}
h1 .sub {
  display: block;
  margin-top: .35em;
  font-weight: 400;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem);
  color: var(--fg);
}

.authors {
  list-style: none;
  margin: 44px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 32px;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
}
.authors sup, .affiliations sup {
  font-size: .62em; font-weight: 700; margin-left: 1px; color: var(--accent);
}
.affiliations {
  list-style: none;
  margin: 18px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 28px;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
}
.affiliations sup { margin: 0 2px 0 0; }
.authors a { color: inherit; text-decoration: none; }
.authors a:hover { color: var(--accent); }
.authors a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.affiliations a { color: inherit; text-decoration: none; }
.affiliations a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

.links {
  list-style: none;
  margin: 28px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px;
}
.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 4px;
  background: var(--fg); color: var(--bg);
  font: inherit; font-size: .95rem; font-weight: 700; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, transform .15s ease;
}
.link-btn svg { width: 17px; height: 17px; flex: none; }
.link-btn:hover { background: var(--accent); }
.link-btn:active { transform: translateY(1px); }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.link-btn .soon {
  font-weight: 400; font-size: .8em; opacity: .85;
}
@media (max-width: 600px) {
  .link-btn { height: 38px; padding: 0 15px; font-size: .9rem; }
}

.fig { margin: 48px auto 0; max-width: 1100px; }
.fig img { width: 100%; height: auto; display: block; }
.fig .img-dark { display: none; }
:root[data-theme="dark"] .fig .img-light { display: none; }
:root[data-theme="dark"] .fig .img-dark { display: block; }
.fig figcaption, .abstract p, .section-text {
  margin: 0; font-size: 1.05rem; line-height: 1.7; color: var(--fg); text-align: justify; hyphens: auto;
}
.fig figcaption { margin-top: 14px; }
.section-text + .section-text { margin-top: 12px; }
.section { max-width: 1100px; margin: 72px auto 0; }
.section > h2, .abstract > h2, .results > h2 {
  text-align: center; margin: 0 0 24px;
  font-size: clamp(1.6rem, 3.6vw, 2.2rem); font-weight: 900; letter-spacing: -0.01em;
}
.section .fig, .section .video { margin-top: 0; }
.qt-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px;
  margin-top: 28px; align-items: start;
}
.subsection h3 + .qt-grid { margin-top: 16px; }
@media (max-width: 860px) { .qt-grid { grid-template-columns: minmax(0, 1fr); } }
.qt {
  margin: 0; padding: 16px 18px 14px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
}
.qt h3 { margin: 0 0 10px; font-size: 1.05rem; font-weight: 900; }
.qt-scroll { overflow-x: auto; }
.qt table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.qt th, .qt td { padding: 6px 5px; text-align: center; }
.qt th:first-child, .qt td:first-child { text-align: left; padding-left: 4px; }
.qt thead th { font-weight: 700; color: var(--muted); font-size: .82rem; border-bottom: 1px solid var(--rule); }
.qt thead tr:first-child th { border-bottom: 0; padding-bottom: 0; }
.qt thead tr:first-child th[colspan] { border-bottom: 1px solid var(--rule); }
.qt thead tr + tr th { padding-top: 4px; }
.qt tbody tr + tr td { border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
.qt tbody.grp td { border-top: 1px solid var(--rule); }
.qt-pose th:nth-child(3), .qt-pose td:nth-child(3) { text-align: left; padding-left: 12px; border-left: 1px solid var(--rule); }
.qt-pose thead tr:first-child th { text-align: center; }
.qt-pose thead tr:first-child th + th { border-left: 1px solid var(--rule); }
.qt tbody td.grp-label { color: var(--muted); font-size: .8rem; font-weight: 700; padding-top: 10px; }
.qt tr.ours td { background: color-mix(in srgb, var(--accent) 9%, transparent); font-weight: 700; }
.qt td b { font-weight: 900; color: var(--accent); }
.qt td u { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.qt-last { grid-column: 1 / -1; justify-self: center; width: max(calc(50% - 10px), min(100%, max-content)); }
@media (max-width: 860px) { .qt-last { width: 100%; } }
a.cite { color: var(--muted); text-decoration: none; font-weight: 400; white-space: nowrap; }
a.cite:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.qt td a.cite { font-size: .78em; }
.fig figcaption a.cite, .subsection a.cite { color: inherit; opacity: .8; text-decoration: none; }
.qt figcaption { margin-top: 10px; font-size: .85rem; line-height: 1.5; color: var(--muted); }
.subsection { margin-top: 48px; }
.subsection h3 {
  margin: 0 0 12px; text-align: center;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem); font-weight: 900; letter-spacing: -0.005em;
}
.subsection a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.subsection a:hover { color: var(--fg); }
.subsection .eq {
  margin: 16px 0 0; padding: 12px 16px; text-align: center;
  font-family: 'Times New Roman', Times, serif; font-size: 1.15rem; line-height: 1.6;
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  overflow-x: auto;
}
.subsection .fig { margin-top: 20px; }
.abstract { max-width: 820px; margin: 56px auto 0; text-align: left; }
.abstract > h2 { margin-bottom: 16px; }

.video {
  margin: 48px auto 0;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--rule);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
}
:root[data-theme="dark"] .video { box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-link { position: relative; display: block; width: 100%; height: 100%; }
.video-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-link .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 50px; border-radius: 14px; background: #ff0033;
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.video-link .play::after {
  content: ""; border-style: solid; border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff; margin-left: 4px;
}
.gallery-note { text-align: center; color: var(--muted); line-height: 1.6; }
.gallery-note code {
  font-size: .9em; padding: 2px 6px; border-radius: 6px;
  background: var(--btn-hover); color: var(--fg);
}

.results { width: 100%; max-width: 1100px; margin: 88px auto 0; text-align: left; }
.results > h2 { margin-bottom: 0; }
.results .lead {
  text-align: center; color: var(--muted);
  margin: 12px auto 0; max-width: 680px; line-height: 1.5;
}
#gallery { margin-top: 32px; }
#compare, #planes { margin-top: 20px; }
.viewer {
  position: relative;
  height: clamp(340px, 58vw, 580px);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .07);
}
:root[data-theme="dark"] .viewer { box-shadow: 0 10px 36px rgba(0, 0, 0, .45); }
.viewer-canvas { position: absolute; inset: 0; }
.viewer-canvas canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.viewer-canvas canvas:active { cursor: grabbing; }
.viewer-status {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: .95rem; pointer-events: none;
}
.viewer-status[hidden] { display: none; }
.viewer-legend {
  position: absolute; left: 14px; top: 14px; right: 64px;
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.viewer-legend li, .compare-legend li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; padding: 4px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  border: 1px solid var(--rule);
  backdrop-filter: blur(6px);
}
.swatch { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); }
.viewer-reset {
  position: absolute; right: 14px; top: 14px;
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--btn-bg); color: var(--fg);
  display: grid; place-items: center; cursor: pointer;
}
.viewer-reset:hover { background: var(--btn-hover); }
.viewer-reset svg { width: 16px; height: 16px; }
.viewer-hint {
  position: absolute; left: 0; right: 0; bottom: 10px; margin: 0;
  text-align: center; font-size: .78rem; color: var(--muted); pointer-events: none;
}
.thumbs {
  position: relative; display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.thumbs::-webkit-scrollbar { display: none; }
.thumb {
  position: relative; aspect-ratio: 4 / 3;
  flex: 1 1 0; min-width: 44px; max-width: 120px;
  padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--rule);
  outline: 3px solid transparent; outline-offset: 2px;
  opacity: .72; transition: flex-grow .3s ease, min-width .3s ease, max-width .3s ease, opacity .15s ease, outline-color .15s ease, transform .15s ease;
}
@media (hover: hover) {
  .thumb:hover { opacity: 1; transform: translateY(-2px); }
}
.thumb:first-child { margin-left: auto; }
.thumb:last-child { margin-right: auto; }
.thumb[aria-selected="true"] { flex-grow: 3.5; min-width: 200px; max-width: 280px; opacity: 1; outline-color: var(--accent); }
.thumb:focus-visible { outline-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.compare-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.compare-panel { margin: 0; }
.compare-panel figcaption {
  text-align: center; font-weight: 700; font-size: .95rem; margin-bottom: 8px; color: var(--muted);
}
.compare-panel.is-ours figcaption { color: var(--accent); }
.compare-panel .viewer { height: clamp(260px, 30vw, 360px); border-radius: 12px; }
.compare-panel.is-ours .viewer { border-color: var(--accent); }
.compare-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.compare-legend {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.compare-hint { flex: 1; margin: 0; text-align: center; font-size: .78rem; color: var(--muted); }
.compare-bar .viewer-reset { position: static; flex: none; }
@media (max-width: 760px) {
  /* stay three side by side, as on desktop: smaller panels, captions with the citation on its own line */
  .compare-grid { gap: 6px; }
  .compare-panel .viewer { height: clamp(150px, 40vw, 260px); border-radius: 8px; }
  .compare-panel { display: flex; flex-direction: column; }
  .compare-panel figcaption { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; font-size: .72rem; line-height: 1.3; margin-bottom: 5px; }
  .compare-panel figcaption .cite { display: block; font-weight: 400; }
  .compare-hint { display: none; }
  .compare-bar { justify-content: space-between; }
}
@media (max-width: 600px) {
  .viewer-hint { display: none; }
  .results { margin-top: 64px; }
  .viewer { border-radius: 12px; }
  .viewer-legend { left: 10px; top: 10px; right: 54px; gap: 4px; }
  .viewer-legend li, .compare-legend li { font-size: .68rem; padding: 3px 7px; gap: 5px; }
  .swatch { width: 8px; height: 8px; }
  .viewer-reset { right: 10px; top: 10px; }
  .thumbs { gap: 8px; }
  .thumb[aria-selected="true"] { min-width: 180px; }
  .thumb { border-radius: 8px; }
}

footer {
  text-align: center;
  padding: 20px 16px 28px;
  font-size: .85rem;
  color: var(--muted);
}
