/* NextEval site styles.
   1. Tokens: the design language of the Bench results pages, extracted from bench/results/results.css
      (test/style-tokens.mjs keeps the two in step).
   2. Base rules and the header: shared by every page, Bench included. They are unchanged, so Bench renders as before.
   3. Page components for the overview and the Solver pages, scoped to body.site-page. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;
  /* Header palette */
  --bg: #0e1314;
  --surface: #141b1c;
  --surface-2: #192223;
  --ink: #edf2ef;
  --muted: #9aa7a3;
  --faint: #687673;
  --line: #2a3838;
  --line-strong: #405150;
  --cyan: #68e1d5;
  --gold: #efb34f;
  --lime: #bed783;
  --display: "Avenir Next", "Helvetica Neue", "SF Pro Display", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  /* Bench tokens: colour */
  --nx-bg: #151617;
  --nx-surface: #1c1d1f;
  --nx-surface-hover: #25272a;
  --nx-line: #35383b;
  --nx-line-strong: #51555a;
  --nx-text: #eeefec;
  --nx-muted: #aeb2b7;
  --nx-accent: #7ddfd4;
  --nx-reference: #e9b86c;
  --nx-on-light: #151617;
  /* Bench tokens: type */
  --nx-sans: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --nx-mono: "SFMono-Regular", Consolas, Menlo, monospace;
  --nx-size-h1: 30px;
  --nx-size-h2: 23px;
  --nx-size-section: 22px;
  --nx-size-h3: 18px;
  --nx-size-body: 16px;
  --nx-size-text: 15px;
  --nx-size-small: 14px;
  --nx-size-note: 13px;
  /* Bench tokens: layout */
  --nx-page-width: 1440px;
  --nx-page-pad: 28px 40px 28px;
  --nx-prose-width: 1000px;
  --nx-radius: 3px;
  --nx-section-gap: 34px;
  --nx-section-pad: 22px;
  font-family: var(--display);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  letter-spacing: 0;
}

/* ---------- 2. Base rules and header (every page) ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 600; }
h1 em, h2 em { color: var(--cyan); font-style: normal; font-weight: 400; }
h2 span { color: var(--cyan); font-weight: 400; }
.site-header { --nav-accent: var(--cyan); position: relative; z-index: 30; min-height: 74px; padding: 0 36px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header[data-product="bench"] { --nav-accent: var(--gold); }
.site-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 650; white-space: nowrap; }
.site-brand img { display: block; }
.header-path { display: flex; align-items: center; gap: 16px; min-width: 0; }
.path-divider { color: var(--line-strong); font-size: 20px; font-weight: 400; user-select: none; }
.nav-switcher { position: relative; min-width: 0; }
.nav-switcher > summary { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 2px; list-style: none; cursor: pointer; white-space: nowrap; color: var(--muted); font-size: 15px; line-height: 1.4; }
.nav-switcher > summary::-webkit-details-marker { display: none; }
.nav-switcher > summary::marker { content: ""; }
.nav-switcher > summary svg { width: 14px; height: 14px; flex: 0 0 14px; color: var(--muted); transition: transform 120ms ease; }
.nav-switcher[open] > summary svg { transform: rotate(180deg); }
.nav-switcher > summary:hover, .nav-switcher[open] > summary { color: var(--ink); }
.nav-switcher > summary:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: 4px; border-radius: 2px; }
.context-switcher > summary { color: var(--ink); }
.switcher-panel { position: absolute; top: calc(100% + 5px); left: -12px; width: 236px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); box-shadow: 0 12px 28px #0005; }
.switcher-panel a { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; padding: 10px 12px; border-radius: 3px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.switcher-panel a:hover, .switcher-panel a:focus-visible { color: var(--ink); background: var(--surface-2); }
.switcher-panel a[aria-current] { color: var(--nav-accent); background: var(--surface-2); }
.switcher-panel a[aria-current]::after { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.switcher-panel .menu-external { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0; }
.switcher-panel svg, .header-source svg { width: 16px; height: 16px; flex: 0 0 16px; }
.header-source { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; margin-left: auto; color: var(--muted); font-size: 15px; }
.header-source:hover { color: var(--ink); }
@media (max-width: 700px) {
  .site-header { min-height: 64px; padding: 0 18px; gap: 12px; }
  .site-brand img { width: 26px; height: 26px; }
  .site-brand > span, .header-source { display: none; }
  .header-path { gap: 10px; }
  .path-divider { font-size: 18px; }
  .nav-switcher > summary { gap: 7px; font-size: 14px; }
  .switcher-panel { width: 220px; }
  .context-switcher .switcher-panel { left: auto; right: -8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- 3. Page components (overview and Solver) ---------- */
