/* Palette follows the paper's figures: navy for the least-squares reference,
   green for the fine-tuned model, violet for pretrained, rust for path divergence. */
:root {
  --ground: #ffffff;
  --plate: #ffffff;
  --ink: #17213a;
  --muted: #566076;
  --line: #d6dbe4;
  --green: #2c7a52;
  --green-wash: #e7f1ea;
  --violet: #6a4fa3;
  --rust: #b0602f;
  --display: "Inter", "Helvetica Neue", Arial, sans-serif;
  --text: "Inter", "Helvetica Neue", Arial, sans-serif;
  --measure: 72ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--green); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.wrap { width: min(100% - 2.5rem, 1080px); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.1em; }
.prose ul { margin: 0 0 1.1em; padding-left: 1.2em; }
.prose li { margin-bottom: 0.5em; }

h1, h2, h3, .sitenav, .btn, .widget, table, .facts, .finding h3, figcaption, summary, .bibtex button, footer {
  font-family: var(--display);
}
h1 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.02em;
  max-width: 26ch;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
  max-width: 34ch;
  margin: 0 0 1.4rem;
  text-wrap: balance;
}
h3 { font-size: 1.1rem; font-weight: 620; margin: 0 0 0.35rem; }
h3.sub { font-size: 1.3rem; margin: 2.6rem 0 0.8rem; }

/* Navigation */
.sitenav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.sitenav .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 3.25rem; }
.sitenav-home { font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; }
.sitenav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0 0 0 auto; padding: 0; overflow-x: auto; }
.sitenav li a { color: var(--muted); text-decoration: none; white-space: nowrap; padding: 0.9rem 0; display: block; }
.sitenav li a:hover, .sitenav li a[aria-current="true"] { color: var(--ink); }
.sitenav li a[aria-current="true"] { box-shadow: inset 0 -2px 0 var(--green); }

/* Hero */
.hero { padding: 4.5rem 0 1rem; }
.authors { font-family: var(--display); font-size: 1.25rem; font-weight: 550; margin: 0; }
.affil { font-family: var(--display); color: var(--muted); margin: 0.1rem 0 1.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.4rem; }
.btn {
  display: inline-block;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
}
a.btn:hover { background: var(--green); }
.btn[aria-disabled="true"] { background: transparent; color: var(--muted); border: 1px dashed #aab2c0; }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
a.btn-quiet:hover { color: #fff; border-color: var(--green); }
.lede { font-size: 1.2rem; line-height: 1.55; max-width: 68ch; margin: 0 0 2.4rem; }

/* Sections */
main > section { padding: 4.5rem 0 1rem; }
main > section + section { border-top: 1px solid var(--line); margin-top: 3.5rem; }

/* Figures. Each image is drawn at 96 px per inch and shown at its natural width,
   so text inside figures is the same size across the page. */
.fig { margin: 2.4rem 0; }
.fig-scroll { overflow-x: auto; }
.fig img { max-width: 100%; height: auto; }
figcaption { font-size: 0.9rem; line-height: 1.5; color: var(--muted); margin-top: 0.8rem; max-width: 78ch; }

.hero-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 3rem; align-items: center; margin-bottom: 2.4rem; }
.hero-text .actions { margin-bottom: 0; }
.hero-video { margin: 0; }
.hero-video video { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.hero-video figcaption { margin-top: 0.5rem; }

.refs { list-style: none; margin: 0; padding: 0; max-width: 820px; font-size: 0.95rem; line-height: 1.5; }
.refs li { margin-bottom: 0.7em; padding-left: 1.5em; text-indent: -1.5em; scroll-margin-top: 4.5rem; }
.refs li:target { background: var(--green-wash); }

/* Three entry points in the overview */
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 2rem 0 2.4rem; border-top: 2px solid var(--ink); }
.trio a { color: inherit; text-decoration: none; padding: 1.1rem 1.4rem 1.2rem 0; }
.trio a + a { padding-left: 1.4rem; border-left: 1px solid var(--line); }
.trio a:hover h3 { color: var(--green); }
.trio p { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--muted); }

/* Equations */
.eq { overflow-x: auto; overflow-y: hidden; padding: 0.4rem 0; }
.katex { font-size: 1.04em; }

