/* ==========================================================================
   LoCoDex project page
   Palette + layout. Edit --accent to rebrand.
   ========================================================================== */
:root {
  --accent: #cc785c;          /* Claude "book cloth" clay */
  --accent-ink: #a8532f;      /* deeper clay for text/links (contrast) */
  --accent-soft: #f2e8e0;
  --ink: #1f1d1a;             /* warm near-black */
  --muted: #6f6a5f;           /* warm gray */
  --line: #e7e1d5;            /* warm hairline */
  --bg: #faf9f5;              /* warm ivory */
  --bg-alt: #f0eee6;          /* cream */
  --max: 1080px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40,30,20,.05), 0 10px 30px rgba(40,30,20,.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { 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; }

.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,249,245,.85);
  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: .2px; margin-right: auto; }
nav.top .brand span { color: var(--accent); }
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: 760px) { nav.top a.link { display: none; } }

/* ---------- hero ---------- */
header.hero { padding: 60px 0 30px; text-align: center; }
h1.title { font-family: var(--font-serif); font-size: clamp(27px, 3.9vw, 42px); line-height: 1.16; margin: 0 auto 24px; max-width: 880px; font-weight: 600; letter-spacing: -.01em; }
.authors { font-size: 19px; margin: 0 auto 8px; max-width: 820px; }
.authors a { color: var(--ink); font-weight: 600; }
.authors sup { color: var(--accent); font-weight: 700; }
.affil { color: var(--muted); font-size: 15px; margin: 0 auto 6px; max-width: 760px; }
.note { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ---------- link buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 30px 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: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: #fff; }
.btn.soon { opacity: .5; cursor: default; }
.btn.soon:hover { transform: none; border-color: var(--line); background: #fff; }
.btn svg { width: 17px; height: 17px; }

/* ---------- sections ---------- */
section { padding: 62px 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; }
.sec-sub { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 34px; }
/* method intro: left-aligned, matched to the figure width */
.method-intro { text-align: left; max-width: 1000px; margin: 22px auto 0; color: #2b2b2b; font-size: 16px; line-height: 1.7; }
.method-intro b { color: var(--ink); }
/* contact-rewards text: same look as the method intro, matched to the graph width */
.rewards-text { text-align: left; max-width: 860px; margin: 28px auto 0; color: #2b2b2b; font-size: 16px; line-height: 1.7; }
.rewards-text p { margin: 0 0 16px; }
.rewards-text p:last-child { margin-bottom: 0; }
.rewards-text b { color: var(--ink); }
.prose { max-width: 820px; margin: 0 auto; font-size: 17px; color: #2b2b2b; }
.prose p { margin: 0 0 18px; }

/* ---------- figures ---------- */
figure { margin: 24px 0 0; }
figure img { border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 auto; }

/* ---------- hero teaser figure ---------- */
.teaser { margin: 36px auto 0; max-width: 960px; }
.teaser img, .teaser video { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }

/* ---------- video grid ---------- */
/* connected "page" tabs: active tab merges into the panel below */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 0 2px; position: relative; z-index: 2; }
.tab {
  margin-bottom: -1px;
  border: 1px solid var(--line); border-radius: 10px 10px 0 0;
  background: var(--bg-alt); color: var(--muted);
  padding: 10px 20px 11px; font-weight: 600; font-size: 14.5px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--ink); font-weight: 700; border-bottom-color: #fff; }
.tabpanel {
  background: #fff; border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: var(--shadow); padding: 24px; position: relative; z-index: 1;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s;
}
.card:hover { transform: translateY(-3px); }
.card .media { position: relative; aspect-ratio: 16 / 10; background: #f0efed; }
.card video, .card img { width: 100%; height: 100%; object-fit: cover; }
/* poster image sits above the video, fades out on hover to reveal the clip */
.card .media img.poster {
  position: absolute; inset: 0; z-index: 1; object-fit: contain;
  background: #f0efed; transition: opacity .25s ease; pointer-events: none;
}
.card .media.playing img.poster { opacity: 0; }
/* 2x speed badge */
.card .media .rate-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .02em; padding: 2px 7px; border-radius: 6px; line-height: 1.4;
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s ease; /* only show over the video, not the poster */
}
.card .media.playing .rate-badge { opacity: 1; }
/* play affordance — "Hover / Tap to play"; hidden once the clip runs */
.card .media .play-hint {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600;
  letter-spacing: .01em; padding: 3px 9px 3px 6px; border-radius: 999px; line-height: 1.4;
  backdrop-filter: blur(2px); pointer-events: none;
  opacity: 1; transition: opacity .2s ease;
}
.card .media .play-hint svg { width: 11px; height: 11px; flex: none; }
.card .media.playing .play-hint { opacity: 0; }
.card .label { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; font-size: 15px; }
/* small label icon removed — the large poster already shows the object */
.card .label img.ico { display: none; }
.taskgroup { display: none; }
.taskgroup.active { display: block; }
/* per task: bar chart panel on the left, videos on the right.
   Fixed height so the panel + card sizes stay identical across every task. */
.task-split { display: flex; gap: 24px; align-items: stretch; height: 460px; }
.task-chart { flex: 0 0 40%; min-width: 0; background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; }
.task-split .grid { flex: 1; min-width: 0; height: 100%; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 16px; }
.task-split .card { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.task-split .card .media { flex: 1 1 auto; aspect-ratio: auto; height: auto; min-height: 0; }
/* 5 objects: 3 + 2 centered, same card height as the 4-object tasks */
.taskgroup[data-task="movebottle"] .grid { display: flex; flex-wrap: wrap; align-content: stretch; justify-content: center; gap: 16px; }
.taskgroup[data-task="movebottle"] .grid .card { flex: 0 1 calc((100% - 32px) / 3); height: calc((100% - 16px) / 2); }
@media (max-width: 820px) {
  .task-split { flex-direction: column; height: auto; }
  .task-chart { flex: none; width: 100%; }
  .task-split .grid { height: auto; grid-template-rows: none; }
  .task-split .card { height: auto; }
  .task-split .card .media { aspect-ratio: 16 / 10; flex: none; height: auto; }
  .taskgroup[data-task="movebottle"] .grid .card { flex: 0 1 calc((100% - 16px) / 2); height: auto; }
}
.task-note { text-align: center; color: var(--muted); font-size: 13.5px; margin: 16px auto 0; max-width: 760px; }
.task-note b { color: var(--ink); }

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

/* ============ per-task animated success chart ============ */
.mo.mini { position: relative; }
.mo-title { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 3px; text-align: center; }
.mo-note { text-align: center; font-size: 10px; letter-spacing: .03em; color: var(--muted); margin: 0 0 16px; }
.mo-body { display: flex; align-items: flex-start; }
.mo-axiscol { flex: none; width: 26px; }
.mo-axis { position: relative; height: 240px; }
.mo-tick { position: absolute; right: 4px; bottom: 0; transform: translateY(50%); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mo-right { flex: 1; min-width: 0; }
.mo-plot { position: relative; height: 240px; }
.mo-grid { position: absolute; inset: 0; }
.mo-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.mo-line-demo { background: transparent; border-top: 1px dashed rgba(193,68,14,.45); }
.mo-demo-tag { position: absolute; left: 0; top: -6px; transform: translateY(-100%); font-size: 9.5px; font-weight: 700; letter-spacing: .02em; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; }
.mo-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-evenly; }
.mo-col { position: relative; width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.mo-bar { width: 32px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #db6b34 0%, var(--accent) 100%); box-shadow: 0 2px 6px rgba(193,68,14,.16); height: 0; transition: height .85s cubic-bezier(.22,1,.36,1); transition-delay: var(--d); }
.mo.in .mo-bar { height: calc(var(--v) / 125 * 100%); }
.mo-val { font-size: 12.5px; font-weight: 800; color: var(--ink); margin-bottom: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mo-pct { font-size: 8.5px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.mo-icons { display: flex; justify-content: space-evenly; margin-top: 12px; }
.mo-ic { width: 46px; display: flex; justify-content: center; opacity: 0; transform: translateY(6px); transition: opacity .5s ease, transform .5s ease; }
.mo.in .mo-ic { opacity: 1; transform: none; }
.mo-tile { width: 42px; height: 42px; border-radius: 11px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.mo .mo-tile img { width: 30px; height: 30px; object-fit: contain; max-width: none; padding: 0; background: none; box-shadow: none; border-radius: 0; margin: 0; }
@media (prefers-reduced-motion: reduce) { .mo-bar, .mo-ic { transition: none; } }

/* ============ sim-to-real comparison chart ============ */
.s2r { max-width: 860px; margin: 32px auto 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 18px; }
.s2r .mo-title { margin-bottom: 14px; }
.s2r-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.s2r-tab { border: 1.5px solid var(--line); background: #fff; color: var(--muted); padding: 5px 14px; border-radius: 999px; font-family: var(--font); font-weight: 600; font-size: 13px; cursor: pointer; }
.s2r-tab:hover { border-color: var(--ink); color: var(--ink); }
.s2r-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.s2r-legend { display: flex; gap: 20px; justify-content: center; margin-bottom: 18px; font-size: 13px; font-weight: 600; color: var(--ink); }
.s2r-leg { display: flex; align-items: center; gap: 7px; }
.s2r-leg i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.s2r .mo-body { align-items: flex-start; }
.s2r .mo-axiscol { width: 26px; }
.s2r .mo-axis, .s2r .mo-plot { height: 220px; }
.s2r-methods { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.s2r-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.s2r-col.gap-before { margin-left: 20px; }
.s2r-pair { display: flex; align-items: flex-end; gap: 5px; height: 100%; }
.s2r-barwrap { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.s2r-bar { width: 20px; border-radius: 5px 5px 2px 2px; height: 0; transition: height .8s cubic-bezier(.22,1,.36,1); }
.s2r-val { font-size: 10.5px; font-weight: 700; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.s2r-val.real { color: var(--accent); }
.s2r-names { display: flex; margin-top: 9px; }
.s2r-name { flex: 1; text-align: center; font-size: 11px; line-height: 1.2; color: var(--muted); }
.s2r-name.ours { color: var(--ink); font-weight: 700; }
.s2r-name.gap-before { margin-left: 20px; }

.s2r-val { 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 replaces the top links on wide screens */
}
.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; text-decoration: none;
  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; }

/* ============ method figure (from Keynote) ============ */
.method-fig { margin: 8px auto 0; max-width: 1000px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px 22px; opacity: 0; transform: translateY(18px) scale(.99); transition: opacity .6s ease, transform .6s ease; }
.method-fig.in { opacity: 1; transform: none; }
.method-fig img { width: 100%; height: auto; display: block; border-radius: 0; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .method-fig { opacity: 1; transform: none; transition: none; } }

/* ============ mobile layout fixes ============ */
/* rollout videos are 1280px wide; without this the cards refuse to shrink and
   push the whole page wider than the phone screen (horizontal overflow). */
.task-split .card { min-width: 0; }
.mo-right { min-width: 0; }
@media (max-width: 700px) {
  /* sim-vs-real chart: 6 methods don't fit a phone — let it scroll horizontally */
  .s2r .mo-body { overflow-x: auto; padding-bottom: 6px; }
  .s2r .mo-right { min-width: 430px; }
  .method-fig { padding: 16px 14px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .tab { padding: 9px 13px; font-size: 13.5px; }
  h2.sec { font-size: 24px; }
}
@media (max-width: 560px) {
  /* keep the connected page-tabs on a single row (scroll instead of wrap) */
  .tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* One Policy, Many Objects: hide per-bar value labels */
.mo.mini .mo-val { display: none; }
