/*
 * L2-Bench dashboard (/dashboard, /dashboard/model/<id>).
 * Every selector is prefixed `lb-` so this file sits next to styles.css without collisions.
 * Uses the OUP tokens from styles.css :root; the extra tints below are not in the OUP palette.
 *
 * Version | Date       | Author     | Change comment
 * --------|------------|------------|---------------
 * 0.3.0   | 2026-11-12 | I. Pattis  | Highlight links (→), shared tooltip, coloured model-page ranks, outro
 * 0.2.0   | 2026-11-11 | I. Pattis  | Pinned following bar; AA-style tooltip; equal heatmap cells + rank row
 * 0.1.0   | 2026-11-09 | I. Pattis  | Merged from the leaderboard wireframe; provider brand logos
 */
:root {
  --lb-mallard-green: #005145;
  --lb-neutral-green: #e0e7d0;
  --lb-panel: #f4f7f7;          /* tint of Neutral Blue */
  --lb-panel-2: #e7eeee;        /* tint of Neutral Blue */
  --lb-muted-ink: #4a5a6c;      /* tint of Oxford Blue, AA on white */
  --lb-primary-soft: #e6edfc;   /* tint of Electric Blue */
  --lb-warn-soft: #fff6c4;      /* tint of Kipper Yellow */
  --lb-warn-ink: #5c4a00;
  --lb-radius: 14px;
  --lb-shadow: 0 1px 2px rgba(1, 30, 65, 0.06), 0 4px 14px rgba(1, 30, 65, 0.07);
}

