/* ============================================================
   SceneLM project page — bespoke, no framework.
   Visual identity: "the map is just text" → terminal panels,
   monospace scene records, and the ADD/EDIT/REMOVE color trio
   (green / amber / red) reused everywhere: ops, charts, legends.
   ============================================================ */

:root {
  /* palette */
  --ink: #1b1e24;
  --ink-soft: #4a5160;
  --ink-faint: #8a91a0;
  --paper: #fbfaf7;          /* warm off-white page background */
  --panel: #ffffff;
  --line: #e7e4dc;
  --term-bg: #14171d;        /* terminal / code panels */
  --term-ink: #d7dce4;
  --term-faint: #6b7383;

  --add: #21a06a;
  --add-soft: #e2f5ec;
  --edit: #d98a1a;
  --edit-soft: #faf0dd;
  --remove: #d64d4d;
  --remove-soft: #fbe8e8;
  --keep: #8a91a0;

  --accent: #2455c4;         /* links, primary buttons */
  --accent-soft: #e8eefb;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1080px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 23, 29, 0.05), 0 8px 24px rgba(20, 23, 29, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }

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

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

section { padding: 72px 0; }
section.tinted { background: #f4f2ec; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
h3 { font-size: 1.15rem; margin-bottom: 8px; letter-spacing: -0.01em; }

.kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 10px;
}

.lead { font-size: 1.08rem; color: var(--ink-soft); max-width: 760px; }
.lead strong { color: var(--ink); }

/* ---------- nav ---------- */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 250, 247, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.wordmark { font-family: var(--mono); font-weight: 700; font-size: 1rem; color: var(--ink); }
.wordmark span { color: var(--accent); }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--ink-soft); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ---------- hero ---------- */
header.hero { padding: 72px 0 40px; text-align: center; }
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.hero .subtitle {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 auto 10px;
}
.hero .subtitle .mono { font-family: var(--mono); font-size: 0.9em; }
.authors { color: var(--ink-faint); font-size: 0.95rem; margin: 18px 0 6px; }
.venue { color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 26px; }
.affiliations {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 12px 28px; margin: 10px 0 28px;
}
.aff { display: inline-flex; align-items: flex-start; gap: 3px; }
.aff sup { color: var(--ink-faint); font-size: 0.7rem; line-height: 1; }
/* muted greyscale so five brand palettes don't compete with the ADD/EDIT/REMOVE colours;
   full colour on hover */
.aff img { display: block; width: auto; filter: grayscale(1); opacity: 0.7; transition: filter 0.2s, opacity 0.2s; }
.aff:hover img { filter: none; opacity: 1; }
/* per-logo heights are optical, not equal: wide one-line marks read larger than stacked ones */
.aff .h-chalmers { height: 22px; }
.aff .h-zenseact { height: 17px; }
.aff .h-stanford { height: 28px; }
.aff .h-berkeley { height: 28px; }
.aff .h-nvidia   { height: 19px; }
/* keep each name glued to its superscript when the line wraps */
.au { white-space: nowrap; }
.authors sup, .affiliations sup { font-size: 0.7em; margin-left: 1px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-bottom: 40px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.92rem; font-weight: 600;
  background: var(--ink); color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn svg { width: 15px; height: 15px; }
.btn.disabled { opacity: 0.55; cursor: default; pointer-events: none; }
/* two-line button: label on top, small note underneath; padding trimmed so the
   pill stays the same height as its one-line neighbours */
.btn.has-soon { flex-direction: column; gap: 1px; padding-top: 7.5px; padding-bottom: 7.5px; line-height: 1.1; }
.btn .soon {
  font-size: 0.56rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* op badges (ADD / EDIT / REMOVE) */
.op { font-family: var(--mono); font-weight: 700; font-size: 0.82em; padding: 1px 7px; border-radius: 5px; white-space: nowrap; }
.op.add { color: var(--add); background: var(--add-soft); }
.op.edit { color: var(--edit); background: var(--edit-soft); }
.op.remove { color: var(--remove); background: var(--remove-soft); }

/* ---------- hero media: video + terminal ---------- */
.hero-media {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  align-items: stretch;
  text-align: left;
}
@media (max-width: 860px) { .hero-media { grid-template-columns: 1fr; } }

.video-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}
.video-frame video { width: 100%; height: 100%; object-fit: cover; }
.video-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 16px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: #fff; font-size: 0.85rem;
}

