/* ==========================================================================
   Academic project page base (adapted from the Nerfies / Academic Project
   Page Template, as used by Rep-MTL)
   ========================================================================== */

body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
}

.footer .icon-link {
  font-size: 25px;
  color: #000;
}

.link-block a {
  margin-top: 5px;
  margin-bottom: 5px;
}

.teaser .hero-body {
  padding-top: 0;
  padding-bottom: 3rem;
}

.teaser {
  font-family: 'Google Sans', sans-serif;
}

.publication-title {
  font-family: 'Google Sans', sans-serif;
}

.publication-authors {
  font-family: 'Google Sans', sans-serif;
}

.publication-authors a,
.publication-authors .author-name {
  color: hsl(204, 86%, 53%) !important;
}

.publication-authors a:hover {
  text-decoration: underline;
}

.author-block {
  display: inline-block;
}

.container.is-max-desktop {
  max-width: 1024px;
}

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --ink: #1d1d1f;
  --ink-2: #3a3a3c;
  --ink-3: #6e6e73;
  --line: #e5e5ea;
  --line-2: #d2d2d7;
  --soft: #f5f5f7;
  --soft-2: #fafafc;
  --accent: #2f6fb5;
  --accent-ink: #1f5592;
  --accent-soft: #eef5fc;
  --accent-line: #a6caec;
  --neg: #d9776a;
  /* Figure 1 palette */
  --tok-task: #f2cfee;
  --tok-virtual: #bcf2c6;
  --tok-read: #edebff;
  --tok-image: #fbe3d6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.08);
  --heading: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 56px;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-ink);
}

/* ==========================================================================
   Sticky section navigation
   ========================================================================== */

.vtp-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 0.5px solid var(--line);
  transform: translateY(-100%);
  transition: transform 0.28s ease;
}

.vtp-nav.is-visible {
  transform: none;
}

.vtp-nav-inner {
  max-width: 1024px;
  margin: 0 auto;
  height: 48px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.vtp-nav-brand {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink) !important;
  white-space: nowrap;
}

.vtp-nav-brand span {
  font-weight: 400;
  color: var(--ink-3);
  margin-left: 0.4rem;
  font-size: 0.85rem;
}

