:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #555;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --border: #e4e4e7;
  --code-bg: #f6f8fa;
  --max-width: 1200px;
  --narrow-width: 820px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow {
  max-width: var(--narrow-width);
}

/* ============================= HERO ============================= */
.hero {
  text-align: center;
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
}

.hero-venue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  padding: 7px 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.2;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.author {
  white-space: nowrap;
}

.author sup {
  font-size: 0.7em;
  color: var(--muted);
}

.author-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.author-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.orcid {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  vertical-align: super;
  background: #a6ce39;
  border-radius: 50%;
  position: relative;
  text-decoration: none;
}

.orcid::after {
  content: "iD";
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 24px;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 8px;
}

.affiliations sup {
  font-size: 0.7em;
}

.footnote-mark {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* ============================= BUTTONS ============================= */
.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent);
}

.btn:active {
  transform: translateY(1px);
}

.btn-icon {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

/* ============================= SECTIONS ============================= */
.section {
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-child {
  border-bottom: none;
}

.section-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600;
  font-size: 1.9rem;
  text-align: center;
  margin: 0 0 28px;
}

.subsection-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin: 36px 0 16px;
}

.abstract-text {
  margin: 0 0 18px;
  text-align: justify;
}

/* ============================= TEASER VIDEO ============================= */
.teaser-video {
  width: 100%;
  max-width: 1280px;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #000;
}

/* ============================= KEY IDEAS ============================= */
.key-ideas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 8px;
}

.key-idea {
  background: #f8faff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 22px 24px;
}

.key-idea-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 10px;
}

.key-idea-text {
  margin: 0;
  font-size: 0.95rem;
  color: #333;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .key-ideas {
    grid-template-columns: 1fr;
  }
}

/* ============================= FIGURE ============================= */
.figure {
  margin: 32px 0 0;
  text-align: center;
}

.figure img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.figure figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: left;
}

/* ============================= PLACEHOLDER ============================= */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: 12px;
  color: #9ca3af;
  font-size: 0.95rem;
  background: #fafafa;
}

.placeholder-wide {
  width: 100%;
  min-height: 240px;
}

/* ============================= GALLERY ============================= */
.gallery-intro {
  text-align: center;
  color: var(--muted);
  max-width: 1000px;
  margin: 0 auto 28px;
  font-size: 0.95rem;
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.acc-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8faff;
  border: none;
  padding: 18px 24px;
  cursor: pointer;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s ease;
}

.acc-header:hover {
  background: #eef3ff;
}

.acc-icon {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 400;
  line-height: 1;
}

.acc-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.acc-item.open .acc-panel {
  max-height: 100000px;
}

.acc-panel-inner {
  padding: 8px 24px 28px;
  /* shared cell size so orientation / inputs / predictions / GT all align */
  --cell: 150px;
  --cell-gap: 12px;
}

.gallery-subtitle {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 18px 0 12px;
}

/* real-world input scene */
.scene-container {
  text-align: center;
  margin-bottom: 8px;
}

.scene-container img {
  width: 100%;
  max-width: 720px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.scene-container img:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* orientation reference grid: same 5 equal columns as predictions so they align */
.orientation-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--cell-gap, 12px);
  margin-bottom: 8px;
}

.orientation-item {
  text-align: center;
}

/* orientation thumbnails shrunk to 65% and centered within the column */
.orientation-item img {
  width: 65%;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fafafa;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.uid-cell img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fafafa;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.orientation-item img:hover,
.uid-cell img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.view-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

/* gallery controls */
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  margin: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.gallery-controls select {
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.gallery-controls input[type="checkbox"] {
  margin-right: 4px;
}

/* per-object rows: each section (Inputs / Predictions / GT) on its own row */
.uid-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px dashed var(--border);
}

.uid-row:last-child {
  border-bottom: none;
}

.uid-section {
  min-width: 0;
}

.uid-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* Predictions & GT: 5 equal columns filling the full block width -> aligned & equal size */
.uid-pred-section .uid-grid,
.uid-gt-section .uid-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--cell-gap);
}

/* Inputs: same 5-column grid so each input matches one prediction column */
.uid-input-section .uid-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--cell-gap);
}

.uid-cell {
  text-align: center;
  min-width: 0;
}

@media (max-width: 700px) {
  .acc-panel-inner {
    --cell-gap: 8px;
    padding: 8px 14px 22px;
  }
}

/* ============================= 3D RECONSTRUCTION ============================= */
.recon-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 8px 0 0;
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}

.recon-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}

.recon-item {
  min-width: 0;
}

.recon-item h4 {
  font-size: 0.9rem;
  text-align: center;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.video-pair {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-wrapper {
  position: relative;
}

.video-wrapper video {
  width: 100%;
  border-radius: 8px;
  background: #000;
  display: block;
}

.video-label {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.baseline-label {
  background: rgba(220, 53, 69, 0.85);
}

.ours-label {
  background: rgba(40, 167, 69, 0.9);
}

@media (max-width: 900px) {
  .recon-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .recon-container { grid-template-columns: 1fr; }
}

/* ============================= MODAL ============================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
}

.modal-content {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: 8px;
  background: #fff;
}

.modal-info {
  color: #eee;
  margin-top: 14px;
  font-size: 0.95rem;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 32px;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 300;
}

/* ============================= BIBTEX ============================= */
.bibtex-wrapper {
  position: relative;
}

.bibtex {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 80px;
  margin: 0;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================= RESPONSIVE ============================= */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  .hero {
    padding: 40px 0 28px;
  }
  .authors {
    font-size: 1rem;
  }
  .abstract-text {
    text-align: left;
  }
}