/* ── page layout ── */
.lb-page { padding-bottom: var(--spacing-xl); color: var(--oxford-blue); }
.lb-page-top { padding-top: var(--spacing-xl); padding-bottom: var(--spacing-md); }
.lb-page h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 4vw, 2.75rem); color: var(--oxford-blue); line-height: 1.15; margin-bottom: .5rem; }
.lb-page h2, .lb-h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; color: var(--oxford-blue); line-height: 1.2; }
.lb-h2 { margin: 2.5rem 0 .6rem; }
.lb-lead { font-size: 1.15rem; color: var(--text-light); max-width: 52rem; margin-bottom: 1rem; }
.lb-hint { font-size: .9rem; color: var(--lb-muted-ink); }
.lb-back { margin-bottom: 1rem; }
/* plain text links only: the site's .btn-pill buttons keep their own colours (white on blue) */
.lb-page a:not(.btn-pill), .lb-controls a:not(.btn-pill) { color: var(--electric-blue); }
.lb-spacer { flex: 1; }
.lb-row { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.lb-page .num, .lb-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.lb-page .nowrap, .lb-table .nowrap { white-space: nowrap; }

/* ── controls ── */
.lb-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 999px; border: 1.5px solid rgba(1, 30, 65, .2); background: #fff; color: var(--oxford-blue); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.lb-btn:hover { border-color: var(--oxford-blue); }
.lb-btn-sm { padding: .3rem .7rem; font-size: .82rem; }
.lb-link-btn { background: none; border: 0; color: var(--electric-blue); cursor: pointer; padding: 0; font: inherit; font-weight: 600; font-size: .85rem; }
.lb-seg { display: inline-flex; border: 1.5px solid var(--neutral-blue); border-radius: 999px; padding: 2px; background: #fff; }
.lb-seg button { border: 0; background: transparent; padding: .35rem .9rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; color: var(--oxford-blue); }
.lb-seg button[aria-pressed="true"] { background: var(--oxford-blue); color: #fff; }
.lb-controls { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--neutral-blue); border-bottom: 1px solid var(--neutral-blue); margin-bottom: 1.5rem; }
.lb-controls .container { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding-top: .65rem; padding-bottom: .65rem; }
.lb-field { display: inline-flex; gap: .45rem; align-items: center; font-size: .85rem; font-weight: 600; color: var(--lb-muted-ink); }
.lb-field select, .lb-picker input[type=search] { font: inherit; border: 1.5px solid var(--neutral-blue); border-radius: 8px; padding: .4rem .6rem; background: #fff; color: var(--oxford-blue); min-width: 0; }
.lb-updated { font-size: .82rem; color: var(--lb-muted-ink); }

/* ── cards, notices, chips ── */
.lb-card { background: #fff; border: 1px solid var(--neutral-blue); border-radius: var(--lb-radius); padding: 1.25rem; box-shadow: var(--lb-shadow); }
.lb-notice { border-radius: 10px; padding: .6rem .9rem; font-size: .92rem; border: 1px solid; margin-bottom: 1rem; color: var(--oxford-blue); }
.lb-notice-info { background: var(--lb-primary-soft); border-color: #c7d6f6; }
.lb-notice-warn { background: var(--lb-warn-soft); border-color: #f1df7a; color: var(--lb-warn-ink); }
.lb-chip { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; background: var(--lb-panel-2); color: var(--oxford-blue); white-space: nowrap; }
.lb-chip-ok { background: var(--lb-neutral-green); color: var(--lb-mallard-green); }
.lb-highlight { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--lb-primary-soft); border: 1px solid #c7d6f6; border-radius: 10px; padding: .5rem .8rem; margin-bottom: 1.25rem; font-size: .92rem; }
.lb-highlight[hidden] { display: none; }
/* pinned to the top of the viewport after a chart click (hidden again on scroll, see leaderboard-page.js) */
.lb-highlight:not([hidden]) {
  position: fixed; z-index: 90; top: .75rem; left: 50%; transform: translateX(-50%); /* top set in JS: below the header */
  width: min(var(--container-max-width), calc(100vw - 2rem)); margin: 0; box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(1, 30, 65, .18);
}
/* styles.css pads every <section> by 4rem top and bottom; the leaderboard spaces its own */
.lb-section { margin-bottom: var(--spacing-xl); padding: 0; }
.lb-section-head { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.lb-section-head h2 { margin: 0; }
.lb-section-head p { margin: .2rem 0 0; color: var(--text-light); font-size: .95rem; }
.lb-options { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .88rem; margin-bottom: .6rem; }
.lb-options label { display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; }
.lb-provider-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; margin-top: .9rem; color: var(--oxford-blue); }
.lb-provider-legend > span { display: inline-flex; align-items: center; gap: .3rem; }
.lb-provider-legend .lb-swatch { margin-right: 0; }
.lb-footnote { font-size: .82rem; color: var(--lb-muted-ink); margin-top: .6rem; }

/* ── provider logos (G1): official marks on a white tile, like artificialanalysis.ai ── */
.lb-logo { display: inline-block; width: 16px; height: 16px; flex: none; object-fit: contain; vertical-align: -3px; }
.lb-logo-inline { margin-right: .35rem; }
.lb-logo-lg { width: 40px; height: 40px; padding: 6px; border: 1px solid var(--neutral-blue); border-radius: 10px; background: #fff; box-sizing: content-box; }
.lb-model-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .4rem; }
.lb-model-head h1 { margin: 0; }
.lb-model-cell { display: inline-flex; align-items: center; gap: .45rem; flex-wrap: wrap; }

/* ── model picker ── */
.lb-picker-wrap { position: relative; }
.lb-picker { position: absolute; left: 0; top: calc(100% + 8px); z-index: 60; width: min(560px, calc(100vw - 2rem)); max-height: min(70vh, 640px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--neutral-blue); border-radius: 14px; box-shadow: 0 16px 40px rgba(1, 30, 65, .2); color: var(--oxford-blue); }
.lb-picker[hidden] { display: none; }
.lb-picker-head { padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--lb-panel-2); display: grid; gap: .55rem; }
.lb-picker-head input[type=search] { width: 100%; }
.lb-picker-head .lb-hint { font-size: .8rem; margin-right: .2rem; }
.lb-picker-list { overflow-y: auto; padding: .4rem .6rem .8rem; }
.lb-picker-none { padding: 1rem; }
.lb-picker-group { font-size: .78rem; font-weight: 700; color: var(--lb-muted-ink); margin: .7rem .4rem .2rem; display: flex; align-items: center; gap: .4rem; }
.lb-picker-row { display: flex; align-items: center; gap: .55rem; padding: .35rem .45rem; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.lb-picker-row:hover { background: var(--lb-panel); }
.lb-picker-score { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--lb-muted-ink); font-size: .85rem; }
.lb-picker-foot { border-top: 1px solid var(--lb-panel-2); padding: .6rem 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.lb-chipbtn { display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--neutral-blue); border-radius: 999px; padding: .15rem .6rem; background: #fff; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--oxford-blue); }
.lb-chipbtn[aria-pressed="true"] { border-color: var(--oxford-blue); background: var(--lb-panel-2); }

/* ── tables (results + model page) ── */
.lb-table-wrap { overflow-x: auto; }
.lb-table { border-collapse: collapse; width: 100%; }
.lb-table-narrow { max-width: 560px; }
.lb-table th, .lb-table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--neutral-blue); vertical-align: middle; color: var(--oxford-blue); font-size: .92rem; }
.lb-table th { font-size: .85rem; font-weight: 700; color: var(--lb-muted-ink); background: var(--lb-panel); }
.lb-table th.num, .lb-table td.num { text-align: right; }
.lb-table th button { background: none; border: 0; font: inherit; font-weight: 700; color: var(--lb-muted-ink); cursor: pointer; padding: 0; white-space: nowrap; }
.lb-table th[aria-sort="ascending"] button, .lb-table th[aria-sort="descending"] button { color: var(--oxford-blue); }
.lb-results .lb-table tbody tr { cursor: pointer; }
.lb-table tr.is-selected td { background: var(--lb-primary-soft); }
.lb-table tbody tr:hover td { background: var(--lb-panel); }

/* ── model page tiles + method prose ── */
.lb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.lb-tile { border: 1px solid var(--neutral-blue); border-radius: 12px; padding: 1rem 1.1rem; background: #fff; }
.lb-tile-title { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; margin: .2rem 0 .6rem; color: var(--oxford-blue); }
.lb-tile-big { font-family: var(--font-display); font-size: 2.4rem; color: var(--oxford-blue); line-height: 1; margin-bottom: .4rem; }
/* .lb-prose: the parked method page (templates/leaderboard/legacy/method.html) – kept for its return */
.lb-prose { max-width: 46rem; }
.lb-prose h2 { margin: 2.2rem 0 .6rem; }
.lb-prose p, .lb-prose ul, .lb-prose ol { margin-bottom: .8rem; }
.lb-prose ul, .lb-prose ol { padding-left: 1.4rem; }
.lb-prose li { margin-bottom: .4rem; }

/* ── highlighted model: its name becomes a link to the model page, "Name →" in Electric Blue ── */
.lb-model-link, .lb-page a.lb-model-link { color: var(--electric-blue); font-weight: 700; text-decoration: none; }
.lb-model-link:hover .lb-arrow, .lb-model-link:focus-visible .lb-arrow { transform: translateX(2px); }
.lb-model-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.lb-arrow { display: inline-block; transition: transform .15s ease; }
a.lb-model-link text { fill: var(--electric-blue); cursor: pointer; pointer-events: auto; }
a.lb-model-link:hover text { text-decoration: underline; }
.lb-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* model names are chart ink everywhere until highlighted (the table used to show them as links) */
.lb-table .lb-name { color: var(--oxford-blue); font-weight: 700; }

/* ── closing block: blog, paper CTA ── */
.lb-outro { margin-top: var(--spacing-lg); max-width: 52rem; color: var(--oxford-blue); }
.lb-outro .blog-cta { margin: 1rem 0; }

@media print { .lb-controls { display: none !important; } }

/* ═══ charts (one class per file in static/js/leaderboard/) ═══ */
.lb-chart {
  --lb-ink: var(--oxford-blue, #011e41);
  --lb-muted: #4a5a6c;           /* tint of Oxford Blue, AA on white */
  --lb-line: var(--neutral-blue, #cad7d8);
  --lb-grid: #e7eeee;            /* tint of Neutral Blue */
  --lb-accent: var(--electric-blue, #0043e0);
  --lb-zone: #e0e7d0;            /* Neutral Green */
  --lb-zone-ink: #005145;        /* Mallard Green */
  color: var(--lb-ink);
  font-size: 14px;
  width: 100%;
}
.lb-muted { color: #4a5a6c; }
.lb-empty { padding: 2rem 1rem; text-align: center; color: #4a5a6c; margin: 0; }

/* tooltip */
.lb-tip {
  position: absolute; z-index: 20; pointer-events: none; max-width: 300px;
  background: #fff; color: #011e41; border: 1px solid #cad7d8; border-radius: 10px;
  padding: .5rem .7rem; font-size: 13px; line-height: 1.45;
  box-shadow: 0 6px 20px rgba(1, 30, 65, .16);
}
.lb-tip .lb-muted { font-size: 12px; }
/* AA-style tooltip: logo + name, grey context, big score, small grey "Click to follow" */
.lb-tip-name { display: block; font-size: 14px; }
.lb-tip-provider { display: flex; align-items: center; gap: .35rem; color: #4a5a6c; font-size: 12px; margin: .15rem 0 .3rem; }
.lb-tip-big { font-size: 22px; font-weight: 700; line-height: 1.2; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.lb-tip-hint { display: block; color: #6b7785; font-size: 11.5px; margin-top: .35rem; }

/* shared bits */
.lb-rank { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 999px; background: #f4f7f7; font-weight: 700; font-size: 12px; color: #011e41; flex: none; }
.lb-swatch { display: inline-block; width: .75em; height: .75em; border-radius: 3px; background: var(--c); margin-right: .45em; flex: none; vertical-align: -.05em; }
.lb-colnum { font-size: 10px; fill: #4a5a6c; color: #4a5a6c; font-weight: 700; }

/* ── bar chart ── */
.lb-bars-axis, .lb-bar-row { display: grid; grid-template-columns: minmax(180px, 34%) 1fr; gap: .75rem; align-items: center; }
.lb-bars-ticks { position: relative; height: 1.2rem; margin-right: 3rem; }
.lb-bars-ticks i { position: absolute; transform: translateX(-50%); font-style: normal; font-size: 11px; color: #4a5a6c; }
.lb-bars-list { list-style: none; margin: 0; padding: 0; }
.lb-bar-row { padding: .3rem .35rem; border-radius: 8px; cursor: pointer; transition: opacity .15s ease; }
.lb-bar-row:hover, .lb-bar-row:focus-visible { background: #f4f7f7; outline: none; }
.lb-bar-row.is-selected { background: #e6edfc; }
.lb-bar-row.is-dim { opacity: .55; }
.lb-bar-label { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.lb-name { font-weight: 600; line-height: 1.3; }
/* the track is the 0–100 axis; the value sits just past the end of the bar */
.lb-bar-track { position: relative; height: 22px; margin-right: 3rem;
  background: repeating-linear-gradient(90deg, #e7eeee 0 1px, transparent 1px 25%); }
.lb-bar-fill { display: block; height: 100%; background: var(--c); border-radius: 0 4px 4px 0; min-width: 2px; }
.lb-bar-value { position: absolute; top: 50%; transform: translate(.45rem, -50%); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .lb-bars-axis { grid-template-columns: 1fr; }
  .lb-bars-axis > span:first-child { display: none; }
  .lb-bar-row { grid-template-columns: 1fr; gap: .2rem; }
}

/* ── rank map ── */
.lb-rowlogo { pointer-events: none; }
.lb-rankmap svg { display: block; overflow: visible; font-family: inherit; }
.lb-guide { stroke: #e7eeee; stroke-width: 1; }
.lb-guide-strong { stroke: #cad7d8; }
.lb-colhead { font-size: 11px; fill: #011e41; font-weight: 600; }
.lb-colhead-strong { font-weight: 800; }
.lb-rowname { font-size: 12.5px; fill: #011e41; font-weight: 600; cursor: pointer; }
.lb-rowname.is-focus { font-weight: 800; fill: #0043e0; }
.lb-line-path { fill: none; stroke-width: 2; opacity: .85; transition: opacity .15s ease; }
.lb-line-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.lb-dot circle { stroke: #fff; stroke-width: 2; }
.lb-dot text { font-weight: 700; pointer-events: none; }
.lb-dot-score { fill: #011e41; font-size: 10.5px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.lb-line { cursor: pointer; transition: opacity .15s ease; }
.has-focus .lb-line:not(.is-focus), .has-hover .lb-line:not(.is-hover) { opacity: .14; }
.has-hover .lb-line.is-hover, .lb-line.is-focus { opacity: 1; }
.lb-line.is-focus .lb-line-path, .lb-line.is-hover .lb-line-path { stroke-width: 3; opacity: 1; }
.lb-legend { list-style: none; padding: 0; margin: .75rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.lb-legend button { display: inline-flex; align-items: center; font: inherit; font-size: 13px; background: #fff; color: #011e41; border: 1px solid #cad7d8; border-radius: 999px; padding: .25rem .65rem; cursor: pointer; }
.lb-legend button[aria-pressed="true"] { border-color: #0043e0; background: #e6edfc; font-weight: 700; }

/* ── heatmap ── */
.lb-heatmap-scroll { overflow-x: auto; border: 1px solid #cad7d8; border-radius: 12px; }
.lb-heatmap-table { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 13px; table-layout: fixed; min-width: 1080px; }
.lb-heatmap-table col.lb-col-model { width: 220px; }
.lb-heatmap-table th { font-weight: 600; font-size: 10.5px; color: #011e41; text-align: center; vertical-align: bottom; padding: .4rem .15rem; background: #fff; line-height: 1.25; hyphens: auto; -webkit-hyphens: auto; }
.lb-heatmap-table tbody th { text-align: left; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: .35rem .6rem .35rem .4rem; vertical-align: middle; }
.lb-heatmap-table .lb-cell { height: 2.6rem; }
/* model page: rank among every model on the version, under each row of scores */
.lb-rank-row th { text-align: left; font-size: 13px; font-weight: 600; color: #011e41; }
.lb-heatmap-table .lb-rank-cell { font-weight: 700; }
.lb-heatmap-model .lb-score-row { cursor: default; }
.lb-heatmap-table thead .lb-corner { text-align: left; vertical-align: bottom; font-size: 13px; font-weight: 700; }
.lb-heatmap-table tbody th .lb-rank { margin-right: .4rem; }
.lb-sticky { position: sticky; left: 0; z-index: 1; background: #fff; }
.lb-cell { text-align: center; padding: .45rem .3rem; border-radius: 4px; font-variant-numeric: tabular-nums; cursor: default; }
.lb-overall-col.lb-cell { background: #f4f7f7; color: #011e41; }
.lb-heatmap-table tbody tr.lb-score-row { cursor: pointer; }
.lb-heatmap-table tbody tr.is-selected th { color: #0043e0; font-weight: 800; }
.lb-heatmap-table tbody tr.is-selected .lb-cell { outline: 2px solid #011e41; outline-offset: -1px; }
.lb-scale { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; font-size: 12px; }
.lb-scale-bar { width: 160px; height: 10px; border-radius: 3px; }

/* ── scatter ── */
.lb-scatter svg { display: block; font-family: inherit; }
.lb-zone { fill: var(--lb-zone); }
.lb-zone-label { fill: var(--lb-zone-ink); font-size: 12px; font-weight: 700; }
.lb-grid { stroke: #e7eeee; }
.lb-tick { font-size: 11px; fill: #4a5a6c; }
.lb-axis-title { font-size: 12px; fill: #011e41; font-weight: 600; }
.lb-frontier { fill: none; stroke: #011e41; stroke-width: 2; stroke-dasharray: 5 4; }
.lb-point { cursor: pointer; outline: none; }
.lb-point .lb-hit { fill: transparent; }
.lb-point-mark { stroke: #fff; stroke-width: 2; }
.lb-point:focus-visible .lb-point-mark { stroke: #011e41; }
.has-focus .lb-point:not(.is-focus) { opacity: .35; }
.lb-point.is-focus .lb-point-mark { stroke: #011e41; stroke-width: 2.5; }
.lb-point-label { font-size: 11.5px; fill: #011e41; paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.lb-point-label.is-focus { font-weight: 800; fill: var(--electric-blue); }
.lb-label-plate { fill: #fff; opacity: .95; }
.lb-leader { stroke: #cad7d8; stroke-width: 1; }
