/* ==========================================================================
   Preconditioned Flow Matching — project page
   ========================================================================== */

:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --tint: #f5f7fb;
  --ink: #0c1220;
  --body: #26303f;
  --muted: #5a6478;
  --line: #e4e8f0;
  --line-soft: #eef1f6;
  --accent: #2f4bd8;
  --accent-soft: #eef2ff;
  --amber: #b8720b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(12, 18, 32, .04), 0 12px 32px -18px rgba(12, 18, 32, .28);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 26px; }
.wrap.narrow { max-width: 780px; }

/* ------------------------------------------------------------------ nav -- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(252, 252, 253, .82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 26px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.nav-brand {
  font-weight: 650;
  font-size: .95rem;
  color: var(--ink);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.nav-links { display: flex; gap: 22px; font-size: .88rem; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ----------------------------------------------------------------- hero -- */
.hero { padding: 74px 0 26px; text-align: center; }

.venue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.venue .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5.2vw, 3.55rem);
  line-height: 1.06;
  letter-spacing: -.028em;
  font-weight: 700;
  color: var(--ink);
}

.tagline {
  margin: 16px auto 0;
  max-width: 640px;
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  color: var(--muted);
}

.authors {
  margin: 30px auto 0;
  max-width: 840px;
  font-size: 1.02rem;
  color: var(--ink);
  line-height: 2;
}
.authors span { white-space: nowrap; }
.authors sup { font-size: .66em; color: var(--muted); margin-left: 1px; }

.affils { margin: 6px 0 0; font-size: .92rem; color: var(--muted); }
.affils sup { font-size: .7em; }

.cta { margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: .93rem;
  font-weight: 550;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); border-color: #d7dce8; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #16203a; border-color: #16203a; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------- sections -- */
.section { padding: 66px 0; scroll-margin-top: 76px; }
.section.tinted {
  background: var(--tint);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(1.55rem, 2.7vw, 2.05rem);
  line-height: 1.22;
  letter-spacing: -.018em;
  font-weight: 680;
  color: var(--ink);
}

h3 { color: var(--ink); font-size: 1.08rem; letter-spacing: -.01em; margin: 0 0 8px; }
h4 { color: var(--ink); font-size: .98rem; margin: 0 0 8px; }

.subhead {
  margin: 56px 0 0;
  font-size: 1.22rem;
  letter-spacing: -.012em;
}

.lead { font-size: 1.1rem; line-height: 1.78; color: var(--body); }
.narrow-text { max-width: 760px; }
.small { font-size: .88rem; color: var(--muted); }
.dim { color: var(--muted); font-size: .84em; }

/* ----------------------------------------------------------------- video -- */
.video-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.player { position: relative; background: #0a0e16; }
.video-wrap { position: relative; line-height: 0; }
.video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0e16;
  cursor: pointer;
}

/* big centred play button, visible while paused */
.bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border: none;
  border-radius: 50%;
  background: rgba(12, 18, 32, .62);
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  padding-left: 5px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.bigplay:hover { background: rgba(12, 18, 32, .82); transform: translate(-50%, -50%) scale(1.06); }
.player.is-playing .bigplay { opacity: 0; pointer-events: none; }

/* control bar */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0c1220;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.ic {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #dbe4f2;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ic:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.ic:focus-visible, .scrub:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic.wide { width: 44px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.ic svg, .bigplay svg { width: 17px; height: 17px; fill: currentColor; display: block; }
.bigplay svg { width: 30px; height: 30px; }
.bigplay { display: flex; align-items: center; justify-content: center; padding-left: 0; }

/* icon states (specificity must beat ".ic svg { display:block }") */
.ic .i-pause, .bigplay .i-replay { display: none; }
.player.is-playing .ic .i-play { display: none; }
.player.is-playing .ic .i-pause { display: block; }
.player.is-ended .bigplay .i-play { display: none; }
.player.is-ended .bigplay .i-replay { display: block; }
.player.is-ended .bigplay { opacity: 1; pointer-events: auto; }

.scrub {
  position: relative;
  flex: 1 1 auto;
  height: 34px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.scrub-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.scrub-buffer { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, .14); }
.scrub-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--amber); }
.scrub-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.scrub:hover .scrub-thumb { transform: translateY(-50%) scale(1.15); }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks i {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 9px;
  margin-top: -4.5px;
  background: rgba(12, 18, 32, .85);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
.time {
  flex: 0 0 auto;
  color: #93a2b8;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* chapter strip */
.chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 12px;
  background: #0c1220;
}
.chapters button {
  border: 1px solid rgba(255, 255, 255, .12);
  background: transparent;
  color: #a9b6ca;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .72rem;
  cursor: pointer;
  transition: all .15s ease;
}
.chapters button:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.chapters button.current { color: #0c1220; background: #ffc15e; border-color: #ffc15e; }
.chapters button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 20px 26px 22px;
}
.video-meta p { margin: 6px 0 0; font-size: .94rem; color: var(--muted); line-height: 1.62; }
.video-meta h3 { margin: 0; }

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

.claim {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px 20px;
}
.claim-num {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--accent);
}
.claim h3 { font-size: 1.02rem; }
.claim p { font-size: .93rem; line-height: 1.66; margin: 0 0 12px; color: var(--muted); }
.claim p.eq {
  margin: 14px 0;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: .74rem;
  white-space: nowrap;
  line-height: 1.55;
  color: #1b2a4a;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  overflow-x: auto;
}

