/* JetSpec++ site. Layout, type and palette follow the JetSpec site (Hao AI Lab, PaperMod): white
   paper, system fonts, one teal accent, light and dark. */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --paper-soft: #f5f5f6;
  --card: #ffffff;
  --ink: #1f1f1f;
  --primary: #1e1e1e;
  --muted: #6c6c6c;
  --faint: #767676;
  --rule: #ebebeb;
  --rule-strong: #d6d6d6;
  --accent: #1f6f8f;
  --accent-soft: rgba(31, 111, 143, 0.10);
  --data-green: #2f8f5f;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", "Roboto Mono", monospace;
  --maxw: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1d1e20;
    --paper-soft: #26272b;
    --card: #26272b;
    --ink: #c4c4c5;
    --primary: #ffffff;
    --muted: #9b9c9d;
    --faint: #7c7e82;
    --rule: #333333;
    --rule-strong: #4a4b4f;
    --accent: #5bb0cf;
    --accent-soft: rgba(91, 176, 207, 0.16);
    --data-green: #5cc090;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1d1e20;
  --paper-soft: #26272b;
  --card: #26272b;
  --ink: #c4c4c5;
  --primary: #ffffff;
  --muted: #9b9c9d;
  --faint: #7c7e82;
  --rule: #333333;
  --rule-strong: #4a4b4f;
  --accent: #5bb0cf;
  --accent-soft: rgba(91, 176, 207, 0.16);
  --data-green: #5cc090;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
p { margin: 0 0 14px; }
sup { font-size: 0.7em; }
strong { color: var(--primary); font-weight: 650; }

.page { width: min(var(--maxw), calc(100vw - 32px)); margin: 0 auto; padding: 18px 0 72px; }

/* Top bar */
/* The top bar stays at the top of the window, so the theme switch is always in reach */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 10px 0; background: var(--paper); }
.brand { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.01em; text-decoration: none; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--card); color: var(--ink); cursor: pointer;
}
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Paper header */
.paper-header { padding: 18px 0 16px; border-bottom: 1px solid var(--rule); text-align: center; }
h1, h2, h3 { color: var(--primary); }
h1 { margin: 0 auto 8px; font-size: clamp(38px, 5vw, 58px); font-weight: 600; line-height: 1.05; letter-spacing: 0; }
.subtitle { margin-bottom: 10px; color: var(--muted); font-size: 19px; font-style: italic; }
.authors { margin-bottom: 4px; font-size: 17px; }
.affiliations { margin-bottom: 12px; color: var(--muted); font-size: 15px; }
.resource-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; font-size: 16px; }

.lead { margin: 22px 0 18px; }

