/* Navigent project page.
   Layout follows the MARS Lab ODE Policy page: a title cover with a clip wall under it, one
   1080px reading column, large display headings, figures and tables on cards.
   Colours stay Navigent's own: pale blue-grey ground, navy ink, one blue accent.
   Geist for display, Inter for text, JetBrains Mono for labels. */

:root {
  --bg: #f6f8fc;
  --bg-rgb: 246, 248, 252;
  --surface: #ffffff;
  --ink: #0f1b2e;
  --soft: #3a4960;
  --muted: #5f6e84;
  --line: #dfe5ee;
  --line-2: #c8d2e0;
  --blue: #3569e8;
  --blue-deep: #2247ae;
  --chip: #eaf0fa;
  --shadow: 0 18px 44px -30px rgba(20, 35, 70, .28), inset 0 1px 0 rgba(255, 255, 255, .85);

  --display: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 16px;
  --r-sm: 12px;
  --nav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; }
p, figure { margin: 0; }
p { text-wrap: pretty; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
strong, b { font-weight: 600; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }

h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.025em; text-wrap: balance; }
h2.sec { margin-bottom: 20px; font-size: clamp(40px, 5vw, 68px); line-height: 1.03; letter-spacing: -.042em; }
h3 { font-size: clamp(25px, 2.5vw, 33px); line-height: 1.15; letter-spacing: -.03em; }
h4 { font: 600 19px/1.3 var(--display); letter-spacing: -.018em; }

.lede { color: var(--soft); font-size: clamp(18px, 1.45vw, 21px); line-height: 1.55; }
.lede strong { color: var(--ink); }

section { padding-block: clamp(76px, 10vw, 140px) 0; scroll-margin-top: var(--nav-h); }

/* ---------- Scroll progress and nav ---------- */

.progress { position: fixed; top: 0; left: 0; z-index: 12; width: 0; height: 2px; pointer-events: none; background: linear-gradient(90deg, var(--blue), #7aa2ff); }

/* Clear over the cover, frosted once the page scrolls. */
nav.top { position: fixed; inset: 0 0 auto 0; z-index: 9; background: transparent; border-bottom: 1px solid transparent; transition: background .4s var(--ease), border-color .4s var(--ease); }
nav.top.on { background: rgba(var(--bg-rgb), .8); border-bottom-color: var(--line); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
nav.top .wrap { display: flex; align-items: center; gap: 22px; height: var(--nav-h); }
.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); font: 700 19px/1 var(--display); letter-spacing: -.022em; text-decoration: none; white-space: nowrap; }
.brand img { width: 38px; height: 26px; object-fit: contain; }
.links { display: flex; min-width: 0; gap: 26px; overflow-x: auto; scrollbar-width: none; }
.links::-webkit-scrollbar { display: none; }
.links a { position: relative; padding: 7px 0; color: var(--muted); font: 500 12.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; text-decoration: none; white-space: nowrap; transition: color .25s var(--ease); }
.links a::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: currentColor; opacity: .75; transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease-out); }
.links a:hover, .links a.on { color: var(--ink); }
.links a:hover::after, .links a.on::after { transform: scaleX(1); }

/* ---------- Cover: the title block, with the clip wall tucked under its lower half ---------- */

