:root {
  color-scheme: light;
  --paper: #f1f4f7;
  --panel: #fff;
  --ink: #172b42;
  --quiet: #4d6175;
  --line: #d4dde6;
  --blue: #24658f;
  --gold: #d4a349;
  --brick: #a44436;
  --route-path: #583398;
  --focus: #9b4c16;
  --sans: "Avenir Next", "Gill Sans", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
a { color: var(--blue); text-underline-offset: .2em; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[id] { scroll-margin-top: 16px; }
.skip { position: absolute; left: 1rem; top: -10rem; z-index: 5; padding: .5rem; background: white; }
.skip:focus { top: 1rem; }
.wrap { width: min(100% - 64px, 1376px); margin-inline: auto; }

.top { background: var(--ink); color: white; }
.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 51px; gap: 12px; }
.brand, .source-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 650; text-decoration: none; }
.brand svg { flex: none; }
.source-link { font-size: .81rem; color: #d3e3f0; }
.source-link:hover { text-decoration: underline; }
.top :focus-visible { outline-color: #f0c47b; }
.intro { background: var(--panel); border-bottom: 1px solid var(--line); }
.intro-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 24px 18px; }
.overline { display: block; color: var(--quiet); font-size: .69rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; margin: 0 0 4px; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.18; letter-spacing: -.025em; }
h1 { font-size: clamp(1.85rem, 3.5vw, 2.75rem); }
h2 { font-size: 1.45rem; }
h3, .panel-heading h2 { font-size: 1.08rem; }
.intro-note { margin: 6px 0 0; color: var(--quiet); }
.window { flex: none; padding-left: 16px; border-left: 2px solid var(--blue); font-size: .82rem; color: var(--quiet); }
.window strong { display: block; margin-bottom: 2px; font-size: .98rem; color: var(--ink); }
.section-nav { display: flex; gap: 23px; overflow-x: auto; white-space: nowrap; font-size: .82rem; }
.section-nav a { padding: 9px 0 10px; border-bottom: 2px solid transparent; text-decoration: none; font-weight: 650; color: var(--quiet); }
.section-nav a:hover, .section-nav a:focus-visible { color: var(--blue); border-color: var(--blue); }
.section-nav a:focus-visible { outline-offset: -3px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; padding-block: 14px; }
.controls > label, legend, .stop-control { display: block; font-size: .76rem; font-weight: 700; }
.controls > label { width: min(280px, 100%); }
select { display: block; margin-top: 4px; min-height: 36px; padding: 5px 9px; border: 1px solid #a2b4c5; border-radius: 3px; background: var(--panel); font-size: .85rem; }
#route { width: 100%; }
fieldset { display: flex; margin: 0; padding: 4px 0 0; border: 0; }
legend { padding: 0; }
fieldset label { cursor: pointer; border: 1px solid #a2b4c5; padding: 7px 11px; background: var(--panel); font-size: .84rem; font-weight: 650; }
fieldset label:first-of-type { border-radius: 3px 0 0 3px; }
fieldset label:last-of-type { border-radius: 0 3px 3px 0; }
fieldset label + label { border-left: 0; }
fieldset label:has(:checked) { background: var(--ink); color: white; }
fieldset label:has(:focus-visible) { z-index: 1; outline: 3px solid var(--focus); outline-offset: 2px; }
fieldset input { position: absolute; opacity: 0; }

.kpis { display: grid; grid-template-columns: 1.25fr repeat(4, 1fr); margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.headway-kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { min-width: 0; padding: 12px clamp(10px, 1.6vw, 21px); border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi strong { display: block; margin-bottom: 3px; font-size: clamp(1.5rem, 2.7vw, 2.2rem); font-weight: 700; line-height: 1.08; font-variant-numeric: tabular-nums; }
.kpi span { display: block; color: var(--quiet); font-size: .78rem; font-weight: 600; }
.headway-kpis .kpi small { display: block; margin-top: 5px; color: var(--quiet); font-size: .76rem; }
.headway-intro { margin: 0 0 12px; color: var(--quiet); font-size: .88rem; }
.headway-notes { margin: 0 0 12px; }
#kpis .kpi:first-child { background: #e7f0f7; border-left: 3px solid var(--blue); }
#kpis .kpi:first-child strong { color: #184f77; }

.workbench, .panels, .method-grid { display: grid; gap: 14px; }
.workbench { grid-template-columns: minmax(0, 2.08fr) minmax(345px, 1fr); align-items: start; }
.inspector { display: grid; gap: 14px; min-width: 0; }
.panels, .method-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.panel-heading, .section-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.panel-heading { margin-bottom: 12px; }
.panel-heading p, .section-head p, .chart-detail { color: var(--quiet); font-size: .83rem; margin: 4px 0 0; }
.section-head { align-items: baseline; margin-bottom: 11px; }
.report-section { margin-top: 28px; }
.map-count { flex: none; margin-top: 1px; color: var(--quiet); font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.map-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.map-tools button { min-height: 36px; padding: 4px 9px; border: 1px solid #a2b4c5; border-radius: 3px; background: var(--panel); color: var(--ink); font-size: .8rem; font-weight: 700; cursor: pointer; }
.map-tools .map-zoom { min-width: 36px; font-size: 1.15rem; line-height: 1; }
.map-tools button:hover:not(:disabled) { background: #e7f0f7; }
.map-tools button:disabled { opacity: .5; cursor: default; }
.map-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-top: 9px; }
.map-footer .legend { margin: 0; }
.map-viewport { position: relative; }
.map-credit { position: absolute; right: 1px; bottom: 1px; padding: 1px 5px; background: #fffffff0; color: var(--ink); font-size: .7rem; }
.map-help { color: var(--quiet); margin: 6px 0 0; font-size: .73rem; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--quiet); font: 12px var(--mono); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .datum { cursor: pointer; }
.chart .datum:focus, .chart .datum.selected { stroke: var(--ink); stroke-width: 2.5; outline: none; }
.chart .value { fill: var(--ink); font-weight: bold; }
#stop-map .chart { overflow: hidden; border: 1px solid var(--line); background: #f6f6ee; }
#stop-map { touch-action: pan-y pinch-zoom; user-select: none; }
#stop-map.zoomed { cursor: grab; touch-action: none; }
#stop-map.dragging, #stop-map.dragging .datum { cursor: grabbing; }
#stop-map .datum { transform-box: fill-box; transform-origin: center; transform: scale(var(--marker-scale, 1)); }
#route-path { pointer-events: none; }
#route-path path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#route-path .route-outline { stroke: #fff; stroke-width: 7; }
#route-path .route-line { stroke: var(--route-path); stroke-width: 4; }
#scatter { max-width: 940px; margin-inline: auto; }
.chart-detail { min-height: 1.5em; }
.bar-row { display: grid; grid-template-columns: 45px minmax(0, 1fr) 49px 56px; align-items: center; gap: 9px; padding: 4px 0; font-size: .78rem; font-variant-numeric: tabular-nums; }
.bar-row > :nth-last-child(-n+2) { text-align: right; }
.bar-heading { color: var(--quiet); border-bottom: 1px solid var(--line); font-size: .72rem; font-weight: 700; }
.route-button { padding: 2px 5px; border: 1px solid #cfdae5; border-radius: 2px; background: #edf3f8; color: #184f77; cursor: pointer; font: inherit; font-weight: 750; }
.route-button:hover { background: #dceaf4; text-decoration: underline; }
.stack { display: flex; height: 12px; overflow: hidden; border-radius: 2px; background: #e7edf2; }
.stack i { display: block; background: var(--swatch); }
.on-time { --swatch: var(--blue); }
.early { --swatch: var(--gold); }
.late { --swatch: var(--brick); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: 9px; color: var(--quiet); font-size: .73rem; }
.legend span::before { content: ""; display: inline-block; background: var(--swatch); width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; }
.legend .route-swatch::before { width: 16px; height: 4px; vertical-align: middle; background: var(--route-path); }

#stop { width: 100%; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: .45rem .35rem; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: .74rem; color: var(--quiet); }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.callout { margin: 11px 0 0; border-left: 3px solid var(--blue); padding: 7px 9px; background: #edf4f9; font-size: .82rem; }
.sensitivity-row { display: grid; grid-template-columns: 66px minmax(0, 1fr) 70px; gap: 7px; align-items: center; padding: 6px 0; font-size: .8rem; font-variant-numeric: tabular-nums; }
.sensitivity-row > :last-child { text-align: right; }
.sensitivity-row .stack { height: 7px; margin-bottom: 2px; }
.sensitivity-row small { color: var(--quiet); font-size: .72rem; }
.sensitivity-heading { padding-top: 0; border-bottom: 1px solid var(--line); color: var(--quiet); font-size: .72rem; font-weight: 700; }
details { margin-top: 10px; font-size: .8rem; }
summary { cursor: pointer; color: var(--blue); font-weight: 700; }
details p { margin: 5px 0 0; color: var(--quiet); }
.panel-link { display: inline-block; margin-top: 8px; font-size: .8rem; font-weight: 700; }
.method { border-block: 1px solid var(--line); padding: 20px 0; }
.method-grid { gap: 15px 24px; }
.method-grid p { font-size: .88rem; color: var(--quiet); margin: 4px 0 0; }
.method-links { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: 16px; font-size: .82rem; font-weight: 700; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 16px 0; font-size: .75rem; color: var(--quiet); }
.empty { color: var(--quiet); padding-block: 5px; }

@media (max-width: 980px) {
  .wrap { width: calc(100% - 36px); }
  .workbench { grid-template-columns: 1fr; }
  .inspector { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 630px) {
  .wrap { width: calc(100% - 28px); }
  .intro-inner { display: grid; gap: 12px; padding-block: 18px 10px; }
  .window { padding-left: 9px; }
  .window .overline { margin-bottom: 1px; }
  .window strong { display: inline; margin-right: 5px; font-size: .82rem; }
  .section-nav { gap: 15px; }
  .panels, .inspector, .method-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #kpis .kpi:first-child { grid-column: 1 / -1; }
  .kpi { border-bottom: 1px solid var(--line); }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  #kpis .kpi:nth-child(even), .headway-kpis .kpi:nth-child(odd) { border-left: 0; }
  .section-head { flex-direction: column; gap: 3px; }
  .panel { padding: 12px; }
  .map-panel .panel-heading { flex-wrap: wrap; gap: 5px; }
  #hour-chart .chart text { font-size: 18px; }
  #scatter .chart text { font-size: 22px; }
}