/* Videos: one light and one dark file per slot, switched with the theme */
.video { position: relative; margin: 8px 0 24px; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--paper-soft); }
.video video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-pending { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted); font-size: 15px; }
.video.pending video { visibility: hidden; }
.video.pending .video-pending { display: grid; }
.video:has(+ .vc) { margin-bottom: 8px; }
.vc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 24px; font-size: 13px; }
.vc-play { min-width: 64px; padding: 6px 12px; border: 0; border-radius: 6px; background: var(--accent); color: var(--paper); font: 600 13px var(--sans); cursor: pointer; }
.vc-seek { flex: 1 1 220px; min-width: 140px; accent-color: var(--accent); }
.vc-time { color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.vc-label { margin-left: 4px; color: var(--muted); font-weight: 600; }

/* Sections */
.section { padding: 24px 0; border-bottom: 1px solid var(--rule); }
.sec-eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
h2 { margin: 0 0 12px; font-size: 25px; font-weight: 600; line-height: 1.22; }
h3 { margin: 26px 0 2px; font-size: 17px; font-weight: 600; line-height: 1.3; }
figcaption { color: var(--muted); font-size: 12.5px; line-height: 1.55; }

/* Paper figures keep their white page in both themes */
.paper-figure { margin: 12px 0 8px; }
.paper-figure img { display: block; width: 100%; height: auto; padding: 14px; border: 1px solid var(--rule); background: #ffffff; }
/* Figure 2 has a dark copy (recoloured, same drawing); each theme shows its own */
.paper-figure img.fig-dark { display: none; background: #26272b; }
:root[data-theme="dark"] .paper-figure img.fig-light { display: none; }
:root[data-theme="dark"] .paper-figure img.fig-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .paper-figure img.fig-light { display: none; }
  :root:not([data-theme="light"]) .paper-figure img.fig-dark { display: block; }
}
.paper-figure figcaption { margin: 10px 0 0; text-align: left; }

/* Headline number, as on the JetSpec site (hero-tps): a left rule, no fill */
.hero-tps { display: flex; flex-wrap: wrap; align-items: baseline; gap: 22px; margin: 20px 0 0; padding: 6px 0 6px 22px; border-left: 4px solid var(--accent); }
.ht-num { color: var(--ink); font: 700 clamp(40px, 6vw, 58px)/1 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ht-num .ht-unit { margin-left: 8px; color: var(--muted); font-size: 24px; font-weight: 600; }
.ht-pre { display: block; margin-bottom: 4px; color: var(--muted); font: 600 13px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; }
.ht-cap { flex: 1 1 340px; margin: 0; color: var(--ink); font-size: 14.5px; line-height: 1.55; }
.ht-cap strong { color: var(--primary); }
.ht-note { display: block; margin-top: 7px; color: var(--faint); font-size: 12.5px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.segmented button { padding: 5px 12px; border: 0; border-right: 1px solid var(--rule-strong); background: transparent; color: var(--muted); font: 600 13px var(--sans); cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--primary); }

/* Result tables: the JetSpec site's data tables, rule for rule */
.table-summary { margin: 18px 0 0; color: var(--ink); font-size: 14.5px; line-height: 1.55; }
.table-scroll { overflow-x: auto; margin: 16px 0 0; }
.dtable { width: 100%; max-width: 100%; margin: 0; border-collapse: collapse; font-size: 14px; }
/* Fixed layout: the method column has a set width and every number column gets the same width */
.dtable.even { table-layout: fixed; min-width: 760px; }
.dtable.even col.c-method { width: 180px; }
.dtable.even.speed col.c-method,
.dtable.even.batch col.c-method { width: 90px; }
.dtable.even col.c-setup { width: 125px; }
.dtable td.setup { color: var(--muted); }
.dtable.even.batch { min-width: 760px; }
.dtable.even td.num, .dtable.even th.num, .dtable.even th.sub { text-align: center; }
.dtable caption { caption-side: bottom; padding-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: left; }
.dtable caption b { color: var(--primary); font-weight: 600; }
.dtable th, .dtable td { padding: 9px 8px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.dtable thead th { border-bottom: 1.5px solid var(--primary); color: var(--primary); font-weight: 600; white-space: nowrap; }
.dtable tbody th { font-weight: 600; white-space: nowrap; }
.dtable td.num, .dtable th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dtable thead th.grp-col { text-align: center; border-left: 1px solid var(--rule); }
.dtable th.sub { color: var(--muted); font-weight: 500; text-align: right; }
.dtable .gl { border-left: 1px solid var(--rule); }
.dtable tr.grp th { padding: 8px 6px 6px; background: var(--paper-soft); color: var(--primary); font-weight: 700; letter-spacing: 0.01em; }
.dtable tbody tr.hl td, .dtable tbody tr.hl th { background: var(--accent-soft); font-weight: 600; }
.dtable tbody tr.hl td.num { color: var(--data-green); }
.dtable tbody tr:last-child td, .dtable tbody tr:last-child th { border-bottom: 1.5px solid var(--primary); }

/* BibTeX and footer */
pre { overflow-x: auto; margin: 14px 0 0; padding: 16px; border: 1px solid var(--rule); background: var(--paper-soft); color: var(--ink); font: 14px/1.5 var(--mono); }
.footer { display: flex; flex-wrap: wrap; gap: 10px 16px; padding-top: 28px; color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
}