.vtp-nav-links {
  display: flex;
  gap: 0.2rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.vtp-nav-links::-webkit-scrollbar {
  display: none;
}

.vtp-nav-links a {
  font-size: 0.84rem;
  color: var(--ink-3);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.vtp-nav-links a:hover {
  color: var(--ink);
  background: var(--soft);
}

.vtp-nav-links a.is-active {
  color: var(--ink);
  font-weight: 600;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.author-note {
  font-family: var(--heading);
  font-size: 0.9rem;
  color: var(--ink-3);
  margin-top: 0.15rem;
}

.venue-line {
  font-size: 25px;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 1.1rem;
  font-family: var(--heading);
}

.link-block .button.is-soon {
  opacity: 0.45;
  pointer-events: none;
}

.link-block .button .soon-tag {
  font-size: 0.72em;
  opacity: 0.85;
  margin-left: 0.35em;
}

/* ==========================================================================
   Figures & captions
   ========================================================================== */

.teaser-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.hero.teaser {
  padding: 0;
  margin-top: -1rem;
}

.hero.teaser .hero-body {
  padding: 1.5rem;
}

.figure-caption {
  font-family: var(--heading);
  font-size: 1rem;
  line-height: 1.6;
  color: #4a4a4a;
  text-align: center;
  margin: 1.1rem auto 0;
  max-width: 940px;
}

.figure-caption b {
  color: var(--ink);
}

.zoomable {
  position: relative;
  display: block;
  cursor: zoom-in;
  border-radius: 8px;
}

.zoomable::after {
  content: '\2922  Click to enlarge';
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-family: var(--heading);
  font-size: 0.75rem;
  color: #fff;
  background: rgba(29, 29, 31, 0.72);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.zoomable:hover::after,
.zoomable:focus-visible::after {
  opacity: 1;
}

.zoomable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ==========================================================================
   Section scaffolding
   ========================================================================== */

.vtp-section {
  padding: 3rem 1.5rem;
}

.vtp-section.is-tinted {
  background: var(--soft-2);
  border-top: 0.5px solid #efeff2;
  border-bottom: 0.5px solid #efeff2;
}

.section-title {
  font-family: var(--heading);
  text-align: center;
  margin-bottom: 0.75rem !important;
}

.section-lead {
  text-align: center;
  color: var(--ink-3);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 780px;
  margin: 0 auto 2.25rem;
}

.prose {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.prose b,
.prose strong {
  color: var(--ink);
}

.subhead {
  font-family: var(--heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 2.5rem 0 1rem;
}

/* ==========================================================================
   TL;DR + highlight stats
   ========================================================================== */

.tldr {
  background: var(--soft);
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.tldr-tag {
  display: inline-block;
  font-family: var(--heading);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  margin-right: 0.5rem;
  vertical-align: 2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stat {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem 0.9rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-family: var(--heading);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin-top: 0.4rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--ink-3);
  margin-top: 0.2rem;
  line-height: 1.4;
}

/* ==========================================================================
   Cards (motivation, analysis, design notes)
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.soft-card {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.soft-card p:not(:last-child) {
  margin-bottom: 0.9rem;
}

.soft-card h3 {
  font-family: var(--heading);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.soft-card h3 .card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  flex: none;
}

.soft-card.is-problem h3 .card-icon {
  background: #fdf0ee;
  color: #c0503f;
}

.soft-card p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.evidence {
  margin-top: auto;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--soft);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.evidence .ev-tag {
  font-family: var(--heading);
  font-weight: 600;
  color: var(--ink);
  margin-right: 0.3rem;
}

.pull-question {
  margin: 2rem auto 0;
  max-width: 820px;
  text-align: center;
  font-family: var(--heading);
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.pull-question::before,
.pull-question::after {
  color: var(--accent-line);
  font-size: 1.6em;
  line-height: 0;
  vertical-align: -0.25em;
}

.pull-question::before {
  content: '\201C';
  margin-right: 0.15em;
}

.pull-question::after {
  content: '\201D';
  margin-left: 0.1em;
}

/* ==========================================================================
   Method: read-write diagram, steps, equations
   ========================================================================== */

.diagram-card {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow);
}

.vtp-diagram {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.vtp-diagram text {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  fill: var(--ink);
}

.vtp-diagram .m {
  font-family: 'Times New Roman', 'Latin Modern Math', 'STIX Two Math', Times, serif;
  font-style: italic;
}

.vtp-diagram .tok-label {
  font-size: 14px;
  text-anchor: middle;
}

.vtp-diagram .lbl {
  font-size: 14px;
  text-anchor: middle;
}

.vtp-diagram .lbl-strong {
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
}

.vtp-diagram .lbl-pill {
  font-size: 13px;
}

.vtp-diagram .lbl-dots {
  font-size: 18px;
}

.vtp-diagram .lbl-accent {
  fill: var(--accent);
  font-weight: 700;
}

.vtp-diagram .lbl-sub {
  font-size: 12px;
  fill: var(--ink-3);
  text-anchor: middle;
}

.vtp-diagram .lbl-ok {
  font-size: 13px;
  font-weight: 600;
  fill: var(--accent);
  text-anchor: middle;
}

.vtp-diagram .tok {
  stroke: #1d1d1f;
  stroke-width: 1.1;
}

.vtp-diagram .tok-task { fill: var(--tok-task); }
.vtp-diagram .tok-virtual { fill: var(--tok-virtual); }
.vtp-diagram .tok-read { fill: var(--tok-read); }
.vtp-diagram .tok-image { fill: var(--tok-image); }

.vtp-diagram .fan {
  stroke: #9a9aa0;
  stroke-width: 1;
  fill: none;
}

.vtp-diagram .arrow {
  stroke: #1d1d1f;
  stroke-width: 1.3;
  fill: none;
}

.vtp-diagram .flow {
  stroke-dasharray: 5 4;
  animation: vtp-flow 1.1s linear infinite;
}

@keyframes vtp-flow {
  to { stroke-dashoffset: -18; }
}

.vtp-diagram .mat-cell {
  fill: #f3f5f9;
  stroke: #c9ccd3;
  stroke-width: 0.6;
}

.vtp-diagram .mat-cell.on {
  fill: var(--accent);
  stroke: var(--accent-ink);
}

.vtp-diagram .mat-frame {
  fill: none;
  stroke: #1d1d1f;
  stroke-width: 1.1;
}

.vtp-diagram .block-frame {
  fill: #f9f9f9;
  stroke: #1d1d1f;
  stroke-width: 1.3;
}

.vtp-diagram .pill {
  stroke: #1d1d1f;
  stroke-width: 1;
}

.vtp-diagram .bracket {
  stroke: var(--ink-3);
  stroke-width: 1;
  fill: none;
}

.vtp-diagram .part {
  transition: opacity 0.25s ease;
}

.vtp-diagram[data-focus] .part {
  opacity: 0.16;
}

.vtp-diagram[data-focus='read'] .part-read,
.vtp-diagram[data-focus='block'] .part-block,
.vtp-diagram[data-focus='write'] .part-write {
  opacity: 1;
}

.mobile-hint {
  display: none;
  font-size: 0.78rem;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 0.4rem;
}

.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.diagram-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 16px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid #1d1d1f;
  display: inline-block;
}

.swatch.cell-on {
  background: var(--accent);
  border-color: var(--accent-ink);
}

.swatch.cell-off {
  background: #f3f5f9;
  border-color: #c9ccd3;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.step {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  outline: none;
}

.step:hover,
.step:focus-visible {
  border-color: var(--accent-line);
  box-shadow: 0 4px 20px rgba(47, 111, 181, 0.12);
  transform: translateY(-1px);
}

.step-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--heading);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.step-title {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.step-eqref {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.step .eq {
  margin: 0.35rem 0 0.6rem;
  padding: 0.55rem 0.4rem;
  background: var(--soft-2);
  border-radius: 8px;
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 0.95rem;
}

.step .eq .katex-display {
  margin: 0;
}

.step .eq .katex {
  font-size: 1.05em;
}

.step p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.eq-block {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.eq-block .katex-display {
  margin: 0.25rem 0;
}

.notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.4rem;
  margin-top: 1rem;
}

.note {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.note-icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.note h4 {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.note p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* Pseudo-code */
.code-card {
  margin-top: 1rem;
}

.code-card .code-title {
  font-family: var(--heading);
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}

pre.code {
  background-color: #f8f9fa;
  border: 0.5px solid #e5e5e8;
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  font-size: 0.82rem;
  font-family: var(--mono);
  line-height: 1.65;
  color: #24292f;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

pre.code .c { color: #6e7781; }
pre.code .k { color: #cf222e; }
pre.code .f { color: #8250df; }
pre.code .n { color: #0550ae; }

/* ==========================================================================
   Segmented tabs
   ========================================================================== */

.seg-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.4rem;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  background: #ececf0;
  border-radius: 11px;
}

.seg button {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.42rem 0.95rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-selected='true'],
.seg button[aria-pressed='true'] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.seg.is-small button {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
}

[role='tabpanel'] {
  animation: vtp-fade 0.3s ease;
}

[role='tabpanel'][hidden] {
  display: none;
}

@keyframes vtp-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Result tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.vtp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

table.vtp-table th,
table.vtp-table td {
  text-align: center;
  white-space: nowrap;
  padding: 0.42rem 0.65rem;
  vertical-align: middle;
}

.vtp-table thead th {
  font-family: var(--heading);
  font-weight: 600;
  color: var(--ink);
  background: var(--soft-2);
  padding-top: 0.6rem;
  padding-bottom: 0.1rem;
}

.vtp-table thead tr.metric-row th {
  font-family: inherit;
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--ink-3);
  padding-top: 0.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 0.5px solid var(--line);
}

.vtp-table thead tr.super-row th {
  padding-bottom: 0.2rem;
}

.vtp-table thead th.span-head {
  font-size: 0.8rem;
  color: var(--ink-3);
  font-weight: 600;
  border-bottom: 0.5px solid var(--line);
}

.vtp-table thead th[rowspan] {
  border-bottom: 0.5px solid var(--line);
  vertical-align: middle;
}

.vtp-table .col-method {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  color: var(--ink);
  padding-left: 0.95rem;
  padding-right: 1rem;
}

.vtp-table thead .col-method {
  background: var(--soft-2);
}

.vtp-table tbody td {
  border-bottom: 0.5px solid #f0f0f3;
}

.vtp-table tbody tr:last-child td {
  border-bottom: 0;
}

.vtp-table tbody tr:hover td {
  background: #f7f8fa;
}

.vtp-table tr.group-row td {
  text-align: left;
  font-family: var(--heading);
  font-style: italic;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-3);
  background: #fcfcfd !important;
  padding: 0.55rem 0.95rem 0.3rem;
  position: sticky;
  left: 0;
}

.vtp-table tr.ours td {
  background: var(--accent-soft);
}

.vtp-table tr.ours:hover td {
  background: #e4effa;
}

.vtp-table tr.ours .col-method {
  font-weight: 600;
  color: var(--accent-ink);
}

.vtp-table tr.baseline .col-method::after {
  content: 'baseline';
  font-family: var(--heading);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: var(--soft);
  border: 0.5px solid var(--line-2);
  border-radius: 5px;
  padding: 0.02rem 0.32rem;
  margin-left: 0.45rem;
  vertical-align: 1px;
}

.vtp-table td.best {
  font-weight: 700;
  color: var(--ink);
}

.vtp-table td.second {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  color: var(--ink);
}

table.vtp-table th.setup-head {
  text-align: left;
}

.vtp-table td.setup {
  text-align: left;
  font-size: 0.8rem;
  color: var(--ink-3);
  font-weight: 400;
}

.table-caption {
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--ink-3);
  margin-top: 0.7rem;
}

.table-caption b {
  color: var(--ink-2);
}

.u {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Charts
   ========================================================================== */

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem 0.9rem;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chart-title .chart-unit {
  font-weight: 400;
  color: var(--ink-3);
  font-size: 0.82rem;
}

.chart-title .seg {
  margin-left: auto;
}

.dp-chart,
.gain-chart {
  display: grid;
  gap: 5px;
}

.dp-row,
.gain-row,
.dp-axis {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr) 3.4rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.dp-label {
  text-align: right;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp-track {
  position: relative;
  height: 13px;
}

.dp-track::before {
  content: '';
  position: absolute;
  left: var(--zero);
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--line-2);
}

.dp-axis .dp-track::before {
  display: none;
}

.dp-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
  background: #cdd1d8;
  transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1), width 0.7s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease;
}

.js .dp-chart:not(.in-view) .dp-bar,
.js .gain-chart:not(.in-view) .dp-bar {
  left: var(--zero) !important;
  width: 0 !important;
}

.dp-row.ours .dp-bar,
.gain-row .dp-bar {
  background: linear-gradient(90deg, #7fb2e3, var(--accent));
}

.gain-row.neg .dp-bar {
  background: linear-gradient(90deg, var(--neg), #e8a59b);
}

.dp-row.ours .dp-label {
  color: var(--accent-ink);
  font-weight: 600;
}

.dp-row.baseline .dp-label {
  font-weight: 600;
  color: var(--ink);
}

.dp-val {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  font-size: 0.8rem;
}

.dp-row.ours .dp-val {
  color: var(--accent-ink);
  font-weight: 700;
}

.gain-row.neg .dp-val {
  color: #b5503f;
}

.dp-axis {
  margin-top: 2px;
}

.dp-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--ink-3);
}

.chart-note {
  font-size: 0.74rem;
  color: var(--ink-3);
  margin-top: 0.6rem;
  line-height: 1.5;
}

.obs-card {
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.obs-card h4 {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.obs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.obs-list li {
  position: relative;
  padding-left: 1.05rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 0.55rem;
}

.obs-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.obs-list li.is-caveat::before {
  background: var(--neg);
}

.obs-list b {
  color: var(--ink);
}

.metric-def {
  font-size: 0.88rem;
  color: var(--ink-3);
  text-align: center;
  margin: -1rem auto 1.6rem;
}

/* Collapsible extras */
details.more {
  margin-top: 1rem;
  border: 0.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

details.more > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.8rem 1.1rem;
  font-family: var(--heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

details.more > summary::-webkit-details-marker {
  display: none;
}

details.more > summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--ink-3);
  border-bottom: 1.6px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-right: 0.15rem;
}

details.more[open] > summary::before {
  transform: rotate(45deg);
}

details.more > summary .summary-hint {
  font-weight: 400;
  color: var(--ink-3);
  font-size: 0.82rem;
}

details.more .more-body {
  padding: 0 1.1rem 1.1rem;
}

details.more .table-wrap {
  box-shadow: none;
}

/* ==========================================================================
   Related work
   ========================================================================== */

.related {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  color: var(--ink-2) !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.related:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.related .related-venue {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

.related .related-title {
  font-family: var(--heading);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.98rem;
}

.related .related-desc {
  font-size: 0.86rem;
  color: var(--ink-3);
}

.related .related-arrow {
  margin-left: auto;
  color: var(--ink-3);
}

/* ==========================================================================
   BibTeX (Apple-inspired, from Rep-MTL)
   ========================================================================== */

#BibTeX pre {
  background-color: #f8f9fa;
  border: 0.5px solid #e5e5e8;
  border-radius: 12px;
  padding: 2rem;
  font-size: 0.95rem;
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: auto;
  box-shadow: var(--shadow);
  letter-spacing: 0.01em;
}

.bibtex-title {
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

#copy-bibtex-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  border: none;
  background-color: #f5f5f7;
  color: #1d1d1f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: all 0.15s ease;
  cursor: pointer;
  letter-spacing: -0.01em;
  margin-top: 0.5rem;
}

#copy-bibtex-btn svg,
#copy-bibtex-btn i {
  margin-right: 0.5rem;
}

#copy-bibtex-btn:hover {
  background-color: #e8e8ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  transform: translateY(-0.5px);
}

#copy-bibtex-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#copy-bibtex-btn.is-copied,
#copy-bibtex-btn.is-copied:hover {
  background-color: #d1d5db !important;
  color: #374151 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 2.5rem 1.5rem 1.5rem;
  background: rgba(250, 250, 252, 0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  cursor: zoom-out;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: min(1800px, 96vw);
  max-height: calc(100vh - 7rem);
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: scale(0.98);
  transition: transform 0.22s ease;
}

.lightbox.is-open img {
  transform: none;
}

.lightbox-caption {
  font-family: var(--heading);
  font-size: 0.88rem;
  color: var(--ink-3);
  text-align: center;
  max-width: 900px;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: #e8e8ed;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: #dcdce1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 960px) {
  .result-grid,
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid,
  .notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .diagram-card {
    overflow-x: auto;
    padding: 1rem 0.75rem 0.9rem;
  }

  .vtp-diagram {
    min-width: 680px;
  }

  .mobile-hint {
    display: block;
  }

  .hide-sm {
    display: none;
  }

  .seg-wrap .seg,
  .chart-title .seg {
    width: 100%;
    margin-left: 0;
  }

  .seg button {
    flex: 1 1 auto;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .vtp-nav-brand span {
    display: none;
  }

  .dp-row,
  .gain-row,
  .dp-axis {
    grid-template-columns: 6.6rem minmax(0, 1fr) 3rem;
  }

  .zoomable::after {
    display: none;
  }

  .related {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 420px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .vtp-diagram .flow {
    animation: none;
  }

  [role='tabpanel'] {
    animation: none;
  }

  .dp-bar {
    transition: none;
  }
}
