:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --amber-soft: #fef3c7;
  --amber-text: #92400e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

section[id],
header[id] {
  scroll-margin-top: 72px;
}

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

a:hover {
  text-decoration: underline;
}

code, pre {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

p code,
figcaption code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.84em;
  color: #0f172a;
}

.math-var {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow {
  max-width: 820px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: none;
}

.nav-mobile-actions {
  display: none;
  gap: 14px;
  font-size: 0.86rem;
  font-weight: 600;
}

.nav-mobile-actions a {
  color: var(--text);
}

/* Hero */
.hero {
  padding: 40px 0 42px;
  background: radial-gradient(circle at 50% 0%, #eff6ff 0%, #ffffff 55%);
}

.eyebrow {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

.title {
  text-align: center;
  font-size: clamp(1.8rem, 3.4vw, 2.65rem);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 900px;
  margin: 0 auto 14px;
}

.title-accent {
  color: var(--accent);
}

.authors {
  text-align: center;
  font-size: 1.06rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.author-sep {
  margin: 0 8px;
  color: var(--subtle);
}

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.btn-primary {
  background: #b91c1c;
  color: #fff;
}

.btn-primary:hover {
  background: #991b1b;
}

.btn-dark {
  background: #0f172a;
  color: #fff;
}

.btn-dark:hover {
  background: #1e293b;
}

.btn-hf {
  background: #ffd21e;
  color: #0f172a;
}

.btn-hf:hover {
  background: #f5c400;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-alt);
}

/* Stat strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

/* Figures */
.hero-figure,
.paper-figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.fig-zoom {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: 6px;
  overflow: hidden;
}

.fig-zoom img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

.fig-zoom:hover img {
  transform: scale(1.005);
}

.zoom-hint {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.fig-zoom:hover .zoom-hint {
  opacity: 1;
}

figcaption {
  margin-top: 12px;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Sections */
.section {
  padding: 58px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section h2 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.section-head {
  margin-bottom: 24px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.lead {
  font-size: 1.01rem;
  color: #1e293b;
  margin: 0;
  text-align: left;
  line-height: 1.72;
}

/* Cards */
.card-grid.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.info-card,
.finding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-tag {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}

.info-card h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.finding-card h4 {
  font-size: 0.97rem;
  margin: 0 0 6px;
}

.info-card p,
.finding-card p {
  margin: 0;
  font-size: 0.89rem;
  color: var(--muted);
  line-height: 1.6;
}

.mech-block + .mech-block {
  margin-top: 40px;
}

/* Interactive Benchmark Explorer */
.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.control-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtle);
}

.pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 10px;
}

.pill {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  color: var(--muted);
}

.chart-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.chart-summary strong {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 0.79rem;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

.bar-row {
  display: grid;
  grid-template-columns: 155px 1fr 122px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}

.bar-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  position: relative;
  height: 21px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.25s ease;
}

.bar-fill.speedup {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.bar-fill.tau {
  background: linear-gradient(90deg, #059669, #10b981);
}

.bar-fill.ar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #cbd5e1;
  border-radius: 6px;
}

.bar-fill.sp {
  position: absolute;
  top: 3px;
  left: 0;
  height: 15px;
  background: #2563eb;
  border-radius: 5px;
}

.bar-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.81rem;
  font-weight: 600;
  text-align: right;
  color: var(--text);
  white-space: nowrap;
}

.bar-val .val-sp {
  color: var(--accent-dark);
}

.bar-val .val-sep {
  color: #94a3b8;
  font-weight: 400;
}

.bar-val .val-ar {
  color: var(--subtle);
  font-weight: 500;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.results-table th,
.results-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
}

.results-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.results-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.results-table th.sortable:hover,
.results-table th.sorted {
  color: var(--accent-dark);
}

.results-table th.sorted-desc::after {
  content: " \25BE";
  font-size: 0.72rem;
}

.results-table th.sorted-asc::after {
  content: " \25B4";
  font-size: 0.72rem;
}

.results-table td.num,
.results-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

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

.speed-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
}

/* Code boxes */
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: #1e293b;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.copy-btn {
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copy-btn:hover {
  background: #334155;
}

.code-box pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.62;
}

/* Roadmap */
.roadmap {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roadmap-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.roadmap-item p {
  margin: 4px 0 0;
  font-size: 0.89rem;
  color: var(--muted);
  line-height: 1.58;
}

.rm-badge {
  flex-shrink: 0;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 2px;
}

.roadmap-item.done .rm-badge {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.roadmap-item.next .rm-badge {
  background: var(--amber-soft);
  color: var(--amber-text);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  font-size: 0.88rem;
  color: var(--subtle);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 18px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.lightbox-inner p {
  color: #e2e8f0;
  font-size: 0.9rem;
  margin-top: 12px;
  text-align: center;
  max-width: 820px;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.8rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 820px) {
  .hero {
    padding: 30px 0 34px;
  }
  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-grid.three-col {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
  .nav-mobile-actions {
    display: flex;
  }
  .bar-row {
    grid-template-columns: 118px 1fr 94px;
    gap: 8px;
  }
  .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}
