/* FreeSpeed project page — single stylesheet.
   Fonts are bundled locally in ../fonts (no external CDN). */

@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/google-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/google-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(../fonts/inter-400.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url(../fonts/inter-500.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(../fonts/inter-600.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(../fonts/inter-700.woff2) format('woff2'); }

:root {
  --ink: #18202e;
  --ink-2: #3c4555;
  --muted: #6a7385;
  --line: #e3e7ee;
  --line-strong: #cdd4df;
  --page: #ffffff;
  --card: #ffffff;
  --soft: #f6f8fb;
  --accent: #3a6db5;          /* FreeSpeed blue, matches the paper figures */
  --accent-ink: #24508f;
  --accent-soft: #eaf1fb;
  --fail: #b8502f;
  --fail-soft: #fbeee9;
  --radius: 14px;
  --gap: 20px;
  --wide: 920px;
  --sans: 'Inter', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Google Sans', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--page); color: var(--ink-2);
  font: 400 15px/1.7 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--ink); font-weight: 600; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 16px; }

.container { width: min(100% - 64px, var(--wide)); margin-inline: auto; }

/* ---------- Top navigation ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav .container { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font: 700 16px/1 var(--display); color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.topnav nav { margin-left: auto; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.topnav nav::-webkit-scrollbar { display: none; }
.topnav nav a { color: var(--muted); font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.topnav nav a:hover { color: var(--ink); background: var(--soft); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { margin: 0 auto; max-width: 860px; font: 700 clamp(26px, 3.6vw, 40px)/1.15 var(--display); color: var(--ink); letter-spacing: -.02em; }
.hero h1 .name { color: var(--accent); }
.hero h1 .sub { display: block; margin-top: 10px; font-weight: 500; font-size: .58em; line-height: 1.3; color: var(--ink-2); letter-spacing: -.01em; }
.authors { margin: 24px auto 0; max-width: 900px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; padding: 0; list-style: none;
  font: 500 15px/1.6 var(--display); }
.authors a { color: var(--ink); }
.authors a:hover { color: var(--accent); }
.authors sup { font-size: .68em; color: var(--muted); margin-left: 1px; }
.affiliations { margin: 8px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 24px; color: var(--muted); font-size: 13.5px; }
.affiliations sup { margin-right: 2px; }
.notes { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.links { margin: 24px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font: 600 13px/1 var(--sans); border: 1px solid var(--ink);
  transition: transform .15s, background .15s;
}
.btn:hover { text-decoration: none; background: #2b3547; transform: translateY(-1px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.soon { background: transparent; color: var(--muted); border-color: var(--line-strong); cursor: default; }
.btn.soon:hover { transform: none; background: transparent; }
.btn.soon small { font-weight: 500; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: var(--soft); }

/* ---------- Sections & modules ---------- */
.section { padding: 80px 0 0; }
main > .section:last-child { padding-bottom: 56px; }
.section-head { margin: 0 0 22px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); }
.section-head .num { display: none; }
.section-head h2 { margin: 0; font: 700 27px/1.25 var(--display); color: var(--accent); letter-spacing: -.015em; }

.stack { display: grid; gap: 48px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }

