/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --fg:      #111827;
  --muted:   #374151;
  --faint:   #4b5563;
  --line:    #e5e7eb;
  --bg:      #ffffff;
  --surface: #f9fafb;
  --accent:  #f97316;
  --accent-light: #fff7ed;
  --good:    #15803d;
  --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12), 0 8px 32px rgba(0,0,0,0.07);
  --radius:  12px;
  --maxw:    1080px;
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; height: auto; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 auto;
  max-width: var(--maxw);
}

/* ─── Entrance: full-screen 4×4 grid of navigation videos ───────────────────── */
.entrance {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  width: 100%;
  height: 100vh;
  background: #000;
  overflow: hidden;
}
.entrance-tile {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 3;
}
.entrance-tile.bright { filter: brightness(1.1) contrast(1.1); }
.entrance-tile video {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  opacity: 0;
  animation: entrance-fade 1s ease forwards;
  animation-delay: 1s;
}
@keyframes entrance-fade { from { opacity: 0; } to { opacity: 1; } }
.entrance-label {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 10;
  color: #fff;
  font-family: "SF Pro Display", "Doto", Arial, sans-serif;
  font-size: 1rem;
  font-weight: bold;
  line-height: 1.4;
  padding: 5px 10px;
  background: rgba(0,0,0,0.5);
  border-radius: 2px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.entrance-tile:hover .entrance-label { opacity: 1; }

.typing-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  pointer-events: none;
  animation: typing-resize 1s forwards;
}
@keyframes typing-resize {
  from { width: 100%; height: 100%; }
  to   { width: 40%;  height: 10%; }
}
.typing-text {
  font-family: "SF Pro Display", "Doto", Arial, sans-serif;
  background-color: rgba(203,203,203,0);
  padding: 0 15px;
  color: #00ff00;
  font-size: 5rem;
  font-weight: bold;
  line-height: 70px;
  white-space: nowrap;
  overflow: hidden;
  border-right: 2px solid #00ff00;
  width: 0;
  flex-shrink: 0;
  text-shadow: 2px 2px 4px rgba(0,255,0,0.5);
  animation: typing 2s steps(8) forwards,
             blink-caret 1s step-end infinite 3.5s,
             typing-bg 1s 1.5s forwards;
}
@keyframes typing { from { width: 0; } to { width: 8.5ch; } }
@keyframes typing-bg { to { background-color: rgba(203,203,203,0.6); } }
@keyframes blink-caret { from, to { border-color: transparent; } 50% { border-color: #00ff00; } }

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #f0f4ff 0%, #ffffff 60%);
  border-bottom: 1px solid var(--line);
  padding: 64px 24px 32px;
  text-align: center;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; }

.title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: 0 0 20px;
  color: var(--fg);
}
.venue {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 999px;
  margin: 0 0 16px;
}
.authors { font-size: 17px; margin: 0 0 4px; }
.authors a { color: #1d4ed8; font-weight: 600; }
.authors a:hover { color: #1e40af; text-decoration: underline; }
.affiliations { font-size: 15px; margin: 0 0 4px; opacity: .85; }
.affiliations.note { font-size: 13px; margin: 0 0 6px; opacity: .7; }

.hero-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0 4px; }
.hero-btns .btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  transition: background .12s, border-color .12s, color .12s, transform .12s, box-shadow .12s;
}
.hero-btns a.btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ─── Sections ──────────────────────────────────────────────────────────────── */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 52px 28px;
}
.section h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.section h3.sub {
  font-size: 20px;
  font-weight: 600;
  margin: 40px 0 8px;
  color: var(--fg);
}
.section p { margin: 8px 0 14px; }
.caption { color: var(--muted); font-size: 15px; line-height: 1.6; }

/* Numbered points with orange markers */
.regimes { margin: 6px 0 16px; padding-left: 26px; }
.regimes li { margin: 9px 0; line-height: 1.6; color: var(--fg); }
.regimes li::marker { font-weight: 800; color: var(--accent); }

/* ─── Demo video ────────────────────────────────────────────────────────────── */
#demo { text-align: center; }
.presentation-video {
  display: block;
  width: 100%;
  max-width: 860px;
  aspect-ratio: 16 / 9;
  margin: 8px auto 6px;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
}

/* ─── Sliding marquee (AgentNav in Action) ──────────────────────────────────── */
.marquee-wrap { position: relative; }
.marquee {
  overflow: hidden;
  margin-top: 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.marquee-track {
  display: flex;
  gap: 14px;
  width: max-content;
  will-change: transform;
}
.mq-item { margin: 0; width: 280px; flex: 0 0 auto; }
.mq-item video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}
.mq-item figcaption {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.3px;
}
.marquee-btn {
  position: absolute;
  top: calc(50% - 14px);
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  z-index: 3;
  transition: background 0.15s, color 0.15s;
}
.marquee-btn:hover { background: var(--accent-light); color: var(--accent); }
.marquee-btn.prev { left: 4px; }
.marquee-btn.next { right: 4px; }
.marquee-note { text-align: center; color: var(--muted); margin-top: 14px; }