body.site-page { background: var(--nx-bg); color: var(--nx-text); font-family: var(--nx-sans); font-size: var(--nx-size-body); line-height: 1.5; letter-spacing: 0; }
.site-page :focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 4px; }
.site-page .site-header :focus-visible { outline-color: var(--nav-accent); }
.site-page [hidden] { display: none !important; }
.site-skip { position: absolute; top: -80px; left: 4px; z-index: 100; padding: 12px; background: var(--nx-surface); color: var(--nx-text); }
.site-skip:focus { top: 4px; }
.page { max-width: var(--nx-page-width); margin: 0 auto; padding: var(--nx-page-pad); outline: none; }
.page h1 { margin: 0; font-size: var(--nx-size-h1); line-height: 1.2; font-weight: 600; }
.page h2 { margin: 0; font-size: var(--nx-size-h2); line-height: 1.3; font-weight: 600; }
.page h3 { margin: 0; font-size: var(--nx-size-h3); line-height: 1.35; font-weight: 600; }
.page h2 span, .page h1 em, .page h2 em { color: inherit; font-weight: inherit; font-style: inherit; }
.page p { margin: 0; }
.page small { font-size: var(--nx-size-small); }
.page .muted { color: var(--nx-muted); }
.page code, .page kbd { font-family: var(--nx-mono); font-size: var(--nx-size-small); overflow-wrap: anywhere; }
.page a.text-link, .prose a, .page-footer a, .def-list a, .data-table a { text-decoration: underline; text-underline-offset: 4px; }
.page a.text-link:hover, .prose a:hover, .page-footer a:hover, .def-list a:hover, .data-table a:hover { color: var(--nx-accent); }

/* Heading block, as on every Bench view */
.page-kicker { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px !important; font: var(--nx-size-note)/1.5 var(--nx-mono); color: var(--nx-muted); }
.page-kicker > i { width: 8px; height: 8px; flex: none; margin-top: 6px; background: var(--nx-accent); border-radius: 1px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-heading > div > p:not(.page-kicker) { max-width: 980px; margin-top: 8px; color: var(--nx-muted); font-size: var(--nx-size-text); }
.page-edition { font: var(--nx-size-small)/1.6 var(--nx-mono); color: var(--nx-muted); white-space: nowrap; }
.page-edition b { font-weight: 400; color: var(--nx-text); }

/* Tabs (section navigation), as the Bench view switcher */
.page-tabs { display: flex; flex-wrap: wrap; gap: 0 28px; margin-bottom: 4px; border-bottom: 1px solid var(--nx-line); }
.page-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 0 12px; border-bottom: 2px solid transparent; color: var(--nx-muted); font-size: var(--nx-size-body); }
.page-tabs a:hover { color: var(--nx-text); }
.page-tabs a[aria-current] { color: var(--nx-text); border-color: var(--nx-accent); }
.page-tabs svg { width: 18px; height: 18px; flex: none; }

/* Toolbar with scope facts */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px; padding: 16px 0; border-top: 1px solid var(--nx-line); }
.page-tabs + .page-toolbar { border-top: 0; }
.page-scope { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; padding: 0; list-style: none; font-size: var(--nx-size-text); }
.page-scope li { white-space: nowrap; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }

/* Sections */
.section { margin-top: var(--nx-section-gap); padding-top: var(--nx-section-pad); border-top: 1px solid var(--nx-line); scroll-margin-top: 16px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 28px; }
.section-head h2, .section > h2 { font-size: var(--nx-size-section); font-weight: 500; }
.section-note { max-width: 1100px; margin-top: 10px !important; color: var(--nx-muted); font-size: var(--nx-size-small); }
.section-head + .prose, .section-head + .def-list, .section-head + .card-grid { margin-top: 12px; }
.section-link { font-size: var(--nx-size-text); color: var(--nx-muted); }
.section-link:hover { color: var(--nx-text); }