.card { min-width: 0; }
.card h3 { margin: 0 0 10px; font: 700 18px/1.35 var(--display); color: var(--ink); }
.card .kicker { display: block; margin: 0 0 8px; font: 700 11.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.card p { font-size: 14.5px; }
.muted { color: var(--muted); }

/* ---------- Figures ---------- */
.fig { margin: 0; }
.fig > a { display: block; }
.fig img { width: 100%; height: auto; margin-inline: auto; max-width: var(--w, 100%); }
.fig figcaption { max-width: 760px; margin: 14px auto 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.fig figcaption b { color: var(--ink-2); font-weight: 600; }
.card .fig + p, .card p + .fig, .card .fig + .table-wrap, .card p + .table-wrap { margin-top: 16px; }

/* ---------- Video ---------- */
.player-frame { border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--line); aspect-ratio: 16 / 9; }
.player-frame video { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.chapters { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chapters button {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: 500 12.5px/1.3 var(--sans); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.chapters button:hover { border-color: var(--line-strong); background: var(--soft); }
.chapters button[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chapters time { font: 500 11px/1 var(--mono); color: var(--muted); }
.chapters button[aria-current="true"] time { color: var(--accent); }

/* ---------- Stats ---------- */
.stat { display: flex; flex-direction: column; }
.stat .value { display: block; font: 700 22px/1.15 var(--display); color: var(--accent); letter-spacing: -.02em; }
.stat .label { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* ---------- Method ---------- */
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font: 700 12px/1 var(--display); vertical-align: 1px; }
.equation { margin: 12px 0; padding: 12px 10px; text-align: center; border-radius: 10px; background: var(--soft);
  font: 400 17px/1.4 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif; color: var(--ink); overflow-x: auto; white-space: nowrap; }
.equation var { font-style: italic; }
.equation sub { font-size: .66em; font-style: normal; }
.m { font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif; font-size: 1.06em; font-style: italic; }
.m sub { font-style: normal; font-size: .7em; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; text-align: center; white-space: nowrap; }
thead th { font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: .02em; border-bottom: 1px solid var(--line); line-height: 1.3; }
thead tr.group th { font-size: 11.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
tbody th { text-align: left; font-weight: 600; color: var(--ink); }
tbody tr + tr > * { border-top: 1px solid var(--line); }
.ours { background: var(--accent-soft); }
td.ours { color: var(--accent-ink); font-weight: 600; }
th.ours { color: var(--accent-ink); }
tr.ref-row > * { color: var(--muted); }
.dash { color: #c3c9d4; }
.caption { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.cap-table td { font-size: 14px; color: var(--ink); }
.cap-table td.no { color: #c3c9d4; }
.cap-table tbody th { font-weight: 500; }
.cap-table thead th { white-space: normal; vertical-align: bottom; }
.cap-table tr.ours-row > * { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ---------- Interactive comparison ---------- */
.rollout-intro { margin: 0 0 18px; font-size: 14.5px; color: var(--ink-2); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.toolbar label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border: solid var(--muted); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); pointer-events: none; }
.toolbar select { appearance: none; height: 34px; padding: 0 34px 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 500 13.5px/1 var(--sans); cursor: pointer; }
.toolbar select:hover { border-color: var(--muted); }
.toolbar-note { color: var(--muted); font-size: 12.5px; }
.playback-actions { margin-left: auto; display: flex; gap: 8px; }
.text-button { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 600 12.5px/1 var(--sans); cursor: pointer; }
.text-button:hover:not(:disabled) { background: var(--soft); }
.text-button:disabled { opacity: .45; cursor: default; }

.speed-control { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 24px; margin: 16px 0 4px; padding: 16px 0; border-block: 1px solid var(--line); }
.speed-control label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.speed-control output { display: block; margin-top: 2px; font: 700 24px/1.15 var(--display); color: var(--accent); letter-spacing: -.02em; }
.range { --thumb: 18px; padding-top: 4px; }
.range input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px; margin: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0 var(--range-fill, 0%), var(--line) var(--range-fill, 0%) 100%);
}
.range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--thumb); height: var(--thumb); border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(16, 24, 40, .2); }
.range input[type=range]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(16, 24, 40, .2); }
.ticks { display: flex; justify-content: space-between; margin: 10px calc(var(--thumb) / 2 - 24px) 0; }
.ticks span { width: 48px; text-align: center; font: 500 12px/1 var(--sans); color: var(--muted); }

.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 18px; margin-top: 16px; }
.video-grid.slowdown .video-card[data-method="reference"],
.video-grid.variable-mode .video-card { grid-column: 1 / -1; justify-self: center; width: calc(50% - 9px); }
.video-card { min-width: 0; }
.video-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; margin-bottom: 6px; }
.video-grid .video-card-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: 600 13.5px/1.3 var(--display); color: var(--ink); }
.video-grid .video-card[data-method="freespeed"] .video-card-title { color: var(--accent); }
.video-status { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--fail-soft); color: var(--fail); font: 600 11px/1.3 var(--sans); }
.panel-play { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; color: var(--accent); font-size: 12px; cursor: pointer; display: grid; place-items: center; }
.panel-play:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.video-card video { width: 100%; aspect-ratio: 16 / 9; border-radius: 9px; background: #0d1117; object-fit: cover; }
.video-card[data-method="freespeed"] video { box-shadow: 0 0 0 2px var(--accent); }
.video-card-footer { display: flex; justify-content: space-between; margin-top: 5px; font: 500 11.5px/1.4 var(--mono); color: var(--muted); }
.video-placeholder { display: grid; place-items: center; aspect-ratio: 16 / 9; padding: 20px; border-radius: 9px; border: 1px dashed var(--line-strong); background: var(--soft); color: var(--muted); font-size: 13px; text-align: center; }
.comparison-note { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- BibTeX ---------- */
.bibtex { position: relative; }
.bibtex pre { margin: 0; padding: 20px 22px; overflow-x: auto; border-radius: var(--radius); background: #0f1623; color: #d7deea; font: 400 12.5px/1.7 var(--mono); }
.copy { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #d7deea; font: 600 12px/1 var(--sans); cursor: pointer; }
.copy:hover { background: rgba(255, 255, 255, .14); }

/* ---------- Footer ---------- */
footer { padding: 24px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
footer p { margin: 3px 0; }
footer a { color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .speed-control { grid-template-columns: 1fr; gap: 10px; }
  .playback-actions { margin-left: 0; }
}
@media (max-width: 640px) {
  .container { width: calc(100% - 32px); }
  .topnav nav { display: none; }
  .hero { padding: 40px 0 28px; }
  .section { padding-top: 32px; }
  .grid-4 { gap: 12px; }
  .video-grid { grid-template-columns: 1fr; }
  .video-grid.slowdown .video-card[data-method="reference"],
  .video-grid.variable-mode .video-card { width: 100%; }
  .ticks span { width: 34px; font-size: 10.5px; }
  .ticks { margin-inline: calc(var(--thumb) / 2 - 17px); }
  th, td { padding: 6px 5px; }
}