/* terminal panel */
.terminal {
  background: var(--term-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 300px;
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #23272f;
}
.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #2e333c; }
.term-bar .title { font-family: var(--mono); font-size: 0.78rem; color: var(--term-faint); margin-left: 6px; }
.term-body {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.75;
  color: var(--term-ink);
  padding: 14px 16px;
  flex: 1;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-body .t-add { color: #4cc98d; }
.term-body .t-edit { color: #e8ab52; }
.term-body .t-remove { color: #ef7a7a; }
.term-body .t-dim { color: var(--term-faint); }
.term-body .t-key { color: #8fb5f2; }
.cursor {
  display: inline-block; width: 8px; height: 15px;
  background: var(--term-ink); vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- stat strip ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 26px;
}
@media (max-width: 860px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  text-align: center;
}
.stat .num { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat .num small { font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); }
.stat .lbl { font-size: 0.82rem; color: var(--ink-faint); margin-top: 4px; line-height: 1.35; }

/* ---------- figures ---------- */
figure.fig { margin: 34px 0 0; }
figure.fig img { border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
figure.fig figcaption { font-size: 0.88rem; color: var(--ink-faint); margin-top: 10px; line-height: 1.5; }
figure.fig figcaption strong { color: var(--ink-soft); }
figure.fig.plain img { border: none; box-shadow: none; background: transparent; }

/* two-up layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.two-col.top { align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- comparison cards (engineered vs learned) ---------- */
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px; }
@media (max-width: 760px) { .vs-grid { grid-template-columns: 1fr; } }
.vs-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.vs-card.ours { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.vs-card .tag {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
  background: #eeece5; color: var(--ink-soft);
}
.vs-card.ours .tag { background: var(--accent-soft); color: var(--accent); }
.vs-card ul { list-style: none; margin-top: 10px; }
.vs-card li { padding: 5px 0 5px 24px; position: relative; font-size: 0.95rem; color: var(--ink-soft); }
.vs-card li::before { content: "•"; position: absolute; left: 8px; color: var(--ink-faint); }
.vs-card.ours li::before { color: var(--accent); }

/* ---------- tabs (ADD / EDIT / REMOVE, deployment scenes) ---------- */
.tabs { margin-top: 30px; }
.tab-rail { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 600;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  cursor: pointer; transition: all 0.15s ease;
}
.tab-btn:hover { border-color: var(--ink-faint); }
.tab-btn[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab-btn.c-add[aria-selected="true"] { background: var(--add); border-color: var(--add); }
.tab-btn.c-edit[aria-selected="true"] { background: var(--edit); border-color: var(--edit); }
.tab-btn.c-remove[aria-selected="true"] { background: var(--remove); border-color: var(--remove); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel .desc { font-size: 0.95rem; color: var(--ink-soft); margin-top: 12px; max-width: 760px; }

/* ---------- charts (pure CSS bars) ---------- */
.chart-block {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.chart-block h3 { margin-bottom: 2px; }
.chart-block .sub { font-size: 0.85rem; color: var(--ink-faint); margin-bottom: 18px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 30px; }
@media (max-width: 860px) { .chart-grid { grid-template-columns: 1fr; } }

.bar-row { display: grid; grid-template-columns: 128px 1fr 52px; align-items: center; gap: 10px; margin: 7px 0; }
.bar-row .lbl { font-size: 0.85rem; color: var(--ink-soft); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .val { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.bar-track { background: #f0eee8; border-radius: 5px; height: 20px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 5px;
  background: #c9c5ba;
  width: 0;                       /* animated in by JS to data-w */
  transition: width 0.9s cubic-bezier(0.25, 0.6, 0.3, 1);
}
.bar-row.ours .lbl { color: var(--ink); font-weight: 600; }
.bar-row.ours .bar-fill { background: var(--accent); }
.bar-row.ours .val { color: var(--accent); }

.chart-note { font-size: 0.82rem; color: var(--ink-faint); margin-top: 12px; }

/* efficiency stat row */
.eff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
@media (max-width: 760px) { .eff-row { grid-template-columns: 1fr; } }
.eff-card {
  background: var(--term-bg); color: var(--term-ink);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.eff-card .num { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; color: #fff; }
.eff-card .num .u { font-size: 1rem; color: var(--term-faint); }
.eff-card .lbl { font-size: 0.84rem; color: var(--term-faint); margin-top: 6px; line-height: 1.45; }

/* callout */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin-top: 26px;
  font-size: 0.98rem;
  color: var(--ink-soft);
}
.callout strong { color: var(--ink); }
.callout.warn { border-color: var(--edit); background: var(--edit-soft); }

/* ---------- video gallery ---------- */
.vid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px; }
@media (max-width: 760px) { .vid-grid { grid-template-columns: 1fr; } }
.vid-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.vid-card video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.vid-card .meta { padding: 14px 16px; }
.vid-card .meta h3 { font-size: 1rem; margin-bottom: 2px; }
.vid-card .meta p { font-size: 0.86rem; color: var(--ink-faint); line-height: 1.5; }

/* ---------- scene explorer ---------- */
.explorer {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-top: 30px;
  align-items: stretch;
}
@media (max-width: 900px) { .explorer { grid-template-columns: 1fr; } }
.explorer-stage {
  position: relative;
  background: radial-gradient(ellipse at 50% 40%, #232833, var(--term-bg) 75%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 480px;
  overflow: hidden;
}
.explorer-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.explorer-stage canvas:active { cursor: grabbing; }
.explorer-hint {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--mono); font-size: 0.7rem; color: var(--term-faint);
  pointer-events: none;
}
.explorer-load {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.85rem; color: var(--term-faint);
}
.explorer-side { display: flex; flex-direction: column; gap: 12px; min-height: 480px; }
.explorer-side .terminal { min-height: 0; flex: 0 0 auto; }
.explorer-side .term-body { min-height: 148px; flex: none; }
.obj-list-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.obj-filter {
  border: none; border-bottom: 1px solid var(--line);
  padding: 10px 14px; font-family: var(--mono); font-size: 0.8rem;
  background: transparent; color: var(--ink); outline: none; width: 100%;
}
.obj-list { overflow-y: auto; flex: 1; padding: 6px 0; max-height: 300px; }
.obj-item {
  display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft);
  padding: 4px 14px; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.obj-item:hover { background: #f4f2ec; }
.obj-item.sel { background: var(--add-soft); color: var(--add); font-weight: 600; }
.obj-count { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-faint); padding: 6px 14px; border-top: 1px solid var(--line); }

/* ---------- takeaways ---------- */
.take-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
@media (max-width: 860px) { .take-grid { grid-template-columns: 1fr; } }
.take-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.take-card .n { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 0.9rem; margin-bottom: 8px; }
.take-card p { font-size: 0.93rem; color: var(--ink-soft); }

/* ---------- bibtex ---------- */
.bib-box { position: relative; margin-top: 24px; }
.bib-box pre {
  background: var(--term-bg); color: var(--term-ink);
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.6;
  border-radius: var(--radius); padding: 20px 22px;
  overflow-x: auto;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--mono); font-size: 0.75rem; font-weight: 600;
  background: #262b34; color: var(--term-ink);
  border: 1px solid #333947; border-radius: 7px;
  padding: 6px 12px; cursor: pointer;
}
.copy-btn:hover { background: #2f3540; }

/* ---------- footer ---------- */
footer { padding: 40px 0 56px; color: var(--ink-faint); font-size: 0.85rem; text-align: center; }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar-fill { transition: none; }
  .cursor { animation: none; }
}
