:root {
  --fg: #16181d;
  --muted: #5b6470;
  --accent: #0d7a6f;        /* teal */
  --accent-dark: #095e55;
  --yes: #138a4a;           /* contact green */
  --yes-bg: #e8f6ee;
  --no: #c0392b;            /* contact red */
  --no-bg: #fbecea;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-soft2: #eef1f4;
  --border: #e4e7ec;
  --border-strong: #d2d7de;
  --content: 920px;
  --wide: min(1760px, 94vw);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* guard against 100vw full-bleed scrollbar */
}

.container { max-width: var(--content); margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: "SFMono-Regular", Menlo, Consolas, monospace; }
.bar { position: relative; display: inline-block; }
.bar::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; border-top: 1.3px solid currentColor; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== HERO ===================== */
.hero {
  background: radial-gradient(1100px 360px at 50% -120px, #e9f3f1 0%, var(--bg-soft) 55%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 0 2.6rem;
  text-align: center;
}
.hero .venue {
  margin: 0 0 1.1rem;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.hero .title {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.02;
  background: linear-gradient(180deg, #11221f, #0d7a6f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .subtitle {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  color: var(--fg);
  margin: .55rem 0 1.4rem;
  font-weight: 400;
}
.hero .authors { margin: 0 0 .15rem; font-size: 1.08rem; color: var(--fg); }
.hero .authors .author { white-space: nowrap; }
.hero .affiliation { margin: .1rem 0 0; font-size: .95rem; color: var(--muted); }
.hero .equal-contribution { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }

.links {
  margin-top: 1.7rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .6rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  padding: .55rem 1.15rem;
  border-radius: 999px;
  background: #1b1f27;
  color: #fff;
  font-size: .94rem;
  font-weight: 500;
  border: 1px solid #1b1f27;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.disabled {
  background: transparent; color: var(--muted); border-color: var(--border-strong);
  cursor: not-allowed; pointer-events: none;
}

/* ===================== TEASER ===================== */
.teaser-wrap { padding: 2.2rem 0 1rem; }
.teaser-wrap figure { margin: 0; }
.teaser-wrap img {
  width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}

/* ===================== CONTENTS — floating side panel ===================== */
.toc-float {
  display: none; /* shown on wide screens via media query */
  position: fixed; left: 20px; top: 50%; transform: translateY(-50%);
  z-index: 80; width: 192px; max-height: 84vh; overflow: auto;
  background: rgba(255,255,255,.9); backdrop-filter: saturate(150%) blur(10px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: .9rem .75rem;
}
.toc-float-title {
  display: block; font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem .55rem;
}
.toc-float a {
  display: block; padding: .34rem .55rem; margin: .05rem 0; font-size: .85rem; line-height: 1.3;
  color: var(--muted); border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
  transition: color .12s, background .12s, border-color .12s;
}
.toc-float a:hover { color: var(--accent); background: var(--bg-soft); text-decoration: none; }
.toc-float a.active {
  color: var(--accent-dark); font-weight: 600;
  border-left-color: var(--accent); background: #e9f3f1;
}

/* ===================== CONTENTS — inline fallback (narrow screens) ===================== */
.contents {
  max-width: var(--content); margin: 1.6rem auto 0; padding: 1.1rem 1.25rem 0;
  text-align: center; line-height: 2.1;
}
.contents .contents-title {
  display: block; font-size: .76rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .35rem;
}
.contents a {
  color: var(--accent); font-weight: 500; font-size: .98rem; white-space: nowrap;
}
.contents a:not(:last-of-type)::after {
  content: "\2022"; color: var(--border-strong); margin: 0 .7rem;
  display: inline-block; text-decoration: none;
}
/* On wide screens: show the floating panel, hide the inline list, and reserve a
   left gutter so the panel never overlaps the full-width gallery. */
@media (min-width: 1400px) {
  :root { --wide: min(1680px, calc(100vw - 460px)); }
  .toc-float { display: block; }
  .contents { display: none; }
}

/* ===================== SECTIONS ===================== */
main { padding: 1rem 0 3rem; }
section { margin: 3rem 0; scroll-margin-top: 28px; }
/* wide sections break out of the narrow main column to span the full viewport */
.wide-section {
  width: 100vw; margin-left: calc(50% - 50vw);
  margin-top: 3.4rem; margin-bottom: 3.4rem;
}

section h2 {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.85rem; font-weight: 600;
  margin: 0 0 1rem; padding-bottom: .4rem;
  border-bottom: 2px solid var(--bg-soft2);
}
section h2::before {
  content: ""; display: inline-block; width: 9px; height: 1.1em;
  background: var(--accent); border-radius: 3px; margin-right: .55rem;
  vertical-align: -2px;
}
section h3 { font-size: 1.18rem; margin: 1.6rem 0 .5rem; }
h3.sub { margin-top: 2.4rem; }
.section-lead { color: var(--fg); }
/* In wide sections, keep prose/tables readable & centered; only the video gallery goes full width */
.wide-section .container-wide > h2,
.wide-section .container-wide > h3,
.wide-section .container-wide > .section-lead,
.wide-section .container-wide > .table-wrap,
.wide-section .container-wide > figure {
  max-width: var(--content); margin-left: auto; margin-right: auto;
}
.keywords { color: var(--muted); font-size: .95rem; }
.cap { text-align: center; color: var(--muted); font-size: .9rem; margin-top: .6rem; }

/* badges */
.badge {
  display: inline-block; font-size: .82em; font-weight: 600;
  padding: .08em .5em; border-radius: 6px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge.yes { color: var(--yes); background: var(--yes-bg); border-color: #bfe6cf; }
.badge.no  { color: var(--no);  background: var(--no-bg);  border-color: #f3cfc9; }

/* figures */
figure { margin: 1.6rem 0; text-align: center; }
figure img {
  max-width: 100%; height: auto; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-soft);
}
figure img.med { max-width: 760px; width: 100%; }
figure.pipeline img { box-shadow: var(--shadow); }
figcaption { margin-top: .7rem; font-size: .9rem; color: var(--muted); text-align: center; line-height: 1.55; }

/* method cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 1.4rem; }
.card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1.3rem;
}
.card h3 { margin-top: 0; font-size: 1.08rem; }
.card h3 i { color: var(--accent); margin-right: .35rem; }
.card ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.card li { margin-bottom: .35rem; font-size: .96rem; }

/* ===================== MAIN VIDEO ===================== */
.video-frame {
  /* break out of the narrow text column so the headline video is large */
  width: min(1120px, 92vw); position: relative; left: 50%; transform: translateX(-50%);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow); background: #000;
}
.video-frame video { display: block; width: 100%; height: auto; }

/* ===================== REAL-WORLD GALLERY ===================== */
.real-gallery { margin-top: 1.8rem; width: 100%; }
.task-block {
  width: 100%; max-width: none;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.3rem 1.4rem 1.5rem; margin-bottom: 1.6rem;
}
.task-title {
  font-family: "Newsreader", Georgia, serif; font-size: 1.4rem;
  margin: 0; font-weight: 600;
}
.contact-pair { margin: .15rem 0 1rem; color: var(--muted); font-size: .92rem; }
.contact-pair span { font-weight: 600; color: var(--fg); }

.cond-group { margin-top: 1rem; }
.group-label {
  font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-dark); margin: .2rem 0 .6rem;
  display: inline-block; padding: .2em .6em; background: #e6f1ef; border-radius: 6px;
}
.cond-row {
  background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 10px; padding: .75rem .9rem; margin-bottom: .7rem;
}
.cond-row.is-yes { border-left-color: var(--yes); }
.cond-row.is-no  { border-left-color: var(--no); }
.cond-head {
  display: flex; align-items: center; gap: .55rem; font-weight: 600;
  font-size: .95rem; margin-bottom: .65rem;
}
.cond-head .cond-name { color: var(--fg); }

/* all 5 trials in one symmetric row */
.takes { display: grid; grid-template-columns: repeat(5, 1fr); gap: .55rem; }
.take {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  background: #0c0c0c; aspect-ratio: 16 / 9; border: 1px solid var(--border);
}
.take video, .take img.poster {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.take .tlabel {
  position: absolute; left: .4rem; top: .4rem; z-index: 2;
  font-size: .68rem; font-weight: 600; color: #fff;
  background: rgba(0,0,0,.55); padding: .05rem .4rem; border-radius: 5px;
  letter-spacing: .02em;
}
.take .play-ic {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.92); font-size: 1.4rem; opacity: 0; transition: opacity .15s; z-index: 2;
  text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none;
}
.take:hover .play-ic { opacity: 1; }
.take:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ===================== TABLES ===================== */
.table-wrap { overflow-x: auto; margin: 1.2rem 0; border-radius: 10px; }
.data-table {
  border-collapse: collapse; width: 100%; font-size: .95rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.data-table.compact { font-size: .86rem; }
.data-table caption {
  caption-side: bottom; text-align: left; color: var(--muted);
  font-size: .85rem; padding: .6rem .2rem 0; line-height: 1.5;
}
.data-table th, .data-table td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table.compact th, .data-table.compact td { padding: .38rem .55rem; }
.data-table thead th {
  background: var(--bg-soft2); font-weight: 600; color: var(--fg);
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.data-table th.grp { text-align: center; border-left: 1px solid var(--border); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:hover { background: #eef6f4; }
.data-table td.b { font-weight: 700; color: var(--accent-dark); }
.data-table tbody td:first-child { font-weight: 500; }

/* ===================== BIBTEX ===================== */
.bibtex-box { position: relative; }
.bibtex-box pre {
  background: #0f1419; color: #e6edf3; border-radius: 10px;
  padding: 1.1rem 1.2rem; overflow-x: auto; font-size: .85rem; line-height: 1.55;
  border: 1px solid #1d2630; margin: 0;
}
.bibtex-box code { font-family: "SFMono-Regular", Menlo, Consolas, monospace; }
.copy-btn {
  position: absolute; top: .6rem; right: .6rem; z-index: 2;
  background: #222b35; color: #cfd8e3; border: 1px solid #38424e;
  border-radius: 7px; padding: .35rem .7rem; font-size: .8rem; cursor: pointer;
  font-family: "Inter", sans-serif; transition: background .12s;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===================== FOOTER / TO-TOP ===================== */
footer { border-top: 1px solid var(--border); padding: 2rem 0; text-align: center; font-size: .88rem; color: var(--muted); background: var(--bg-soft); }
footer p { margin: .25rem 0; }
footer .muted { font-size: .82rem; }

.to-top {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 60;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; color: var(--fg); cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-2px); }

/* ===================== LIGHTBOX ===================== */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(10,12,16,.86); align-items: center; justify-content: center; padding: 2rem;
}
.lightbox.open { display: flex; }
.lightbox .lb-inner { max-width: min(1100px, 94vw); width: auto; }
.lightbox video { max-width: 100%; max-height: 84vh; border-radius: 10px; display: block; box-shadow: 0 10px 40px rgba(0,0,0,.5); background:#000; }
.lightbox .lb-cap { color: #e6edf3; text-align: center; margin-top: .7rem; font-size: .92rem; }
.lightbox .lb-close {
  position: absolute; top: 1rem; right: 1.2rem; color: #fff; font-size: 1.6rem;
  background: none; border: none; cursor: pointer; line-height: 1;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 820px) {
  .cards { grid-template-columns: 1fr; }
  .hero { padding: 2.6rem 0 2rem; }
  section h2 { font-size: 1.5rem; }
}
/* on small screens keep the 5 trials as a swipeable single row */
@media (max-width: 760px) {
  .takes {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 47%;
    overflow-x: auto; scroll-snap-type: x mandatory;
    padding-bottom: .35rem; -webkit-overflow-scrolling: touch;
  }
  .take { scroll-snap-align: start; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .takes { grid-auto-columns: 62%; }
}
