/* ===== Design Tokens ===== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #0ea5e9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-accent: #f1f5f9;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-warm: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  --gradient-cool: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --radius: 12px;
  --radius-lg: 16px;
  --ease: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base ===== */
html {
  scroll-behavior: smooth;
}

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

.container.is-max-desktop {
  max-width: 1080px;
}

/* ===== Sections ===== */
.hero.is-light,
section.hero.is-light {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.hero-body {
  padding: 3.5rem 1.5rem;
}

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

.has-text-centered .title.is-3::after,
.has-text-centered > .title.is-3::after,
.columns.has-text-centered .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;
}

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

/* ===== Publication Header ===== */
.publication-title {
  font-family: 'Google Sans', 'Inter', sans-serif !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  margin-bottom: 1.4rem !important;
  line-height: 1.15 !important;
  letter-spacing: -0.02em;
  font-size: clamp(1.6rem, 3vw, 2.3rem) !important;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.publication-authors {
  font-family: 'Google Sans', 'Inter', sans-serif !important;
  font-weight: 500;
  margin-bottom: 0.6rem;
  line-height: 1.7;
}

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

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

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

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

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

.affiliations {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.85;
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Venue Badge ===== */
.publication-venue {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.4rem 1.2rem;
  background: var(--gradient-warm);
  color: #fff !important;
  font-weight: 700;
  font-size: 1.02rem;
  border-radius: 24px;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 14px -3px rgba(239, 68, 68, 0.45);
  animation: venuePulse 3s ease-in-out infinite;
}

@keyframes venuePulse {
  0%, 100% { box-shadow: 0 4px 14px -3px rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 4px 20px -3px rgba(239, 68, 68, 0.65); }
}

/* ===== Buttons ===== */
.button {
  border-radius: var(--radius) !important;
  font-weight: 600 !important;
  transition: var(--ease) !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) !important;
}

.button.is-dark:active {
  transform: translateY(0);
}

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

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

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

.content.has-text-justified ul {
  margin-top: 0.4rem;
}

.content.has-text-justified li + li {
  margin-top: 0.45rem;
}

/* ===== Highlights Grid ===== */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.highlight-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.9rem 1.4rem;
  text-align: center;
  transition: var(--ease);
  box-shadow: var(--shadow-sm);
}

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

.highlight-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #fff;
}

.highlight-icon.icon-graph {
  background: var(--gradient-primary);
}

.highlight-icon.icon-seg {
  background: var(--gradient-warm);
}

.highlight-icon.icon-text {
  background: var(--gradient-cool);
}

.highlight-card h4 {
  font-weight: 700;
  font-size: 1.03rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.highlight-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

/* ===== Figure Cards ===== */
.figure-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--ease);
}

.figure-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

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

.figure-card .figure-caption {
  padding: 0.9rem 1.4rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  line-height: 1.5;
}

/* plain centered figure (no card) */
.figure {
  margin: 1.1rem auto 0.3rem;
  text-align: center;
}

.figure img {
  display: block;
  margin: 0 auto;
  height: auto;
  border-radius: var(--radius);
}

/* Paired figures: identical image box, captions aligned at the bottom.
   The card must be the only child of its column, otherwise the 100% height
   stretch overflows the row. */
.fig-pair > .column {
  display: flex;
}

.fig-pair .figure-card {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.fig-pair .figure-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #fbfdff;
  display: block;
}

.fig-pair .figure-caption {
  flex: 1 1 auto;
}

.figure-caption {
  margin: 0.6rem auto 0;
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ===== Tables ===== */
.table-wrap {
  margin: 1.2rem auto 0.3rem;
  max-width: 860px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-wrap .table {
  background: transparent;
  margin-bottom: 0 !important;
}

.table-wrap .table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 700;
  border-bottom: 2px solid var(--border) !important;
}

.table-wrap .table th,
.table-wrap .table td {
  vertical-align: middle;
  text-align: center;
  padding: 0.65rem 0.75rem;
}

.table-wrap .table th:first-child,
.table-wrap .table td:first-child {
  text-align: left;
}

.table-caption {
  color: var(--text-light);
  font-size: 0.84rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ===== Theory note ===== */
.theory-note {
  margin: 1.2rem auto 0;
  max-width: 820px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.theory-note p:last-child {
  margin-bottom: 0;
}

.mjx-container, .MathJax {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

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

.bibtex-header .title {
  margin-bottom: 0 !important;
}

pre {
  background: var(--bg-accent) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 1.4rem !important;
  font-size: 0.86rem !important;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

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

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

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

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

/* ===== Scroll to Top ===== */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--ease);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  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;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-secondary) !important;
  border-top: 1px solid var(--border);
  padding: 2.6rem 1.5rem !important;
}

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

.footer a {
  color: var(--primary);
  transition: var(--ease);
}

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

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

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-body,
.section > .container {
  animation: fadeInUp 0.6s ease-out both;
}

section:nth-child(2) > .container { animation-delay: 0.05s; }
section:nth-child(3) > .container { animation-delay: 0.1s; }
section:nth-child(4) > .container { animation-delay: 0.15s; }
section:nth-child(5) > .container { animation-delay: 0.2s; }

/* ===== Responsive ===== */
@media screen and (max-width: 768px) {
  .hero-body { padding: 2rem 1rem; }
  .publication-title { font-size: 1.7rem !important; line-height: 1.2 !important; }
  .highlights-grid { grid-template-columns: 1fr; gap: 1rem; }
  .button { margin: 0.25rem !important; font-size: 0.875rem !important; }
  .content.has-text-justified { font-size: 1rem; }
}

@media screen and (max-width: 480px) {
  .publication-title { font-size: 1.45rem !important; }
  .link-block { display: block; margin-bottom: 0.5rem; }
  .button { width: 100%; justify-content: center; }
}

@media print {
  .scroll-to-top { display: none; }
  .hero, .section { animation: none; }
  .button { box-shadow: none !important; }
}
