/* Facet-SLAM project page. Palette and type follow the lab's earlier paper pages; the shapes are triangles. */

:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-hi: #181818;
  --text: #e6e6e6;
  --text-dim: #8d8d8d;
  --text-faint: #5c5c5c;
  --accent: oklch(0.78 0.12 230);
  --accent-soft: oklch(0.78 0.12 230 / 0.12);
  --accent-line: oklch(0.78 0.12 230 / 0.4);
  --path: oklch(0.74 0.16 50);
  --border: rgba(255, 255, 255, 0.07);
  --border-hi: rgba(255, 255, 255, 0.14);
  --max-w: 1040px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* a small upward triangle, used as the page's marker */
  --tri: polygon(50% 8%, 100% 92%, 0 92%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--accent-soft); color: #fff; }
img, video, canvas, svg { max-width: 100%; display: block; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  position: relative;
  z-index: 1;
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 60;
}

/* ---------- Top bar ---------- */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(24px, env(safe-area-inset-right, 0px)) 16px max(24px, env(safe-area-inset-left, 0px));
  background: rgba(10, 10, 10, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.top-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  text-decoration: none;
}
.top-mark .glyph { width: 18px; height: 18px; color: var(--accent); }
.top-mark .v { color: var(--text); }
.top-mark .slash { opacity: 0.4; margin: 0 2px; }
.top-nav { display: flex; gap: 22px; }
.top-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.top-nav a:hover { color: var(--text); }
.top-nav a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 640px) { .top-nav { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(112px, 15vh, 168px) 0 64px;
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 78%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 78%);
}

.eyebrow,
.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.eyebrow::before,
.section-eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent);
  clip-path: var(--tri);
  flex: none;
}

.paper-title {
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 18px;
}
.paper-title .accent { color: var(--accent); }
/* "Facet" is drawn by main.js as a Delaunay mesh of lit triangles on a canvas laid over
   the word. The text stays in the page (selectable, and shown as-is without the script). */
.paper-title .facets { position: relative; }
.paper-title .facets.is-splat { color: transparent; }
.paper-title .facets canvas { position: absolute; max-width: none; pointer-events: none; }

.paper-subtitle {
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  color: var(--text-dim);
  line-height: 1.45;
  max-width: 46ch;
  margin-bottom: 28px;
  text-wrap: balance;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.affiliations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 28px;
}
.authors sup,
.affiliations sup { font-size: 0.7em; margin-right: 1px; }

.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.action-btn svg { width: 15px; height: 15px; stroke: currentColor; }
.action-btn[href]:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.action-btn[aria-disabled="true"] { color: var(--text-faint); border-color: var(--border); cursor: default; }

/* ---------- Media frames ---------- */
.teaser,
.gallery,
.layers,
.explore {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.teaser { margin-top: 44px; }
.teaser video,
.gallery-stage video {
  width: 100%;
  aspect-ratio: 1280 / 678;
  background: #050505;
  object-fit: contain;
}
.teaser video { aspect-ratio: 2 / 1; }
.teaser figcaption,
.gallery-cap,
.layer-cap {
  display: flex;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-dim);
}
.teaser figcaption .right,
.gallery-cap .right {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  align-self: center;
}

/* ---------- Sections ---------- */
.scroll-section { padding: 72px 0; border-top: 1px solid var(--border); position: relative; }

.section-title {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 18px;
  max-width: 24ch;
  text-wrap: balance;
}
.section-lede,
p.body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 66ch;
}
.section-lede { margin-bottom: 30px; }
p.body + p.body { margin-top: 14px; }
p.body strong { color: var(--text); font-weight: 600; }
.fine { font-size: 0.82rem; color: var(--text-faint); margin-top: 12px; }

