/* ==========================================================================
   DATAFARM project page
   ========================================================================== */
:root {
  --accent: #2f7a4f;          /* farm green */
  --accent-ink: #256340;
  --accent-soft: #e3efe6;
  --ink: #1c1d1a;
  --ink-2: #2d2e2a;
  --muted: #6b6c64;
  --line: #e3e2da;
  --bg: #fafaf6;
  --bg-alt: #f1f0e8;
  --card: #ffffff;
  --grid: #e8e7e0;
  --axis: #c3c2b7;

  /* chart series — fixed order, follows the entity */
  --s-pre: #4a3aa7;           /* π0.5-DROID (pretrained) */
  --s-raw: #eb6834;           /* Raw TAMP */
  --s-ours: #2a78d6;          /* DATAFARM */
  --s-human: #1baf7a;         /* Human teleop */

  --max: 1080px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30,30,20,.05), 0 10px 30px rgba(30,30,20,.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Fraunces', 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: 70px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
.sc { font-variant: small-caps; letter-spacing: .02em; }

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

/* ---------- sticky nav ---------- */
nav.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,250,246,.86);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
nav.top .brand { font-family: var(--font-serif); font-weight: 600; font-size: 19px; letter-spacing: .3px; margin-right: auto; color: var(--ink); }
nav.top .brand span { color: var(--accent); }
nav.top .brand:hover { text-decoration: none; }
nav.top a.link { color: var(--muted); font-size: 14px; font-weight: 500; }
nav.top a.link:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 820px) { nav.top a.link { display: none; } }

/* ---------- left table of contents (wide screens) ---------- */
.toc { display: none; }
@media (min-width: 1480px) {
  .toc { display: block; position: fixed; top: 120px; left: calc((100vw - 1080px) / 2 - 188px); width: 168px; z-index: 40; }
  nav.top a.link { display: none; }
}
.toc-hd { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px 15px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc-list a {
  display: block; padding: 7px 0 7px 15px; margin-left: -2px;
  border-left: 2px solid transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; line-height: 1.3;
  transition: color .15s ease, border-color .15s ease;
}
.toc-list a:hover { color: var(--ink); text-decoration: none; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }

/* ---------- hero ---------- */
header.hero { padding: 60px 0 30px; text-align: center; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
h1.title { font-family: var(--font-serif); font-size: clamp(27px, 3.9vw, 42px); line-height: 1.16; margin: 0 auto 22px; max-width: 900px; font-weight: 600; letter-spacing: -.01em; }
h1.title .name { color: var(--accent); }
.authors { font-size: 18px; margin: 0 auto 6px; color: var(--ink-2); font-weight: 600; }
.affil { color: var(--muted); font-size: 15px; margin: 0 auto; }

/* ---------- link buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 999px; transition: transform .12s ease, background .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); background: #000; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.soon { opacity: .5; cursor: default; }
.btn.soon:hover { transform: none; border-color: var(--line); }
.btn svg { width: 17px; height: 17px; }

/* ---------- sections ---------- */
section { padding: 64px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2.sec { font-family: var(--font-serif); font-size: 31px; font-weight: 600; text-align: center; margin: 0 0 10px; letter-spacing: -.005em; }
h3.sub { font-family: var(--font-serif); font-size: 22px; font-weight: 600; margin: 48px 0 8px; text-align: center; }
.sec-sub { text-align: center; color: var(--muted); max-width: 740px; margin: 0 auto 34px; }
.prose { max-width: 820px; margin: 0 auto; font-size: 17px; color: var(--ink-2); }
.prose p { margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose b { color: var(--ink); }

/* ---------- figures ---------- */
figure { margin: 0; }
.fig {
  margin: 8px auto 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px 18px;
}
.fig img { width: 100%; height: auto; margin: 0 auto; }
.fig figcaption, .caption { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 14px auto 0; max-width: 880px; text-align: left; }
.fig figcaption b, .caption b { color: var(--ink-2); }
.teaser { max-width: 980px; margin-top: 40px; }
.fig.narrow { max-width: 620px; }
@media (max-width: 700px) { .fig { padding: 14px 12px 12px; } }

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ---------- method cards ---------- */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 36px 0 0; }
.pillar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 20px 18px; }
.pillar .step { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.pillar h4 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; margin: 4px 0 2px; }
.pillar .what { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pillar .what code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-alt); padding: 1px 6px; border-radius: 5px; color: var(--ink-2); }
.pillar p { font-size: 15px; color: var(--ink-2); margin: 0; line-height: 1.6; }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } }

