/* =============================================================
   Sat3DGen — Project Page Stylesheet
   Inspired by the PLANA3R / Nerfies academic project pages.
   ============================================================= */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f6f8fb;
  --color-fg: #1f2937;
  --color-muted: #5b6473;
  --color-accent: #1f6feb;
  --color-accent-dark: #134aa3;
  --color-border: #e3e8f0;
  --color-code-bg: #0f172a;
  --color-code-fg: #e2e8f0;

  --maxw: 1180px;
  --maxw-narrow: 880px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

code {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 0.92em;
  background: rgba(31, 111, 235, 0.08);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  color: var(--color-accent-dark);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}
.container.narrow {
  max-width: var(--maxw-narrow);
  margin: 0 auto;
  padding: 0 28px;
}

/* ============== HERO ============== */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(ellipse at top, rgba(31, 111, 235, 0.08), transparent 60%),
    linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.venue-badge {
  display: inline-block;
  background: var(--color-accent);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.title {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.25;
  font-weight: 800;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}
.title .model-name {
  background: linear-gradient(135deg, #1f6feb, #6f46e8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.authors {
  font-size: 1.02rem;
  color: var(--color-fg);
  max-width: 100%;
  margin: 0 auto 14px;
  line-height: 1.9;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: 0 6px 6px;
  text-align: center;
}
.authors a {
  color: var(--color-fg);
  font-weight: 500;
  border-bottom: 1px dashed transparent;
}
.authors a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}
.authors sup {
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.78em;
  margin-left: 1px;
}

.affiliations {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-bottom: 32px;
}
.affiliations span { margin: 0 10px; }
.affiliations sup {
  color: var(--color-accent);
  font-weight: 600;
  margin-right: 2px;
}

.links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1f2937;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.94rem;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--color-accent);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-disabled {
  background: #cbd5e1;
  color: #ffffff;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.85;
}
.btn-icon { font-size: 1rem; line-height: 1; }

/* ============== SECTIONS ============== */
.section {
  padding: 72px 0;
}
.section-alt {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.section-teaser {
  padding-top: 48px;
  padding-bottom: 24px;
}
.section-title {
  font-size: 1.9rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.section-subtitle {
  text-align: center;
  color: var(--color-muted);
  max-width: 760px;
  margin: 0 auto 40px;
  font-size: 1rem;
}

.abstract {
  font-size: 1.04rem;
  color: var(--color-fg);
  line-height: 1.8;
  margin: 0 0 16px;
  text-align: justify;
}

.caption {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  margin: 18px auto 0;
  max-width: 780px;
}
.caption.small { font-size: 0.86rem; margin-top: 12px; }

/* ============== TEASER VIDEO ============== */
.teaser-video {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background: #000;
}

/* ============== PAPER FIGURES ============== */
.paper-figure {
  margin: 0 auto 40px;
  text-align: center;
}
.paper-img {
  width: 100%;
  max-width: 960px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* ============== PIPELINE ============== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.pipeline-step {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 26px 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pipeline-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.pipeline-step h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--color-fg);
}
.pipeline-step p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ============== APPLICATIONS ============== */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.app-card {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  text-align: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
/* Make app-card-link variants behave like clickable cards */
.app-card-link {
  text-decoration: none;
  color: inherit;
}
.app-card-link:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}
.app-card-link:hover .app-cta {
  color: var(--color-accent);
}
.app-cta {
  margin-top: auto;
  padding-top: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
  transition: color 0.18s ease;
}

/* ============== TRY IT ONLINE — Model Zoo ============== */
.model-zoo {
  margin-top: 48px;
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.model-zoo-title {
  text-align: center;
  margin: 0 0 22px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-fg);
  letter-spacing: 0.01em;
}
.model-zoo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.zoo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  color: var(--color-fg);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.zoo-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-fg);
}
.zoo-icon { font-size: 1.7rem; line-height: 1; }
.zoo-label {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}
.zoo-label small {
  display: inline-block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--color-muted);
}
.zoo-host {
  font-size: 0.78rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.app-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
}
.app-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.app-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ============== INTERACTIVE 3D MESH ============== */
.mesh-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.mesh-tab,
.demo-tab {
  background: #ffffff;
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mesh-tab:hover,
.demo-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.mesh-tab.active,
.demo-tab.active {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.three-canvas {
  position: relative;
  width: 100%;
  height: 560px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #eaf1fb 0%, #f6f8fb 100%);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}
.three-canvas canvas { display: block; }

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  pointer-events: none;
  background: rgba(246, 248, 251, 0.7);
  backdrop-filter: blur(2px);
}

/* ============== DEMO GALLERY ============== */
.demo-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.demo-card {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.demo-card.wide {
  grid-column: span 2;
}
.demo-label {
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  letter-spacing: 0.02em;
}
.demo-hint {
  margin: 0;
  padding: 8px 16px 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--color-border);
}
/* Panorama: 3:1 frame; 75% of previous size (min(100%,960) → min(75%,720)); 4:1 video + contain + letterbox */
.demo-pano-embed {
  width: min(75%, 720px);
  max-width: 100%;
  margin: 0 auto 4px;
  box-sizing: border-box;
  border-radius: 6px;
  overflow: hidden;
  background: #0c0d10;
}
.demo-pano-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  background: #0c0d10;
}
.demo-pano-embed .demo-media--pano,
.demo-pano-embed .demo-media.demo-media--pano {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0c0d10;
}
/*
 * Render videos at their natural aspect ratio.
 * Earlier versions used `max-height + object-fit: contain`, which caused tall
 * letterbox bars on small (256x256) videos that share a grid row with a
 * larger mesh-orbit video — the row stretched to the larger card and the
 * 256x256 video sat in the top with black `background: #000` padding below,
 * looking like a "black screen" bug.
 */
.demo-media {
  display: block;
  width: 100%;
  height: auto;
  background: var(--color-bg-alt);
}
/* Allow the row to use mixed heights instead of forcing both cells to match. */
.demo-grid { align-items: start; }

/* ============== BIBTEX ============== */
.caption-bib-related {
  margin-top: 22px;
}
#bibtex .bibtex + .bibtex {
  margin-top: 12px;
}
.bibtex {
  background: var(--color-code-bg);
  color: var(--color-code-fg);
  padding: 22px 24px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  box-shadow: var(--shadow-md);
  margin-top: 18px;
}
.bibtex code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ============== FOOTER ============== */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-muted);
  font-size: 0.88rem;
  background: var(--color-bg-alt);
}
.footer p { margin: 0; }

/* ============== RESPONSIVE ============== */
@media (max-width: 980px) {
  .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
  .apps-grid { grid-template-columns: repeat(2, 1fr); }
  .three-canvas { height: 460px; }
}
@media (max-width: 700px) {
  .hero { padding: 56px 0 40px; }
  .section { padding: 56px 0; }
  .links { gap: 8px; }
  .btn { padding: 10px 16px; font-size: 0.88rem; }
  .demo-grid { grid-template-columns: 1fr; }
  .demo-card.wide { grid-column: span 1; }
  .three-canvas { height: 380px; }
  .pipeline-grid { grid-template-columns: 1fr; }
  .apps-grid { grid-template-columns: 1fr; }
}
