:root {
  --bg: #f7f9fb;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #526070;
  --soft: #eef3f7;
  --line: #d7dee8;
  --blue: #256fb3;
  --red: #c2413a;
  --green: #0f766e;
  --maxw: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.58;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1.08;
}

h1,
h2 {
  font-family: "Source Serif 4", Georgia, serif;
}

h1 {
  max-width: 900px;
  font-size: clamp(1.95rem, 3.2vw, 3.25rem);
  font-weight: 600;
  text-align: center;
}

h2 {
  font-size: clamp(1.55rem, 2.4vw, 2.2rem);
  font-weight: 600;
  max-width: none;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 0.78rem max(1rem, calc((100vw - var(--maxw)) / 2));
  background: rgba(247, 249, 251, 0.92);
  border-bottom: 1px solid rgba(215, 222, 232, 0.9);
  backdrop-filter: blur(14px);
}

.nav-links a,
.links a {
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  width: auto;
  max-width: 100%;
  min-width: 0;
  justify-content: center;
  overflow-x: auto;
}

.nav-links a {
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  color: #4b5563;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: #e7f0f2;
  color: var(--ink);
}

.hero {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.hero-overlay {
  display: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(980px + 2rem);
  margin: 0 auto;
  padding: 2.15rem 1rem 1rem;
  text-align: center;
}

.venue {
  color: var(--green);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .venue {
  color: var(--green);
  margin-bottom: 0.75rem;
}

.hero h1 {
  color: var(--ink);
  text-shadow: none;
}

.authors {
  max-width: 72ch;
  margin: 1.05rem auto 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: break-word;
}

.authors a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.authors a:hover,
.authors a:focus-visible {
  text-decoration-color: var(--ink);
}

.affiliation {
  margin-top: 0.3rem;
  color: var(--muted);
}

.links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.links a,
.links span.todo {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.52rem 0.9rem;
  border: 1px solid #1f2937;
  border-radius: 7px;
  color: #ffffff;
  background: #1f2937;
  font-size: 0.92rem;
  font-weight: 800;
}

.links a:hover,
.links a:focus-visible {
  background: var(--ink);
  color: #ffffff;
}

.links .todo {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
}

.hero-summary {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: min(100%, calc(var(--maxw) + 2rem));
  margin: 0 auto;
  padding: 0.85rem 1rem 1.15rem;
  border-top: 1px solid var(--line);
}

.hero-summary span {
  padding: 0 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.hero-summary strong {
  color: var(--ink);
}

main {
  width: 100%;
}

.section {
  width: 100%;
  max-width: calc(var(--maxw) + 2rem);
  margin: 0 auto;
  padding: 3.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin-bottom: 1.25rem;
  min-width: 0;
}

.section-heading h2 {
  grid-column: 1;
}

.section-heading p {
  grid-column: 2;
  max-width: 68ch;
  padding-top: 0.2rem;
  font-size: 1.06rem;
}

.intro-section {
  padding-top: 3rem;
}

.path-lab {
  display: grid;
  border: 1px solid var(--line);
  background: var(--paper);
  min-width: 0;
}

.path-stage {
  position: relative;
  height: 300px;
  max-height: 300px;
  min-height: 0;
  overflow: hidden;
  contain: layout paint size;
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, #f3f7fb 72%);
}

.path-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.hero-anim-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.path-panel {
  display: block;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  min-width: 0;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.path-card {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 1rem;
}

.path-card:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.path-card:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.hero-anim-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.hero-anim-btn {
  min-width: 4.8rem;
  min-height: 2.2rem;
  border: 1px solid #1f2937;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.hero-anim-btn:hover,
.hero-anim-btn:focus-visible {
  background: #111827;
}

.hero-anim-scrubber {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.hero-anim-scrubber input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--blue);
}

#hero-anim-t-val {
  width: 3.2ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hero-anim-plot {
  margin: 0;
  min-width: 0;
}

.hero-anim-plot canvas,
.vel-canvas-wrap canvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.hero-anim-plot canvas {
  height: 230px;
}

figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.evidence-item {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-height: 100%;
  padding: 1.1rem;
  border: 1px solid var(--line);
  background: var(--paper);
  min-width: 0;
}

.evidence-item:first-child,
.evidence-item-wide {
  grid-column: 1 / -1;
  gap: 1.3rem;
}

.paper-observation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: min(100%, 660px);
  margin: 0.1rem auto 0;
}

.paper-observation-grid figcaption {
  max-width: 78ch;
  margin-right: auto;
  margin-left: auto;
}

.item-index {
  display: inline-block;
  margin-bottom: 0.65rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.evidence-item h3,
.method-steps h3,
.vel-side h3 {
  margin-bottom: 0.42rem;
}

.evidence-item p,
.method-steps p,
.vel-side p {
  max-width: 62ch;
  font-size: 0.96rem;
}

.evidence-copy-wide p {
  max-width: none;
}

.figure-clean {
  margin: 0;
}

.figure-clean img,
.method-figure img {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.vel-demo {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.vel-canvas-wrap {
  aspect-ratio: 16 / 9;
}

.vel-canvas-wrap canvas {
  height: 100%;
}

.vel-side {
  align-self: center;
}

.vel-controls {
  margin-top: 0.85rem;
}

.swap-demo {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.4rem;
}

.swap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.swap-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.45rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.45s ease, box-shadow 0.45s ease, transform 0.45s ease;
}

.swap-panel.is-paired {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.28), 0 6px 18px rgba(15, 118, 110, 0.14);
  transform: translateY(-2px);
}

.swap-panel:not(.is-paired) {
  opacity: 0.55;
  filter: saturate(0.7);
}

.swap-panel-label {
  display: grid;
  gap: 0.05rem;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.25;
}

.swap-panel-label .swap-sub {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
}

.swap-panel.is-paired .swap-panel-label {
  color: var(--green);
}

.swap-panel img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  background: #f1f5f9;
  align-self: end;
}

.swap-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.swap-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 1.4em;
}

.vel-bar-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 3.8ch;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.vel-bar {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf2;
}

#vel-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #e18a82, var(--red));
  transition: width 0.06s linear;
}

#vel-bar-val {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.method-steps,
.result-band,
.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.method-steps article,
.result-band article {
  padding: 1.1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.method-figure {
  width: min(100%, 760px);
  margin: 1rem auto 0;
}

.method-figure figcaption {
  max-width: 78ch;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.result-band {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-band article {
  min-height: 9rem;
}

.result-band p {
  min-height: 2.8rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.result-band strong {
  display: block;
  margin-top: 0.6rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.08;
}

.result-band span {
  display: block;
  margin-top: 0.45rem;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  margin-top: 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

th {
  background: #edf3f8;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.improve {
  color: var(--green);
  font-weight: 900;
}

.examples-section .section-heading {
  margin-bottom: 1.5rem;
}

.example-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.qual-figure {
  margin: 0;
}

.qual-figure img {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  width: 100%;
  margin: 0 auto;
}

.sample-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 1.25rem;
}

.sample-strip img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.citation-section pre {
  margin: 0;
  padding: 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  font-size: 0.88rem;
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: calc(var(--maxw) + 2rem);
  margin: 0 auto;
  padding: 1.6rem 1rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.footer a:hover,
.footer a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .site-nav {
    align-items: center;
    gap: 0;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    min-height: auto;
  }

  .hero-inner {
    padding-top: 2rem;
  }

  .hero-summary,
  .section-heading,
  .vel-demo,
  .method-steps,
  .result-band,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .section-heading h2,
  .section-heading p {
    grid-column: auto;
  }

  .section-heading {
    gap: 0.8rem;
  }

  .path-panel,
  .path-grid,
  .paper-observation-grid {
    grid-template-columns: 1fr;
  }

  .path-card:nth-child(odd) {
    border-right: 0;
  }

  .path-card:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .swap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .path-stage {
    height: 280px;
    max-height: 280px;
  }

  .hero-anim-plot canvas {
    height: 220px;
  }

}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 104px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(1.7rem, 8vw, 2.2rem);
  }

  .section {
    padding: 3rem 0.55rem;
  }

  .hero-inner,
  .hero-summary,
  .footer {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .hero-summary span {
    padding-right: 0;
    width: auto;
    max-width: calc(100vw - 1.1rem);
  }

  .hero-anim-controls {
    grid-template-columns: 1fr;
    width: calc(100vw - 2.1rem);
    max-width: calc(100vw - 1.1rem);
  }

  .section-heading p,
  .path-card figcaption,
  .evidence-item p,
  .vel-side p {
    width: calc(100vw - 1.1rem);
    max-width: calc(100vw - 1.1rem);
  }

  .path-lab,
  .path-grid,
  .path-card {
    width: 100%;
    max-width: calc(100vw - 1.1rem);
  }

  .path-stage,
  .hero-anim-plot canvas {
    width: 100%;
    max-width: calc(100vw - 3.1rem);
  }

  .path-stage {
    height: 250px;
    max-height: 250px;
  }

  .hero-anim-plot canvas {
    height: 190px;
  }

  .vel-bar-wrap {
    grid-template-columns: 1fr;
  }

  #vel-bar-val {
    text-align: left;
  }

  .sample-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer {
    flex-direction: column;
  }
}