.cover { position: relative; isolation: isolate; padding-top: calc(var(--nav-h) + clamp(40px, 6vw, 84px)); }
.cover::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(46% 90% at 90% 0%, rgba(53, 105, 232, .09), transparent 70%); }
.cover-in { position: relative; }
.cover-in > * { animation: rise 1.1s var(--ease-out) backwards; }
.cover-in > :nth-child(1) { animation-delay: .1s; }
.cover-in > :nth-child(2) { animation-delay: .2s; }
.cover-in > :nth-child(3) { animation-delay: .3s; }
.cover-in > :nth-child(4) { animation-delay: .44s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Authors and buttons share one grid cell with the wall, so they always lie on its first rows. */
.under { display: grid; margin-top: 22px; }
.under > * { grid-area: 1 / 1; min-width: 0; }

/* Clip wall, as wide as the reading column: looping replays and robot runs. */
.wall { -webkit-mask-image: linear-gradient(180deg, transparent, #000 56px); mask-image: linear-gradient(180deg, transparent, #000 56px); }
.cgrid { display: flex; flex-direction: column; gap: 8px; }
.crow { display: flex; align-items: flex-start; gap: 8px; }
/* A replay (8:3) and a robot clip (16:9) share one row height when their widths are 3:2. */
.tile { overflow: hidden; border-radius: 10px; background: #dde4ee; }
.tile.sim { flex: 3 1 0; aspect-ratio: 8 / 3; }
.tile.real { flex: 2 1 0; aspect-ratio: 16 / 9; }
.tile video { display: block; width: 100%; height: 100%; object-fit: cover; }

/* The veil keeps the text readable: the clips show through faintly behind it, a little more
   toward the right where there is less text, and come up to full strength below the buttons. */
.byline { position: relative; z-index: 1; align-self: start; padding: 14px 0 0; }
.byline::before {
  content: "";
  position: absolute;
  inset: 0 0 -150px 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(var(--bg-rgb), .88) 0%, rgba(var(--bg-rgb), .8) 45%, rgba(var(--bg-rgb), .6) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 136px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 136px), transparent);
}

.cover h1 { font-size: clamp(52px, 7.6vw, 112px); line-height: .98; letter-spacing: -.045em; }
.cover h1 .ac { color: var(--blue); }
.tagline { margin-top: 14px; color: var(--ink); font: 500 clamp(19px, 2.1vw, 30px)/1.2 var(--display); letter-spacing: -.02em; text-wrap: balance; }
.authors { font-size: 18px; line-height: 1.6; }
.authors .au { font-weight: 500; white-space: nowrap; }
.authors sup { margin-left: 1px; color: var(--blue); font-size: .62em; }
.authors .aff { color: var(--muted); font-size: 16px; }
.authors .aff sup { margin: 0 2px 0 0; }
.authors small { display: inline-block; margin-top: 4px; color: var(--muted); font-size: 13px; }

.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 15px/1 var(--body);
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .3s var(--ease-out), border-color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
}
.btn:hover { transform: translateY(-1px); border-color: var(--blue); box-shadow: 0 10px 24px -16px rgba(20, 35, 70, .5); }
.btn:active { transform: translateY(0) scale(.985); transition-duration: .1s; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 10px 24px -14px rgba(15, 27, 46, .7); }
.btn.primary:hover { background: var(--blue); border-color: var(--blue); }
.btn[aria-disabled="true"] { cursor: not-allowed; }
.btn[aria-disabled="true"]:hover { transform: none; border-color: var(--line-2); box-shadow: none; }
.btn.primary[aria-disabled="true"]:hover { background: var(--ink); border-color: var(--ink); box-shadow: 0 10px 24px -14px rgba(15, 27, 46, .7); }

/* Logos sit beside the title, on the right edge of the reading column. */
.cover-logos { position: absolute; top: calc(clamp(52px, 7.6vw, 112px) * .49 - 25px); right: 20px; display: flex; align-items: center; gap: 14px; }
.cover-logos img { display: block; width: auto; height: 50px; }
.cover-logos .ntu, .colophon .ntu { box-sizing: content-box; height: 40px; padding-left: 14px; border-left: 1px solid var(--line-2); }

/* ---------- Running text ---------- */

.prose p { color: var(--soft); font-size: 17px; line-height: 1.7; }
.prose p + p { margin-top: 16px; }

/* Running text is justified and hyphenated, and runs the full width of its column, so
   paragraphs square up with the cards beside and below them. */
.lede, .prose p, .mstep p, .step-txt p, .plate figcaption {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
}
.prose p.lede { font-size: clamp(18px, 1.45vw, 21px); line-height: 1.55; }
.prose em { color: var(--ink); font-style: normal; font-weight: 600; }
.prose strong { color: var(--ink); }

.idea { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr); align-items: start; gap: 44px; margin-top: 30px; }

/* ---------- Cards: figures, tables, clips ---------- */

.plate, .tcard, .rt, pre.bib { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .3s var(--ease); }
@media (hover: hover) { .plate:hover, .tcard:hover, .rt:hover, pre.bib:hover { border-color: var(--line-2); } }

