/* ---------- Dataset analysis figure grid ---------- */
.dataset-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
  margin-top: 12px;
  width: 100%;
  align-items: start;
}

.dataset-stats-grid .figure-cell {
  min-width: 0;
  text-align: center;
}

.dataset-stats-grid .figure-caption {
  font-size: 0.85em;
  margin-top: 4px;
}

/* ---------- Benchmark table ---------- */
.benchmark-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  width: 150%;
  margin-left: -25%;
}

#benchmark-table {
  font-size: 0.78em;
}

#benchmark-table tbody td {
  border-bottom: none;
  border-top: none;
}

/* ---------- Carousel captions ---------- */
.c-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.3) 70%,
    transparent 100%
  );
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 28px 18px 14px;
  font-style: italic;
}

/* ---------- Smooth scroll + section offset ---------- */
html {
  scroll-behavior: smooth;
}
:target {
  scroll-margin-top: 80px;
}

/* ---------- Floating Table of Contents ---------- */
.toc-sidebar {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 210px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.95);
  border-left: 3px solid #363636;
  padding: 14px 16px;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  font-size: 0.85em;
  z-index: 100;
  backdrop-filter: blur(4px);
  transition: width 0.25s ease, padding 0.25s ease;
}

.toc-sidebar .toc-title {
  font-weight: 700;
  color: #363636;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78em;
  padding-right: 22px;
}

.toc-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-sidebar li {
  margin: 5px 0;
}

.toc-sidebar a {
  color: #555;
  text-decoration: none;
  transition: color 0.2s, border-left-color 0.2s;
  display: block;
  padding: 2px 0 2px 8px;
  border-left: 2px solid transparent;
  line-height: 1.35;
}

.toc-sidebar a:hover {
  color: #363636;
  border-left-color: #363636;
}

.toc-sidebar a.toc-sub {
  padding-left: 18px;
  font-size: 0.95em;
  color: #777;
}

/* ---------- TOC toggle button ---------- */
.toc-toggle {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #555;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.toc-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #363636;
}

.toc-toggle-icon {
  display: inline-block;
  transition: transform 0.25s ease;
}

/* ---------- TOC collapsed state (compact dark pill) ---------- */
.toc-sidebar.is-collapsed {
  width: auto;
  max-height: none;
  padding: 0;
  overflow: visible;
  background: #363636;
  border-left: none;
  border-radius: 9999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
}

.toc-sidebar.is-collapsed .toc-title,
.toc-sidebar.is-collapsed ul {
  display: none;
}

.toc-sidebar.is-collapsed .toc-toggle {
  position: static;
  width: 34px;
  height: 34px;
  color: #fff;
}

.toc-sidebar.is-collapsed .toc-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.toc-sidebar.is-collapsed .toc-toggle-icon {
  transform: rotate(180deg);
}

/* ---------- Hide TOC on narrow viewports ---------- */
@media (max-width: 1279px) {
  .toc-sidebar {
    display: none;
  }
}

/* ---------- Post-video CTA ---------- */
.post-video-cta {
  margin: 12px auto 10px;
  max-width: 840px;
}

.post-video-cta-desktop {
  display: block;
}

.post-video-cta-desktop img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
}

.post-video-cta-mobile {
  display: none;
  text-decoration: none;
  background: #f6f6f7;
  border: 1px solid #e3e3e3;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
}

.post-video-cta-mobile-title {
  display: block;
  color: #2d2d2d;
  font-size: 0.94rem;
  line-height: 1.35;
  margin-bottom: 8px;
}

.post-video-cta-mobile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e24f21;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.2;
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
  width: 100%;
}

@media (max-width: 768px) {
  .post-video-cta {
    max-width: 100%;
    margin-top: 10px;
  }

  .post-video-cta-desktop {
    display: none;
  }

  .post-video-cta-mobile {
    display: block;
  }
}

/* ---------- Mobile layout (≤768px) ---------- */
@media (max-width: 768px) {
  html {
    font-size: 18px;
  }

  /* Abstract: side margins + readable body copy */
  #abstract .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  #abstract .content {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  #abstract .title.is-3 {
    font-size: 1.5rem;
  }

  /* Hero link pills (Paper, Dataset, etc.) */
  .publication-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.5rem;
  }

  .publication-links .link-block {
    display: inline-block;
    margin: 0;
  }

  /* Dataset analysis: stack figures vertically */
  .dataset-stats-grid,
  .dataset-content-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100% !important;
    margin-left: 0 !important;
  }

  /* Body text across main sections */
  .section .content.has-text-justified,
  .hero.teaser .content {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .section .title.is-2 {
    font-size: 1.65rem;
  }

  .section .title.is-3 {
    font-size: 1.4rem;
  }

  /* Teaser video: full width */
  .teaser-video-wrap {
    width: 100%;
    padding: 0 0.75rem;
  }

  #teaser {
    width: 100% !important;
    max-width: 100%;
    height: auto;
  }

  /* Benchmark table: contained, horizontally scrollable */
  .benchmark-table-wrap {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .benchmark-table-wrap::after {
    content: "Swipe for more →";
    display: block;
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin-top: 6px;
  }

  #benchmark-table {
    font-size: 0.7rem;
    min-width: 720px;
  }

  #benchmark-table th,
  #benchmark-table td {
    padding: 4px 5px !important;
    white-space: nowrap;
  }

  #benchmark-table td:first-child,
  #benchmark-table th:first-child {
    white-space: normal;
    min-width: 72px;
  }
}
