/* ==========================================================================
   TANDEM project page
   ========================================================================== */
:root {
  --ink: #17181a;
  --ink-2: #35373b;
  --muted: #72757b;
  --line: #e4e4e1;
  --line-2: #c9c9c4;
  --bg: #ffffff;
  --bg-soft: #f7f7f5;

  /* chart series — fixed order, follows the entity */
  --s-pre: #9a9992;           /* π0.5-DROID (pretrained) */
  --s-hitl: #bf6a3c;          /* HITL-TAMP */
  --s-ours: #23517c;          /* TANDEM */
  --s-human: #5c8759;         /* Human teleop */
  --grid: #ededea;
  --axis: #b9b9b3;

  /* phase executors, matching the task figure and video labels */
  --tamp: #2e7d4f;
  --teleop: #2c5d93;

  --max: 960px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: currentColor; }
img, video { max-width: 100%; display: block; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }

/* ---------- sticky nav ---------- */
nav.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap { display: flex; align-items: baseline; gap: 22px; height: 54px; padding-top: 17px; }
nav.top .brand {
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  margin-right: auto; color: var(--ink); text-decoration: none;
}
nav.top a.link { color: var(--muted); font-size: 13.5px; text-decoration: none; }
nav.top a.link:hover { color: var(--ink); }
@media (max-width: 820px) { nav.top a.link { display: none; } }

/* ---------- left table of contents (wide screens) ---------- */
.toc { display: none; }
@media (min-width: 1400px) {
  .toc { display: block; position: fixed; top: 116px; left: calc((100vw - var(--max)) / 2 - 184px); width: 166px; z-index: 40; }
  nav.top a.link { display: none; }
}
.toc-hd { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px 14px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-list a {
  display: block; padding: 6px 0 6px 14px; margin-left: -1px;
  border-left: 1px solid transparent; color: var(--muted);
  font-size: 13px; line-height: 1.35; text-decoration: none;
}
.toc-list a:hover { color: var(--ink); }
.toc-list a.active { color: var(--ink); border-left-color: var(--ink); }

/* ---------- hero ---------- */
header.hero { padding: 72px 0 56px; text-align: center; }
h1.title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.4vw, 37px); line-height: 1.22;
  margin: 0 auto 26px; max-width: 880px; font-weight: 600; letter-spacing: -.01em; text-wrap: balance;
}
.authors { font-size: 16px; margin: 0 auto 4px; color: var(--ink-2); }
.affil { color: var(--muted); font-size: 14.5px; margin: 0 auto; }
.affil .inst { color: var(--ink-2); margin-left: 0.12em; }

/* ---------- link buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 26px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); color: var(--ink); background: var(--bg);
  font-size: 14px; padding: 8px 15px; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn.soon { color: var(--muted); border-color: var(--line); cursor: default; }
.btn.soon:hover { border-color: var(--line); }
.btn svg { width: 15px; height: 15px; opacity: .75; }

/* ---------- sections ---------- */
section { padding: 66px 0; border-top: 1px solid var(--line); }
h2.sec { font-family: var(--font-serif); font-size: 27px; font-weight: 600; margin: 0 0 8px; letter-spacing: -.005em; }
h3.sub { font-family: var(--font-serif); font-size: 20px; font-weight: 600; margin: 56px 0 8px; }
.sec-sub { color: var(--muted); margin: 0 0 34px; font-size: 15.5px; }
.prose { font-size: 16.5px; color: var(--ink-2); }
.prose p { margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose b { color: var(--ink); font-weight: 600; }

/* ---------- figures ---------- */
figure { margin: 0; }
.fig { margin: 0; }
.fig img { width: 100%; height: auto; }
.fig figcaption, .caption { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 14px 0 0; }
.fig figcaption b, .caption b { color: var(--ink-2); font-weight: 600; }
.teaser { margin: 44px 0 0; }
.teaser video { width: 100%; height: auto; aspect-ratio: 962 / 270; background: var(--bg-soft); }
.fig.spaced { margin-top: 48px; }

/* predicate and operator names */
.pred { font-family: var(--font-mono); font-size: .88em; color: var(--ink-2); white-space: nowrap; }

/* ---------- method steps ---------- */
.pillars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 34px 40px; margin: 40px 0 0; }
.pillar { border-top: 1px solid var(--ink); padding-top: 14px; }
.pillar .step { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pillar h4 { font-family: var(--font-serif); font-size: 19px; font-weight: 600; margin: 6px 0 10px; }
.pillar p { font-size: 14.5px; color: var(--ink-2); margin: 0; line-height: 1.6; }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- tasks ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1.05fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; gap: 28px; } }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-list li {
  border-top: 1px solid var(--line); padding: 13px 0;
  font-size: 14.5px; color: var(--ink-2); line-height: 1.55;
}
.task-list li:last-child { border-bottom: 1px solid var(--line); }
.task-list li b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.task-list .phases { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.task-list .phases .tag { margin-left: 0; vertical-align: 0; }
.tag {
  display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line-2); color: var(--muted); padding: 0 5px; margin-left: 7px; vertical-align: 2px;
}
.tag.tamp { border-color: var(--tamp); color: var(--tamp); }
.tag.teleop { border-color: var(--teleop); color: var(--teleop); }

