/* PC-DAPS project page. Layout and dropdown/lightbox styles follow ../TrajectoryForcing. */

:root {
  --ink: #1f2328;
  --ink-2: #4a5360;
  --muted: #6b7785;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #e1e4e8;
  --accent: #007c7a;           /* teal: PC-DAPS, approximation of p(x0 | x_t) */
  --accent-soft: rgba(0, 124, 122, 0.08);
  --good: #2a78d6;             /* blue: on the prior / faithful */
  --bad: #eb6834;              /* orange: off the prior / hallucinated */
  --failed: #77756f;           /* gray: failed */
  --magma: linear-gradient(90deg, #000004 0%, #180f3d 12.5%, #440f76 25%, #721f81 37.5%, #9e2f7f 50%,
                           #cd4071 62.5%, #f1605d 75%, #fd9668 87.5%, #fcfdbf 100%);
}

body {
  font-family: 'Noto Sans', sans-serif;
  color: var(--ink);
  background: var(--surface);
}

.hero .hero-body {
  padding-top: 2.25rem;
  padding-bottom: 0.75rem;
}

.section-tight {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.publication-title {
  font-family: 'Google Sans', sans-serif;
  margin-bottom: 1rem !important;
}

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

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

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

.publication-affiliations {
  margin-top: 0.35rem;
  color: var(--ink-2);
}

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

.publication-links {
  margin-top: 1rem;
}

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

.publication-links .icon svg {
  width: 1.05em;
  height: 1.05em;
  fill: currentColor;
}

.button.is-soon {
  cursor: default;
  opacity: 0.55;
}

.soon-label {
  color: var(--muted);
  font-size: 0.6em;
  font-weight: 400;
}

.button.is-soon small {
  margin-left: 0.25em;
  font-size: 0.75em;
  opacity: 0.85;
}

.method-pill {
  display: inline-block;
  margin-bottom: 0.9rem;
  padding: 0.25rem 0.9rem;
  color: #ffffff;
  background: linear-gradient(135deg, #007c7a 0%, #2a78d6 100%);
  border-radius: 999px;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.section-lede {
  margin: 0 auto 1.25rem;
  max-width: 820px;
  color: var(--ink-2);
  text-align: justify;
}

.tldr {
  margin: 0 auto 1.25rem;
  max-width: 680px;
  padding: 0.8rem 1.3rem;
  color: var(--ink);
  background: var(--accent-soft);
  border-radius: 10px;
  font-family: 'Google Sans', sans-serif;
  font-size: 1.08rem;
  text-align: center;
}

/* ------------------------------------------------------------------ teaser */
.teaser-section {
  padding-top: 0.75rem;
  padding-bottom: 1rem;
}

.teaser-wrap {
  max-width: 1360px;
  margin: 0 auto;
}

.teaser {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media screen and (min-width: 1024px) {
  .teaser {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }
}

.teaser-block {
  display: grid;
  grid-template-columns: 1fr 1fr 4px 1fr 1fr 1fr 4px 1fr;
  gap: 3px;
}

.tc-1 { grid-column: 1; }
.tc-2 { grid-column: 2; }
.tc-3 { grid-column: 4; }
.tc-4 { grid-column: 5; }
.tc-5 { grid-column: 6; }
.tc-6 { grid-column: 8; }

.teaser-head {
  padding-bottom: 3px;
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.teaser-head small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.teaser-head.is-ours {
  font-weight: 700;
}

.teaser-head.is-ours small {
  color: var(--accent);
  font-weight: 600;
}

.tcell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #000;
  border-radius: 3px;
}

.tcell img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.tcell img.is-active {
  opacity: 1;
}

.tcell.is-ours::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 3px;
  pointer-events: none;
}

.teaser-caption {
  max-width: 900px;
  margin: 0.8rem auto 0;
  color: var(--ink-2);
  font-size: 0.92rem;
  text-align: center;
}

@media screen and (max-width: 520px) {
  .teaser-head {
    font-size: 0.66rem;
  }

  .teaser-head small {
    font-size: 0.58rem;
  }
}

/* ---------------------------------------------------------- anim controls */
.anim-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.anim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.anim-btn:hover,
.anim-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.anim-icon-pause,
.anim-icon-play {
  display: block;
}

.anim-icon-pause {
  width: 10px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}

.anim-icon-play {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.run-dots {
  display: inline-flex;
  gap: 6px;
}

.run-dot {
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.run-dot.is-active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.anim-status b {
  font-variant-numeric: tabular-nums;
}

.anim-scrub {
  width: min(460px, 62vw);
  accent-color: var(--accent);
}

.anim-readout {
  min-width: 7.5em;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- dropdowns */
.content-dropdown {
  margin-top: 0.5rem;
  padding: 0.4rem 1.1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
}

.content-dropdown summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  margin-bottom: 0;
  padding: 0.6rem 0 0.7rem;
  list-style: none;
  text-align: center;
  cursor: pointer;
}

.content-dropdown summary::-webkit-details-marker {
  display: none;
}

.dropdown-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-family: "Google Sans", "Noto Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.content-dropdown summary:hover .dropdown-hint {
  color: var(--accent);
}

.dropdown-hint-label::after {
  content: "Read more";
}

.content-dropdown[open] .dropdown-hint-label::after {
  content: "Show less";
}

.dropdown-chevron {
  width: 0.42em;
  height: 0.42em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.content-dropdown[open] .dropdown-chevron {
  transform: rotate(-135deg);
}

.content-dropdown-body {
  padding-top: 0.5rem;
}

.content .katex-display {
  margin: 0.8em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2em 0;
}

.method-sub {
  margin-top: 1.6rem !important;
  margin-bottom: 0.6rem !important;
  font-family: 'Google Sans', sans-serif;
}

/* ------------------------------------------------ best-of-k (motivation) */
.bok {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.bok-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 0.8rem;
}

.bok-label {
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

.bok-label small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.bok-cells {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.content figure.bok-cell,
.content figure.bok-oracle {
  margin: 0;
}

.bok-cell {
  position: relative;
  border-radius: 6px;
  transition: transform 0.25s ease, opacity 0.35s ease, box-shadow 0.25s ease;
}

.bok-cell img,
.bok-oracle img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.bok-badge {
  position: absolute;
  left: 50%;
  bottom: 5px;
  padding: 1px 7px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 999px;
  font-size: 0.64rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.bok-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  vertical-align: 1px;
  background: var(--good);
  border-radius: 50%;
}

.bok-cell[data-verdict="bad"] .bok-badge::before {
  background: var(--bad);
  border-radius: 0;
  transform: rotate(45deg);
}

.bok-cell.is-judged .bok-badge {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bok-cell.is-scanning {
  box-shadow: 0 0 0 3px var(--ink-2);
  transform: translateY(-3px);
}

.bok-cell.is-picked {
  box-shadow: 0 0 0 3px var(--accent);
}

.bok-cell.is-picked::after {
  content: "best-of-4";
  position: absolute;
  top: -9px;
  left: 50%;
  padding: 0 6px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  transform: translateX(-50%);
  white-space: nowrap;
}

.bok-cell.is-discarded {
  opacity: 0.3;
}

.bok-oracle {
  text-align: center;
}

.bok-oracle img {
  outline: 2px dashed var(--muted);
  outline-offset: 2px;
  transition: outline-color 0.2s ease;
}

.bok-oracle.is-active img {
  outline-color: var(--ink);
}

.bok-oracle figcaption,
.bok-oracle-none span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
}

.bok-status {
  min-height: 1.5em;
  margin: 0.8rem 0 !important;
  color: var(--ink-2);
  font-size: 0.86rem;
  text-align: center;
}

@media screen and (max-width: 640px) {
  .bok-badge {
    padding: 2px 4px;
    font-size: 0;
  }

  .bok-badge::before {
    margin-right: 0;
  }

  .bok-row {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .bok-label {
    grid-column: 1 / -1;
    text-align: left;
  }

  .bok-label small {
    display: inline;
    margin-left: 0.4em;
  }
}

/* ---------------------------------------------------------------- pipeline */
.content ol.pipeline {
  position: relative;
  margin: 1.4rem 0 0.4rem;
  padding: 0;
  list-style: none;
}

.content ol.pipeline li + li {
  margin-top: 10px;
}

.pipe-step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(150px, 210px) minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.3;
}

.pipe-step:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 29px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.pipe-step.is-new {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.pipe-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
}

.pipe-step.is-new .pipe-num {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.pipe-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pipe-tag {
  margin-left: 0.35rem;
  padding: 0 6px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: 2px;
  white-space: nowrap;
}

.pipe-eq {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0;
}

.pipe-note {
  color: var(--muted);
  font-size: 0.74rem;
}

.pipe-loop {
  margin-top: 0.8rem !important;
  color: var(--ink-2);
  font-size: 0.86rem;
  text-align: center;
}

@media screen and (max-width: 640px) {
  .pipe-step {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 0.3rem 0.7rem;
  }

  .pipe-eq {
    grid-column: 2;
  }
}

.algo-box {
  margin-top: 1.4rem;
  padding: 0.6rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.algo-box summary {
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.content ol.algo {
  margin: 0.7rem 0 0.2rem 1.3rem;
  font-size: 0.9rem;
}

.content ol.algo ol {
  margin-top: 0.3rem;
  list-style-type: lower-alpha;
}

/* -------------------------------------------------------------- toy figures */
.toy-figure {
  max-width: 1180px;
  margin: 0.5rem auto 0;
}

.toy-panels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

@media screen and (max-width: 820px) {
  .toy-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }
}

.toy-title {
  min-height: 2.9em;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.toy-method {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.toy-stat {
  display: block;
  min-height: 1.3em;
  color: var(--ink-2);
  font-size: 0.76rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.toy-stat::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  vertical-align: 1px;
  background: var(--muted);
  border-radius: 50%;
}

.toy-stat-good::before {
  background: var(--good);
}

.toy-stat-bad::before {
  background: var(--bad);
  border-radius: 0;
  transform: rotate(45deg);
}

.toy-figure.is-final .toy-stat {
  opacity: 1;
}

.toy-panel {
  display: flex;
  flex-direction: column;
}

.toy-canvas-wrap {
  position: relative;
  margin-top: auto;
  aspect-ratio: 1 / 1.08;
}

.toy-canvas-wrap.is-square {
  aspect-ratio: 1 / 1;
}

.toy-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.gate-flag {
  position: absolute;
  top: 6px;
  left: 6px;
  max-width: 72%;
  padding: 3px 7px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  font-size: 0.68rem;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gate-flag.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toy-axis-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 2rem;
  margin-top: 0.3rem;
  color: var(--ink-2);
  font-size: 0.86rem;
}

.toy-colorbar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
}

.toy-colorbar-ramp {
  display: inline-block;
  width: 96px;
  height: 8px;
  background: var(--magma);
  border-radius: 2px;
}

.toy-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.2rem;
  margin-top: 0.8rem;
  color: var(--ink-2);
  font-size: 0.82rem;
}

.toy-caption {
  max-width: 900px;
  margin: 0.8rem auto 0;
  color: var(--ink-2);
  font-size: 0.86rem;
  text-align: justify;
}

.glyph,
.glyph-img {
  display: inline-block;
  margin-right: 0.4rem;
  vertical-align: -1px;
}

.glyph-img {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.glyph-good {
  width: 10px;
  height: 10px;
  background: var(--good);
  border-radius: 50%;
}

.glyph-open {
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 1.6px solid #0b0b0b;
  border-radius: 50%;
}

.glyph-bad {
  width: 9px;
  height: 9px;
  background: var(--bad);
  transform: rotate(45deg);
}

.glyph-dots {
  width: 16px;
  height: 8px;
  background:
    radial-gradient(circle, #4f97ff 60%, transparent 64%) 0 50% / 7px 7px no-repeat,
    radial-gradient(circle, #ff7a45 60%, transparent 64%) 8px 50% / 7px 7px no-repeat;
}

.glyph-lik {
  width: 16px;
  height: 8px;
  background: linear-gradient(#2a78d6, #2a78d6) center / 100% 1.5px no-repeat, rgba(42, 120, 214, 0.22);
}

.glyph-ellipse {
  width: 16px;
  height: 9px;
  border: 1.8px solid #007c7a;
  border-radius: 50%;
}

.glyph-bag {
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1.5px solid #52514e;
  border-radius: 50%;
}

.glyph-start {
  width: 22px;
  height: 8px;
  background:
    radial-gradient(circle at 4px 50%, var(--ink) 3.2px, transparent 3.7px),
    linear-gradient(var(--ink), var(--ink)) 4px 50% / 18px 1.8px no-repeat;
}

/* ----------------------------------------------------------- outcome chart */
.outcome-chart {
  max-width: 720px;
  margin: 1.4rem auto 2.2rem;
}

.outcome-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  margin-bottom: 0.9rem;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.4rem;
  vertical-align: -1px;
  border-radius: 3px;
}

.swatch-faithful { background: var(--good); }
.swatch-inverted { background: var(--bad); }
.swatch-failed { background: var(--failed); }

.outcome-group {
  margin-bottom: 0.9rem;
}

.outcome-dataset {
  margin: 0 0 0.3rem 162px;
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.outcome-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.outcome-method {
  color: var(--ink-2);
  font-size: 0.85rem;
  text-align: right;
}

.outcome-method small {
  color: var(--muted);
}

.outcome-row.is-ours .outcome-method {
  color: var(--ink);
  font-weight: 700;
}

.outcome-bar {
  display: flex;
  gap: 2px;
  height: 26px;
}

.outcome-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 0;
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
  transition: flex-grow 1s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.outcome-seg:first-child { border-radius: 4px 0 0 4px; }
.outcome-seg:last-child { border-radius: 0 4px 4px 0; }
.outcome-seg.is-faithful { background: var(--good); }
.outcome-seg.is-inverted { background: var(--bad); }
.outcome-seg.is-failed { background: var(--failed); }

.outcome-axis {
  display: flex;
  justify-content: space-between;
  margin-left: 162px;
  padding-top: 4px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.outcome-note {
  margin-top: 0.8rem;
  color: var(--ink-2);
  font-size: 0.86rem;
  text-align: center;
}

/* "Show all task comparisons": the paper's full results table */
.results-toggle {
  margin: -1.2rem 0 2.2rem;
}

.results-toggle summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  margin: 0 auto;
  padding: 0.35rem 1rem;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.86rem;
  list-style: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.results-toggle summary::-webkit-details-marker {
  display: none;
}

.results-toggle summary:hover,
.results-toggle summary:focus-visible {
  color: var(--ink);
  border-color: var(--accent);
  outline: none;
}

.results-toggle-label::after {
  content: "Show all task comparisons";
}

.results-toggle[open] .results-toggle-label::after {
  content: "Hide task comparisons";
}

.results-toggle[open] .dropdown-chevron {
  transform: rotate(-135deg);
}

.results-caption {
  max-width: 880px;
  margin: 1rem auto 0.7rem;
  color: var(--ink-2);
  font-size: 0.82rem;
}

.results-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

table.results-table th,
table.results-table td {
  padding: 0.26rem 0.5rem;
  text-align: center;
  white-space: nowrap;
  border: 0;
}

table.results-table thead th {
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  vertical-align: bottom;
  border-bottom: 1px solid var(--line);
}

.results-table tbody {
  border-top: 1px solid var(--line);
}

table.results-table .col-task {
  min-width: 108px;
  color: var(--ink);
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
}

table.results-table td:first-of-type,
table.results-table .col-method {
  text-align: left;
}

.results-table tr.is-ours td {
  color: var(--ink);
  background: var(--accent-soft);
}

.results-table tr.is-ours td:first-of-type {
  font-weight: 700;
}

.results-table tr.is-reference td {
  border-top: 1px dotted var(--line);
}

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

.results-table u {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.results-table small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 0.72em;
}

.results-table sup {
  color: var(--muted);
}


@media screen and (max-width: 560px) {
  .outcome-row {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
  }

  .outcome-dataset,
  .outcome-axis {
    margin-left: 104px;
  }

  .outcome-method small {
    display: block;
  }
}

/* ------------------------------------------------------ phase retrieval grid */
.pr-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

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

.pr-example {
  margin: 0;
}

.pr-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 3px;
}

.pr-input,
.pr-cell {
  position: relative;
}

.pr-input {
  margin-right: 4px;
}

.pr-input img,
.pr-cell img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.pr-cap,
.pr-tag {
  position: absolute;
  padding: 1px 5px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 4px;
  font-size: 0.6rem;
  line-height: 1.35;
  white-space: nowrap;
}

.pr-cap {
  left: 3px;
  bottom: 3px;
}

.pr-tag {
  top: 3px;
  left: 3px;
}

.pr-tag::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  vertical-align: 1px;
  background: var(--bad);
  transform: rotate(45deg);
}

.pr-tag.is-failed::before {
  background: #b9b7ae;
  border-radius: 50%;
  transform: none;
}

@media screen and (max-width: 560px) {
  .pr-tag {
    padding: 2px 4px;
    font-size: 0;
  }

  .pr-tag::before {
    margin-right: 0;
  }

  .pr-cap {
    font-size: 0.52rem;
  }
}

.pr-label {
  align-self: center;
  color: var(--ink-2);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.7rem;
  text-align: center;
  white-space: nowrap;
  transform: rotate(180deg);
  writing-mode: vertical-rl;
}

.pr-label.is-ours {
  color: var(--ink);
  font-weight: 700;
}

.pr-example figcaption {
  margin-top: 0.4rem;
  color: var(--ink-2);
  font-family: 'Google Sans', sans-serif;
  font-size: 0.9rem;
  text-align: center;
}

.pr-examples + .section-lede {
  margin-top: 1rem;
  font-size: 0.92rem;
}

/* ------------------------------------------------------------------ gallery */
.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.gallery-tabs a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.gallery-tabs a:hover,
.gallery-tabs a:focus-visible {
  color: var(--ink);
  border-color: var(--accent);
  outline: none;
}

.gallery-tabs li.is-active a {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.gallery-panel {
  display: none;
  max-width: 760px;
  margin: 0 auto;
}

.gallery-panel.is-active {
  display: block;
}

.gallery-panel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.gallery-panel figcaption {
  margin-top: 0.6rem;
  color: var(--ink-2);
  font-size: 0.86rem;
  text-align: center;
}

/* ----------------------------------------------------------------- lightbox */
.zoomable-image {
  cursor: zoom-in;
}

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

body.image-lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  padding: clamp(0.5rem, 2vw, 1.5rem);
  color: #ffffff;
  background: rgba(4, 8, 13, 0.94);
}

.image-lightbox:not([hidden]) {
  display: flex;
}

.image-lightbox-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  width: 100%;
  height: 100%;
}

.image-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.5rem;
}

.image-lightbox-caption {
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
}

.image-lightbox-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 0.7rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 7px;
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

.image-lightbox-button:hover,
.image-lightbox-button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: 2px solid #8cc4ff;
  outline-offset: 1px;
}

.image-lightbox-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.image-lightbox-close {
  margin-left: 0.25rem;
  font-size: 1.75rem;
}

.image-lightbox-zoom {
  min-width: 3.4rem;
  color: #ffffff;
  font-size: 0.8rem;
  text-align: center;
}

.image-lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  cursor: zoom-in;
  touch-action: none;
}

.image-lightbox-stage.is-zoomed {
  cursor: grab;
}

.image-lightbox-stage.is-dragging {
  cursor: grabbing;
}

.image-lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  will-change: transform;
}

.image-lightbox-help {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  text-align: center;
}

@media screen and (max-width: 768px) {
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .publication-title {
    font-size: 2rem !important;
  }

  .has-text-justified,
  .section-lede,
  .toy-caption {
    text-align: left !important;
  }

  .image-lightbox-caption {
    font-size: 0.78rem;
  }
}

/* --------------------------------------------------------------------------
   Dark mode: follows the visitor's system setting, as on the TF page.
-------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1f3f5;
    --ink-2: #cfd3d8;
    --muted: #8f9aa6;
    --surface: #15191e;
    --surface-2: #1d2228;
    --line: #2c333b;
    --accent: #3fb4b1;
    --accent-soft: rgba(63, 180, 177, 0.1);
    --good: #4a92e8;
    --bad: #e2682f;
    --failed: #8e8c86;
  }

  html,
  body {
    background-color: var(--surface) !important;
  }

  .hero,
  .section {
    background-color: transparent !important;
  }

  .title,
  .publication-title,
  .subtitle,
  h1, h2, h3, h4, h5, h6 {
    color: var(--ink) !important;
  }

  .content,
  .content p,
  p, td, th, li, dd, dt {
    color: var(--ink-2);
  }

  strong,
  .content strong,
  .table th,
  .table thead th {
    color: var(--ink);
  }

  a {
    color: #4ea3f0;
  }

  a:hover {
    color: #f5a94e;
  }

  .publication-authors a {
    color: #5cb3ff !important;
  }

  .method-pill,
  .run-dot.is-active {
    color: #0f1417;
  }

  .content-dropdown {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  }

  .content pre,
  .content pre code {
    color: var(--ink-2);
    background: var(--surface-2);
  }

  .table {
    color: var(--ink-2);
    background: transparent;
  }

  .table td,
  .table th {
    border-color: var(--line);
  }

  .gallery-tabs li.is-active a {
    color: #0f1417;
  }

  .pipe-tag,
  .pipe-step.is-new .pipe-num,
  .bok-cell.is-picked::after {
    color: #0f1417;
  }

  .glyph-start {
    background:
      radial-gradient(circle at 4px 50%, #0b0b0b 3.2px, transparent 3.7px),
      linear-gradient(#0b0b0b, #0b0b0b) 4px 50% / 18px 1.8px no-repeat,
      #e8e6df;
    border-radius: 2px;
  }

  .glyph-open {
    border-color: #ffffff;
    background: #15191e;
  }

  .footer {
    background-color: var(--surface) !important;
  }
}