.plate { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 18px 16px; }
.plate.wide { margin-top: 40px; padding: 22px 22px 18px; }
.plate img { display: block; width: 100%; height: auto; border-radius: 8px; cursor: zoom-in; }
.plate figcaption { margin-top: auto; color: var(--muted); font-size: 15px; line-height: 1.55; }
.plate figcaption b { margin-right: 8px; color: var(--ink); font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }

.tcard { min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
tr > :first-child { padding-left: 22px; text-align: left; }
tr > :last-child { padding-right: 22px; }
thead th { color: var(--muted); font: 500 12px/1.3 var(--mono); letter-spacing: .06em; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
.ours { background: rgba(53, 105, 232, .075); }
.ours th { color: var(--blue); font-weight: 600; }
.ours td { font-weight: 600; }
.group-row th { padding-top: 18px; padding-bottom: 8px; color: var(--blue); font: 500 11.5px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }

.full-results { min-width: 940px; }
.full-results th, .full-results td { padding-block: 11px; }
.full-results thead tr:first-child th { padding-top: 20px; padding-bottom: 10px; border-bottom: 0; color: var(--ink); font: 600 14px/1.3 var(--display); letter-spacing: -.01em; }
.full-results thead th[colspan] { position: relative; text-align: center; }
.full-results thead th[colspan]::after { content: ""; position: absolute; inset: auto 16px 0 16px; height: 1px; background: var(--line-2); }
.full-results thead tr:last-child th { padding-top: 10px; }
.full-results thead tr:first-child th:nth-child(3), .full-results tr > :nth-child(6) { border-left: 1px solid var(--line); }
.full-results .ours td:nth-child(4), .full-results .ours td:nth-child(7) { color: var(--blue); font-weight: 700; }

/* ---------- Method ---------- */

.msteps { margin-top: clamp(48px, 6vw, 72px); }
.mstep { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; gap: 18px 48px; padding-block: clamp(28px, 3.2vw, 40px); border-top: 1px solid var(--line); }
.mstep:last-child { padding-bottom: 0; }
.mstep h3 { font-size: clamp(22px, 2.1vw, 28px); }
.mstep p { color: var(--soft); font-size: 16.5px; line-height: 1.7; }

/* ---------- Video ---------- */

.robot { display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px; margin: 44px 0 16px; padding-top: 18px; border-top: 1px solid var(--line); }
h2.sec + .robot { margin-top: 28px; }
.robot h4 { font: 600 22px/1.2 var(--display); letter-spacing: -.02em; }
.robot p { color: var(--soft); font-size: 15px; }

.rtasks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.rtasks.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Five recovery clips: two wide, then three. */
.rtasks.r23 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rtasks.r23 .rt { grid-column: span 2; }
.rtasks.r23 .rt:nth-child(-n+2) { grid-column: span 3; }
.rt { display: flex; flex-direction: column; overflow: hidden; margin: 0; border-radius: var(--r-sm); }
.rt .tv { background: #0b1220; }
.rt video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
/* Replays keep their full frame: first-person view on the left, map and route on the right. */
.rtasks.r2 video, .rtasks.r23 video { aspect-ratio: 8 / 3; }
.rt figcaption { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.rt h4 { font: 600 17px/1.25 var(--display); letter-spacing: -.01em; }
.rt .meta { color: var(--blue); font: 500 11.5px/1.3 var(--mono); letter-spacing: .06em; text-transform: capitalize; }
.rt p { color: var(--soft); font-size: 14.5px; line-height: 1.45; }

/* ---------- Results ---------- */

.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 44px; border-block: 1px solid var(--line); }
.num { padding: 32px 26px 30px; border-left: 1px solid var(--line); }
.num:first-child { padding-left: 0; border-left: 0; }
.num .v { font: 500 clamp(42px, 4.8vw, 64px)/1 var(--display); letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num .v .n { background: linear-gradient(180deg, var(--ink) 25%, #5c6a80 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num .v .x { margin-left: 3px; color: var(--blue); font-weight: 400; }
.num .k { margin-top: 12px; color: var(--soft); font-size: 16px; line-height: 1.4; }

.block { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: clamp(72px, 9vw, 120px); }
.block > .lede { margin-top: -4px; }

.study { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }

.mrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 20px 40px; padding-block: 32px; border-top: 1px solid var(--line); }
.mrow:last-child { padding-bottom: 0; }
.mrow.top { padding-top: 0; border-top: 0; }
.step-txt { display: grid; gap: 12px; }
.step-txt h4 { font: 600 21px/1.25 var(--display); letter-spacing: -.02em; }
.step-txt p { color: var(--soft); font-size: 16px; line-height: 1.65; }
.step-txt p strong { color: var(--ink); }

/* ---------- Cite and footer ---------- */

.cite-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.cite-row h2.sec { margin: 0; }
pre.bib { margin: 0; padding: 22px 24px; overflow-x: auto; color: var(--soft); font: 400 14px/1.7 var(--mono); }

footer { margin-top: clamp(80px, 10vw, 140px); padding-block: 34px 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; }
footer .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.colophon { display: flex; align-items: center; gap: 16px; }
.colophon img { display: block; width: auto; height: 38px; }
.colophon .ntu { height: 30px; padding-left: 16px; }
footer a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); transition: color .2s var(--ease), border-color .2s var(--ease); }
footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Lightbox and reveal ---------- */

.lb { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(15, 27, 46, .82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); cursor: zoom-out; }
.lb img { max-width: min(1600px, 100%); max-height: 100%; background: #fff; border-radius: 8px; }

/* Classes are added by the script, so the page is complete without it. */
.rv { opacity: 0; transform: translateY(22px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: var(--d, 0ms); }
.rv.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .rtasks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rtasks.r23 .rt, .rtasks.r23 .rt:nth-child(-n+2) { grid-column: span 3; }
  .cover-logos { top: calc(clamp(52px, 7.6vw, 112px) * .49 - 20px); }
  .cover-logos img { height: 40px; }
  .cover-logos .ntu { height: 32px; }
}

@media (max-width: 900px) {
  .idea, .mstep, .study, .mrow { grid-template-columns: minmax(0, 1fr); }
  .idea .plate { max-width: 560px; }

  /* Two clips per row. */
  .crow .tile:nth-child(3) { display: none; }
}

/* No room beside the title: the logos stay in the footer only. */
@media (max-width: 720px) {
  .cover-logos { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .crow { flex-direction: column; }
  .tile.sim, .tile.real { flex: none; width: 100%; }
  .crow:nth-child(n+3) { display: none; }
  .cover h1 { font-size: clamp(48px, 15vw, 64px); }
  .authors { font-size: 15.5px; line-height: 1.55; }
  .authors .aff { font-size: 14px; }
  .authors small { font-size: 12px; }
  .btn { padding: 10px 16px; font-size: 14px; }

  .numbers { grid-template-columns: minmax(0, 1fr); }
  .num { display: flex; align-items: baseline; gap: 16px; padding: 20px 0; border-left: 0; border-top: 1px solid var(--line); }
  .num:first-child { border-top: 0; }
  .num .k { margin-top: 0; }
  .rtasks, .rtasks.r2 { grid-template-columns: minmax(0, 1fr); }
  .rtasks.r23 .rt, .rtasks.r23 .rt:nth-child(-n+2) { grid-column: span 6; }
  .plate, .plate.wide { padding: 12px 12px 14px; }
  table { font-size: 14px; }
  th, td { padding: 10px 10px; }
  tr > :first-child { padding-left: 14px; }
  tr > :last-child { padding-right: 14px; }
  .tcard:not(:has(.full-results)) tbody th { white-space: normal; }
  pre.bib { padding: 16px; font-size: 12.5px; }
  .colophon span { display: none; }
}

@media (max-width: 520px) {
  .lede, .prose p, .mstep p, .step-txt p, .plate figcaption { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
  nav.top .wrap { gap: 10px; padding-inline: 16px; }
  .links { gap: 14px; }
  .links a { font: 500 13px/1 var(--body); letter-spacing: 0; text-transform: none; }
  .links a:nth-child(1), .links a:nth-child(5), .links a:nth-child(6) { display: none; }
  .brand { font-size: 16px; gap: 7px; }
  .brand img { width: 30px; height: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .cover-in > * { animation: none; }
}