/* ---------- videos ---------- */
.vid-card { margin-top: 26px; }
.vid-card + .vid-card { margin-top: 34px; }
.vid-hd { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.vid-grid { display: grid; gap: 14px; }
.vid-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.vid-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .vid-grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .vid-grid.cols-2, .vid-grid.cols-3 { grid-template-columns: 1fr; } }
.vid video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: var(--bg-soft); }
.vid figcaption { font-size: 13px; color: var(--muted); margin-top: 7px; line-height: 1.35; }

/* ---------- charts ---------- */
.chart-card { margin-top: 26px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-2); }
.seg button { border: 0; background: transparent; color: var(--muted); font: 400 13px var(--font); padding: 4px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: #fff; }
.seg button:focus-visible { outline: 1px solid var(--ink); outline-offset: 1px; }
@media (max-width: 480px) { .seg button { padding: 4px 9px; font-size: 12px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; display: inline-block; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .cat { font-size: 12.5px; fill: var(--ink-2); }
.chart .val { font-size: 11px; fill: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .bar { transition: opacity .15s ease; }
.chart .hit { fill: transparent; cursor: default; }
.chart.dim .bar { opacity: .3; }
.chart.dim .bar.on { opacity: 1; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--ink); color: #fff; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.45;
  opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .12s ease; white-space: nowrap;
}
.tip.show { opacity: 1; }
.tip .t { font-weight: 600; margin-bottom: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; }
.tip i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 0; }
.chart-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

/* ---------- collection attempts (stacked horizontal bars) ---------- */
.fail-chart { position: relative; display: grid; gap: 12px; margin-top: 4px; }
.frow { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: center; transition: opacity .15s ease; }
.flabel { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.flabel small { display: block; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.ftrack { display: flex; height: 22px; gap: 1px; }
.fseg { height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; min-width: 2px; }
.fail-chart.dim .frow { opacity: .3; }
.fail-chart.dim .frow.on { opacity: 1; }
.faxis { display: grid; grid-template-columns: 250px 1fr; gap: 16px; }
.faxis .ticks { position: relative; height: 18px; border-top: 1px solid var(--axis); }
.faxis .ticks span { position: absolute; top: 3px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.faxis .ticks span:first-child { transform: none; }
.faxis .ticks span:last-child { transform: translateX(-100%); }
@media (max-width: 760px) {
  .frow { grid-template-columns: 1fr; gap: 5px; }
  .faxis { grid-template-columns: 1fr; gap: 0; }
  .faxis > div:first-child { display: none; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 16px; }
details.table-toggle { margin-top: 18px; }
details.table-toggle summary { cursor: pointer; font-size: 13.5px; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 7px; }
details.table-toggle summary:hover { color: var(--ink); }
details.table-toggle summary::-webkit-details-marker { display: none; }
details.table-toggle summary::before { content: "+"; font-family: var(--font-mono); }
details.table-toggle[open] summary::before { content: "\2212"; }
table.res { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13px; font-variant-numeric: tabular-nums; }
table.res th, table.res td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.res th { font-size: 11.5px; font-weight: 500; color: var(--muted); }
table.res thead tr:first-child th { color: var(--ink-2); }
table.res thead tr:last-child th { border-bottom-color: var(--line-2); }
table.res td:first-child, table.res th:first-child { text-align: left; }
table.res td.ours { font-weight: 600; color: var(--ink); background: var(--bg-soft); }
table.res tr.total td { border-top: 1px solid var(--line-2); font-weight: 600; color: var(--ink); }
table.res .grp { border-left: 1px solid var(--line); }

/* ---------- key findings ---------- */
.findings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 40px; margin-top: 44px; }
.finding { border-top: 1px solid var(--line); padding: 13px 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.finding b { display: block; color: var(--ink); font-weight: 600; }
@media (max-width: 760px) { .findings { grid-template-columns: 1fr; } }

/* ---------- bibtex ---------- */
.bib { position: relative; }
.bib pre {
  background: var(--bg-soft); color: var(--ink-2); border: 1px solid var(--line);
  padding: 18px 20px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  overflow-x: auto; margin: 0;
}
.copy {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line-2);
  font: 400 12px var(--font); padding: 3px 9px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--ink); }

footer { color: var(--muted); font-size: 13.5px; padding: 34px 0; border-top: 1px solid var(--line); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--ink); }

/* ---------- justified body text ---------- */
.prose p, .sec-sub, .fig figcaption, .caption, .chart-note, .pillar p, .finding, .task-list li { text-align: justify; }
@media (max-width: 640px) {
  .prose p, .sec-sub, .fig figcaption, .caption, .chart-note, .pillar p, .finding, .task-list li { hyphens: auto; -webkit-hyphens: auto; }
}

@media (max-width: 640px) { h1.title br { display: none; } }
@media (max-width: 480px) {
  .wrap { padding: 0 20px; }
  section { padding: 48px 0; }
  header.hero { padding: 48px 0 40px; }
  h2.sec { font-size: 23px; }
}
