/* ═══════════════════════════════════════════════════════════════
   Learning Adaptive LLM Decoding — Paper Website Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #0053D6;
  --primary-dark: #003DAD;
  --accent:       #0053D6;
  --text:         #0a0f1e;
  --text-light:   #4b5563;
  --text-muted:   #6b7280;
  --bg:           #ffffff;
  --bg-alt:       #f8fafc;
  --border:       #e2e8f0;
  --success:      #16a34a;
  --radius:       12px;
  --radius-sm:    6px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.10), 0 12px 40px rgba(0,0,0,.08);
  --font-sans:    'Inter', system-ui, sans-serif;
  --font-serif:   'Source Serif 4', Georgia, serif;
  --max-w:        1100px;
  --narrow-w:     760px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  background: #F0F0EE;
  color: #0053D6;
  padding: 80px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 60%, rgba(0,83,214,.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(0,83,214,.05) 0%, transparent 50%);
  pointer-events: none;
}

.venue-badge {
  display: inline-block;
  background: rgba(0,83,214,.10);
  border: 1px solid rgba(0,83,214,.25);
  color: #0053D6;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
}

.paper-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  font-weight: 600;
  line-height: 1.25;
  color: #0053D6;
  max-width: 800px;
  margin: 0 auto 28px;
  position: relative;
}

.authors {
  font-size: 1.05rem;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.author { margin: 0 8px; }
.author sup { font-size: .65em; color: #0053D6; }

.affiliations {
  font-size: 0.875rem;
  color: #555555;
  margin-bottom: 36px;
}

.hero .authors a {
  color: #0053D6;
  text-decoration: none;
  font-weight: 500;
}
.hero .authors a:hover {
  text-decoration: underline;
}

/* ── Link buttons ─────────────────────────────────────────────── */
.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  position: relative;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #0053D6;
  color: #fff;
}
.btn-primary:hover {
  background: #003DAD;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,83,214,.35);
}

.btn-outline {
  background: transparent;
  color: #0053D6;
  border: 1.5px solid #0053D6;
}
.btn-outline:hover {
  background: rgba(0,83,214,.08);
  color: #003DAD;
  border-color: #003DAD;
  transform: translateY(-1px);
}

/* ── Sections ─────────────────────────────────────────────────── */
.section {
  padding: 72px 0;
}
.alt-bg {
  background: var(--bg-alt);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  max-width: 680px;
  margin: 0 auto 48px;
  font-size: 1rem;
}

.subsection {
  margin-top: 56px;
}
.subsection-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

/* ── Abstract ─────────────────────────────────────────────────── */
.abstract-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  margin-top: 28px;
}

.abstract-box p {
  font-size: 1.02rem;
  color: var(--text);
  margin-bottom: 16px;
}
.abstract-box p:last-child { margin-bottom: 0; }

/* ── Stats ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-top: 36px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Method cards ─────────────────────────────────────────────── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
  margin-top: 36px;
}

.method-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.method-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  margin-bottom: 18px;
}

.method-card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.method-card p {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 14px;
}

.method-formula {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
  text-align: center;
  overflow-x: auto;
}

.formula-block {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  margin: 20px 0;
  text-align: center;
  overflow-x: auto;
}

/* ── Tables ───────────────────────────────────────────────────── */
.table-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 10px;
}

.table-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

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

.results-table thead {
  background: linear-gradient(135deg, #020314, #040829);
  color: #e2e8f0;
}

.results-table th {
  padding: 13px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: .04em;
}

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

.results-table td {
  padding: 11px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

.results-table tbody tr:nth-child(even) { background: #f8fafc; }

.results-table tbody tr:hover { background: #eff6ff; }

.results-table td.best {
  font-weight: 700;
  color: var(--primary);
}

.results-table td.delta {
  color: var(--success);
  font-weight: 600;
}

.results-table td.best-delta {
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── Figures ──────────────────────────────────────────────────── */
.teaser-section {
  padding: 0;
  margin-top: -2px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.teaser-figure {
  padding: 48px 0 36px;
}

.teaser-img {
  width: 100%;
  max-width: 780px;
  display: block;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.teaser-section .container {
  max-width: 100vw;
  padding: 0;
}

.teaser-pdfs {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
  margin: 0 auto 20px;
  max-width: 1800px;
  width: 100%;
}

.teaser-pdf {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

figure figcaption {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  max-width: 640px;
  margin: 0 auto;
}

.inline-figure {
  margin: 24px 0;
}

.inline-figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: block;
}

.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  margin-top: 24px;
  align-items: start;
}

.inline-figure.half { margin: 0; }

.pdf-embed {
  width: 100%;
  height: 220px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: block;
  border: none;
}

.figure-row.three-col {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .figure-row.three-col {
    grid-template-columns: 1fr;
  }
}

/* Placeholder styling for missing images */
.placeholder-img {
  min-height: 220px;
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
  object-fit: cover;
  position: relative;
}

/* Show "Image placeholder" text via pseudo-element when image fails to load */
img.placeholder-img::after {
  content: '📊 Figure';
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  color: #6366f1;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Contributions ────────────────────────────────────────────── */
.contributions-list {
  list-style: none;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contributions-list li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.contributions-list li i {
  color: var(--success);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.contributions-list li div {
  font-size: 0.97rem;
  color: var(--text-light);
  line-height: 1.6;
}

.contributions-list li strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* ── BibTeX ───────────────────────────────────────────────────── */
.bibtex-block {
  position: relative;
  background: #020314;
  border-radius: var(--radius);
  margin-top: 20px;
  overflow: hidden;
}

.bibtex-block pre {
  padding: 28px 32px;
  color: #94a3b8;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.1);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.copy-btn:hover {
  background: rgba(255,255,255,.2);
  color: #e2e8f0;
}
.copy-btn.copied {
  color: #4ade80;
  border-color: #4ade80;
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: #020314;
  color: #475569;
  text-align: center;
  padding: 36px 24px;
  font-size: 0.875rem;
}

.site-footer a {
  color: #64748b;
  text-decoration: underline;
}
.site-footer a:hover { color: #94a3b8; }

.footer-note {
  margin-top: 6px;
  font-size: 0.8rem;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 56px 16px 48px; }
  .section { padding: 48px 0; }
  .abstract-box { padding: 24px 20px; }
  .method-grid { grid-template-columns: 1fr; }
  .figure-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .results-table { font-size: 0.8rem; }
  .results-table th, .results-table td { padding: 9px 10px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}
