/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #4a4a4a;
  --text-muted: #7a7a7a;
  --accent: hsl(204, 86%, 53%);
  --accent-light: hsl(204, 86%, 95%);
  --border: #dbdbdb;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --font: 'Noto Sans', sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

body { font-family: var(--font); color: var(--text); line-height: 1.6; background: var(--bg); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.container.narrow { max-width: 900px; }
.container.bit-narrow { max-width: 1000px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
strong { font-weight: 600; color: #363636; }

/* ── Hero ── */
.hero {
  background: #fff; color: var(--text);
  text-align: center;
  display: flex;
  flex-direction: column;
}
.hero .container {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero .title {
  font-size: 3rem; font-weight: 700; margin-bottom: 0.75rem;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
  line-height: 1.2; color: #363636;
}
.hero .title.paper-title { font-size: 2.3rem; max-width: 920px; }
.hero .subtitle {
  font-size: 1.5rem; font-weight: 400; color: #4a4a4a;
  margin-bottom: 1rem;
}
.author-block {
  font-size: 1.25rem; margin-bottom: 0.5rem;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.author { display: inline-block; margin: 0 6px; }
.author a { color: hsl(204, 86%, 53%); text-decoration: none; }
.author a:hover { text-decoration: underline; }
.affiliations {
  font-size: 1.25rem; color: var(--text-muted); margin-bottom: 0.25rem;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.affiliations span { display: inline-block; margin: 0 6px; }
.author-notes { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 1rem; }
.author-notes span { display: inline-block; margin: 0 6px; }
.hero-buttons {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 0.5rem;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5em 1em; border-radius: 290486px;
  background: #363636; color: #fff;
  font-size: 1rem; font-weight: 400;
  border: 1px solid transparent;
  transition: background 0.15s; text-decoration: none;
}
.btn:hover { background: #4a4a4a; text-decoration: none; }
.btn i { font-size: 0.9rem; }

.teaser { font-family: 'Google Sans', sans-serif; }

/* ── Sections ── */
.section-title {
  font-size: 2rem; font-weight: 600; text-align: center; margin-bottom: 1rem;
  font-family: 'Google Sans', 'Noto Sans', sans-serif; color: #363636;
}

/* ── Abstract ── */
.abstract-lead { font-size: 1.1rem; line-height: 1.7; text-align: justify; }

/* ── Figures ── */
.figure-block { margin: 32px 0; text-align: center; }
.figure-img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.figure-img-half { max-width: min(100%, 640px); }
.figure-img-medium { max-width: min(100%, 760px); }
.figure-caption { margin-top: 12px; font-size: 1.0rem; color: var(--text-muted); margin-left: auto; margin-right: auto; text-align: left; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.figure-pair .figure-block { margin: 0; }

/* ── Benchmark ── */
.benchmark-section { padding: 3rem 1.5rem; background: var(--bg); }

/* ── MathLens demos ── */
:root {
  --e-pr: #9a6fb0; --e-p: #e07b39; --e-r: #4c78a8; --e-mm: #73c08e;
  --hl: hsl(204, 86%, 45%); --hl-bg: hsl(204, 86%, 92%);
}
.demo { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 24px; background: #fff; }
.demo-note { margin-top: 12px; font-size: 0.98rem; color: var(--text-muted); line-height: 1.6; }
.io-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.3px; margin: 10px 0 4px; }
.io-label:first-child { margin-top: 0; }
.io-box { border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; background: #fafafa; font-size: 1rem; line-height: 1.6; }
.answer-value { font: 600 2.2rem 'Google Sans', 'Noto Sans', sans-serif; color: #363636; }
.answer-value.small { font-size: 1.3rem; }
.arrow { color: #9a9a9a; font-size: 1.2rem; }

.decomp-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.decomp-view { background: var(--bg-alt); border-radius: 8px; padding: 14px 18px; }
.view-text { margin: 0; font-size: 1.05rem; line-height: 1.6; color: #333; }
.view-q { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.view-note { margin-top: 12px; font-size: 0.95rem; color: var(--text-muted); line-height: 1.55; }
.probe {
  display: block; width: 100%; text-align: left; font: 1.02rem var(--font); color: #333; cursor: pointer;
  background: transparent; border: 0; border-left: 3px solid transparent; border-radius: 0 4px 4px 0; padding: 6px 10px; margin: 2px 0;
}
.probe:hover { background: #eceff3; }
.probe.active { border-left-color: var(--accent); background: var(--accent-light); }
.lane {
  border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title title" "io out"; column-gap: 12px; row-gap: 4px; align-items: center;
}
.lane:hover { border-color: #b5b5b5; }
.lane.active { border-color: var(--accent); background: var(--accent-light); }
.lane-title {
  grid-area: title; justify-self: start; font: 600 0.98rem var(--font); color: #363636; text-align: left;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.lane-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.lane-io { grid-area: io; font-size: 0.92rem; color: var(--text-muted); }
.lane-answer { font-weight: 600; color: #363636; }
.lane-out { grid-area: out; display: inline-flex; border: 1.5px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.lane-out button { border: 0; background: #fff; padding: 4px 10px; font: 0.85rem var(--font); color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.lane-out button + button { border-left: 1.5px solid var(--border); }
.lane-out button.active[data-pass="1"] { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.lane-out button.active[data-pass="0"] { background: #fdecea; color: #c62828; font-weight: 600; }
.arrow { color: #9a9a9a; }
.diag {
  display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 24px; align-items: center;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}
.diag-note { font-size: 1rem; color: var(--text-muted); line-height: 1.6; }
.err-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 5px; }
.err-head { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; text-align: center; align-self: end; }
.err-row { align-self: center; text-align: right; padding-right: 4px; }
.err-cell {
  --cat: #999;
  min-height: 48px; border-radius: 6px; display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  background: #fff; border: 1.5px solid var(--border); color: var(--text-muted); font-size: 0.92rem; line-height: 1.3;
  transition: border-color 0.15s, background 0.15s;
}
.err-cell::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cat); }
.err-cell.active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 9%, #fff); color: #222; font-weight: 600; }
.c-mm { --cat: var(--e-mm); } .c-r { --cat: var(--e-r); } .c-p { --cat: var(--e-p); } .c-pr { --cat: var(--e-pr); }
.mods-q { background: var(--bg-alt); border-radius: 6px; padding: 6px 12px; font-size: 1rem; color: #333; }

.gen-wrap { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.pred-btn {
  display: block; width: 100%; text-align: left; font: 0.88rem var(--mono); color: #333; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 4px; padding: 5px 8px;
}
.pred-btn:hover { border-color: var(--border); }
.pred-btn.active { background: var(--hl-bg); border-color: hsl(204, 86%, 70%); }
.pred-query { margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; padding-top: 8px; }
.gen-out [data-key] { border-radius: 3px; cursor: pointer; transition: background 0.1s; }
.gen-out [data-key].hl { background: var(--hl-bg); box-shadow: 0 0 0 2px var(--hl-bg); }
.q-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.q-tag { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); min-width: 92px; }
.q-drop { text-decoration: line-through; color: #999; }

.mods-seg { margin-bottom: 12px; flex-wrap: wrap; }
.mods-qa { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

/* Diagram */
.dg { display: block; width: 100%; height: auto; max-height: 340px; }
.dg-mods { height: 340px; }
.dg .seg { stroke: #9a9a9a; stroke-width: 2.6; stroke-linecap: round; }
.dg .seg.overlay { stroke: transparent; }
.dg .seg.extra { stroke: #9a9a9a; }
.dg .tri { fill: transparent; transition: fill 0.1s; }
.dg .asector { fill: transparent; }
.dg .amark { fill: none; stroke: #222; stroke-width: 1.4; }
.dg .pt { fill: #222; }
.dg .plabel { font: 17px var(--font); fill: #222; text-anchor: middle; dominant-baseline: middle; }
.dg .alabel { font: 16px 'Times New Roman', Times, serif; fill: #222; text-anchor: middle; dominant-baseline: middle; }
.dg .q { opacity: 0; }
.dg .seg.hl { stroke: var(--hl); stroke-width: 4; }
.dg .tri.hl { fill: var(--hl-bg); }
.dg .asector.hl { fill: var(--hl); fill-opacity: 0.28; }
.dg .q.hl { opacity: 1; }
.dg .pt.hl, .dg .plabel.hl, .dg .alabel.hl { fill: var(--hl); font-weight: 700; }

/* ── Results table ── */
.leaderboard-section { padding: 3rem 1.5rem; background: var(--bg); }
.table-controls { display: flex; justify-content: center; margin-bottom: 16px; }
.seg {
  display: inline-flex; border: 1.5px solid var(--border); border-radius: 20px; overflow: hidden;
}
.seg button {
  border: 0; background: #fff; padding: 6px 16px;
  font-family: var(--font); font-size: 0.9rem; cursor: pointer; color: var(--text-muted);
}
.seg button + button { border-left: 1.5px solid var(--border); }
.seg button.active { background: var(--accent-light); color: hsl(204, 86%, 38%); font-weight: 600; }
.table-scroll { position: relative; overflow-x: auto; }
.leaderboard {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem; margin: 0 auto 12px;
}
.leaderboard th, .leaderboard td {
  padding: 5px 10px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.leaderboard th {
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  vertical-align: bottom;
}
.leaderboard td:first-child, .leaderboard th:first-child,
.leaderboard td:nth-child(2), .leaderboard th:nth-child(2) { text-align: left; }
.leaderboard td { font-variant-numeric: tabular-nums; }
.leaderboard td.model { font-weight: 600; color: #363636; white-space: nowrap; vertical-align: top; }
.leaderboard td.variant { white-space: nowrap; color: var(--text); }
.leaderboard tbody tr:hover { background: #f5f7fa; }
.leaderboard tr.group-start td { border-top: 2px solid var(--border); }
.leaderboard td.ne { color: #b5b5b5; }
.leaderboard .sep { border-left: 1px solid var(--border); }
.table-caption {
  text-align: center; font-size: 1.0rem; color: var(--text-muted);
  margin: 0 auto;
}

/* ── Navigation ── */
.site-nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.site-nav-links { display: flex; justify-content: center; gap: 32px; padding: 0 16px; overflow-x: auto; }
.site-nav a {
  padding: 12px 2px 10px; border-bottom: 2px solid transparent; white-space: nowrap;
  font: 1rem 'Google Sans', 'Noto Sans', sans-serif; color: var(--text);
}
.site-nav a:hover { color: #363636; text-decoration: none; }
.site-nav a.active { color: #363636; border-bottom-color: var(--accent); }
section[id] { scroll-margin-top: 48px; }

.teaser-tldr {
  margin: 16px 0 0; font-size: 1.2rem; line-height: 1.6;
  font-family: 'Google Sans', 'Noto Sans', sans-serif; color: #363636; text-align: center;
}
.abstract-details { margin: 8px 0 2.5rem; }
.abstract-details summary {
  cursor: pointer; text-align: center; color: var(--accent); font-size: 1rem; list-style: none;
}
.abstract-details summary::-webkit-details-marker { display: none; }
.abstract-details summary::after { content: ' \25BE'; }
.abstract-details[open] summary::after { content: ' \25B4'; }
.abstract-details .abstract-lead { margin-top: 12px; }

/* ── Analysis ── */
.results-section { padding: 3rem 1.5rem; background: var(--bg); }
.section-lead { margin: 0 0 1.25rem; font-size: 1.1rem; line-height: 1.7; }
.subsection-title {
  font-size: 1.4rem; font-weight: 600; color: #363636; margin: 2.75rem 0 0.4rem; line-height: 1.3;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.subsection-lead { font-size: 1.08rem; line-height: 1.65; margin: 0 0 14px; }
.finding-index { list-style: none; margin: 0 auto 1rem; padding: 0; border-top: 1px solid var(--border); }
.finding-index li { border-bottom: 1px solid var(--border); }
.finding-index a { display: flex; align-items: baseline; gap: 14px; padding: 11px 4px; color: #363636; font-size: 1.05rem; }
.finding-index a:hover { background: var(--bg-alt); text-decoration: none; }
.fi-num { flex: none; width: 24px; font-weight: 600; color: var(--accent); }
.finding { margin: 4rem 0 0; scroll-margin-top: 64px; }
.finding-label {
  font-size: 0.95rem; font-weight: 600; color: var(--accent);
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.finding-title {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.5rem; font-weight: 600; line-height: 1.3; color: #363636;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.finding-text { font-size: 1.1rem; line-height: 1.7; }
.finding .figure-block { margin: 20px 0 0; }
.finding-subtitle {
  margin: 2.5rem 0 0.5rem; font-size: 1.2rem; font-weight: 600; color: #363636;
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}

/* ── Examples carousel ── */
.examples-section { padding: 3rem 1.5rem; background: var(--bg); }
.carousel { position: relative; }
.carousel-viewport { text-align: center; }
.carousel-slide img { max-width: min(100%, 720px); height: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.carousel-nav { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 16px; }
.carousel-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--border); background: #fff;
  color: #363636; cursor: pointer; font-size: 0.9rem;
}
.carousel-btn:hover { border-color: var(--accent); }
.carousel-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.carousel-count { font-size: 0.9rem; color: var(--text-muted); min-width: 220px; text-align: center; }

/* ── BibTeX ── */
.bibtex-section { padding: 3rem 1.5rem; background: var(--bg); }
.bibtex-block {
  position: relative; background: #f5f5f5; color: #333;
  border: 1px solid var(--border);
  border-radius: 4px; padding: 20px 24px; overflow-x: auto;
}
.bibtex-block pre { font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; white-space: pre; margin: 0; }
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.05); border: none; color: #666;
  padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 0.85rem;
}
.copy-btn:hover { background: rgba(0,0,0,0.1); }

/* Section divider */
.section-divider {
  margin: 0 auto;
  width: 60%;
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #ccc, transparent);
}

footer { padding: 24px; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .benchmark-section, .results-section,
  .leaderboard-section, .examples-section, .bibtex-section { padding-left: 0; padding-right: 0; }
  .hero .container { padding: 2rem 16px; }
  .hero .title.paper-title { font-size: 1.55rem; }
  .hero .subtitle { font-size: 1.05rem; }
  .author-block, .affiliations { font-size: 1.05rem; }
  .section-title { font-size: 1.4rem; }
  .abstract-lead { text-align: left; font-size: 1rem; }
  .teaser-tldr { font-size: 1.05rem; }
  .section-lead, .finding-text, .subsection-lead { font-size: 1rem; }
  .subsection-title { font-size: 1.15rem; }
  .finding-title { font-size: 1.2rem; }
  .finding-subtitle { font-size: 1.05rem; }
  .site-nav-links { gap: 15px; padding: 0 8px; }
  .site-nav a { font-size: 0.92rem; }
  .decomp-grid, .gen-wrap, .diag { grid-template-columns: 1fr; }
  .dg .plabel { font-size: 28px; }
  .dg .alabel { font-size: 26px; }
  .dg .seg { stroke-width: 3.5; }
  .dg .seg.hl { stroke-width: 6; }
  .dg .pt { r: 5px; }
  .demo { padding: 14px 12px; }
  .dg-mods { height: 260px; }
  .seg.mods-seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; border-radius: 12px; }
  .seg.mods-seg button { border-left: 0; padding: 7px 4px; white-space: nowrap; }
  .seg.mods-seg button:not(:nth-child(3n+1)) { border-left: 1.5px solid var(--border); }
  .seg.mods-seg button:nth-child(n+4) { border-top: 1.5px solid var(--border); }
  .figure-pair { grid-template-columns: 1fr; }
  .carousel-count { min-width: 0; }
}