/* ---------------------------------------------------------------- method -- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 34px 0 46px; }
.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.step-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.step p { margin: 8px 0 0; font-size: .93rem; line-height: 1.66; color: var(--muted); }
.step p.eq {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: .76rem;
  white-space: nowrap;
  color: #1b2a4a;
  background: var(--tint);
  padding: 9px 11px;
  border-radius: 6px;
  overflow-x: auto;
}

.theory { display: grid; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: start; margin-top: 44px; }
.theory h3 { font-size: 1.05rem; }
.theory p { font-size: .96rem; color: var(--muted); margin: 0; }

.algobox {
  background: #0c1220;
  color: #c9d6ea;
  border-radius: var(--radius);
  padding: 20px 22px 16px;
  font-size: .9rem;
}
.algotitle { margin: 0 0 10px; font-size: .82rem; letter-spacing: .04em; color: #8fa3c4; text-transform: uppercase; font-weight: 650; }
.algobox ol { margin: 0; padding-left: 20px; }
.algobox li { margin: 7px 0; line-height: 1.55; }
.algobox em { color: #ffd08a; font-style: normal; }

/* --------------------------------------------------------------- figures -- */
.figure { margin: 34px 0 0; position: relative; }
.figure:hover::after {
  content: "⤢  enlarge";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(12, 18, 32, .72);
  color: #fff;
  font-size: .74rem;
  letter-spacing: .02em;
  pointer-events: none;
}
.figure img {
  width: 100%;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: zoom-in;
}
.figure.wide { margin-top: 44px; }
figcaption {
  margin-top: 12px;
  font-size: .89rem;
  line-height: 1.66;
  color: var(--muted);
  max-width: 940px;
}
figcaption strong { color: var(--ink); font-weight: 620; }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 22px; margin-top: 40px; }
.gallery .figure { margin: 0; }
.figure.centered { max-width: 660px; margin-left: auto; margin-right: auto; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; margin-top: 40px; }

.notecard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.notecard ul { margin: 10px 0 0; padding-left: 20px; }
.notecard li { margin: 10px 0; font-size: .93rem; line-height: 1.68; color: var(--muted); }

/* ---------------------------------------------------------------- tables -- */
.table-block { margin: 44px 0 0; }
.table-head h4 { margin: 0 0 4px; font-size: 1rem; }
.table-head p { margin: 0 0 14px; font-size: .89rem; color: var(--muted); }

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fafbfe;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafd; }
tbody tr.ours { background: var(--accent-soft); }
tbody tr.ours:hover { background: #e7edff; }
tbody td.best { font-weight: 700; color: var(--ink); }

/* ------------------------------------------------------------------ code -- */
.code-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 28px; margin-top: 32px; align-items: start; }

pre.code, .bibtex pre {
  margin: 0;
  padding: 20px;
  background: #0c1220;
  color: #cfdcf0;
  border-radius: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .83rem;
  line-height: 1.68;
}
pre.code code, .bibtex code { font-family: inherit; }

.repo-list { list-style: none; margin: 0; padding: 0; }
.repo-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--line);
}
.repo-list li:last-child { border-bottom: none; }
.repo-list code { font-family: var(--mono); font-size: .82rem; color: var(--accent); }
.repo-list span { font-size: .86rem; color: var(--muted); }

.bibtex { position: relative; margin-top: 26px; }
.bibtex .copy { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #d7e2f3; font-size: .8rem; padding: 6px 12px; }
.bibtex .copy:hover { background: rgba(255,255,255,.16); box-shadow: none; }

/* ---------------------------------------------------------------- license -- */
.license { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; }
.license > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
}
.license p { margin: 0; font-size: .9rem; color: var(--muted); line-height: 1.66; }
.license code { font-family: var(--mono); font-size: .84rem; }

/* ---------------------------------------------------------------- footer -- */
.footer { padding: 44px 0 56px; text-align: center; border-top: 1px solid var(--line); background: var(--surface); }
.footer p { margin: 0 0 8px; font-size: .92rem; }

/* -------------------------------------------------------------- lightbox -- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 4vh 4vw;
  background: rgba(8, 12, 20, .93);
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 8px; background: #fff; }
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .2); }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 920px) {
  .cards.three, .steps, .gallery, .two-col, .code-grid, .license, .theory { grid-template-columns: 1fr; }
  .section { padding: 52px 0; }
  .video-meta { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nav-links { gap: 16px; font-size: .82rem; }
}

@media (max-width: 560px) {
  .controls { gap: 6px; padding: 8px 10px; }
  .ic { width: 30px; height: 30px; }
  .ic.wide { width: 34px; font-size: .7rem; }
  .time { font-size: .68rem; letter-spacing: 0; }
  .scrub { min-width: 56px; }
  .chapters { padding: 2px 10px 10px; gap: 5px; }
  .chapters button { font-size: .67rem; padding: 3px 7px; }
  .bigplay { width: 62px; height: 62px; }
  .bigplay svg { width: 22px; height: 22px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero { padding-top: 52px; }
  .table-scroll { border-radius: 10px; }
  thead th, tbody td { padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}

/* ---------------------------------------------------------------- latex */
.eq {
  margin: 14px 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  white-space: normal;
  line-height: 1.5;
  color: #1b2a4a;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  overflow-x: auto;
}
.eq .katex-display { margin: 0; }
.eq .katex { font-size: 1.02em; }
.claim .eq { font-size: .92rem; }
.claim .eq .katex { font-size: .96em; }

