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

:root {
  --accent: #1a3a6b;
  --accent-light: #2d5aa0;
  --bg: #ffffff;
  --surface: #f6f8fb;
  --border: #dde3ec;
  --text: #1a1a2e;
  --muted: #5a6580;
  --code-bg: #f0f2f7;
  --radius: 8px;
  --max-w: 960px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

/* ===== Layout ===== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

section { padding: 60px 0; }
section + section { border-top: 1px solid var(--border); }

/* ===== Nav ===== */
nav {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 12px 0;
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.nav-brand {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

/* ===== Hero ===== */
#hero {
  padding: 72px 0 48px;
  text-align: center;
  background: linear-gradient(to bottom, #f0f4ff 0%, #ffffff 100%);
  border-top: none;
}

.venue-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

h1.paper-title {
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  max-width: 780px;
  margin: 0 auto 28px;
}

.authors {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 8px;
}

.authors a { color: var(--accent-light); text-decoration: none; }
.authors a:hover { text-decoration: underline; }
.co-first { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }

.affil {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ===== Resource Links ===== */
.resource-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  border: 2px solid transparent;
}

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

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

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== Section Headings ===== */
h2.section-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--muted);
  margin-bottom: 36px;
  font-size: 0.96rem;
}

/* ===== Teaser ===== */
.teaser-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.caption {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

/* ===== Abstract ===== */
.abstract-text {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 24px 28px;
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--text);
}

/* ===== System + Architecture ===== */
.figure-block {
  text-align: center;
  margin: 32px 0;
}

.figure-block img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.key-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.spec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}

.spec-card .spec-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.spec-card .spec-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Image Compare Slider ===== */
.image-compare {
  position: relative;
  overflow: hidden;
  cursor: col-resize;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  max-width: 760px;
  margin: 0 auto;
}

.image-compare .base-img {
  display: block;
  width: 100%;
  height: auto;
}

.compare-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 50%;
  border-right: 2px solid #fff;
  box-shadow: 1px 0 4px rgba(0,0,0,0.25);
  transition: width 0s;
}

.compare-overlay img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
}

.compare-divider {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 2px;
  background: #fff;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.compare-handle svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.compare-label {
  position: absolute;
  top: 12px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.compare-label.left  { left: 12px; }
.compare-label.right { right: 12px; }

.compare-hint {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
}

/* ===== Two-column ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 680px) { .two-col { grid-template-columns: 1fr; } }

/* ===== Interactive comparison ===== */
.comparison-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.scene-btn {
  padding: 7px 18px;
  border-radius: 100px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.scene-btn:hover { border-color: var(--accent-light); color: var(--accent-light); }
.scene-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.comparison-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* System comparison grid — always 5 columns, scroll on small screens */
.sys-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sys-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 8px;
  min-width: 640px;
}

.sys-grid-item img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}

/* Ablation grid — always 5 columns, scroll on small screens */
.ablation-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ablation-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  min-width: 600px;
}

.ablation-grid img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== Metrics table ===== */
.metrics-table-wrap {
  overflow-x: auto;
  margin-top: 24px;
}

table.metrics {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

table.metrics th,
table.metrics td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

table.metrics th {
  background: var(--surface);
  font-weight: 600;
  color: var(--accent);
  border-top: 2px solid var(--accent);
}

table.metrics tr:hover td { background: #f9faff; }

.rank-1 { background: #ffd6d6 !important; }
.rank-2 { background: #f5d0f5 !important; }
.rank-3 { background: #fafad2 !important; }
.best-row td { font-weight: 700; }

/* ===== BibTeX ===== */
.bibtex-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.copy-btn:hover { background: var(--accent-light); }
.copy-btn.copied { background: #2e7d32; }

/* ===== Info pills ===== */
.info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.83rem;
  color: var(--muted);
}

.pill strong { color: var(--accent); }

/* ===== Footer ===== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.8;
}

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

/* ===== Responsive ===== */
@media (max-width: 600px) {
  section { padding: 40px 0; }
  .sys-grid, .ablation-grid { grid-template-columns: repeat(2, 1fr); }
  nav .nav-brand { display: none; }
}