/* ---------- Key numbers ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 40px 0 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.stat { padding: 22px 20px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat-value {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 0.5em; font-weight: 500; color: var(--text-dim); margin-left: 5px; letter-spacing: 0; }
.stat-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 10px; line-height: 1.4; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ---------- Pipeline ---------- */
.pipeline {
  display: grid;
  grid-template-columns: 1fr 44px 1fr 44px 1fr;
  align-items: stretch;
}
.node {
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 16px 16px 18px;
  background: var(--surface);
  min-width: 0;
}
.node.is-input { border-style: dashed; background: transparent; }
.node.is-accent { border-color: var(--accent-line); }
.node-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.node-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.node.is-accent .node-title { color: var(--accent); }
.node-desc { font-size: 0.84rem; color: var(--text-dim); line-height: 1.5; }
.formula .bar { text-decoration: overline; }
.formula {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
}
/* an arrow: a line ending in a triangle; .is-both points both ways */
.link { position: relative; }
.link span {
  position: absolute;
  top: 50%;
  left: 6px;
  right: 6px;
  height: 1px;
  background: var(--accent-line);
}
.link::after,
.link.is-both::before {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  width: 8px;
  height: 8px;
  background: var(--accent);
}
.link::after { right: 4px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.link.is-both::before { left: 4px; clip-path: polygon(100% 0, 0 50%, 100% 100%); }
@media (max-width: 760px) {
  .pipeline { grid-template-columns: 1fr; }
  .link { height: 34px; }
  .link span { top: 6px; bottom: 6px; left: 50%; right: auto; width: 1px; height: auto; }
  .link::after { top: auto; bottom: 4px; right: calc(50% - 4px); clip-path: polygon(0 0, 100% 0, 50% 100%); }
  .link.is-both::before { top: 4px; left: calc(50% - 4px); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
}

/* ---------- Tabs (clips and map layers) ---------- */
.gallery-tabs,
.layer-tabs,
.explore-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.gallery-tabs button,
.layer-tabs button,
.explore-tabs button {
  flex: none;
  position: relative;
  padding: 9px 14px 9px 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font: 500 0.84rem var(--sans);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.gallery-tabs button::before,
.layer-tabs button::before,
.explore-tabs button::before {
  content: "";
  position: absolute;
  left: 11px;
  top: calc(50% - 4px);
  width: 8px;
  height: 8px;
  background: var(--text-faint);
  clip-path: var(--tri);
  transition: background 0.2s;
}
.gallery-tabs button:hover,
.layer-tabs button:hover,
.explore-tabs button:hover { color: var(--text); }
.gallery-tabs button[aria-selected="true"],
.layer-tabs button[aria-selected="true"],
.explore-tabs button[aria-selected="true"] { color: var(--text); background: var(--surface-hi); }
.gallery-tabs button[aria-selected="true"]::before,
.layer-tabs button[aria-selected="true"]::before,
.explore-tabs button[aria-selected="true"]::before { background: var(--accent); }
.gallery-tabs button:focus-visible,
.layer-tabs button:focus-visible,
.explore-tabs button:focus-visible,
.explore-reset:focus-visible,
.action-btn:focus-visible,
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.layer-stage { position: relative; aspect-ratio: 3 / 2; background: #0a0a0a; }
.layer-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.layer-stage img.is-active { opacity: 1; }

/* ---------- Explore: the interactive mesh ---------- */
.explore-stage { position: relative; aspect-ratio: 16 / 10; background: #0a0a0a; overflow: hidden; }
.explore-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.explore-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  pointer-events: none;
}
.explore-status[hidden] { display: none; }
.explore-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(10, 10, 10, 0.66);
  font-size: 0.74rem;
  color: var(--text-dim);
  pointer-events: none;
}
.explore-hint .touch { display: none; }
@media (pointer: coarse) {
  .explore-hint .mouse { display: none; }
  .explore-hint .touch { display: inline; }
}
.explore-reset {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 11px;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  background: rgba(10, 10, 10, 0.66);
  color: var(--text-dim);
  font: 500 0.74rem var(--sans);
  cursor: pointer;
  transition: color 0.2s;
}
.explore-reset:hover { color: var(--text); }
@media (max-width: 640px) { .explore-stage { aspect-ratio: 4 / 3; } }

/* ---------- Tables ---------- */
.table-block + .table-block { margin-top: 44px; }
.table-head {
  display: flex;
  justify-content: space-between;
  gap: 6px 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.table-head .tag { color: var(--accent); }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 620px; }
th,
td {
  padding: 11px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: 0; }
th {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
th:nth-child(-n+2),
td:nth-child(-n+2) { text-align: left; }
td { color: var(--text-dim); }
td.method { color: var(--text); font-weight: 500; }
tr.group-start td { border-top: 1px solid var(--border-hi); }
tr.is-ours td { background: var(--accent-soft); color: var(--text); }
tr.is-ours td.method { color: var(--accent); font-weight: 600; }
.best { color: var(--accent); font-weight: 600; }
.table-note { font-size: 0.8rem; color: var(--text-faint); line-height: 1.55; margin-top: 10px; max-width: 78ch; }

/* ---------- BibTeX ---------- */
.bibtex-block {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
}
.bibtex-block pre { font: inherit; white-space: pre; overflow-x: auto; padding-bottom: 4px; }
.bibtex-block .k { color: var(--accent); }
.bibtex-block .tt { color: var(--path); }
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-dim);
  font: 0.68rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover,
.copy-btn.is-copied { color: var(--accent); border-color: var(--accent-line); }

.sub-title { font-size: 1.05rem; font-weight: 600; margin: 40px 0 10px; }
.ack-text { font-size: 0.94rem; color: var(--text-dim); line-height: 1.7; max-width: 70ch; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 52px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.foot-mark { width: 60px; height: 12px; margin: 0 auto 14px; fill: var(--accent); opacity: 0.7; }

/* ---------- Motion ---------- */
/* hidden only once the script that reveals them is known to run */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .layer-stage img { transition: none; }
}

@media (max-width: 640px) {
  .scroll-section { padding: 52px 0; }
  .hero { padding-bottom: 44px; }
  .teaser { margin-top: 32px; }
}

/* ---------- Scrollbars of the scrolling boxes ---------- */
pre, .table-wrap, .gallery-tabs, .layer-tabs, .explore-tabs { scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent; }