/* algorithm block matches the width of the method figure above it */
.algo-row { max-width: 660px; margin: 40px auto 0; }
.algo-row .algobox { width: 100%; }
.algobox .katex { color: #ffd08a; font-size: .96em; }
.algobox ol { padding-left: 20px; }

.note-row { margin-top: 40px; }

/* method overview figure: compact, sits above the three steps */
.figure.fig-small { max-width: 400px; margin-left: auto; margin-right: auto; margin-top: 8px; margin-bottom: 34px; }
.figure.fig-small figcaption { max-width: 100%; margin-left: auto; margin-right: auto;
  text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }

/* justified body copy: paragraphs fill the measure */
p, figcaption, .lead, .video-meta p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.license p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
/* everything justified, including the narrow cards */
.claim p, .step p, .notecard p, .claim h3, .step h3 { text-align: justify; text-justify: inter-word;
  hyphens: auto; -webkit-hyphens: auto; }

/* page-wide: every block of text fills its measure */
body, p, li, figcaption, h1, h2, h3, h4, td, th, .lead, .small, .affils, .authors {
  text-align: justify;
  text-justify: inter-word;
}
p, li, figcaption, .lead, .claim p, .step p, .notecard p { hyphens: auto; -webkit-hyphens: auto; }

/* two-panel figure with one shared caption */
.figure-pair .pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.figure-pair .pair-grid img { width: 100%; display: block; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; cursor: zoom-in; }
.figure-pair figcaption { max-width: 100%; margin-top: 16px; }
@media (max-width: 780px) { .figure-pair .pair-grid { grid-template-columns: 1fr; } }

/* hero stays centred: the page-wide justify rule must not reach it */
.hero h1, .hero .tagline, .hero .authors, .hero .affils, .hero .venue {
  text-align: center;
  text-justify: auto;
  hyphens: manual;
  -webkit-hyphens: manual;
}

/* headings are set ragged-right: justification only stretches their word gaps */
h1, h2, h3, h4, h5, h6 { text-align: left; hyphens: manual; -webkit-hyphens: manual; }

/* equations carry the argument: set them a notch larger than the prose */
.eq .katex { font-size: 1.16em; }
.step .eq .katex { font-size: 1.24em; }
.step .eq { padding: 12px 14px; }
.claim .eq .katex { font-size: 1.05em; }
.algobox .katex { font-size: 1.02em; }

/* every caption spans exactly the width of the figure it belongs to */
figure .figure, .figure figcaption { max-width: 100%; width: 100%; box-sizing: border-box; }

/* claim-card equations: larger, they carry the formal statement */
.claim .eq { font-size: 1rem; padding: 12px 14px; }
.claim .eq .katex { font-size: 1.18em; }

/* equations sized to read as the statement, not as a footnote */
.eq .katex { font-size: 1.3em; }
.step .eq .katex { font-size: 1.4em; }
.claim .eq .katex { font-size: 1.36em; }
.step .eq { padding: 12px 10px; }
.claim .eq { padding: 12px 10px; }

/* ---------------------------------------------------------- phone layout */
.brand-short { display: none; }

@media (max-width: 720px) {
  /* full name on phones too: brand on its own row, links scroll beneath it */
  .brand-long { display: inline; }
  .brand-short { display: none; }
  .nav-inner { flex-direction: column; align-items: stretch; height: auto;
               padding: 9px 16px 3px; gap: 0; }
  .nav-brand { font-size: .92rem; }
  .nav-links { gap: 16px; font-size: .8rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 9px 0; display: inline-block; }   /* bigger tap targets */
  .wrap { padding: 0 16px; }
  .hero { padding: 48px 0 18px; }
  .hero h1 { font-size: clamp(1.95rem, 8.4vw, 2.5rem); }
  .authors { font-size: .95rem; line-height: 1.75; }
  .cta { gap: 8px; }
  .section { padding: 44px 0; scroll-margin-top: 96px; }
  .section h2 { font-size: 1.6rem; }
  .step, .claim { padding: 22px 18px; }
  .eq { padding: 10px 8px; }
  .step .eq .katex, .claim .eq .katex { font-size: 1.18em; }  /* fits the narrower card */
  .algobox { padding: 16px 16px 12px; }
}

@media (max-width: 420px) {
  .nav-links { gap: 12px; font-size: .76rem; }
  .hero h1 { font-size: 1.8rem; }
  .figure figcaption, figcaption { font-size: .84rem; }
}
