/* ===== CSS Variables & Reset ===== */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f8f9fa;
  --color-bg-code: #f0f1f3;
  --color-text: #1a1a2e;
  --color-text-secondary: #4a4a6a;
  --color-accent: #4361ee;
  --color-accent-hover: #3a56d4;
  --color-border: #e0e0e0;
  --color-table-header: #4361ee;
  --color-table-header-text: #ffffff;
  --color-table-stripe: #f4f6ff;
  --color-best: #d63384;
  --color-second: #4361ee;
  --color-shadow: rgba(0, 0, 0, 0.06);
  --font-body: 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --max-width: 980px;
  --max-width-wide: 1200px;
  --max-width-full: 1400px;
  --section-spacing: 4.5rem;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ===== Containers ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.container-wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 2rem;
}

.container-full {
  max-width: var(--max-width-full);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition);
}

.navbar.scrolled {
  box-shadow: 0 2px 20px var(--color-shadow);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.navbar-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
}

.navbar-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.navbar-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition);
  border-radius: 1px;
}

.navbar-links a:hover {
  color: var(--color-accent);
}

.navbar-links a:hover::after {
  width: 100%;
}

/* ===== Hero Section ===== */
.hero {
  padding-top: 120px;
  padding-bottom: 2rem;
  text-align: center;
  background: linear-gradient(180deg, #f0f4ff 0%, var(--color-bg) 100%);
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-accent);
  background: rgba(67, 97, 238, 0.1);
  border: 1px solid rgba(67, 97, 238, 0.2);
  border-radius: 50px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--color-text);
  max-width: 860px;
  margin: 0 auto 0.6rem;
}

/* Authors */
.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1.5rem;
  margin-bottom: 0.6rem;
}

.author {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--color-text);
}

.author sup {
  font-size: 0.65em;
  color: var(--color-accent);
  margin-left: 1px;
}

.author .corresponding {
  color: var(--color-best);
  font-weight: 700;
}

.author .project-lead {
  color: #e6a817;
  font-weight: 700;
}

.affiliations {
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.7;
}

.affiliations sup {
  color: var(--color-accent);
  font-weight: 600;
  margin-right: 2px;
}

.internship-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 2rem;
}

/* Buttons */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 50px;
  transition: all var(--transition);
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--color-shadow);
}

.btn i,
.btn .btn-icon {
  font-size: 1.1em;
}

/* ===== Sections ===== */
.section {
  padding: var(--section-spacing) 0;
}

.section:nth-child(even) {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.section-divider {
  width: 50px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
  margin: 0 auto 2.5rem;
}

/* ===== Abstract ===== */
.abstract-text {
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--color-text-secondary);
  max-width: 780px;
  margin: 0 auto;
  text-align: justify;
}

/* ===== Figure Block (Teaser & Method) ===== */
.figure-block {
  text-align: center;
  margin: 2rem 0;
}

