/* ==========================================================================
   Global
   ========================================================================== */

body {
  font-family: 'Noto Sans', sans-serif;
  line-height: 1.7;
  color: #1a1a2e;
}

/* ==========================================================================
   Side navigation
   ========================================================================== */

.side-nav {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.3s;
}

.side-nav.visible {
  opacity: 1;
}

.side-nav a {
  display: block;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: #999;
  text-decoration: none;
  border-right: 2px solid transparent;
  text-align: right;
  transition: all 0.2s;
  white-space: nowrap;
}

.side-nav a:hover {
  color: #555;
}

.side-nav a.active {
  color: #667eea;
  border-right-color: #667eea;
  font-weight: 600;
}

@media (max-width: 1400px) {
  .side-nav { display: none; }
}

.section {
  padding: 5rem 1.5rem;
}

.section-alt {
  background: #f8f9fc;
}

/* Hero gradient */
.hero {
  background: linear-gradient(135deg, #667eea11, #764ba211);
}

/* Section title accent bar */
.section-title {
  text-align: center;
  padding-bottom: 1rem;
}

.section-title .title::after {
  content: '';
  display: block;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

/* ==========================================================================
   ByG title highlight
   ========================================================================== */

#title-B, #title-Y, #title-G {
  transition: color 0.3s, text-shadow 0.3s;
}

#title-B.highlight { color: #667eea; text-shadow: 0 0 8px #667eea55; }
#title-Y.highlight { color: #e040a0; text-shadow: 0 0 8px #e040a055; }
#title-G.highlight { color: #764ba2; text-shadow: 0 0 8px #764ba255; }

.byg-hover {
  cursor: default;
}

/* BibTeX copy button */
.bibtex-wrapper {
  position: relative;
}

.bibtex-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  transition: all 0.2s;
}

.bibtex-copy-btn:hover {
  background: #e0e0e0;
  border-color: #999;
  color: #333;
}

/* ==========================================================================
   TL;DR Box
   ========================================================================== */

