/* Colours follow the teaser figure: viridis contours, green = GGL, blue = Langevin / input, red = guidance. */
:root {
  --text: #23222b;
  --muted: #6f6d7a;
  --line: #e7e5ee;
  --accent: #46327e;        /* outer viridis contour */
  --accent-dark: #2f1f5f;
  --accent-soft: #f4f2fa;
  --accent-line: #dcd6ee;
  --teal: #21918c;
  --ggl: #2ca02c;
  --ggl-soft: #eef7ee;
  --langevin: #1f77b4;
  --guidance: #d62728;
  --viridis: linear-gradient(90deg, #440154, #3b528b 25%, #21918c 50%, #5ec962 75%, #fde725);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.7; background: #fff; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }
section[id] { scroll-margin-top: 24px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; }
.skip-link:focus { left: 16px; z-index: 10; }

.container { width: min(1080px, calc(100% - 64px)); margin: 0 auto; }
.narrow { width: min(820px, calc(100% - 64px)); }

/* header */
.site-header { max-width: 1440px; margin: 0 auto; height: 72px; padding: 0 48px; display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -.2px; color: var(--accent-dark); }
.site-header nav { display: flex; gap: 26px; font-size: 13px; color: var(--muted); }

/* hero */
.hero { padding-top: 40px; text-align: center; }
h1 { margin: 0; font-size: 42px; font-weight: 700; letter-spacing: -1.2px; line-height: 1.2;
     background: linear-gradient(90deg, #440154, #3b528b 45%, #21918c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.authors { margin: 22px 0 4px; font-size: 17px; line-height: 1.9; }
.authors span { display: inline-block; white-space: nowrap; margin: 0 10px; }
.authors a { border-bottom: 1px solid var(--accent-line); }
.authors a:hover { border-bottom-color: var(--accent); }
.affiliations { margin: 0; color: var(--muted); font-size: 14.5px; }
.affiliations span { display: inline-block; margin: 0 10px; }
.venue { display: inline-block; margin: 14px 0 22px; padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13.5px; letter-spacing: .3px; }
.hero-actions { display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.paper-button, .citation-block summary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 112px; height: 38px; padding: 0 16px; border-radius: 6px; font-size: 13.5px; font-weight: 500; }
.paper-button { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.paper-button:hover { background: var(--accent-dark); color: #fff; }
.paper-button svg { width: 16px; height: 16px; }
.citation-block { text-align: center; }
.citation-block summary { list-style: none; cursor: pointer; border: 1px solid var(--accent-line); color: var(--accent); background: #fff; }
.citation-block summary::-webkit-details-marker { display: none; }
.citation-block[open] summary { background: var(--accent-soft); }
.citation-block pre { position: absolute; left: 50%; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); margin-top: 8px; z-index: 5; text-align: left; }
pre { padding: 14px 18px; border: 1px solid var(--line); border-radius: 6px; background: #faf9fc; color: #4a4858; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.viridis-rule { height: 3px; width: min(420px, 70%); margin: 36px auto 0; border-radius: 3px; background: var(--viridis); opacity: .85; }

/* teaser */
.teaser { margin-top: 36px; }
.teaser img { margin: 0 auto; width: min(100%, 1000px); }
figcaption, .caption { margin: 14px auto 0; max-width: 820px; font-size: 14px; line-height: 1.65; color: var(--muted); text-align: center; }
.c-langevin { color: var(--langevin); font-weight: 600; }
.c-ggl { color: var(--ggl); font-weight: 600; }
.c-guidance { color: var(--guidance); font-weight: 600; }
.tldr { max-width: 820px; margin: 28px auto 0; padding: 14px 20px; border-left: 3px solid var(--ggl); background: var(--ggl-soft); border-radius: 0 6px 6px 0; font-size: 15.5px; }
.tldr strong { color: var(--ggl); margin-right: 6px; }

/* sections */
section > h2 { margin: 72px 0 10px; font-size: 28px; font-weight: 700; letter-spacing: -.6px; color: var(--accent-dark); text-align: center; }
.section-intro { max-width: 760px; margin: 0 auto 22px; text-align: center; color: var(--muted); font-size: 15px; }
#abstract p { text-align: justify; }

/* method */
.method-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.method-card .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.method-card { position: relative; padding: 20px 24px 14px 64px; border: 1px solid var(--line); border-radius: 10px; }
.method-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--accent-dark); }
.method-card p { margin: 0 0 8px; }
.step-index { position: absolute; left: 20px; top: 20px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff; }
.method-card:nth-child(1) .step-index { background: #3b528b; }
.method-card:nth-child(2) .step-index { background: var(--teal); }
.method-card:nth-child(3) .step-index { background: var(--ggl); }
.katex-display { margin: 10px 0; overflow-x: auto; overflow-y: hidden; }
.mini-table { border-collapse: collapse; margin: 8px 0 4px; font-size: 14px; }
.mini-table th, .mini-table td { padding: 4px 14px; border-bottom: 1px solid var(--line); text-align: right; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; padding-left: 0; }
.mini-table th { font-weight: 600; color: var(--muted); }
.mini-table .is-ours td { color: var(--ggl); }
.autoencoder-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; margin: 10px 0 20px; }
.autoencoder-row .note { margin-bottom: 0; }
.autoencoder-figure { display: block; width: 100%; height: auto; max-height: 198px; margin: 0 auto; }
.autoencoder-figure image { pointer-events: none; }
.autoencoder-figure text { font-family: Arial, 'Liberation Sans', Helvetica, sans-serif; fill: #000; cursor: text; user-select: text; }
.autoencoder-figure .ae-math { font-family: KaTeX_Math, 'Times New Roman', serif; font-style: italic; }
.autoencoder-row .mini-table { margin-top: 0; }
.autoencoder-row .mini-table th, .autoencoder-row .mini-table td { padding: 9px 10px; white-space: nowrap; }
.autoencoder-row .mini-table th:first-child, .autoencoder-row .mini-table td:first-child { padding-left: 0; }
.note { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* tabs */
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 22px; }
.tabs button { border: 0; background: none; padding: 6px 1px 7px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--accent); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs-secondary { margin-top: 4px; }
.tabs-secondary button { font-size: 13px; }

/* viewers */
.viewer-card { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.viewer { position: relative; width: 100%; aspect-ratio: 16 / 9; background: radial-gradient(ellipse at 50% 40%, #ffffff 0%, #f3f2f8 100%); touch-action: none; }
.viewer canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; pointer-events: none; }
.viewer-controls { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.viewer-controls.centered { justify-content: center; border-top: 0; padding-top: 14px; }
.viewer-controls input[type="range"] { flex: 1; accent-color: var(--ggl); }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--accent-line); border-radius: 50%; background: #fff; color: var(--accent); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button .icon-play { display: none; }
.icon-button.paused .icon-play { display: block; }
.icon-button.paused .icon-pause { display: none; }
.step-label { min-width: 112px; font-variant-numeric: tabular-nums; color: var(--text); }
.toggle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.toggle input { accent-color: var(--langevin); }
.text-button { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 3px 12px; font-size: 13px; color: var(--muted); }
.text-button:hover { color: var(--accent); border-color: var(--accent-line); }
.curve { height: 96px; padding: 6px 16px 10px; border-top: 1px solid var(--line); }
.curve svg { width: 100%; height: 100%; overflow: visible; }
.curve text { font-size: 11px; fill: var(--muted); }
.curve .init-mark line { stroke: var(--guidance); stroke-width: 1.2; stroke-dasharray: 3 3; }
.curve .init-mark circle { fill: var(--guidance); }

.compare-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 18px; }
.compare-side .viewer { aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.method-select { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.method-select select { min-width: 160px; padding: 5px 10px; border: 1px solid var(--accent-line); border-radius: 6px; background: #fff; color: var(--text); font-size: 14px; }
.metric { margin: 8px 0 0; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.metric b { color: var(--text); font-weight: 600; }
.metric.is-ours b { color: var(--ggl); }

/* results */
.results-tabs { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.results-table th, .results-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.results-table th { font-weight: 600; color: var(--muted); font-size: 13px; }
.results-table thead tr:first-child th { color: var(--accent-dark); font-size: 14px; }
.results-table td:first-child, .results-table th:first-child { text-align: left; }
.results-table tr.group-start td { border-top: 1.5px solid #cfcbe0; }
.results-table tr.is-ours td:first-child { background: var(--ggl-soft); }
.results-table tr.is-ours td:first-child { color: var(--ggl); font-weight: 700; }
.results-table b { font-weight: 700; color: var(--accent-dark); }

.citation-section pre { margin: 0; }
.site-footer { display: flex; justify-content: space-between; margin-top: 64px; padding: 22px 0 36px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

@media (max-width: 820px) {
  .site-header { padding: 0 16px; }
  .site-header nav { display: none; }
  .container, .narrow { width: calc(100% - 32px); }
  h1 { font-size: 28px; letter-spacing: -.6px; }
  h1 br { display: none; }
  .compare-pair { grid-template-columns: 1fr; }
  .method-card { padding: 18px 16px 12px 52px; }
  .autoencoder-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .autoencoder-figure { max-height: none; }
  .step-index { left: 14px; }
  .viewer { aspect-ratio: 4 / 3; }
  .viewer-controls { flex-wrap: wrap; }
  .viewer-controls input[type="range"] { flex-basis: 100%; order: 3; }
}
