/* Modern CSS Variables for consistent theming — HKUST(GZ) Brand Palette */
:root {
  /* Navy → Gold brand system */
  --primary-color: #0d4a7a;
  --primary-hover: #003366;
  --secondary-color: #5a6e82;
  --accent-color: #b8860b;
  --accent-deep: #996600;
  --text-primary: #1a2636;
  --text-secondary: #536478;
  --text-light: #8494a7;
  --background-primary: #ffffff;
  --background-secondary: #f6f8fa;
  --background-accent: #edf1f7;
  --border-color: #d4dbe6;

  /* Z-index scale */
  --z-toc: 100;
  --z-scroll-top: 200;
  --z-header: 300;
  --z-progress: 400;
  --z-skip-link: 900;
  --z-overlay: 1000;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --gradient-primary: linear-gradient(135deg, #003366 0%, #0d4a7a 100%);
  --gradient-accent: linear-gradient(135deg, #996600 0%, #c89a2a 100%);
  --gradient-subtle: linear-gradient(135deg, #fff8e7 0%, #fef0d0 100%);
  --gradient-brand: linear-gradient(90deg, #003366, #0d4a7a, #b8860b);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --carousel-image-max-height: 420px;

  /* Colored text for figures */
  --color-query-blue: #0d4a7a;
  --color-query-purple: #6B3FA0;
  --color-consistent-green: #1B7A1B;
  --color-target-brown: #8B4513;
}

/* Smooth scrolling for better UX */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  background-color: var(--background-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container.is-wide-title,
.container.is-wide-abstract {
  max-width: 1200px;
}

/* Modern Button Styles */
.button {
  border-radius: var(--border-radius) !important;
  font-weight: 600 !important;
  transition: var(--transition) !important;
  border: 2px solid transparent !important;
  position: relative;
  overflow: hidden;
}

.button.is-dark {
  background: var(--text-primary) !important;
  border: none !important;
  color: white !important;
  box-shadow: var(--shadow-md);
}

.button.is-dark:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-color) !important;
}

.button.is-dark:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

.footer .icon-link {
    font-size: 25px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.footer .icon-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.link-block a {
    margin: 8px 4px;
}

.dnerf {
  font-variant: small-caps;
}

/* Hero Section Modernization */
.hero {
  position: relative;
  overflow: hidden;
}

.hero.is-light {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.hero-body {
  padding: 6rem 1.5rem 2rem;
}

.teaser .hero-body {
  padding-top: 0.5rem;
  padding-bottom: 4rem;
}

.teaser {
  font-family: 'Inter', sans-serif;
}

.tldr-card {
  position: relative;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #e8d9b0;
  border-left: 4px solid var(--accent-color);
  border-radius: 10px;
  background: #fdf8ee;
  box-shadow: none;
  text-align: left;
  overflow: hidden;
}

.tldr-card::before {
  content: none;
}

.tldr-text {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 400;
}

.tldr-inline-label {
  margin-right: 0.35rem;
  font-weight: 700;
  color: var(--accent-deep);
}


/* Publication Content Styling */
.publication-title {
    font-family: 'Inter', sans-serif !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    margin-bottom: 2rem !important;
    line-height: 1.1 !important;
}

.publication-banner {
  max-height: 70vh;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  margin: 2rem 0;
}

.publication-banner video {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  object-fit: cover;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-lg);
}

.publication-header .hero-body {
  padding: 6rem 1.5rem 4rem;
}

.publication-authors {
    font-family: 'Inter', sans-serif !important;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.publication-venue {
    color: var(--text-secondary);
    width: fit-content;
    font-weight: 600;
    background: var(--background-accent);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    display: inline-block;
}

.publication-awards {
    color: #8b1a1a;
    width: fit-content;
    font-weight: 700;
    background: linear-gradient(135deg, #fef2f2, #fce8e8);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid #c43030;
    margin-top: 1rem;
}

.publication-authors a {
   color: var(--primary-color) !important;
   text-decoration: none;
   font-weight: 600;
   transition: var(--transition);
   position: relative;
}

.publication-authors a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: var(--gradient-accent);
    transition: var(--transition);
}

.publication-authors a:hover::after {
    width: 100%;
}

.publication-authors a:hover {
    color: var(--primary-hover) !important;
}

.author-block {
  display: inline-block;
  margin-right: 0.5rem;
}

.publication-banner img {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.publication-banner img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* Modern Video and Carousel Styling */
.publication-video {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    overflow: hidden;
    border-radius: var(--border-radius-lg) !important;
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
}

.publication-video:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.publication-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-lg);
}

.publication-body img {
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.publication-body img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.results-carousel {
  overflow: hidden;
  padding: 1rem 0;
}

.results-carousel .item {
  margin: 1rem;
  overflow: hidden;
  padding: 1.5rem;
  font-size: 0;
  background: var(--background-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.results-carousel .item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.results-carousel .item img,
.results-carousel video {
  margin: 0;
  border-radius: var(--border-radius);
  width: 100%;
  height: auto;
}

.results-carousel .item img {
  max-height: var(--carousel-image-max-height);
  object-fit: contain;
}

.results-carousel .subtitle {
  font-size: 1rem !important;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-weight: 500;
}

/* Pagination and Misc Improvements */
.slider-pagination .slider-page {
  background: var(--primary-color);
  border-radius: 50%;
  transition: var(--transition);
}

.slider-pagination .slider-page.is-active {
  background: var(--primary-hover);
  transform: scale(1.2);
}

.eql-cntrb { 
  font-size: 0.875rem;
  color: var(--text-light);
  font-style: italic;
}

/* Section Titles */
.title.is-3 {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700 !important;
  color: var(--text-primary);
  margin-bottom: 2rem !important;
  position: relative;
  padding-bottom: 1rem;
}

.title.is-3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

/* Content Improvements */
.content.has-text-justified {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.content.has-text-justified p {
  margin-bottom: 1.5rem;
}

/* Footer Improvements */
.footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem;
}

.footer .content {
  color: var(--text-secondary);
  line-height: 1.7;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* BibTeX Styling */
pre {
  background: var(--background-accent) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  padding: 1.5rem !important;
  font-size: 0.9rem !important;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

code {
  background: var(--background-accent) !important;
  color: var(--text-primary) !important;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace !important;
}

/* BibTeX Section Improvements */
.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.copy-bibtex-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-bibtex-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.copy-bibtex-btn.copied {
  background: #2d8659;
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: var(--z-scroll-top);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
}

.scroll-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}


/* ===== Site Header Bar ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  background: #f4f2ee;
  border-bottom: 1px solid #ddd9d2;
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease;
}

.site-header.header-shadow {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 2rem;
  position: relative;
}

/* Header Badge */
.header-badge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #003366, #0d4a7a);
  color: #f0e6cc;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.3rem 1rem;
  border-radius: 100px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-decoration: none;
  transition: filter 0.25s ease, transform 0.25s ease;
}

.header-badge:hover {
  color: #fff;
  filter: brightness(1.15);
  transform: translateX(-50%) translateY(-1px);
}

.header-badge i {
  font-size: 0.7rem;
}

.header-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo-item {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.header-logo-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-logo-item.logo-hkustgz {
  background: transparent;
}

.header-logo-item img {
  height: 34px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: center;
}

/* More Works Dropdown */
.more-works-container {
  position: relative;
}

.more-works-btn {
  background: var(--background-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
}

.more-works-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--background-secondary);
  border-color: var(--primary-color);
}

.more-works-btn .dropdown-arrow {
  transition: var(--transition);
  font-size: 0.8rem;
}

.more-works-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.more-works-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 400px;
  max-width: 90vw;
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  max-height: 70vh;
  overflow-y: auto;
}

.more-works-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.dropdown-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.close-btn:hover {
  background: var(--background-accent);
  color: var(--text-primary);
}

.works-list {
  padding: 1rem;
}

.work-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem;
  border-radius: var(--border-radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  margin-bottom: 0.5rem;
}

.work-item:hover {
  background: var(--background-accent);
  transform: translateX(4px);
}

.work-info h5 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.work-info p {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.work-venue {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

.work-item .fas {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
}


/* Mobile Responsive Improvements */
@media screen and (max-width: 768px) {
  .hero-body {
    padding: 2rem 1rem;
  }
  
  .publication-header .hero-body {
    padding: 3rem 1rem 2rem;
  }
  
  .publication-title {
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
    margin-bottom: 1.5rem !important;
  }
  
  .publication-authors {
    font-size: 1rem !important;
  }
  
  .button {
    margin: 0.25rem !important;
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }

  .site-header-inner {
    padding: 0.4rem 1rem;
  }

  .header-logo-item img {
    height: 26px;
  }

  .header-badge {
    display: none;
  }
  
  .more-works-container {
    position: relative;
  }
  
  .more-works-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
  
  .more-works-dropdown {
    width: calc(100vw - 2rem);
    right: 0;
    top: calc(100% + 0.5rem);
  }
  
  .results-carousel .item {
    margin: 0.5rem;
    padding: 1rem;
  }
  
  .teaser .hero-body {
    padding: 1rem;
  }

  .tldr-card {
    padding: 1rem 1rem 1rem 1.2rem;
    margin-bottom: 1.2rem;
  }

  .tldr-text {
    font-size: 0.98rem;
    line-height: 1.65;
  }
  
  .content.has-text-justified {
    font-size: 1rem;
  }
}

@media screen and (max-width: 480px) {
  .publication-title {
    font-size: 2rem !important;
  }
  
  .hero-body {
    padding: 1.5rem 0.75rem;
  }
  
  .more-works-container {
    position: relative;
  }
  
  .more-works-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .more-works-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: calc(100vw - 2rem);
    max-width: 90vw;
  }
  
  .link-block {
    display: block;
    margin-bottom: 0.5rem;
  }
  
  .button {
    width: 100%;
    justify-content: center;
  }

}

/* Tablet Responsive */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .hero-body {
    padding: 3rem 2rem;
  }
  
  .publication-header .hero-body {
    padding: 4rem 2rem 3rem;
  }
}

/* Animation for page load */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero, .section {
  animation: fadeInUp 0.6s ease-out;
}

/* Improved focus states for accessibility */
.button:focus-visible,
.related-works-btn:focus-visible,
.more-works-btn:focus-visible,
.copy-bibtex-btn:focus-visible,
.scroll-to-top:focus-visible,
.lightbox-close:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--primary-color);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--border-radius);
  z-index: var(--z-skip-link);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0.5rem;
}


/* Print styles */
@media print {
  .site-header {
    display: none;
  }
  
  .hero, .section {
    animation: none;
  }
  
  .button {
    background: transparent !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
  }
}

/* ===== Experiment Table Styles ===== */
.experiment-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  background: var(--background-primary);
}

.experiment-table-wrapper .table-caption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem 1.5rem 0.5rem;
  line-height: 1.5;
}

/* Use .content prefix to override Bulma's .content table styles */
.content .experiment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.content .experiment-table th,
.content .experiment-table td {
  border: none;
  vertical-align: middle;
  text-align: center;
}

.content .experiment-table thead th {
  background: var(--background-accent);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem 0.7rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Top header row: method group spanning columns */
.content .experiment-table thead tr:first-child th[colspan] {
  border-bottom: 1px solid var(--border-color);
}

/* Rowspan cells (WSI Site, Query) — no bottom border on first row */
.content .experiment-table thead tr:first-child th[rowspan] {
  border-bottom: 2px solid var(--border-color);
}

.content .experiment-table thead th.col-group-border {
  border-left: 2px solid var(--border-color);
}

/* Query 列（第2列）左右栏间线 — 仅第一行表头和 tbody */
.content .experiment-table thead tr:first-child th:nth-child(2) {
  border-left: 2px solid var(--border-color);
  border-right: 2px solid var(--border-color);
}
.content .experiment-table tbody td:nth-child(2) {
  border-left: 2px solid var(--border-color);
  border-right: 2px solid var(--border-color);
}

.content .experiment-table tbody td {
  padding: 0.45rem 0.7rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid #edf1f7;
  color: var(--text-primary);
}

.content .experiment-table tbody td.col-group-border {
  border-left: 2px solid var(--border-color);
}

.content .experiment-table tbody tr:last-child td {
  border-bottom: none;
}

.content .experiment-table tbody tr:hover {
  background-color: #f3f6fa;
}

/* Zebra striping for subtype rows */
.content .experiment-table tbody tr:not(.site-group-row):nth-child(even) {
  background-color: #f8f9fb;
}

.content .experiment-table tbody tr.site-group-row td {
  font-weight: 700;
  background-color: #f0f3f9;
}

.content .experiment-table tbody tr.section-divider td {
  border-top: 2px solid var(--border-color);
}

.content .experiment-table .cell-row-best {
  font-weight: 700;
  color: #8b1a1a;
}

.content .experiment-table .cell-ours {
  background-color: #ddf0e6;
}

.content .experiment-table .site-name {
  text-align: left;
  font-weight: 600;
  padding-left: 1rem;
}

.content .experiment-table .subtype-name {
  text-align: left;
  padding-left: 1.8rem;
  color: var(--text-secondary);
}

/* Panel divider for dual-column tables */
.content .experiment-table.dual-column {
  font-size: 0.72rem;
}

.content .experiment-table.dual-column th,
.content .experiment-table.dual-column td {
  padding: 0.4rem 0.5rem;
}

.content .experiment-table thead th.panel-divider,
.content .experiment-table tbody td.panel-divider {
  border-left: 3px solid var(--primary-color);
}

@media (max-width: 768px) {
  .content .experiment-table {
    font-size: 0.65rem;
  }
  .content .experiment-table thead th,
  .content .experiment-table tbody td {
    padding: 0.3rem 0.35rem;
  }
  .experiment-table-wrapper {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* ===== Experiment Tabs Container (Excel-style) ===== */
.experiment-tabs-container {
  margin: 1.5rem 0;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  background: var(--background-primary);
  overflow: hidden;
}

.experiment-tabs-header {
  padding: 0;
}

.experiment-tabs-header .table-caption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem 1.5rem 0.5rem;
  line-height: 1.5;
  margin: 0;
  transition: opacity 0.25s ease-out;
}

/* Tab panels */
.experiment-tab-panel {
  display: none;
}

.experiment-tab-panel.active {
  display: block;
  animation: tabFadeIn 0.35s ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Reset inner wrapper shadow/radius since container handles it */
.experiment-tabs-container .experiment-table-wrapper {
  box-shadow: none;
  border-radius: 0;
  margin: 0;
}

/* Bottom Tab Bar */
.experiment-tabs-bar {
  display: flex;
  align-items: stretch;
  background: var(--background-accent);
  border-top: 2px solid var(--border-color);
  padding: 0;
  gap: 0;
}

.experiment-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  white-space: nowrap;
  font-family: inherit;
}

.experiment-tab i {
  font-size: 0.78rem;
}

.experiment-tab:hover {
  color: var(--primary-color);
  background: rgba(13, 74, 122, 0.06);
}

.experiment-tab.active {
  color: var(--primary-color);
  background: var(--background-primary);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 0 var(--primary-color);
  border-bottom: none;
}

.experiment-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 3px 3px 0 0;
}

.experiment-tab:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

@media (max-width: 768px) {
  .experiment-tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .experiment-tab {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .experiment-tab-panel.active {
    animation: none;
  }
}

/* ===== Highlight Stat Cards ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem 0.75rem;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  transform: translateY(-4px);
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-weight: 500;
}

@media (max-width: 960px) {
  .stat-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 600px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-value {
    font-size: 1.3rem;
  }
}

/* ===== Figure Width Constraint ===== */
.text-with-figure {
  overflow: hidden; /* clearfix */
}

.figure-inline {
  float: right;
  width: 33.333%;
  margin: 0 0 1rem 1.5rem;
}

.figure-inline img {
  width: 100%;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.figure-inline figcaption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.5rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .figure-inline {
    float: none;
    width: 100%;
    margin: 1rem 0;
  }
}

/* ===== Unified figure/table caption ===== */
.content figcaption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* ===== Colored Text for Figure 3 ===== */
.color-query-blue {
  color: var(--color-query-blue);
  font-weight: 600;
}
.color-query-purple {
  color: var(--color-query-purple);
  font-weight: 600;
}
.color-consistent-green {
  color: var(--color-consistent-green);
  font-weight: 600;
}
.color-target-brown {
  color: var(--color-target-brown);
  font-weight: 600;
}

/* ===== Theoretical Foundation Section ===== */
.theory-highlight {
  background: linear-gradient(135deg, #ecf2f9 0%, #f0f5fb 100%);
  border-left: 4px solid var(--primary-color);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
}

.theory-highlight p {
  margin-bottom: 0;
}

.math-block {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
}

/* ===== Table Expand/Collapse ===== */
.content .experiment-table tbody tr {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.content .experiment-table .subtype-row-wrap td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom-width: 1px;
  transition: padding 0.3s ease, opacity 0.3s ease, line-height 0.3s ease, font-size 0.3s ease, border-bottom-width 0.3s ease;
  overflow: hidden;
}

.content .experiment-table .subtype-hidden td {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 0;
  font-size: 0;
  border-bottom-width: 0;
  opacity: 0;
}

.content .experiment-table .subtype-hidden {
  pointer-events: none;
}

.content .experiment-table .site-group-row {
  user-select: none;
}

.content .experiment-table .site-group-row:hover {
  background-color: #edf2f8;
}

.expand-chevron {
  display: inline-block;
  font-size: 0.6em;
  margin-right: 0.4em;
  transition: transform 0.25s ease;
  vertical-align: middle;
}

.site-expanded .expand-chevron {
  transform: rotate(90deg);
}


/* ========================================
   BEAUTIFICATION ENHANCEMENTS
   ======================================== */

/* --- Reading Progress Bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-brand);
  z-index: var(--z-progress);
  transition: width 0.1s linear, top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* --- Scroll-triggered Animations --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.stagger-children.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.08s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.16s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.24s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.32s; opacity: 1; transform: translateY(0); }

/* Override the page-load animation — now controlled by IntersectionObserver */
.hero, .section {
  animation: none;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .stagger-children > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .reading-progress {
    transition: none;
  }
}

/* --- Hero Gradient Mesh Background --- */
.hero-gradient-bg {
  position: relative;
  overflow: hidden;
}
.hero-gradient-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 51, 102, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-gradient-bg::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(153, 102, 0, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* --- Floating TOC --- */
.floating-toc {
  position: fixed;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-toc);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.floating-toc.visible {
  opacity: 1;
  visibility: visible;
}
.floating-toc a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.78rem;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.3rem 0;
}
.floating-toc a .toc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
  transition: var(--transition);
}
.floating-toc a .toc-label {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  background: var(--background-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}
.floating-toc:hover a .toc-label {
  opacity: 1;
  transform: translateX(0);
}
.floating-toc a.active .toc-dot {
  background: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(13, 74, 122, 0.2);
  width: 10px;
  height: 10px;
}
.floating-toc a.active {
  color: var(--primary-color);
  font-weight: 600;
}

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

/* --- Image Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
  padding: 2rem;
}
.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  background: #fff;
  padding: 0.8rem;
}
.lightbox-overlay.active img {
  transform: scale(1);
}
.lightbox-caption {
  color: rgba(0, 0, 0, 0.7);
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
  max-width: 700px;
  line-height: 1.5;
}
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  color: #333;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Clickable figure hint */
.content figure.image {
  cursor: zoom-in;
  position: relative;
}
.content figure.image::after {
  content: '\f00e'; /* fa-search-plus */
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.content figure.image:hover::after {
  opacity: 1;
}

/* --- Stat Card Gradient Border Enhancement --- */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stat-card:hover::before {
  opacity: 1;
}

/* Number counting animation */
.stat-value {
  transition: color 0.3s ease;
}
.stat-card:hover .stat-value {
  background: linear-gradient(135deg, #003366, #0d4a7a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Section Divider Wave --- */
.section-wave {
  width: 100%;
  height: 40px;
  overflow: hidden;
  line-height: 0;
}
.section-wave svg {
  display: block;
  width: 100%;
  height: 100%;
}
.section-wave.wave-white svg path {
  fill: #ffffff;
}
.section-wave.wave-light svg path {
  fill: var(--background-secondary);
}

/* --- Teaser GIF Polish --- */
.teaser-gif {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  transition: var(--transition);
  background: #fff;
  padding: 0.6rem;
}
.teaser-gif:hover {
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

/* --- Section Title Left Accent Variant --- */
.content .title {
  position: relative;
  padding-left: 1rem;
  border-left: 4px solid var(--primary-color);
}

/* --- Reading Time Badge --- */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.5rem;
}
.reading-time i {
  font-size: 0.8rem;
}

/* --- Global Interactive Cursor --- */
button,
[role="button"],
.more-works-btn,
.close-btn,
.copy-bibtex-btn,
.scroll-to-top,
.lightbox-close,
.toc-link,
summary {
  cursor: pointer;
}

/* --- Enhanced Footer --- */
.footer {
  background: linear-gradient(180deg, var(--background-secondary) 0%, #e8ecf2 100%);
  padding: 3rem 1.5rem 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}
.footer-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--primary-color);
}
.footer-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0 0 1rem;
}

/* Visitor Statistics */
.visitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.visitor-header .footer-heading {
  margin-bottom: 0;
}
.visitor-map-frame {
  display: block;
  width: 100%;
  aspect-ratio: 1.5 / 1;
  border: none;
  border-radius: 4px;
  background: transparent;
}
.footer-bottom {
  text-align: center;
}
.footer-bottom p {
  font-size: 0.78rem;
  color: var(--text-light);
}
.footer-bottom a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s;
}
.footer-bottom a:hover {
  text-decoration-color: var(--primary-color);
}

.challenge-task-figure {
  margin: 0 0 1.25rem;
}

.challenge-task-grid {
  display: flex;
  gap: 0.5rem;
}

.challenge-task-grid img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
}

/* widths proportional to aspect ratios so both images render at equal height */
.challenge-task-grid img:first-child {
  flex: 1.111;  /* challenge.png: 1283/1155 */
}

.challenge-task-grid img:last-child {
  flex: 1.569;  /* task.png: 1514/965 */
}

@media (max-width: 768px) {
  .challenge-task-grid {
    flex-direction: column;
    gap: 1rem;
  }

  .challenge-task-grid img:first-child,
  .challenge-task-grid img:last-child {
    flex: none;
  }
}

.human-study-section {
  margin-top: 1.5rem;
}

.human-study-title {
  margin: 0 0 1rem;
  color: inherit;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
  font-family: inherit;
}

.human-study-grid {
  display: grid;
  grid-template-columns: repeat(2, 50%);
  gap: 0;
  align-items: start;
}

.human-study-figure {
  margin: 0 0 1.25rem;
}

.human-study-grid img {
  display: block;
  width: 100%;
  height: auto;
  padding: 0 0.75rem;
}

.human-study-summary {
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .human-study-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .human-study-grid img {
    padding: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .visitor-map-frame {
    max-width: 400px;
  }
}