.eq { font-family: var(--font-serif); font-style: italic; }

/* ---------- task cards ---------- */
.two-col { display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; align-items: center; }
.two-col .fig { margin: 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.task-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.task-list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.task-list li b { display: block; color: var(--ink); font-size: 15.5px; }
.task-list li.ood { border-color: #f1d3bd; background: #fffaf5; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.tag.target { background: var(--accent-soft); color: var(--accent-ink); }
.tag.ood { background: #fbe6d6; color: #9a4a1c; }

/* ---------- videos ---------- */
.vid-card + .vid-card { margin-top: 18px; }
.vid-hd { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.vid-hd .tag { letter-spacing: .06em; }
.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: 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; border-radius: 9px; background: var(--bg-alt); }
.vid video.wide { aspect-ratio: 1496 / 472; background: #fff; }
.vid figcaption { font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: center; margin-top: 7px; line-height: 1.35; }
.vid-row { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.vid-row + .vid-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.vid-label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.vid-label i { display: block; width: 22px; height: 4px; border-radius: 2px; margin-bottom: 6px; }
@media (max-width: 760px) { .vid-row { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- charts ---------- */
.chart-card, .vid-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 18px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-title { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 5px 14px; border-radius: 999px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; 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: 13px; fill: var(--ink-2); font-weight: 600; }
.chart .val { font-size: 11px; fill: var(--ink-2); font-weight: 700; 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: .35; }
.chart.dim .bar.on { opacity: 1; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.18);
  opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .12s ease; white-space: nowrap;
}
.tip.show { opacity: 1; }
.tip .t { font-weight: 700; margin-bottom: 2px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.chart-note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 14px; }
details.table-toggle { margin-top: 14px; }
details.table-toggle summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent-ink); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.table-toggle summary::-webkit-details-marker { display: none; }
details.table-toggle summary::before { content: "▸"; transition: transform .15s ease; display: inline-block; }
details.table-toggle[open] summary::before { transform: rotate(90deg); }
table.res { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13.5px; 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: 12px; font-weight: 700; color: var(--muted); }
table.res thead tr:first-child th { color: var(--ink-2); font-size: 12.5px; }
table.res td:first-child, table.res th:first-child { text-align: left; }
table.res tr.ours td { background: var(--accent-soft); font-weight: 700; color: var(--ink); }
table.res tr.abl td { color: var(--muted); }
table.res tr.oracle td { font-style: italic; color: var(--ink-2); }
table.res .grp { border-left: 1px solid var(--line); }

/* ---------- key findings ---------- */
.findings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 30px; }
.finding { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 14px 18px; font-size: 15px; color: var(--ink-2); line-height: 1.55; }
.finding b { color: var(--ink); }
@media (max-width: 760px) { .findings { grid-template-columns: 1fr; } }

/* ---------- bibtex ---------- */
.bib { position: relative; max-width: 820px; margin: 0 auto; }
.bib pre { background: #1f201c; color: #e9e8e0; border-radius: var(--radius); padding: 20px 22px; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; overflow-x: auto; margin: 0; }
.copy { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.1); color: #e9e8e0; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; font: 600 12px var(--font); padding: 5px 10px; cursor: pointer; }
.copy:hover { background: rgba(255,255,255,.18); }

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

@media (max-width: 640px) { h1.title br { display: none; } }
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  h2.sec { font-size: 25px; }
}