/* ─── Results tables ────────────────────────────────────────────────────────── */
.res-h { margin: 32px 0 4px; font-size: 20px; font-weight: 600; }

.table-wrap { overflow-x: auto; margin: 18px 0 26px; -webkit-overflow-scrolling: touch; }

.res-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.res-table caption {
  caption-side: top;
  text-align: left;
  color: var(--faint);
  font-size: 14px;
  line-height: 1.5;
  padding: 0 0 10px;
}
.res-table th, .res-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: right;
  white-space: nowrap;
}
.res-table th:first-child, .res-table td:first-child { text-align: left; white-space: normal; }
.res-table td.l, .res-table th.l { text-align: left; white-space: normal; }
.res-table thead th {
  border-bottom: 2px solid var(--muted);
  font-weight: 600;
  color: var(--muted);
}
.res-table th.grp {
  text-align: center;
  font-weight: 700;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.res-table th.grp + th.grp { border-left: 1px solid var(--line); }
.res-table tbody tr:hover { background: var(--surface); }
.res-table tr.ours { background: var(--accent-light); }
.res-table tr.ours:hover { background: var(--accent-light); }
.res-table tr.ours td { border-bottom: 1px solid var(--accent); }
.res-table td.model { font-weight: 600; vertical-align: top; background: #fff; }

/* 14-column city results: fit the content column */
.res-table-compact { font-size: 13.5px; }
.res-table-compact th, .res-table-compact td { padding: 7px 6px; text-align: center; }
.res-table-compact th:first-child, .res-table-compact td:first-child { text-align: left; padding-left: 8px; }
@media (max-width: 900px) {
  .res-table-compact { font-size: 12.5px; }
  .res-table-compact th, .res-table-compact td { padding: 6px 4px; }
}
@media (max-width: 760px) { .res-table-compact { min-width: 720px; } }

/* ─── BibTeX ────────────────────────────────────────────────────────────────── */
.bib {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 13.5px;
  font-family: "SF Mono", "Menlo", Consolas, monospace;
  overflow-x: auto;
  line-height: 1.6;
  box-shadow: var(--shadow);
  margin: 16px 0 10px;
}
.bib code { font-family: inherit; }
.cite-links { font-size: 14px; color: var(--muted); }

/* ─── Sticky side navigation ────────────────────────────────────────────────── */
.sidenav {
  position: fixed;
  top: 16px;
  left: 16px;
  background: #f1f4fa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 50;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.sidenav.show { opacity: 1; visibility: visible; }
.sidenav-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  min-width: 195px;
}
.sidenav-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.sidenav a {
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  line-height: 1.3;
  transition: background 0.12s, color 0.12s;
}
.sidenav a:hover { color: var(--fg); text-decoration: none; background: var(--surface); }
.sidenav a.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-light);
}
@media (max-width: 1280px) { .sidenav { display: none; } }

/* With the side bar shown, offset the centered content so the bar never covers text. */
@media (min-width: 1281px) {
  .section, .hero-inner, hr {
    margin-left: max(calc((100% - var(--maxw)) / 2), 264px);
    margin-right: auto;
  }
  .hero-inner { transform: translateX(-24px); }
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 28px 64px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .title { font-size: 26px; }
  .section { padding: 40px 18px; }
  .hero { padding: 48px 18px 28px; }
  .bib { padding: 16px 14px; font-size: 12.5px; }
  .typing-text { font-size: 3rem; line-height: 48px; }
  .entrance-label { font-size: 0.7rem; padding: 3px 6px; }
  .mq-item { width: 220px; }
}
.res-table tr.ours td.model { border-bottom: 1px solid var(--line); }

/* ─── Figures ───────────────────────────────────────────────────────────────── */
.fig { margin: 20px 0 28px; text-align: center; }
.fig img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.fig figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.fig-narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.fig img.plain { border: 0; box-shadow: none; border-radius: 0; }

/* CityNav: one sample path per city, 2×2 */
.city-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 22px 0 6px; }
.city-grid figure { margin: 0; }
.city-grid a { display: block; cursor: zoom-in; }
.city-grid img { width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.city-grid figcaption { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
.city-cap { text-align: center; margin: 10px 0 26px; }
@media (max-width: 560px) { .city-grid { grid-template-columns: 1fr; } }
