:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #363636;
  --text: #4a4a4a;
  --muted: #7a7a7a;
  --accent: #c2512a;
  --link: #3273b9;
  --wash: #f5f5f5;
  --line: #e8e8e8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font: 16px/1.75 var(--font);
  -webkit-font-smoothing: antialiased;
}
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
strong, b { font-weight: 650; }
::selection { background: #f6dccf; color: #6d2a12; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.container { width: min(1100px, calc(100% - 96px)); margin-inline: auto; }
.reading-container { width: min(900px, calc(100% - 96px)); margin-inline: auto; }
.container .reading-container { width: min(900px, 100%); }

.skip-link {
  position: fixed; z-index: 100; top: 12px; left: 16px;
  transform: translateY(-200%);
  padding: 8px 16px; background: var(--ink); color: #fff; border-radius: 4px;
}
.skip-link:focus { transform: translateY(0); }

/* Header */
.publication-header { text-align: center; padding-top: 56px; padding-bottom: 25px; }
h1 { color: var(--ink); font-size: 44px; font-weight: 650; line-height: 1.24; text-wrap: balance; }
.project-name { color: var(--accent); }
.publication-authors {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
  color: var(--link); font-size: 20px; margin-top: 25px;
}
.publication-authors .author { white-space: nowrap; }
.publication-authors a { color: inherit; }
.publication-authors a:not([href]) { cursor: default; text-decoration: none; }
.publication-affiliations { color: var(--text); font-size: 15px; margin-top: 10px; }
.publication-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 22px; }
.publication-button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 8px 20px; border-radius: 24px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font-size: 15px; line-height: 1.5; white-space: nowrap; transition: background .15s;
}
a.publication-button:hover { background: #474747; text-decoration: none; }
.section-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px; margin-top: 22px; font-size: 13px; }
.section-nav a { color: #747474; }
.section-nav a:hover { color: var(--link); }

/* Teaser */
.teaser-section { padding-top: 14px; padding-bottom: 45px; }
.teaser-figure figcaption {
  max-width: 950px; margin: 24px auto 0; text-align: center; font-size: 18px; line-height: 1.65;
}
.stat-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  margin-top: 36px;
}
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.stat-note { font-size: 13px; color: var(--text); }