/* Tables */
.tablewrap { margin: 2.2rem 0; overflow-x: auto; }
.tablewrap.narrow { max-width: 760px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; line-height: 1.35; background: var(--plate); }
caption { caption-side: top; text-align: left; color: var(--muted); font-size: 0.9rem; line-height: 1.45; padding: 0 0 0.7rem; background: var(--ground); }
th, td { padding: 0.55rem 0.85rem; text-align: left; vertical-align: top; }
thead th { font-weight: 620; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
thead tr:first-child th { border-top: 1.5px solid var(--ink); }
tbody tr + tr td, tbody tr + tr th { border-top: 1px solid #e8ebf0; }
tbody tr.rule td { border-top: 1.5px solid var(--ink); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 1.5px solid var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.best { font-weight: 700; }
tr.ours td { background: var(--green-wash); }
table.matrix th[scope="row"] { font-weight: 620; }
details { margin-top: 0.9rem; }
summary { cursor: pointer; font-size: 0.93rem; font-weight: 550; color: var(--green); padding: 0.3rem 0; }
details table { margin-top: 0.7rem; }

/* Findings */
.finding {
  margin: 2.6rem 0 0;
  max-width: 820px;
  padding: 1.2rem 1.5rem 1.3rem;
  background: var(--green-wash);
  border-left: 4px solid var(--green);
}
.finding h3 { color: var(--green); font-size: 0.95rem; margin-bottom: 0.3rem; }
.finding p { margin: 0; font-size: 1.08rem; line-height: 1.55; }
.finding p + p { margin-top: 0.8em; }
.costs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin: 1.1rem 0 0; font-family: var(--display); text-align: center; }
.costs div { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 0.6rem 0.8rem; }
.costs dt { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.costs dd { margin: 0.15rem 0 0; font-size: 1.25rem; font-weight: 700; }
.costs .ours { border-color: var(--green); }
.costs .ours dt, .costs .ours dd { color: var(--green); }

/* Schedule widget */
.widget { margin: 2.4rem 0; background: var(--plate); border: 1px solid var(--line); border-radius: 6px; padding: clamp(1rem, 2.5vw, 1.6rem); max-width: 900px; }
.widget-head { display: flex; flex-wrap: wrap; gap: 0.8rem 2rem; align-items: end; justify-content: space-between; margin-bottom: 0.6rem; }
.widget-head h3 { font-size: 1.15rem; margin: 0; }
.widget-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; font-size: 0.93rem; }
.widget-controls output { display: inline-block; min-width: 3.2ch; font-weight: 700; font-variant-numeric: tabular-nums; color: #1f6aa5; }
#n-slider { width: 190px; accent-color: #2b7bba; }
.presets { display: flex; gap: 0.3rem; }
.presets button {
  font: inherit; font-size: 0.85rem; cursor: pointer;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--line); background: #f3f5f8; color: var(--ink);
}
.presets button:hover { border-color: var(--green); }
#gn-chart { width: 100%; font-family: var(--display); }
#gn-chart .axis { stroke: var(--ink); stroke-width: 1; }
#gn-chart .grid { stroke: #e8ebf0; stroke-width: 1; }
#gn-chart .tick { fill: var(--muted); font-size: 12px; }
#gn-chart .label { fill: var(--ink); font-size: 13px; }
/* Series colors match panel (a) of the paper's Gaussian figure. */
#gn-chart .vp { stroke: #d95f02; stroke-width: 2.5; fill: none; stroke-linejoin: round; }
#gn-chart .curve { stroke: #2b7bba; stroke-width: 3; fill: none; stroke-linejoin: round; }
#gn-chart .t-vp { fill: #b84f00; font-size: 13px; font-weight: 600; }
#gn-chart .t-curve { fill: #1f6aa5; font-size: 13px; font-weight: 600; }
.widget-note { margin: 0.5rem 0 0; font-size: 0.93rem; color: var(--muted); max-width: 75ch; }

/* Key facts */
.facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0 3rem; margin: 2rem 0; }
.facts div { display: flex; flex-direction: column-reverse; }
.facts dt { color: var(--muted); font-size: 0.92rem; }
.facts dd { margin: 0; font-size: 2.1rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Takeaways */
.takeaways { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2.5rem; max-width: 900px; }
.takeaways li { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.takeaways p { margin: 0; font-size: 1.02rem; line-height: 1.5; color: var(--muted); }

/* Citation */
.bibtex { position: relative; max-width: 820px; background: var(--ink); color: #e9edf5; border-radius: 6px; padding: 1.3rem 1.5rem; }
.bibtex pre { margin: 0; overflow-x: auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86rem; line-height: 1.6; }
.bibtex button {
  position: absolute; top: 0.8rem; right: 0.8rem;
  font-size: 0.85rem; cursor: pointer;
  padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1px solid #5b6680; background: transparent; color: #e9edf5;
}
.bibtex button:hover { background: #26324f; }

footer { padding: 3.5rem 0 3rem; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 900px) {
  .hero-top { grid-template-columns: 1fr; }
  .hero-video { max-width: 520px; }
}

@media (max-width: 760px) {
  body { font-size: 1.05rem; }
  .sitenav-home { display: none; }
  .sitenav ul { margin-left: 0; }
  .hero { padding-top: 2.5rem; }
  .hero-top { gap: 1.8rem; }
  .lede { font-size: 1.15rem; }
  .trio, .takeaways { grid-template-columns: 1fr; }
  .costs dd { font-size: 1.05rem; }
  .fig img[width="1037"], .fig img[width="1040"] { min-width: 700px; max-width: none; }
  .fig img[width="902"], .fig img[width="860"], .fig img[width="820"] { min-width: 620px; max-width: none; }
  .trio a, .trio a + a { padding: 1rem 0; border-left: 0; }
  .trio a + a { border-top: 1px solid var(--line); }
  .facts { grid-template-columns: repeat(2, auto); gap: 1.2rem 2.5rem; }
  .bibtex button { position: static; margin-bottom: 0.8rem; }
  main > section { padding-top: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

thead th.grp { text-align: center; }
thead tr:first-child th.grp { border-bottom: 1px solid var(--line); }