/* Buttons and badges */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; border: 1px solid var(--nx-line-strong); border-radius: var(--nx-radius); background: var(--nx-surface); color: var(--nx-text); font: inherit; font-size: var(--nx-size-text); cursor: pointer; }
.button:hover { background: var(--nx-surface-hover); }
.button-primary { background: var(--nx-text); border-color: var(--nx-text); color: var(--nx-on-light); font-weight: 600; }
.button-primary:hover { background: #fff; border-color: #fff; }
.button svg { width: 16px; height: 16px; flex: none; }
.badge { display: inline-block; padding: 1px 7px; border: 1px solid #62686d; border-radius: var(--nx-radius); font: 12px/1.5 var(--nx-mono); color: #c8cdc9; white-space: nowrap; vertical-align: 2px; }
.badge-accent { border-color: var(--nx-accent); color: var(--nx-accent); }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px 20px 20px; border: 1px solid var(--nx-line); border-radius: var(--nx-radius); background: var(--nx-surface); }
a.card:hover, a.card:focus-visible { background: var(--nx-surface-hover); border-color: var(--nx-line-strong); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: var(--nx-size-note) var(--nx-mono); color: var(--nx-muted); }
.card h2, .card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.card > p { color: var(--nx-muted); font-size: var(--nx-size-text); }
.card-more { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; font-size: var(--nx-size-text); }
.card-more svg { width: 16px; height: 16px; flex: none; color: var(--nx-muted); }
a.card:hover .card-more svg { color: var(--nx-accent); }
.card-entry { min-height: 172px; }
.card-entry[data-product="bench"] .card-mark { color: var(--gold); }
.card-entry[data-product="solver"] .card-mark { color: var(--cyan); }

/* Facts strip, as the Bench task facts */
.facts { display: flex; flex-wrap: wrap; gap: 12px 34px; margin: 0; padding: 20px 0; border-top: 1px solid var(--nx-line); border-bottom: 1px solid var(--nx-line); list-style: none; }
.facts li { display: flex; gap: 8px; align-items: baseline; font-size: var(--nx-size-text); }
.facts span { color: var(--nx-muted); }
.facts strong { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tables, as the Bench coverage tables */
.table-scroll { overflow: auto; border: 1px solid var(--nx-line); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--nx-size-small); text-align: left; }
.data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); }
.data-table th, .data-table td { padding: 12px 15px; border-bottom: 1px solid var(--nx-line); font-weight: 400; font-variant-numeric: tabular-nums; vertical-align: top; }
.data-table thead th { color: var(--nx-muted); white-space: nowrap; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody th { color: var(--nx-text); }
.data-table td { color: var(--nx-muted); }
.data-table .num { font-family: var(--nx-mono); text-align: right; color: var(--nx-text); white-space: nowrap; }
.data-table .rank { width: 44px; font-family: var(--nx-mono); color: var(--nx-muted); text-align: right; }
.data-table code { color: var(--nx-text); }
.data-table .nowrap { white-space: nowrap; }
.option-table { min-width: 720px; table-layout: fixed; }
.option-table th:first-child { width: 270px; }
.option-table th:nth-child(2) { width: 120px; }

/* Leaderboard preview on the overview */
.board-preview .data-table { min-width: 620px; }
.board-preview .data-table th, .board-preview .data-table td { padding: 9px 12px; vertical-align: middle; }
.data-table a.board-who { display: flex; align-items: center; gap: 0; font-weight: 500; font-size: var(--nx-size-small); color: var(--nx-text); text-decoration: none; }
.data-table a.board-who:hover span { text-decoration: underline; text-underline-offset: 3px; }
.board-who .org-logo { flex: none; margin-right: 7px; }
.board-bar { width: 44%; min-width: 180px; }
.board-bar svg { display: block; width: 100%; height: 22px; }
.board-bar .grid { stroke: #2a2d30; stroke-width: 1; }
.board-bar .ref { stroke: #eef0ec; stroke-width: 1.4; }
.board-axis { display: flex; justify-content: space-between; margin-top: 2px; font: 12px var(--nx-mono); color: #b5bcc1; }

/* Prose and documentation layout */
.prose { max-width: 1100px; }
.prose p, .prose li { max-width: var(--nx-prose-width); color: var(--nx-muted); font-size: var(--nx-size-text); }
.prose p { margin-top: 12px; }
.prose ul, .prose ol { margin: 12px 0 0; padding-left: 20px; }
.prose li { margin: 7px 0; }
.prose strong { color: var(--nx-text); font-weight: 600; }
.prose h3 { margin-top: 26px; }
.prose code { color: var(--nx-text); }
.prose > :first-child { margin-top: 0; }
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px 44px; align-items: start; padding-top: 22px; border-top: 1px solid var(--nx-line); }
.page-tabs + .docs-layout { border-top: 0; }
.docs-toc { position: sticky; top: 16px; display: grid; gap: 2px; font-size: var(--nx-size-small); }
.docs-toc strong { margin-bottom: 8px; font: var(--nx-size-note) var(--nx-mono); font-weight: 400; color: var(--nx-muted); text-transform: uppercase; }
.docs-toc a { padding: 6px 0 6px 12px; border-left: 2px solid var(--nx-line); color: var(--nx-muted); }
.docs-toc a:hover, .docs-toc a:focus-visible { color: var(--nx-text); border-color: var(--nx-accent); }
.docs-body { min-width: 0; max-width: 1100px; }
.docs-body > section { padding: 24px 0 26px; border-top: 1px solid var(--nx-line); scroll-margin-top: 16px; }
.docs-body > section:first-child { padding-top: 0; border-top: 0; }
.docs-body h2 { font-size: var(--nx-size-section); font-weight: 500; }

/* Code */
.code-block { position: relative; max-width: var(--nx-prose-width); margin-top: 12px; }
.code-block pre { margin: 0; padding: 12px 56px 12px 14px; border: 1px solid var(--nx-line); background: var(--nx-surface); color: var(--nx-text); font: var(--nx-size-small)/1.7 var(--nx-mono); overflow-x: auto; tab-size: 4; }
.code-block pre code { font: inherit; overflow-wrap: normal; }
.code-block .copy-code { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--nx-line); border-radius: var(--nx-radius); background: var(--nx-surface); color: var(--nx-muted); cursor: pointer; }
.code-block .copy-code:hover { color: var(--nx-text); border-color: var(--nx-line-strong); }
.code-block .copy-code svg { width: 16px; height: 16px; }
.code-block .copy-status { position: absolute; top: 12px; right: 48px; padding: 0 6px; background: var(--nx-surface); color: var(--nx-muted); font-size: var(--nx-size-note); }
.code-key { color: var(--nx-accent); }
.code-string { color: var(--nx-reference); }
.code-muted { color: var(--nx-muted); }

/* Definition lists (signatures, options, result fields) */
.def-list { margin: 14px 0 0; border-top: 1px solid var(--nx-line); }
.def-list > div { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 8px 24px; padding: 12px 0; border-bottom: 1px solid var(--nx-line); }
.def-list dt { min-width: 0; color: var(--nx-text); font-size: var(--nx-size-small); }
.def-list dd { min-width: 0; max-width: var(--nx-prose-width); margin: 0; color: var(--nx-muted); font-size: var(--nx-size-text); }
.def-list dd code, .def-list dt code { color: var(--nx-text); }

/* Callout, as the Bench notes with an accent rule */
.page .callout { max-width: 1100px; margin-top: 14px; padding: 2px 0 2px 12px; border-left: 2px solid var(--nx-accent); color: var(--nx-muted); font-size: var(--nx-size-small); }
.callout strong { color: var(--nx-text); font-weight: 600; }
.release-line .badge { margin-right: 10px; }
.release-line a { margin-left: 6px; white-space: nowrap; }

/* Architecture figure */
.figure { margin: 16px 0 0; }
.figure svg { display: block; width: 100%; height: auto; max-width: 1100px; }
.figure .figure-narrow { display: none; max-width: 420px; }
.figure figcaption { max-width: var(--nx-prose-width); margin-top: 10px; color: var(--nx-muted); font-size: var(--nx-size-small); }
.arch-box { fill: var(--nx-surface); stroke: var(--nx-line-strong); stroke-width: 1; }
.arch-zone { fill: none; stroke: var(--nx-line); stroke-width: 1; stroke-dasharray: 4 5; }
.arch-title { fill: var(--nx-text); font: 600 14px var(--nx-sans); }
.arch-text { fill: var(--nx-muted); font: 12.5px var(--nx-sans); }
.arch-label { fill: var(--nx-muted); font: 12px var(--nx-mono); }
.arch-flow { fill: none; stroke: #8f989c; stroke-width: 1.3; }
.arch-flow.agent { stroke: var(--nx-accent); }
.arch-flow.fallback { stroke: var(--nx-reference); stroke-dasharray: 5 4; }
.arch-head { fill: #8f989c; }
.arch-head.agent { fill: var(--nx-accent); }
.arch-head.fallback { fill: var(--nx-reference); }
.arch-key-agent { fill: var(--nx-accent); }
.arch-key-fallback { fill: var(--nx-reference); }

/* Footer, as the Bench results footer */
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--nx-line); color: var(--nx-muted); font-size: var(--nx-size-small); }
.page-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.page-footer .slogan-line { color: var(--nx-muted); }

@media (max-width: 1000px) {
  .card-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 24px 32px; }
}
@media (max-width: 850px) {
  .page { padding: 26px 22px; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; padding-bottom: 18px; border-bottom: 1px solid var(--nx-line); }
  .docs-toc strong { grid-column: 1 / -1; }
  .board-bar { display: none; }
  .board-preview .data-table { min-width: 0; }
}
@media (max-width: 700px) {
  .figure .figure-wide { display: none; }
  .figure .figure-narrow { display: block; }
  .card-grid, .card-grid.three { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card-entry { min-height: 0; }
  .def-list > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 520px) {
  .page { padding: 24px 16px; }
  .page h1 { font-size: 27px; }
  .page-edition { white-space: normal; }
  .page-tabs { gap: 0 18px; }
  .page-tabs a { font-size: var(--nx-size-text); }
  .facts { gap: 10px 24px; }
  .data-table th, .data-table td { padding: 10px 10px; }
  .board-preview .data-table th, .board-preview .data-table td { padding: 9px 8px; }
  .board-harness { display: none; }
  .code-block pre { padding: 12px 48px 12px 12px; }
  .docs-toc { grid-template-columns: minmax(0, 1fr); }
}