/* Sections */
.section { padding-block: 52px; }
h2 { color: var(--ink); text-align: center; font-size: 32px; font-weight: 650; line-height: 1.3; margin-bottom: 25px; }
h3 { font-size: 21px; font-weight: 600; color: var(--ink); line-height: 1.4; }
h4 { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 12px; }
.section-intro { text-align: center; font-size: 17px; color: #686868; margin-top: -10px; margin-bottom: 30px; }
.section-intro.small { font-size: 15px; margin-top: 0; margin-bottom: 22px; }
.abstract-section, .evaluation-section { background: var(--wash); }
.abstract-section p, .prose p { text-align: justify; line-height: 1.85; }
.prose { margin-bottom: 34px; }

/* Figures */
.paper-figure { width: 100%; }
.narrow-figure { max-width: 880px; margin: 48px auto 0; }
.figure-button {
  width: 100%; padding: 0; position: relative; display: block;
  background: transparent; border: 0; cursor: zoom-in;
}
.figure-button > img { width: 100%; height: auto; }
.figure-zoom {
  position: absolute; bottom: 10px; right: 10px; width: 32px; height: 32px;
  border: 1px solid #dedede; border-radius: 4px; background: #fffffff0;
  display: grid; place-items: center; color: #686868; opacity: 0; transition: opacity .15s;
}
.figure-button:hover .figure-zoom, .figure-button:focus-visible .figure-zoom { opacity: 1; }
.figure-zoom svg { width: 16px; height: 16px; }
figcaption { margin-top: 18px; font-size: 16px; line-height: 1.75; text-align: justify; }

/* Method components */
.component-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.component {
  position: relative; padding: 24px 24px 22px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.component-index {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-bottom: 10px;
  border-radius: 50%; background: #f6e3da; color: var(--accent); font-size: 14px; font-weight: 650;
}
.component h3 { font-size: 18px; margin-bottom: 8px; }
.component p { font-size: 15px; line-height: 1.7; }
.objective { max-width: 900px; margin: 48px auto 0; }
.objective h3 { text-align: center; margin-bottom: 12px; }
.objective p { text-align: justify; line-height: 1.8; }
.equation { overflow-x: auto; padding: 8px 0; margin: 10px 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.results-table {
  width: 100%; border-collapse: collapse; font-size: 15px;
  font-variant-numeric: tabular-nums; background: #fff;
}
.results-table caption {
  caption-side: bottom; padding-top: 12px; font-size: 14px; color: var(--muted); text-align: left;
}
.results-table th, .results-table td { padding: 9px 14px; text-align: center; border-bottom: 1px solid var(--line); }
.results-table thead th { color: var(--ink); font-weight: 600; border-bottom: 2px solid #cfcfcf; white-space: nowrap; }
.results-table tbody th { text-align: left; font-weight: 500; color: var(--ink); white-space: nowrap; }
.results-table tr.ours { background: #fbefe9; }
.results-table tr.ours th, .results-table tr.ours td { color: var(--ink); }
.results-table tr.group-start > * { border-top: 2px solid #e2e2e2; }
.results-table tr.subhead th { background: var(--wash); font-style: italic; font-weight: 600; color: var(--muted); }
.results-table tr.muted-row th, .results-table tr.muted-row td { color: var(--muted); font-style: italic; }
.results-table.compact { font-size: 14px; }
.results-table.compact th, .results-table.compact td { padding: 7px 10px; }
.evaluation-section .table-wrap { margin-top: 36px; }
.table-note { font-size: 14px; color: var(--muted); margin-top: 8px; }
.subsection-title { text-align: center; margin-top: 56px; margin-bottom: 8px; }
.ablation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.ablation { padding: 20px; border: 1px solid var(--line); border-radius: 8px; }
.ablation p { font-size: 14px; line-height: 1.65; margin-top: 12px; }

/* Charts (two series: categorical slots 1 and 2 of the reference palette) */
.viz-root {
  --surface-1: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  position: relative;
}
.chart-legend {
  display: flex; justify-content: center; gap: 24px;
  font-size: 14px; color: var(--text-secondary); margin-bottom: 16px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chart-card { background: var(--surface-1); border: 1px solid rgba(11, 11, 11, .08); border-radius: 8px; padding: 18px 18px 8px; }
.chart-card .chart-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text-primary); text-align: left; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); }
.chart .tick { font-size: 12px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart .cat { font-size: 13px; fill: var(--text-secondary); }
.chart .value-label { font-size: 12px; font-weight: 600; fill: var(--text-primary); }
.chart .grid { stroke: var(--gridline); stroke-width: 1; }
.chart .base { stroke: var(--baseline); stroke-width: 1; }
.chart .whisker { stroke: var(--text-secondary); stroke-width: 1.5; }
.chart .bar { transition: opacity .12s; }
.chart .hit { fill: transparent; cursor: default; }
.chart svg.hovering .bar { opacity: .45; }
.chart svg.hovering .bar.active { opacity: 1; }
.chart-tooltip {
  position: absolute; z-index: 10; pointer-events: none;
  padding: 8px 12px; border-radius: 6px; background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12); border: 1px solid rgba(11, 11, 11, .1);
  font-size: 13px; line-height: 1.5; color: var(--text-primary); white-space: nowrap;
}
.chart-tooltip .tt-head { font-weight: 600; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.chart-tooltip .tt-row b { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Qualitative */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: 24px; }
.tabs button {
  border: 0; border-bottom: 2px solid #ddd; background: transparent;
  padding: 10px 22px; font-size: 15px; color: #747474;
}
.tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.tabs button:hover { background: #ececec; }
.qual-panel img { width: 100%; height: auto; border-radius: 6px; background: #fff; }
.qual-steps {
  display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 8px;
  font-size: 13px; color: var(--muted); text-align: center;
}
.qual-panel figcaption { text-align: center; max-width: 860px; margin-inline: auto; }

/* Citation */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; padding: 22px 24px; overflow-x: auto;
  background: var(--wash); border-radius: 6px; font-size: 14px; line-height: 1.6; color: var(--ink);
}
.copy-button {
  position: absolute; top: 10px; right: 10px; padding: 4px 12px;
  border: 1px solid #d6d6d6; border-radius: 4px; background: #fff; font-size: 13px; color: var(--text);
}
.copy-button:hover { background: #f0f0f0; }

.footer { padding: 28px 0 40px; text-align: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

/* Lightbox */
.lightbox {
  max-width: 96vw; max-height: 94vh; padding: 0; border: 0; border-radius: 6px; background: #fff;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .7); }
.lightbox img { max-width: 94vw; max-height: 90vh; width: auto; height: auto; margin: 2vh auto; }
.lightbox-close {
  position: absolute; top: 6px; right: 10px; border: 0; background: transparent;
  font-size: 28px; line-height: 1; color: var(--muted);
}

@media (max-width: 900px) {
  .container, .reading-container { width: calc(100% - 40px); }
  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .component-grid, .ablation-grid, .chart-grid { grid-template-columns: 1fr; }
  .publication-authors { font-size: 17px; }
}
