/* Watch Your Step — project page.
   Light (default) takes its colours from the paper's figures: the method figure's blue and orange,
   the magenta footholds. Dark is mheyrman.github.io's palette (Sanzo Wada #342: Corinthian Pink,
   Cream Yellow on warm charcoal). Source Serif for text, Source Sans for interface, thin rules. */
:root {
  --bg: #ffffff; --surface: #f5f6f8; --line: #e1e4e9;
  --text: #2b2e35; --text-strong: #111317; --muted: #5d636f;
  --accent: #2752c3; --accent-2: #d65f01; --on-accent: #ffffff;
  --nav-bg: rgba(255,255,255,0.92);
  --radius: 4px; --text-width: 820px; --wide-width: 1120px;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Source Sans Pro', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #16171a; --surface: #1d1f23; --line: #33363c;
  --text: #d9d4ca; --text-strong: #f3eee4; --muted: #8f8a82;
  --accent: #f8b6ba; --accent-2: #fdbf68; --on-accent: #1a1416;
  --nav-bg: rgba(22,23,26,0.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--serif); font-size: 18px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; display: block; }
strong, b { color: var(--text-strong); font-weight: 600; }
sub, sup { line-height: 0; }
.wrap { max-width: var(--text-width); margin: 0 auto; padding: 0 20px; }
.wrap.wide { max-width: var(--wide-width); }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* nav */
.navbar { position: sticky; top: 0; z-index: 20; background: var(--nav-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); font-family: var(--sans); }
.navbar .wrap { max-width: var(--wide-width); display: flex; align-items: center; justify-content: space-between; gap: 18px; height: 52px; }
.nav-title { font-family: var(--serif); font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.nav-title:hover { text-decoration: none; color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.nav-links { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; font-size: 0.9rem; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--muted); white-space: nowrap; }
.nav-links a:hover { color: var(--text-strong); text-decoration: none; }
.nav-links a[aria-current] { color: var(--accent); }
@media (max-width: 640px) {
  .nav-title { display: none; }
  .nav-right { width: 100%; justify-content: space-between; }
  .nav-links { gap: 16px; font-size: 0.86rem; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 18px; }
}
.skip { position: absolute; left: 12px; top: -48px; z-index: 30; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-family: var(--sans); }
.skip:focus { top: 8px; }
.theme-toggle { flex: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); width: 32px; height: 32px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.theme-toggle:hover { color: var(--text-strong); border-color: var(--muted); }
.theme-toggle svg { width: 16px; height: 16px; }
.toggle-sun { display: none; }
:root[data-theme="dark"] .toggle-moon { display: none; }
:root[data-theme="dark"] .toggle-sun { display: block; }

/* title block */
.hero { text-align: center; padding: 64px 20px 34px; max-width: 980px; }
.hero h1 { font-weight: 600; font-size: clamp(1.85rem, 4.2vw, 2.7rem); line-height: 1.18; letter-spacing: -0.005em; margin: 0 0 26px; color: var(--text-strong); text-wrap: balance; }
.authors { font-size: 1.15rem; margin: 0 0 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 24px; color: var(--text-strong); }
.authors sup { color: var(--muted); font-size: 0.66em; margin-left: 1px; }
.affil { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; margin: 0; }
.venue { color: var(--muted); font-style: italic; margin: 12px 0 28px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-family: var(--sans); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius); background: transparent; border: 1px solid var(--line); color: var(--text-strong); font: inherit; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn.disabled, .btn:disabled { opacity: 0.5; cursor: default; }
.btn.disabled:hover, .btn:disabled:hover { border-color: var(--line); color: var(--text-strong); }
.btn small { font-size: 0.7em; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* looping clips, 2 x 2 */
.clip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.clip-grid.three { grid-template-columns: repeat(3, 1fr); }
.tile { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.tile video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.tile figcaption { position: absolute; left: 8px; bottom: 8px; margin: 0; padding: 2px 8px; border-radius: 3px; background: rgba(17,19,23,0.7); color: #fff; font-family: var(--sans); font-size: 0.82rem; line-height: 1.45; pointer-events: none; }
@media (max-width: 640px) { .clip-grid, .clip-grid.three { grid-template-columns: 1fr 1fr; gap: 4px; } .tile figcaption { left: 4px; bottom: 4px; padding: 1px 5px; font-size: 0.66rem; } }

/* sections */
.section { padding: 52px 0 8px; }
.section h2 { font-weight: 600; font-size: 1.6rem; line-height: 1.25; color: var(--text-strong); text-align: center; margin: 0 0 22px; }
.section p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.abstract { text-align: justify; hyphens: auto; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card video, .card img { width: 100%; }
img.zoom { cursor: zoom-in; }
figure { margin: 24px 0; }
/* breaks out of the text column, up to the full content width */
.figure-wide { width: min(1080px, calc(100vw - 40px)); margin-left: 50%; transform: translateX(-50%); }
.sim.figure-wide { margin-top: 18px; }
.robot-view { width: min(880px, calc(100vw - 40px)); margin-bottom: 22px; }
/* overview video: poster + play button, swapped for the YouTube iframe on click */
.yt { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #111317; }
.yt img { display: block; width: 100%; height: 100%; object-fit: cover; }
.yt.ready img { cursor: pointer; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play { position: absolute; top: 50%; left: 50%; width: 76px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; transform: translate(-50%, -50%); }
.yt-play svg { width: 100%; height: 100%; display: block; }
.yt-play:hover path:first-child, .yt-play:focus-visible path:first-child { fill: #ff0033; fill-opacity: 1; }
.yt-soon { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: var(--radius); background: rgba(17,19,23,0.72); color: #eef0f3; font-family: var(--sans); font-size: 0.85rem; white-space: nowrap; }
.yt-link { margin: 8px 0 0; text-align: right; font-family: var(--sans); font-size: 0.9rem; }   /* the demo spans the wide column, like the Results grid */
figcaption { color: var(--muted); font-family: var(--sans); font-size: 0.88rem; margin: 10px 2px 0; line-height: 1.5; }

/* BibTeX */
pre.bib { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.55; position: relative; color: var(--text); }
.copy { position: absolute; top: 10px; right: 10px; font-family: var(--sans); font-size: 0.8rem; padding: 3px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
kbd { font-family: var(--mono); font-size: 0.8em; padding: 1px 5px; margin: 0 1px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: var(--surface); color: var(--text-strong); }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-family: var(--sans); font-size: 0.85rem; padding: 24px 0 36px; text-align: center; margin-top: 48px; }
.footer a { color: var(--muted); text-decoration: underline; }

/* interactive demo */
.sim { position: relative; aspect-ratio: 16 / 9; min-height: 340px; max-height: 82vh; background: #dfe4ea; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; font-family: var(--sans); }
.sim canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sim.active { box-shadow: 0 0 0 2px var(--accent); }
.sim-banner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: var(--radius); background: rgba(17,19,23,0.82); color: #fff; font-size: 0.95rem; pointer-events: none; }
.sim-legend { position: absolute; bottom: 10px; left: 10px; display: none; flex-wrap: wrap; gap: 4px 12px; max-width: 60%; padding: 5px 10px; border-radius: var(--radius); background: rgba(17,19,23,0.6); color: #eef0f3; font-size: 12px; pointer-events: none; }
.sim-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.sim-keys { position: absolute; top: 10px; right: 10px; padding: 5px 10px; border-radius: var(--radius); background: rgba(17,19,23,0.6); color: #eef0f3; font-size: 12px; pointer-events: none; display: none; }
.sim-keys kbd { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); color: #fff; }
.sim-pad { position: absolute; right: 12px; bottom: 12px; display: none; grid-template-columns: repeat(3, 46px); gap: 6px; }
.sim-pad button { width: 46px; height: 42px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.25); background: rgba(17,19,23,0.55); color: #fff; cursor: pointer; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; font-family: var(--sans); }
.sim-pad button b { font-size: 15px; line-height: 1; color: #fff; }
.sim-pad button small { font-size: 10px; line-height: 1; opacity: 0.75; }
.sim-pad button:active { background: rgba(39,82,195,0.8); }
.sim.running .sim-keys { display: block; }
.sim.running .sim-pad { display: grid; }
.sim.running .sim-legend { display: flex; }
@media (max-width: 640px) { .sim { aspect-ratio: 4 / 5; } .sim-keys, .sim-legend { display: none !important; } }
.sim-cover { position: absolute; inset: 0; display: grid; place-items: center; }
.sim-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(0.85); }
.sim-cover-inner { position: relative; text-align: center; padding: 16px 22px; border-radius: var(--radius); background: rgba(17,19,23,0.7); max-width: 90%; }
.sim-cover .sim-status { color: #e6e8ec; font-family: var(--sans); font-size: 0.85rem; margin: 10px 0 0; }
.sim.running .sim-cover { display: none; }
.sim.loading .sim-cover-inner .btn { opacity: 0.6; }

/* figure lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(14,14,16,0.88); }
.lightbox img { max-width: 96vw; max-height: 94vh; width: auto; height: auto; border-radius: var(--radius); cursor: zoom-out; }
.lightbox-close { position: fixed; top: 14px; right: 18px; width: 38px; height: 38px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.3); background: rgba(17,19,23,0.7); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .navbar, .sim, .yt, .yt-link, .theme-toggle, .copy, .skip, video { display: none !important; } body { background: #fff; color: #000; } }
.center { text-align: center; }
