/* DVLA-RL++ project page. Layout and typography follow the OmniTaskonomy page template. */
:root {
  --background: #fff;
  --foreground: #344452;
  --body-copy: #344452;
  --body-secondary: #495967;
  --primary: #326eb1;
  --border: #e4e8ed;
  --muted: #f7f9fb;
  --tint: #f8fafc;
  --accent: #eef4fb;
  --accent-foreground: #285e98;
  --heading: #1e2a36;
  --term-align: #47799f;      /* "Vision-Language Alignment" */
  --term-gate: #a45862;       /* "Reinforcement Learning Gating" */
  --term-pur: #3f7d6a;        /* purification */
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Arial, Helvetica, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body-size: 1.075rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--sans);
  font-size: var(--body-size);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); color: var(--heading); font-weight: 600; margin: 0; }
h1 { font-size: clamp(2.3rem, 4.4vw, 3.6rem); line-height: 1.06; letter-spacing: -.03em; text-wrap: balance; }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.14; letter-spacing: -.02em; text-wrap: balance; }
h3 { font-size: 1.55rem; line-height: 1.2; color: #365872; margin-bottom: 12px; }
p { margin: 0 0 1em; }
strong { font-weight: 600; }
sup { line-height: 0; }

.shell { width: min(1080px, 100% - 64px); margin-inline: auto; }
.narrow { max-width: 850px; margin-inline: auto; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: #fff; padding: 10px 16px; }
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.paper-header { text-align: center; padding: 68px 0 34px; }
.paper-header h1 .title-second { font-weight: 500; display: block; margin-top: 6px; }
.term-align { color: var(--term-align); font-weight: 700; }
.term-gate { color: var(--term-gate); font-weight: 700; }
.term-pur { color: var(--term-pur); font-weight: 700; }
.venue-line { margin: 20px auto 0; font-family: var(--serif); font-size: 1.25rem; color: #4f6273; font-weight: 500; }
.venue-line .venue-badge {
  display: inline-block; border: 1px solid #c9d7e4; border-radius: 999px; padding: 2px 14px;
  background: var(--accent); color: var(--accent-foreground); font-family: var(--sans); font-size: .82rem;
  font-weight: 600; letter-spacing: .04em; margin-left: 8px; vertical-align: middle;
}
.paper-authors { color: #3e5265; max-width: 1040px; margin: 24px auto 0; }
.paper-authors sup { color: #5f7890; margin-left: 1px; font-size: .72em; }
.author-list, .affiliation-list { display: flex; flex-wrap: wrap; justify-content: center; }
.author-list { align-items: baseline; gap: 2px 14px; font-size: 15px; font-weight: 700; line-height: 1.55; }
.author { color: #000; white-space: nowrap; }
.author a { color: #000; }
.author a:hover { color: var(--primary); }
.affiliation-list { color: #5b6c7b; gap: 3px 14px; margin-top: 8px; font-size: 14px; line-height: 1.55; }
.resource-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.resource-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 8px 18px; border-radius: 22px; font-size: .9rem; font-weight: 500; line-height: 1.5;
  color: #fff; background: #292d32; border: 1px solid #292d32; transition: background .15s, border-color .15s;
}
.resource-button:hover { background: #41474e; border-color: #41474e; text-decoration: none; }
.resource-button svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
.resource-button.is-disabled { background: #e8ecf0; border-color: #e8ecf0; color: #7a8794; cursor: not-allowed; }
.resource-button.is-disabled:hover { background: #e8ecf0; }

/* ---------------------------------------------------------------- overview */
.overview { padding-bottom: 28px; }
.tldr-heading { text-align: center; letter-spacing: -.015em; margin: 2px 0 18px; font-size: 2rem; }
.teaser { margin: 12px auto 0; }
.figure-frame { background: #fff; border: 1px solid #e7ebf0; border-radius: 10px; padding: 18px 18px 8px; }
.teaser .figure-frame { padding: 16px 20px 6px; }
.figure-link { display: block; border-radius: 6px; }
.figure-link:hover { text-decoration: none; opacity: .97; }
.figure-caption {
  color: var(--body-secondary); max-width: 900px; margin: 13px auto 0; font-size: .95rem; line-height: 1.7;
  font-family: Georgia, "Times New Roman", serif; font-style: italic; text-align: center; text-wrap: pretty;
}
.teaser-caption { text-align: left; font-family: var(--serif); font-style: normal; font-size: 1.35rem; font-weight: 600; color: #2c4055; margin-top: 10px; }
.overview-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; margin: 28px 20px 22px; }
.overview-notes > div { border-top: 2px solid #d7e3ef; padding-top: 15px; }
.overview-notes > div:nth-child(2) { border-color: #e4d2d5; }
.overview-notes > div:nth-child(3) { border-color: #cedfd7; }
.finding-label { color: var(--heading); margin: 0 0 11px; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.overview-notes p { color: var(--body-copy); margin: 0; font-size: 1rem; line-height: 1.75; }
.tldr-questions { border-top: 1px solid #dce5ee; margin: 23px 20px 0; padding: 20px 0 0 1.9em; list-style: upper-roman; }
.tldr-questions li { padding-left: 9px; }
.tldr-questions li + li { margin-top: 13px; }
.tldr-questions li::marker { color: #476b8b; }
.tldr-questions p { margin: 0; line-height: 1.65; }

/* ---------------------------------------------------------------- nav */
.section-nav {
  position: sticky; top: 0; z-index: 10; border-block: 1px solid var(--border);
  background: rgba(255,255,255,.97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  overflow-x: auto; scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.nav-inner { display: flex; justify-content: center; align-items: center; gap: 18px; width: max-content; max-width: 100%; min-height: 46px; margin: auto; padding: 5px 14px; }
.nav-inner a {
  white-space: nowrap; color: #687583; padding: 5px 0; font-family: var(--serif); font-size: 1.05rem; font-weight: 500;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.nav-inner a:hover { color: var(--primary); text-decoration: none; }
.nav-inner a.is-active { color: var(--primary); border-color: var(--primary); }

/* ---------------------------------------------------------------- chapters */
.chapter { border-bottom: 1px solid #edf0f3; padding: 65px 0 60px; }
.chapter-tinted { background: var(--tint); }
.section-heading { text-align: center; max-width: 790px; margin: 0 auto 20px; }
.section-heading::after { content: ""; display: block; width: 42px; height: 2px; background: #b8cee1; margin: 21px auto 0; }
.section-index { display: block; color: #477daa; letter-spacing: .18em; margin-bottom: 14px; font-size: .75rem; font-weight: 600; line-height: 1; }
.section-lead { max-width: 850px; margin: 0 auto 28px; color: var(--body-copy); font-size: var(--body-size); line-height: 1.8; }
.section-lead + .section-lead { margin-top: -12px; }
figure { margin: 28px auto 0; }
figure.fig-narrow { max-width: 560px; }
figure.fig-medium { max-width: 720px; }
.finding { border-left: 2px solid #80a9cc; max-width: 780px; margin: 30px auto; padding: 3px 0 3px 22px; }
.finding p { color: #294d6a; margin: 0; font-size: 1.18rem; font-weight: 500; line-height: 1.65; }
.method-note { border-top: 1px solid #d9e3ec; max-width: 850px; margin: 36px auto 0; padding-top: 25px; }
.method-note h3 { color: #34536d; margin-bottom: 14px; font-size: 1.7rem; }
.method-note p { font-size: 1.05rem; line-height: 1.8; }
.method-note p:last-child { margin-bottom: 0; }
.katex-display { margin: 14px 0 18px; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.eq-fallback { font-family: var(--mono); font-size: .95rem; color: #40566b; }

/* step cards (framework) */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-width: 1000px; margin: 30px auto 0; }
.steps > div { background: #fff; border: 1px solid #dfe7ef; border-radius: 10px; padding: 18px 20px; box-shadow: 0 8px 24px rgba(51,78,105,.05); }
.steps .step-key { display: inline-block; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-foreground); font-weight: 700; text-align: center; line-height: 28px; font-size: .9rem; margin-bottom: 10px; }
.steps h3 { font-size: 1.3rem; margin-bottom: 8px; }
.steps p { margin: 0; font-size: .97rem; line-height: 1.62; }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; max-width: 1000px; margin: 30px auto 0; }
.stat { background: #fff; border: 1px solid #dfe7ef; border-radius: 10px; padding: 16px 18px 14px; }
.stat .stat-value { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; color: #2c4a66; line-height: 1.1; }
.stat .stat-value small { font-size: 1.1rem; font-weight: 600; color: #6a7f94; }
.stat .stat-label { font-size: .88rem; color: var(--body-secondary); margin-top: 6px; line-height: 1.45; }
.stat .stat-delta { display: inline-block; margin-left: 6px; font-family: var(--sans); font-size: .85rem; font-weight: 600; color: var(--term-pur); vertical-align: middle; }

/* results tabs and tables */
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 24px auto 18px; }
.tab {
  border: 1px solid #d3dde6; background: #fff; color: #3e5265; border-radius: 999px; padding: 7px 18px;
  font-family: var(--sans); font-size: .92rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s;
}
.tab:hover { background: var(--accent); }
.tab[aria-selected="true"] { background: #292d32; border-color: #292d32; color: #fff; }
.tab-panel[hidden] { display: none; }
.table-scroll { overflow-x: auto; border: 1px solid #e0e7ee; border-radius: 10px; background: #fff; }
table.results { border-collapse: collapse; width: 100%; min-width: 760px; font-size: .92rem; }
table.results th, table.results td { padding: 8px 12px; text-align: center; white-space: nowrap; border-bottom: 1px solid #edf1f5; }
table.results th { background: var(--muted); color: #2f4356; font-weight: 600; }
table.results th.group { border-bottom: 1px solid #d9e2ea; }
table.results td:first-child, table.results th:first-child { text-align: left; }
table.results td:nth-child(2) { color: #6a7a89; }
table.results tr.ours td { background: #f1f6fb; font-weight: 700; color: #1f3f5f; }
table.results tr.base td { background: #fbfcfd; }
table.results small { font-size: .78em; color: #7a8794; font-weight: 400; }
table.results td.na { color: #b0bac4; }
.table-note { font-size: .9rem; color: var(--body-secondary); margin: 12px 4px 0; font-style: italic; font-family: Georgia, serif; }
table.ablation { min-width: 620px; }
table.ablation td:nth-child(2) { color: inherit; }
table.ablation td.mark { font-size: 1.05rem; }

/* ablation chart */
.chart-card { background: #fff; border: 1px solid #e0e7ee; border-radius: 10px; padding: 18px 18px 10px; max-width: 900px; margin: 28px auto 0; }
.chart-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 8px; }
.chart-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: #2c4055; }
.chart-legend { display: flex; gap: 16px; font-size: .85rem; color: var(--body-secondary); }
.chart-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .lg-clean::before { background: #7ca6c9; }
.chart-legend .lg-shift::before { background: #d1848c; }
.chart-svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
.chart-svg .bar { transition: opacity .15s; cursor: pointer; }
.chart-svg .bar:hover { opacity: .8; }
.chart-tip {
  position: fixed; z-index: 20; pointer-events: none; background: #1e2a36; color: #fff; font-size: .82rem;
  padding: 6px 10px; border-radius: 6px; opacity: 0; transition: opacity .12s; white-space: nowrap;
}
.chart-tip.is-visible { opacity: 1; }

/* figure grid */
.figure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 1000px; margin: 28px auto 0; }
.figure-grid figure { margin: 0; }

/* citation / acknowledgments / footer */
.citation { max-width: 780px; padding: 50px 0 56px; }
.citation h2 { margin: 0 0 18px; font-size: 2rem; }
.citation pre { color: #40566b; white-space: pre-wrap; overflow-wrap: anywhere; background: #f4f7fa; border: 1px solid #dce5ed; border-radius: 8px; margin: 0 0 16px; padding: 22px 24px; font-size: .95rem; line-height: 1.6; font-family: var(--mono); }
footer { border-top: 1px solid var(--border); color: #8a949e; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 26px; padding: 24px 0 30px; font-size: .78rem; }
footer a { color: #718295; }
footer > span { text-align: center; flex-basis: 100%; }
.site-credit { max-width: 780px; color: var(--body-secondary); text-align: center; flex-basis: 100%; margin: 6px auto 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 36px); }
  .paper-header { padding: 38px 0 24px; }
  .chapter { padding: 46px 0 42px; }
  .overview-notes { grid-template-columns: 1fr; gap: 20px; margin-inline: 0; }
  .tldr-questions { margin-inline: 0; }
  .steps { grid-template-columns: 1fr; }
  .figure-grid { grid-template-columns: 1fr; }
  .nav-inner { justify-content: flex-start; gap: 14px; }
  .finding { padding-left: 14px; }
  .finding p { font-size: 1.08rem; }
  .section-heading::after { margin-top: 16px; }
  .figure-frame { padding: 10px 8px 4px; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 32px); }
  h1 { font-size: 2rem; }
  .resource-button { padding-inline: 13px; font-size: .84rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
