:root {
  --ink: #1d2433;
  --muted: #5f6b7e;
  --line: #e2e7ee;
  --soft: #f5f7fa;
  --blue: #2f5f9e;
  --blue-dark: #21456f;
  --accent: #e07a4f;
  --ours: #eef4fc;
  --series-ours: #2a78d6;
  --series-base: #eb6834;
  --max: 1040px;
  --narrow: 820px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; color-scheme: light; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }

img, video { display: block; max-width: 100%; height: auto; }

.wrap { width: min(calc(100% - 32px), var(--max)); margin-inline: auto; }
.wrap.narrow { max-width: var(--narrow); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: 0.01em; }
.brand .logo { width: 22px; height: 22px; color: var(--blue); }
.brand:hover { text-decoration: none; color: var(--blue); }
.topbar nav { display: flex; gap: 20px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-size: 15px; }
.topbar nav a:hover, .topbar nav a.active { color: var(--ink); text-decoration: none; }
.topbar nav a.active { box-shadow: inset 0 -2px 0 var(--blue); }

/* Hero */
.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 {
  margin: 0 auto 20px;
  max-width: 900px;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.25;
  font-weight: 600;
}
.hero h1 .name {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(40px, 6vw, 60px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--blue);
}
.tagline { margin: -6px auto 22px; max-width: 760px; color: var(--muted); font-size: 18px; }
.authors { margin: 0 0 4px; font-size: 19px; }
.authors .author { display: inline-block; margin: 0 10px; white-space: nowrap; }
.authors sup { font-size: 0.65em; }
.affiliations { margin: 0; color: var(--muted); font-size: 16px; }

.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 24px 0 32px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}
.button:hover { background: #000; color: #fff; text-decoration: none; }
.button svg { width: 17px; height: 17px; }
.button em { font-style: normal; font-weight: 400; opacity: 0.75; font-size: 13px; }
.button.disabled { background: #e9edf2; color: var(--muted); cursor: default; }

.teaser { margin: 0; }
.teaser video { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.teaser figcaption { max-width: 860px; margin: 12px auto 0; }

.highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 32px 0 8px;
}
.highlights div {
  padding: 18px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.highlights strong { display: block; font-size: 24px; font-weight: 700; color: var(--blue); }
.highlights span { color: var(--muted); font-size: 14px; line-height: 1.45; display: block; margin-top: 4px; }

/* Sections */
.section { padding: 56px 0; }
.band { background: var(--soft); border-block: 1px solid var(--line); }
h2 { font-size: 28px; line-height: 1.3; margin: 0 0 18px; text-align: center; letter-spacing: -0.01em; }
h2::after { content: ""; display: block; width: 40px; height: 3px; margin: 10px auto 0; border-radius: 2px; background: var(--blue); }
h3 { font-size: 20px; margin: 36px 0 8px; }
.lede { max-width: var(--narrow); margin: 0 auto 24px; text-align: center; color: var(--muted); }
.note { color: var(--muted); font-size: 15px; margin: 6px 0 14px; }
#abstract p { text-align: justify; hyphens: auto; }

.figure { margin: 20px 0 0; }
.figure img, .figure video {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.figure video { padding: 0; }
.narrow-figure { max-width: 680px; margin-inline: auto; }
figcaption { color: var(--muted); font-size: 15px; line-height: 1.55; margin-top: 10px; text-align: center; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 8px;
}
.cards article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.cards h3 { margin: 10px 0 6px; font-size: 18px; }
.cards p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 28px;
  align-items: start;
}
.split .figure { margin-top: 36px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--soft); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.ours td { background: var(--ours); font-weight: 600; }

/* Videos */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.video-grid .figure { margin-top: 8px; }
.tag { padding: 1px 6px; border-radius: 4px; font-size: 13px; color: #fff; }
.tag.red { background: #d93025; }
.tag.green { background: #1e8e3e; }

/* BibTeX */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.copy:hover { border-color: var(--muted); }

footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar nav { gap: 12px; }
  .topbar nav a { font-size: 14px; }
  .hero { padding-top: 36px; }
  .authors { font-size: 17px; }
  .highlights, .cards, .split, .video-grid { grid-template-columns: 1fr; }
  .split .figure { margin-top: 8px; }
  .section { padding: 40px 0; }
  #abstract p { text-align: left; }
}

@media (max-width: 520px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; }
  .topbar nav a { font-size: 13px; }
}

/* Success vs. latency chart */
.chart-card { margin: 18px 0 22px; padding: 16px 16px 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 14px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.key.ours { background: var(--series-ours); }
.key.base { background: var(--series-base); }
.key.arrow { width: 18px; height: 2px; border-radius: 1px; background: var(--muted); position: relative; }
.key.arrow::after { content: ""; position: absolute; left: -2px; top: -3px; border: 4px solid transparent; border-right: 6px solid var(--muted); border-left: 0; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart-box { position: relative; min-width: 560px; max-width: 760px; margin: 0 auto; }
.tradeoff { display: block; width: 100%; height: auto; font-family: inherit; }
.tradeoff .grid { stroke: #edf0f4; stroke-width: 1; }
.tradeoff .axis { stroke: #c9d0da; stroke-width: 1; }
.tradeoff .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tradeoff .axis-title { fill: var(--muted); font-size: 12.5px; }
.tradeoff .label { fill: var(--ink); font-size: 13px; font-weight: 600; pointer-events: none; }
.tradeoff .annot { fill: var(--muted); font-size: 12.5px; font-weight: 600; pointer-events: none; }
.tradeoff .arrow { stroke: #8a94a3; stroke-width: 2; }
.tradeoff .arrow-head { fill: #8a94a3; }
.tradeoff .dot { stroke: #fff; stroke-width: 2; }
.tradeoff .pt.ours .dot { fill: var(--series-ours); }
.tradeoff .pt.base .dot { fill: var(--series-base); }
.tradeoff .hit { fill: transparent; cursor: pointer; }
.tradeoff .pt:hover .dot, .tradeoff .pt:focus .dot { r: 8; }
.tradeoff .pt:focus { outline: none; }
.tradeoff .pt:focus-visible .hit { stroke: var(--blue); stroke-width: 2; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(29, 36, 51, 0.12);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}
