/* ============================
   CSS Custom Properties
   ============================ */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #64748b;
  --color-accent: #0d9488;
  --color-accent-hover: #0f766e;
  --color-accent-light: #ccfbf1;
  --color-border: rgba(0, 0, 0, 0.06);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* ============================
   Base
   ============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================
   Layout Containers
   ============================ */
.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.section {
  padding: 5rem 0;
}

/* ============================
   Hero Section
   ============================ */
.hero-section {
  position: relative;
  padding: 7rem 2rem 5rem;
  text-align: center;
  overflow: hidden;
  color: #ffffff;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0a2e2e 0%, #1a5c4c 50%, #0d3b3b 100%);
  z-index: 0;
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(13, 148, 136, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(20, 184, 166, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #ffffff;
}

.hero-tagline {
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  max-width: 640px;
  margin: 0 auto 2rem;
}

.hero-authors {
  font-size: 1.05rem;
  line-height: 2;
  margin-bottom: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
}

.hero-authors a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.hero-authors a:hover {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

.hero-affiliations {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2.5rem;
}

.hero-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================
   Buttons
   ============================ */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-decoration: none;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-body);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.link-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  color: #ffffff;
}

.link-btn i {
  font-size: 1rem;
}

/* ============================
   Section Titles
   ============================ */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 400;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.section-subtitle {
  text-align: center;
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto 3rem;
  line-height: 1.6;
}

.section-subtitle-left {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 1.25rem;
  margin-top: 1rem;
}

.video-description {
  text-align: left;
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: 2rem;
}

/* ============================
   Abstract
   ============================ */
.abstract-section {
  background: var(--color-surface);
}

.abstract-text {
  font-size: 1.02rem;
  line-height: 1.8;
  color: #374151;
}

.abstract-text p {
  margin-bottom: 1.2rem;
}

.abstract-text p:last-child {
  margin-bottom: 0;
}

.abstract-text strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ============================
   Figures — Stacked Rows
   ============================ */
.figure-section {
  padding-top: 0;
  padding-bottom: 2rem;
  background: var(--color-surface);
}

/* Trend figures — side-by-side */
.trend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.trend-item {
  display: flex;
  flex-direction: column;
}

.trend-item img {
  width: 100%;
  display: block;
}

.trend-label {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}

.trend-item:first-child {
  border-right: 1px solid var(--color-border);
}

.figure-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  transition: box-shadow 0.3s ease;
}

.figure-card:hover {
  box-shadow: var(--shadow-lg);
}

.figure-card img {
  width: 100%;
  display: block;
}

.figure-caption {
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

.figure-caption-top {
  border-top: none;
  border-bottom: 1px solid var(--color-border);
}

.figure-caption strong {
  color: var(--color-text);
}

/* Clickable figures */
.clickable-figure {
  cursor: pointer;
  position: relative;
}

.clickable-figure:hover {
  box-shadow: var(--shadow-lg);
}

.click-hint {
  display: inline-block;
  margin-left: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-accent);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.clickable-figure:hover .click-hint {
  opacity: 1;
}

.click-hint i {
  margin-right: 0.2rem;
}

/* ============================
   Lightbox
   ============================ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 2rem;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox-img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 2.5rem;
  color: #ffffff;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lightbox-close:hover {
  opacity: 1;
}

/* ============================
   Tables
   ============================ */
.tables-section {
  background: var(--color-bg);
}

.table-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.table-card:last-child {
  margin-bottom: 0;
}

.table-header {
  padding: 1.25rem 1.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}

.table-header strong {
  color: var(--color-text);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.results-table thead th {
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text);
  background: #f8fafc;
  border-bottom: 2px solid var(--color-border);
}

.results-table thead tr:last-child th {
  border-bottom: 2px solid rgba(0, 0, 0, 0.12);
}

.results-table thead th:first-child {
  text-align: left;
  padding-left: 1.5rem;
}

.results-table tbody td {
  padding: 0.6rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  color: #374151;
}

.results-table tbody td:first-child {
  text-align: left;
  padding-left: 1.5rem;
  font-weight: 500;
  color: var(--color-text);
}

.std {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-left: 0.1rem;
}

.group-label td {
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}

.separator-row td {
  border-top: 2px solid rgba(0, 0, 0, 0.1);
}

.highlight-row {
  background: var(--color-accent-light);
}

.highlight-row td {
  color: var(--color-text);
  font-weight: 500;
  border-bottom: none;
}

.highlight-row td:first-child {
  font-weight: 700;
}

/* ============================
   Video Demos — Three-Column Grid
   ============================ */
.demos-section {
  background: var(--color-surface);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.video-grid-sim {
  grid-template-columns: repeat(3, 1fr);
}

.video-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.video-card video {
  width: 100%;
  display: block;
}

.video-label {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* ============================
   Footer
   ============================ */
.site-footer {
  padding: 3rem 0;
  text-align: center;
  background: #f1f5f9;
  border-top: 1px solid var(--color-border);
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ============================
   Scroll Reveal Animation
   ============================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children in the hero */
.hero-content .reveal:nth-child(1) { transition-delay: 0.05s; }
.hero-content .reveal:nth-child(2) { transition-delay: 0.12s; }
.hero-content .reveal:nth-child(3) { transition-delay: 0.2s; }
.hero-content .reveal:nth-child(4) { transition-delay: 0.28s; }
.hero-content .reveal:nth-child(5) { transition-delay: 0.36s; }

/* ============================
   Responsive
   ============================ */
@media screen and (max-width: 768px) {
  .hero-section {
    padding: 4rem 1.25rem 3rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-affiliations {
    flex-direction: column;
    gap: 0.25rem;
  }

  .section {
    padding: 3rem 0;
  }

  .trend-grid {
    grid-template-columns: 1fr;
  }

  .trend-item:first-child {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .video-grid {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto 2.5rem;
  }

  .video-grid-sim {
    grid-template-columns: 1fr;
  }

  .hero-links {
    flex-direction: column;
    align-items: center;
  }

  .results-table {
    font-size: 0.78rem;
  }

  .results-table thead th,
  .results-table tbody td {
    padding: 0.5rem 0.6rem;
  }
}

@media screen and (max-width: 480px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .hero-authors {
    font-size: 0.95rem;
  }

  .container-narrow,
  .container-wide {
    padding: 0 1rem;
  }
}