.tldr-box {
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.7;
  color: #1a1a2e;
  background: linear-gradient(135deg, #667eea0d, #764ba20d);
  border-left: 4px solid #4a6cf7;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.tldr-label {
  display: inline-block;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 4px;
  margin-right: 8px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

/* ==========================================================================
   Typography & Links
   ========================================================================== */

.publication-title {
  font-family: 'Google Sans', sans-serif;
}

.publication-authors {
  font-family: 'Google Sans', sans-serif;
}

.publication-authors a {
  color: #4a6cf7 !important;
}

.publication-authors a:hover {
  text-decoration: underline;
}

.author-block {
  display: inline-block;
}

.publication-venue {
  font-family: 'Google Sans', sans-serif;
  font-size: 2rem;
  margin-top: 0.75rem;
}

.publication-equal-contrib {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.95rem;
  color: #555;
  margin-top: 0.4rem;
}

.link-block a {
  margin-top: 5px;
  margin-bottom: 5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.link-block a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==========================================================================
   Images & Media
   ========================================================================== */

.publication-img {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.publication-img img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.publication-img:hover {
  transform: scale(1.01);
}

.publication-img:hover img {
  box-shadow: 0 8px 30px rgba(0,0,0,0.10);
}

.publication-video {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 10px !important;
}

.publication-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer .icon-link {
  font-size: 25px;
  color: #000;
}

/* ==========================================================================
   Carousel
   ========================================================================== */

/* Additional Results tabs */
.additional-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.additional-tab {
  padding: 0.5rem 1.5rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}

.additional-tab:hover {
  border-color: #999;
  color: #333;
}

.additional-tab.is-active {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea11, #764ba211);
  color: #1a1a2e;
  font-weight: 600;
}

.additional-tab-content {
  display: none;
}

.additional-tab-content.is-active {
  display: block;
}

/* Results image grid */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.results-grid img {
  width: 100%;
  height: auto;
  border: 1px solid #bbb;
  border-radius: 10px;
  display: block;
}

/* ==========================================================================
   Teaser Section
   ========================================================================== */

.teaser-section {
  padding: 0 0 2rem 0;
  font-family: 'Google Sans', sans-serif;
}

.teaser-wide-container {
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Top row: figure (left) + image pairs (right), matched height --- */
.teaser-top-row {
  display: flex;
  gap: 0;
  align-items: center;
}

.teaser-method {
  flex: 0 0 38%;
  display: flex;
  align-items: stretch;
}

.teaser-method img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

/* Right: two img→img rows stacked, constrained to match figure height */
.teaser-image-pairs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  min-width: 0;
  position: relative;
  padding-left: 60px;
}

.teaser-image-pairs::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 5%;
  bottom: 5%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #999 15%, #999 85%, transparent);
}

.teaser-img-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.teaser-img-cell {
  flex: 1;
  min-width: 0;
}

.teaser-img-cell img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  object-fit: cover;
  display: block;
}

.teaser-img-pair .teaser-arrow {
  flex-shrink: 0;
}

.teaser-img-pair .teaser-prompt {
  flex-basis: 100%;
  text-align: center;
}

/* --- Bottom row: 4 videos in a single strip --- */
.teaser-video-strip {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.teaser-video-pair {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.teaser-video-cell {
  flex: 1;
}

.teaser-video-cell video {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  display: block;
}

.teaser-video-prompts {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.teaser-video-prompts .teaser-prompt {
  flex: 1;
  text-align: center;
}

/* --- Shared teaser elements --- */
.teaser-arrow {
  font-size: 1.1rem;
  color: #555;
  flex-shrink: 0;
  padding: 0 2px;
}

.teaser-prompt {
  text-align: center;
  font-style: italic;
  font-size: 0.85rem;
  margin: 0;
  color: #444;
  background: #f0f1f5;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  align-self: center;
}

.teaser-caption {
  font-size: 1.05rem;
  margin-top: 1rem;
  text-align: center;
  color: #333;
  line-height: 1.6;
}

/* ==========================================================================
   Comparison Slider
   ========================================================================== */

.comparison-slider {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  cursor: col-resize;
  user-select: none;
  --slider-pos: 50%;
}

.comparison-slider img {
  display: block;
  width: 100%;
  height: auto;
}

.comparison-before {
  position: relative;
  z-index: 1;
}

.comparison-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  clip-path: inset(0 0 0 var(--slider-pos));
}

.comparison-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--slider-pos);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.comparison-handle-line {
  width: 2px;
  flex: 1;
  background: white;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.comparison-handle-grip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 14px;
  flex-shrink: 0;
}

/* ==========================================================================
   Video Comparison Carousel
   ========================================================================== */

.vid-compare-header {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.vid-compare-header span {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
  padding: 6px 0;
}

.vid-compare-header .vid-compare-ours {
  color: #4a6cf7;
}

/* ==========================================================================
   Image Comparison Grid
   ========================================================================== */

.img-compare-grid {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.img-compare-header {
  display: grid;
  grid-template-columns: 140px repeat(4, 1fr);
  gap: 6px;
  padding: 10px 10px 6px;
  background: #f8f9fc;
  border-bottom: 1px solid #eee;
}

.img-compare-header span {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
}

.img-compare-header .img-compare-ours {
  color: #4a6cf7;
}

.img-compare-row {
  display: grid;
  grid-template-columns: 140px repeat(4, 1fr);
  gap: 6px;
  padding: 6px 10px;
  align-items: center;
  transition: background 0.2s ease;
}

.img-compare-row:hover {
  background: #f8f9fc;
}

.img-compare-row:not(:last-child) {
  border-bottom: 1px solid #f0f0f0;
}

.img-compare-caption {
  font-style: italic;
  font-size: 0.82rem;
  color: #555;
  padding-right: 8px;
  line-height: 1.4;
}

.img-compare-row img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  object-fit: cover;
  aspect-ratio: 1;
}

.img-compare-row img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 1;
  position: relative;
}

@media screen and (max-width: 768px) {
  .img-compare-header,
  .img-compare-row {
    grid-template-columns: 1fr;
  }

  .img-compare-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .img-compare-caption {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4px 0;
  }

  .img-compare-header span:first-child {
    display: none;
  }

  .img-compare-header {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Video carousel iframe */
.vid-carousel-frame {
  width: 100%;
  border: none;
  overflow: hidden;
  min-height: 200px;
}

/* ==========================================================================
   User Study Chart
   ========================================================================== */

.user-study-chart {
  padding: 1.5rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.user-study-chart:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.chart-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.chart-label {
  flex: 0 0 160px;
  text-align: right;
  padding-right: 16px;
  font-weight: 600;
  font-size: 1rem;
  color: #1a1a2e;
}

.chart-bar-container {
  flex: 1;
  display: flex;
  position: relative;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  transition: width 1s ease, filter 0.25s ease, flex-grow 0.3s ease;
}

.chart-bar-container:hover .chart-bar {
  filter: brightness(1.08);
}

.chart-bar-container:hover .chart-bar-ours {
  filter: brightness(1.12) saturate(1.2);
}

.chart-bar-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chart-bar-ours {
  background: #4caf50;
}

.chart-bar-ditto {
  background: #c2185b;
}

.chart-midline {
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 2px;
  border-left: 2px dashed #1a1a2e;
  pointer-events: none;
}

.chart-footer {
  display: flex;
  align-items: flex-start;
  margin-top: 8px;
  padding-left: 176px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #333;
}

.chart-legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-block;
}

.chart-legend-ours {
  background: #4caf50;
}

.chart-legend-ditto {
  background: #c2185b;
}

.chart-footer-bar-area {
  flex: 1;
  position: relative;
}

.chart-axis-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.3;
}

@media screen and (max-width: 600px) {
  .chart-label {
    flex: 0 0 100px;
    font-size: 0.85rem;
    padding-right: 10px;
  }

  .chart-footer {
    padding-left: 110px;
  }

  .chart-bar-container {
    height: 38px;
  }

  .chart-bar-text {
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Scroll Animations
   ========================================================================== */

[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 968px) {
  .teaser-top-row {
    flex-direction: column;
  }

  .teaser-method {
    flex: none;
  }

  .teaser-image-pairs {
    max-width: 100%;
    padding-left: 0;
  }

  .teaser-image-pairs::before {
    display: none;
  }

  .teaser-method img {
    max-height: 400px;
    margin: 0 auto;
    display: block;
  }

  .teaser-video-strip {
    flex-direction: column;
  }

  .teaser-video-prompts {
    flex-direction: column;
    gap: 6px;
  }

  .section {
    padding: 3rem 1rem;
  }
}

@media screen and (max-width: 600px) {
  .teaser-video-pair {
    gap: 4px;
  }

  .teaser-arrow {
    font-size: 0.9rem;
  }

  .comparison-handle-grip {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
}
