/* Court Queue Lab: neutral test-build styling. Brand colours and type come later. */
:root {
  --ink: #111418;
  --ink-2: #4a525c;      /* 7.6:1 on white */
  --ink-3: #5f6873;      /* 5.6:1 on white */
  --line: #d9dde2;
  --soft: #f3f5f7;
  --paper: #ffffff;
  --accent: #1d4ed8;     /* scenario */
  --accent-soft: rgba(29, 78, 216, 0.16);
  --base: #6b7280;       /* no-change line */
  --warn: #b45309;
  --good: #047857;
  --radius: 6px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; font: 16px/1.5 var(--sans); color: var(--ink); background: var(--paper); -webkit-text-size-adjust: 100%; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: var(--mono); }
.small { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.lbl { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; border-radius: var(--radius); }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 4.4vw, 50px); max-width: 18ch; }
h2 { font-size: clamp(22px, 2.6vw, 30px); }
h3 { font-size: 17px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand svg { fill: var(--ink); }
.tag { font-size: 11px; color: var(--ink-3); font-weight: 500; border: 1px solid var(--line); padding: 2px 6px; border-radius: 3px; }
nav { display: flex; gap: 4px; }
nav a { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
nav a:hover { background: var(--soft); }

/* hero */
.hero { padding-top: 36px; padding-bottom: 28px; }
.eyebrow { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 10px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 62ch; margin: 0 0 24px; }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: var(--radius); }
.stats li { padding: 14px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stats li:first-child { border-left: 0; }
.stats .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats .d { font-size: 12.5px; color: var(--ink-2); }
.stats .spark { margin-top: 2px; }
.spark path { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.up { color: var(--warn); } .down { color: var(--good); }

/* sections */
.band-section { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 36px 0; margin: 12px 0; }
section.wrap { padding-top: 36px; padding-bottom: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head p { max-width: 60ch; margin: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* model */
.model-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.controls { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 88px); overflow: auto; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
legend { padding: 0; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
input, select, button { font: inherit; color: inherit; }
select, input[type=number], input[type=search] { border: 1px solid #9aa3ad; border-radius: var(--radius); padding: 8px 10px; min-height: 40px; background: var(--paper); width: 100%; }
.field.inline input { width: 240px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid #9aa3ad; background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; min-height: 36px; }
.chip[aria-checked=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.hint { font-size: 13px; color: var(--ink-2); margin: 0; min-height: 1.2em; }
.slider { display: grid; grid-template-columns: 1fr 86px; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; }
.slider label { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink); }
.slider input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.slider input[type=number] { min-height: 34px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.slider .changed { font-weight: 600; }
details.more summary { cursor: pointer; padding: 6px 0; }
details.more[open] { display: flex; flex-direction: column; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: var(--radius); padding: 8px 14px; cursor: pointer; min-height: 40px; font-size: 14px; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn:hover { opacity: .9; }

.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.outcomes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.outcome { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.outcome .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.outcome .r { font-size: 12.5px; color: var(--ink-2); }
.outcome.lead { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.outcome.lead { flex-direction: column; align-items: stretch; gap: 6px; }
.outcome.lead p { margin: 0; font-size: 17px; }
.chart-card { margin: 0; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--ink); }
.key.base { border-color: var(--base); }
.key.scen { border-color: var(--accent); }
.key.alt { border-color: #0f766e; }
.key.dashed { border-top-style: dashed; }
.key.bandkey { height: 10px; border: 0; background: var(--accent-soft); }
.chart { position: relative; border-radius: 4px; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: #e7eaee; }
.chart .tick { stroke: #9aa3ad; }
.chart .axis { font: 11.5px var(--mono); fill: var(--ink-3); }
.chart .label-today { fill: var(--ink-2); font-weight: 600; }
.chart .future { fill: #f8f9fb; }
.chart .today { stroke: #9aa3ad; stroke-dasharray: 2 3; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linejoin: round; }
.chart .line.base { stroke: var(--base); }
.chart .line.scen { stroke: var(--accent); stroke-width: 2.75; }
.chart .line.alt { stroke: #0f766e; }
.chart .line.dashed { stroke-dasharray: 6 4; }
.chart .band { fill: var(--accent-soft); }
.chart .band.base { fill: rgba(107, 114, 128, .14); }
.chart .cursor { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .dot { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.chart .dot.scen { stroke: var(--accent); } .chart .dot.base { stroke: var(--base); } .chart .dot.alt { stroke: #0f766e; }
.readout[hidden] { display: none; }
.readout { position: absolute; top: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.08); pointer-events: none; min-width: 180px; }
.readout .mono { font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; }
.readout .key { margin-right: 6px; vertical-align: middle; }
.readout .muted { color: var(--ink-3); font-size: 12px; }
.readout b { font-variant-numeric: tabular-nums; }
.chart:focus-visible { outline-offset: 4px; }
.table-toggle { min-width: 0; max-width: 100%; overflow: hidden; }
.table-toggle > div { overflow-x: auto; position: relative; }
.table-toggle summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 8px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.reverse p { margin: 0 0 10px; color: var(--ink-2); }
.reverse-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: end; }
.solve-out { margin: 12px 0 0; font-size: 16px; min-height: 1.4em; }

/* tables */
table.data, table.courts, table.checks { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td, table.checks th, table.checks td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; }
table.data th:first-child, table.checks th:first-child, table.checks td:first-child { text-align: left; }
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table-wrap { position: relative; max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.courts thead th { position: sticky; top: 0; background: var(--paper); z-index: 1; border-bottom: 1px solid var(--ink); padding: 0; text-align: right; }
table.courts thead th:first-child { text-align: left; }
table.courts thead button { all: unset; display: block; box-sizing: border-box; width: 100%; padding: 10px 10px; cursor: pointer; font: 600 11.5px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
table.courts thead button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
table.courts thead th[aria-sort] button { color: var(--ink); }
table.courts thead th[aria-sort=ascending] button::after { content: " ↑"; }
table.courts thead th[aria-sort=descending] button::after { content: " ↓"; }
table.courts td, table.courts tbody th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-weight: 400; }
table.courts tbody th { text-align: left; }
table.courts tbody tr:hover { background: var(--soft); }
table.courts .city { font-weight: 600; }
table.courts .st { color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }
table.courts .bar { display: inline-block; height: 8px; background: var(--ink); vertical-align: middle; margin-left: 8px; border-radius: 1px; }
table.courts td.spark-cell { width: 110px; }
.link-btn { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; font-size: 13.5px; padding: 4px 0; }
.link-btn:focus-visible { outline: 3px solid var(--accent); }
.custody { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.custody .outcome .v { font-size: 22px; }

/* accuracy */
.acc-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.scores { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scores li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.scores .v { font-size: 26px; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
.scores .r { font-size: 12.5px; color: var(--ink-2); }
table.checks { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }

/* method */
.diagram { margin: 0 0 20px; }
.diagram svg { width: 100%; height: auto; }
.diagram .node rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.diagram .node.strong rect { fill: var(--ink); }
.diagram .node.strong text { fill: #fff; }
.diagram .node.soft rect { fill: var(--soft); stroke: var(--line); }
.diagram .t { font: 700 17px var(--sans); fill: var(--ink); }
.diagram .s { font: 12.5px var(--mono); fill: var(--ink-2); }
.diagram .flow { stroke: var(--ink); stroke-width: 1.75; fill: none; }
.diagram .arrowhead { fill: var(--ink); }
.method-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.method-cols ul { padding-left: 18px; margin: 0; color: var(--ink-2); }
.method-cols li { margin-bottom: 8px; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 32px; margin-top: 24px; }
.foot-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot p { margin: 0; }

/* responsive */
@media (max-width: 1020px) {
  .model-grid { grid-template-columns: 1fr; }
  .controls { position: static; max-height: none; }
  .outcomes { grid-template-columns: 1fr 1fr; }
  .acc-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats li:nth-child(4) { border-left: 0; }
  .stats li:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  nav { display: none; }
  .tag { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li { border-left: 0 !important; border-top: 1px solid var(--line); }
  .stats li:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .stats li:first-child, .stats li:nth-child(2) { border-top: 0; }
  .stats .v { font-size: 22px; }
  .two, .custody, .method-cols, .scores { grid-template-columns: 1fr; }
  .reverse-row { grid-template-columns: 1fr 1fr; }
  .reverse-row .btn { grid-column: 1 / -1; }
  .field.inline { flex-direction: column; align-items: stretch; }
  .field.inline input { width: 100%; }
  .lede { font-size: 16px; }
  table.courts .hide-sm { display: none; }
  .readout[hidden] { display: none; }
.readout { min-width: 150px; font-size: 12px; }
}