.figure-block img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.figure-desc {
  margin-top: 1.5rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.figure-desc h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.figure-desc p {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

/* ===== Teaser specific ===== */
.teaser-section {
  padding-top: 1rem;
}

/* ===== Table Card ===== */
.table-card {
  margin-bottom: 3rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 16px var(--color-shadow);
  background: var(--color-bg);
  overflow: hidden;
}

.table-card-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.table-card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.table-card-header p {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

/* ===== Table Full-Width (NO scroll) ===== */
.table-full {
  width: 100%;
}

.table-full table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  table-layout: auto;
}

.table-full thead {
  background: var(--color-table-header);
  color: var(--color-table-header-text);
}

.table-full thead th {
  padding: 0.55rem 0.35rem;
  font-weight: 600;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.table-full thead th:last-child {
  border-right: none;
}

.table-full thead tr.sub-header th {
  background: rgba(67, 97, 238, 0.85);
  font-size: 0.68rem;
  padding: 0.35rem 0.3rem;
  font-weight: 500;
}

.table-full tbody td {
  padding: 0.45rem 0.35rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

.table-full tbody tr:nth-child(even) {
  background: var(--color-table-stripe);
}

.table-full tbody tr:hover {
  background: rgba(67, 97, 238, 0.06);
}

/* Highlight row for "Ours" */
.table-full tbody tr.highlight-row {
  font-weight: 700;
  background: rgba(67, 97, 238, 0.08);
}

.table-full tbody tr.highlight-row:hover {
  background: rgba(67, 97, 238, 0.12);
}

.table-full td.method-name {
  text-align: left;
  font-weight: 600;
  padding-left: 0.8rem;
  color: var(--color-text);
  white-space: nowrap;
}

.best {
  color: var(--color-best);
  font-weight: 800;
}

.second {
  color: var(--color-second);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.table-legend {
  font-size: 0.74rem;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 0.6rem 1rem 1rem;
}

/* ===== Group header row in tables ===== */
.group-header th {
  background: var(--color-table-header) !important;
  font-size: 0.76rem !important;
  padding: 0.5rem 0.35rem !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

/* ===== Metric type sub-header ===== */
.metric-type-header th {
  padding: 0.2rem 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.metric-type-header .physical-label {
  background: #e07040;
  color: #fff;
}

.metric-type-header .semantic-label {
  background: #5c6bc0;
  color: #fff;
}

.legend-physical {
  color: #e07040;
  font-size: 0.8em;
}

.legend-semantic {
  color: #5c6bc0;
  font-size: 0.8em;
}

/* ===== Gallery Items (Qualitative Figures) ===== */
.gallery-item {
  margin-bottom: 3.5rem;
}

.gallery-header {
  text-align: center;
  margin-bottom: 1.2rem;
}

.gallery-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.4rem;
  position: relative;
  display: inline-block;
}

.gallery-header h3::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

.gallery-header p {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  max-width: 800px;
  margin: 0.6rem auto 0;
  line-height: 1.6;
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 0;
  border: none;
  outline: none;
  box-shadow: none;
  image-rendering: -webkit-optimize-contrast;
}

/* ===== BibTeX / Citation ===== */
.citation-block {
  background: var(--color-bg-code);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.citation-block pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--color-text);
  overflow-x: auto;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.copy-btn:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
}

.copy-btn.copied {
  background: #10b981;
}

/* ===== Footer ===== */
.footer {
  padding: 2.5rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

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

.footer a:hover {
  text-decoration: underline;
}

/* ===== Scroll to Top ===== */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(67, 97, 238, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 999;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(67, 97, 238, 0.4);
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Smooth reveal for images ===== */
.figure-block img {
  opacity: 0;
  animation: fadeInImg 0.8s ease forwards;
}

@keyframes fadeInImg {
  to {
    opacity: 1;
  }
}

/* Gallery images: no animation, no artifacts */
.gallery-item img {
  opacity: 1 !important;
  animation: none !important;
}

/* ===== Selection color ===== */
::selection {
  background: rgba(67, 97, 238, 0.2);
  color: var(--color-text);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
  background: #c5c5d2;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a0b2;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --section-spacing: 3rem;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

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

  .authors {
    gap: 0.2rem 0.8rem;
  }

  .author {
    font-size: 0.9rem;
  }

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

  .btn {
    width: 220px;
    justify-content: center;
  }

  .navbar-links {
    display: none;
  }

  .table-full table {
    font-size: 0.62rem;
  }

  .table-full thead th,
  .table-full tbody td {
    padding: 0.3rem 0.2rem;
  }

  .table-full thead th {
    font-size: 0.6rem;
  }

  .table-full thead tr.sub-header th {
    font-size: 0.56rem;
  }

  .container,
  .container-wide,
  .container-full {
    padding: 0 0.8rem;
  }

  .gallery-header h3 {
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.4rem;
  }

  .hero-badge {
    font-size: 0.7rem;
  }

  .table-full table {
    font-size: 0.55rem;
  }
}

/* ===== Method column width ===== */
.table-full table td:first-child,
.table-full table th:first-child {
  min-width: 85px;
}
