/* CAM3R interactive demo — styled to match the project landing page. */

:root {
  --ink: #222;
  --ink-strong: #111;
  --ink-soft: #444;
  --muted: #666;
  --faint: #777;
  --line: #e0e0e0;
  --line-soft: rgba(0, 0, 0, 0.05);
  --line-table: #edf1f7;
  --bg-card: #ffffff;
  --bg-soft: #f8f9fa;
  --accent: #1a73e8;
  --accent-dark: #1152a8;
  --accent-wash: #f0f4ff;
  --accent-strong: #1a56db;

  /* The point clouds are light points drawn on a dark scene background
     (viewer.js paints 0x0b0e13). Every viewer panel keeps that dark surface
     so the clouds stay legible on the otherwise light page. */
  --canvas-bg: #0b0e13;

  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1200px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--sans);
  background: linear-gradient(to bottom, #ffffff 0%, #f0f2f5 100%);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------- layout ---------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.narrow { max-width: 950px; margin-left: auto; margin-right: auto; }

/* ---------- nav ---------- */

nav.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
nav.topbar .wrap {
  display: flex; align-items: center; gap: 6px;
  height: 52px; overflow-x: auto; scrollbar-width: none;
}
nav.topbar .wrap::-webkit-scrollbar { display: none; }
nav.topbar a {
  font-size: 0.9rem; color: var(--ink-soft); padding: 5px 10px;
  border-radius: 6px; white-space: nowrap;
}
nav.topbar a:hover { background: var(--accent-wash); color: var(--accent-dark); text-decoration: none; }
nav.topbar a.back {
  color: var(--accent); font-weight: 500; margin-right: 12px;
}
nav.topbar a.back:hover { color: var(--accent-dark); }

/* ---------- page head ---------- */

header.page-head {
  background: var(--bg-card);
  padding: 44px 24px 36px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
header.page-head h1 {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
header.page-head p {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- sections ---------- */

section { padding: 56px 0 0; }
section > .wrap { padding-bottom: 40px; border-bottom: 1px solid var(--line-soft); }
section:last-of-type > .wrap { border-bottom: none; }

h2 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--ink-strong);
  text-align: center;
  margin: 0 0 20px;
}
h2 .num {
  font-family: var(--mono); font-size: 0.8rem; color: var(--accent);
  letter-spacing: .12em; display: block; margin-bottom: 10px; font-weight: 500;
}

h3 {
  font-size: 1.3rem; font-weight: 600; color: #333;
  text-align: center; margin: 34px 0 12px;
}

p.lede {
  color: var(--ink-soft);
  font-size: 1.08rem;
  max-width: 950px;
  margin: 0 auto 28px;
}

figure { margin: 0; }
figure img {
  border-radius: 8px;
  background: var(--bg-soft);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
figcaption {
  font-size: 0.95rem; color: #555; line-height: 1.5;
  margin-top: 12px; max-width: 950px;
}
figure.center { text-align: center; }
figure.center img { margin-left: auto; margin-right: auto; }
figure.center figcaption { margin-left: auto; margin-right: auto; text-align: left; }

code, .mono { font-family: var(--mono); font-size: .88em; }
p code, li code, td code {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
}

/* ---------- example widget ---------- */

.widget { margin-top: 26px; }

.tabs {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin-bottom: 24px;
}
.tabs button {
  font-family: var(--sans); font-size: 0.92rem; font-weight: 500;
  padding: 8px 20px; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent);
  transition: background .2s, color .2s;
}
.tabs button:hover { background: var(--accent); color: #fff; }
.tabs button[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

.example-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px;
  justify-content: center; margin-bottom: 14px;
}
.example-head .name { font-size: 1.3rem; font-weight: 600; color: var(--ink-strong); }
.example-head .src { font-size: 0.95rem; color: var(--muted); }

.metrics { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 16px 0 0; }
.metric {
  border: 1px solid var(--line-table); border-radius: 8px;
  padding: 10px 16px; background: var(--bg-card); min-width: 170px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.metric .k {
  display: block; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: .06em; color: var(--muted);
}
.metric .v { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; color: var(--accent-strong); }

.strip { margin: 20px 0 0; }
.strip img {
  border-radius: 8px; width: 100%;
  background: var(--bg-soft);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.strip .cap { font-size: 0.9rem; color: #555; line-height: 1.5; margin-top: 10px; }

.pair-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- viewers ---------- */

.viewer-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
  margin: 22px 0 12px; font-size: 0.9rem; color: var(--muted);
}
.viewer-toolbar .hint { display: flex; align-items: center; gap: 7px; }
.viewer-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.viewer-toolbar input[type="range"] { width: 118px; accent-color: var(--accent); }
.viewer-toolbar button {
  font-family: var(--sans); font-size: 0.88rem; padding: 6px 14px;
  border-radius: 6px; border: 1.5px solid var(--accent); background: transparent;
  color: var(--accent); cursor: pointer;
  transition: background .2s, color .2s;
}
.viewer-toolbar button:hover { background: var(--accent); color: #fff; }

.stage { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stage.single { grid-template-columns: 1fr; }
/* Ground truth plus three methods in one row, all driven by one camera. */
.stage.quad { grid-template-columns: repeat(4, 1fr); }

/* Dark panels inset into the light page: the clouds are pale points and need
   a dark backdrop to stay readable. */
.panel {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.14); border-radius: 10px;
  background: var(--canvas-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  min-height: 240px;
}
.panel canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.panel .tag {
  position: absolute; top: 10px; left: 12px; z-index: 3;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: .1em;
  text-transform: uppercase;
  color: #dfe6ea; background: rgba(10, 14, 20, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 3px 9px; border-radius: 5px;
  pointer-events: none;
}
/* a name that is already lowercase by definition must survive the uppercasing */
.panel .tag .sym { text-transform: none; font-size: 0.82rem; }

.stage.single .panel { aspect-ratio: 16 / 9; }
/* four square panels fit the row without forcing the page taller */
.stage.quad .panel { aspect-ratio: 1 / 1; min-height: 190px; }

/* the method this page is presenting, marked out among the three baselines */
.panel.ours { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash), 0 4px 12px rgba(26, 115, 232, .22); }
.panel.ours .tag {
  color: #fff; background: var(--accent-strong);
  border-color: rgba(255, 255, 255, .3); font-weight: 700;
}

.panel .overlay {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 22px;
  background: var(--canvas-bg); color: #b9c3cc;
  font-size: 0.9rem;
}
.panel .overlay[hidden] { display: none; }
.panel .overlay.error { color: #ffb4a8; }
.panel .overlay .spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: #6fb9c7;
  animation: spin .9s linear infinite;
}
.panel .overlay.error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .panel .overlay .spinner { animation-duration: 3s; }
  html { scroll-behavior: auto; }
}

.viewer-note { font-size: 0.9rem; color: #555; line-height: 1.6; margin: 14px 0 0; max-width: 80ch; }
/* per-example caveats, e.g. a benchmark where the methods do not cover the
   same set of views: worth noticing, so it is set apart rather than buried */
.viewer-note.views {
  border-left: 3px solid var(--line); background: var(--bg-soft);
  border-radius: 0 6px 6px 0; padding: 10px 14px; color: var(--ink-soft);
}

/* ---------- notes / callouts ---------- */

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  font-size: 0.98rem; color: var(--ink-soft);
  margin: 24px 0 0;
}
.callout strong { color: var(--ink); }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line);
  background: #fafafa;
  text-align: center;
  padding: 32px 16px;
  font-size: 0.85rem; color: var(--faint);
}
footer p { margin: 0 auto 8px; max-width: 950px; }
footer p:last-child { margin-bottom: 0; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .stage.quad { grid-template-columns: repeat(2, 1fr); }
  .panel { aspect-ratio: 4 / 3; min-height: 200px; }
  .pair-imgs { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  header.page-head { padding: 32px 20px 26px; }
  header.page-head h1 { font-size: 1.5rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.1rem; }
  section { padding: 40px 0 0; }
  section > .wrap { padding-bottom: 30px; }
  .metric { min-width: 140px; flex: 1 1 140px; }
  .stage.quad { grid-template-columns: 1fr; }
}
