/* Centered paper layout with a stone palette and Georgia headings. */
:root {
  color-scheme: light;
  --bg: light-dark(#fff, #0c0c0c);
  --ink: light-dark(#1c1917, #f5f5f4);
  --body: light-dark(#44403c, #d6d3d1);
  --quiet: light-dark(#57534e, #a8a29e);
  --faint: light-dark(#78716c, #a8a29e);
  --panel: #f8f8f8;
  --rule: light-dark(#e7e5e4, #292524);
  --rule-strong: light-dark(#d6d3d1, #57534e);
  --accent: light-dark(#44403c, #d6d3d1);
  --button: light-dark(#1c1917, #f5f5f4);
  --button-hover: light-dark(#292524, #e7e5e4);
  --button-text: light-dark(#fff, #1c1917);

  --sans: Inter, system-ui, -apple-system, sans-serif;
  --heading: Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --page-width: 54rem;
  --page-gutter: 3rem;
  --section-gap: clamp(1.5rem, 3.5vw, 2.25rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font: 400 1rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--rule-strong); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* One centered column sets the width for the paper and its figures. */
.article { width: min(var(--page-width), 100% - 2 * var(--page-gutter)); margin-inline: auto; }
.full { width: 100%; margin: 2.5rem 0 0; }
.article > p:not(.caption), .abstract p {
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}

.note {
  margin: 1.5rem 0 0; padding: 1rem 1.5rem;
  border-radius: 8px; background: var(--panel); color: var(--quiet);
  text-align: center; font-size: 0.875rem; line-height: 1.65;
}
.note p { margin: 0 0 0.5rem; }
.note p:last-child { margin-bottom: 0; }

/* Masthead */
.masthead { text-align: center; padding-top: clamp(0.875rem, 1.8vw, 1.5rem); margin: 0; }
article > .masthead { padding-top: clamp(1.75rem, 4vw, 3rem); }
h1, h2, h3 { font-family: var(--heading); }
.masthead h1 {
  font-size: clamp(1.375rem, 3.1vw, 1.875rem); line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 700; color: var(--ink); margin: 0 0 1.5rem; text-wrap: balance;
}
.authors { line-height: 1.5; color: var(--ink); margin: 0 auto 0.75rem; }
.authors .line {
  display: flex; flex-wrap: wrap; justify-content: center; column-gap: clamp(1rem, 2.4vw, 2rem); row-gap: 0.2rem;
}
.authors .line + .line { margin-top: 0.2rem; }
.authors .a { font-weight: 500; white-space: nowrap; }
.authors sup { font-size: 0.66em; font-weight: 400; }
.affil, .contrib { font-size: 0.71875rem; line-height: 1.6; color: var(--quiet); }
.affil { max-width: 58rem; margin-inline: auto; }
.affil .line {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.15em 1.3em;
}
.affil .line + .line { margin-top: 0.15em; }
.affil sup { font-size: 0.76em; padding-right: 0.15em; }
.contrib { margin: 0.5rem auto 0; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: 0.5rem; text-decoration: none;
  font-size: 0.8125rem; line-height: 1.25rem; font-weight: 500;
}
.btn svg { width: 1em; height: 1em; }
.btn-paper {
  background: var(--button); color: var(--button-text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%);
}
.btn-paper:hover { background: var(--button-hover); text-decoration: none; }
.btn-soon {
  background: #fff; border: 1px solid transparent;
  color: #000; opacity: 0.55; pointer-events: none;
}
.btn-soon::after { content: "soon"; font-size: 0.71875rem; }

.abstract { background: var(--panel); border-radius: 8px; padding: 1.5rem 2rem 2rem; margin: var(--section-gap) 0 0; }
.abstract h2 { margin: 0 0 1.25rem; }
.abstract p { margin: 0; }

h2, h3 { color: var(--ink); font-weight: 600; text-align: center; text-wrap: balance; }
h2 {
  font-size: clamp(1.125rem, 2.3vw, 1.375rem); line-height: 1.25; letter-spacing: -0.015em;
  margin: var(--section-gap) 0 1.25rem; scroll-margin-top: 1.5rem;
}
h3 { font-size: 1rem; line-height: 1.5; margin: 1.5rem 0 1rem; }
p { margin: 0 0 1.5rem; }
a { color: var(--ink); text-decoration-color: var(--faint); text-underline-offset: 0.19em; }
a:hover { text-decoration-color: currentColor; }
strong, b { color: var(--ink); font-weight: 650; }
code { font: inherit; }

/* Display equations */
.eq { margin: 0.4rem 0 1.1rem; color: var(--ink); }
.katex-display {
  position: relative; margin: 0; overflow-x: auto; overflow-y: hidden; padding: 0.15rem 0;
}
#fitted-scaling .katex-display > .katex {
  width: max-content; min-width: 0; margin-inline: auto;
  padding: 0.35em 0.6em; background: #f2f2ff;
}

/* Figures and animations */
figure { margin: 0; }
figure.full { margin: 2rem 0 2.5rem; }
figure.full:has(+ h2, + .abstract) { margin-bottom: 1.5rem; }
#method, #data { margin-bottom: 0.75rem; }
#architecture, #training-protocol, #data-sampling { margin-top: 1rem; }
#architecture, #data + p { margin-bottom: 1rem; }
.full img, .diagram-video {
  display: block; width: 100%; height: auto; margin: 0 auto; background: #fff;
}
.zoom { display: block; cursor: zoom-in; text-decoration: none; }
figcaption, .caption {
  font-size: 0.8125rem; line-height: 1.6; color: var(--quiet);
  margin-top: 0.85rem; text-align: center; text-wrap: pretty;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0.4rem 0 1.4rem; position: relative; }
table { border-collapse: collapse; font-size: 0.75rem; width: 100%; }
th, td { text-align: right; padding: 0.5rem 0.7rem; }
th { font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
td { color: var(--body); border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
td:first-child { color: var(--ink); }
tr.ours td { background: var(--panel); font-weight: 650; color: var(--ink); }
table.exponents th:not(:first-child) { font-size: 0.8125rem; }
.table-wrap + .caption { margin-top: -0.6rem; }

/* Citation and footer */
.bibtex {
  position: relative; background: var(--panel); border-radius: 8px; padding: 1.3rem 1.6rem;
  overflow-x: auto; margin: 1rem 0;
}
.bibtex pre { margin: 0; font: 0.75rem/1.7 var(--mono); color: var(--body); }
.copy {
  position: absolute; top: 0.6rem; right: 0.6rem; font: 500 0.8125rem/1.3 var(--sans);
  border: 1px solid var(--rule-strong); background: var(--panel); color: var(--ink);
  border-radius: 6px; padding: 0.35em 0.7em; cursor: pointer;
}
.copy:hover { border-color: var(--accent); }
footer { border-top: 1px solid var(--rule); margin-top: var(--section-gap); padding: 1.5rem 0 3.5rem; text-align: center; }
footer h3 { margin-top: 0; }
footer p {
  font-size: 0.71875rem; line-height: 1.6; color: var(--quiet); margin: 0 auto 0.7rem;
  text-wrap: balance;
}
.acknowledgment-logos {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 1rem; margin: 1rem 0;
}
.acknowledgment-logos img { width: auto; margin: 0; }
.acknowledgment-logos .jump-logo { height: 2.25rem; }
.acknowledgment-logos .amd-logo { height: 1.875rem; }

@media (max-width: 60rem) {
  .masthead h1 br { display: none; }
}
@media (max-width: 900px) {
  :root { --page-gutter: 1.5rem; }
}
@media (max-width: 640px) {
  .masthead h1 { font-size: clamp(1.1875rem, 5.3vw, 1.5rem); }
  .abstract { padding: 1.25rem 1.2rem 1.3rem; }
  /* A phone column is too narrow to justify cleanly. */
  .abstract p, .article > p:not(.caption) { text-align: left; }
  .eq { font-size: 0.8125rem; }
  .katex-display > .katex { width: max-content; min-width: 100%; }
  #fitted-scaling .katex-display > .katex { padding-inline: 0.35em; }
  th, td { padding: 0.45rem 0.5rem; }
}
@media (max-width: 600px) {
  :root { --page-gutter: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; }
  .reveal.is-revealed {
    opacity: 1;
    animation: fade-in var(--reveal-duration, 500ms) ease-out var(--reveal-delay, 0ms) backwards;
  }
  .intro-reveal { --reveal-duration: 750ms; --reveal-delay: 160ms; }
  .opening-reveal { --reveal-duration: 250ms; }

  .masthead h1.reveal.is-revealed,
  #figure3 img.reveal.is-revealed {
    animation-name: opening-fade-in;
    animation-duration: 300ms;
    animation-timing-function: ease-in-out;
  }
  /* Keep focused controls visible while their component is fading. */
  .reveal:focus-within, .zoom:focus-visible > .reveal {
    opacity: 1 !important; transform: none !important;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes opening-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
