/* Shared by the two EV road reports (peninsular/, borneo/). Tokens: docs/design-charter.md §4 (copied from the rail-stations study) */
:root {
  --canvas: #ffffff;
  --ink: #171b21;
  --ink-2: #4a5059;
  --ink-3: #6b717a;
  --rule: #dfe2e6;
  --ground: #f3f4f5;
  --subject: #9ab800;      /* hi-vis lime: the subject, public fast (DC) chargers; marks only */
  --subject-ink: #4d5c00;
  --bench: #8a8f98;        /* context: slow (AC-only) chargers */
  /* road distance to the nearest fast charger, one NAMED colour per level so a reader can say "the yellow road":
     lime (thin), yellow, orange, red, purple, black; from yellow on, lightness falls with distance, so the order survives
     colour blindness and greyscale print, and the thin line sets lime apart (charter ledger 2026-09-30, operator brief:
     grey read as the basemap's boundaries and minor roads). Each report sets its
     own kilometres per colour (data.json bands) */
  --b0: #9ab800; --b1: #f2b400; --b2: #ff7a00; --b3: #e3120b; --b4: #8e1fb0; --b5: #171b21;
  --focus: #171b21;
  --measure: 70ch;
  --text: 58ch;
  --sans: "Chivo", system-ui, sans-serif;
  --mono: "Chivo Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 17px/1.55 var(--sans); }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.col { max-width: var(--measure); }
.num, td, .tick, .tt { font-variant-numeric: tabular-nums; }

.mast { border-bottom: 1px solid var(--ink); }
.mast .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand a.home { color: inherit; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .brand a.home:hover { text-decoration: underline; text-underline-offset: 3px; } }
.brand span { font-weight: 400; color: var(--ink-2); margin-left: 10px; }
.ref { font: 400 13px var(--mono); color: var(--ink-2); display: flex; gap: 16px; }
.ref time { font-family: var(--sans); font-size: 14px; }

header.title { padding: 48px 0 8px; }
h1 { font-weight: 700; font-size: clamp(30px, 4.4vw, 42px); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 18px; max-width: 24ch; }
.stand { font-size: 19px; color: var(--ink-2); margin: 0 0 8px; max-width: var(--text); }
.meta { font-size: 14px; color: var(--ink-3); margin: 18px 0 0; max-width: var(--text); }
h2 { font-weight: 700; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 12px; }
section { padding: 44px 0 8px; border-top: 1px solid var(--rule); margin-top: 36px; }
p { margin: 0 0 14px; }
p, li { text-wrap: pretty; }
h1, h2, .findings strong { text-wrap: balance; }

.findings { list-style: none; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--ink); }
/* a small chart beside each finding that has a data pattern (text left at 58ch, chart 340 px right; stacked on phones):
   the rail-station study's grammar, drawn from data.json by ev-roads.js; the full figures and tables are below */
.findings li { display: grid; grid-template-columns: minmax(0, var(--text)) 340px; column-gap: 48px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.findings .ft { display: grid; gap: 4px; align-content: start; }
.findings .fc { margin: 2px 0 0; }
.findings .fc .clegend { font-size: 13px; gap: 4px 12px; margin-top: 6px; }
.findings .fc .frow { cursor: pointer; }
.findings .fc .rn { font-family: var(--mono); font-weight: 600; font-size: 12px; fill: var(--ink); }
.findings .fc .rnm, .findings .fc .lbl { font-weight: 600; font-size: 13px; fill: var(--ink); }
.findings .fc .rs { font-size: 12px; fill: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .findings .fc .frow:hover .rn, .findings .fc .frow:hover .rnm { text-decoration: underline; } }
.clegend { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.clegend span { display: inline-flex; align-items: center; gap: 6px; }
.clegend b { font-weight: 600; color: var(--ink); }
.chart .clegend svg { display: inline; width: auto; flex: none; }  /* not the chart's own full-width rule */
.findings strong { font-weight: 600; }
.findings .refs { display: flex; flex-wrap: wrap; gap: 4px; }
.findings p { margin: 0; color: var(--ink-2); font-size: 16px; max-width: var(--text); }

/* Signature: the place reference. Here a road, cited by its route number (FT = federal; letters = state routes),
   or by name where it has none; a chip flies the map to the road's farthest point from a fast charger. */
.gref { display: inline-block; font: 600 13px/1 var(--mono); padding: 4px 6px; border: 1px solid var(--ink); border-radius: 2px; text-decoration: none; color: var(--ink); background: var(--canvas); margin: 0 2px; vertical-align: 1px; white-space: nowrap; }
.gref.nm { font-family: var(--sans); white-space: normal; line-height: 1.25; }  /* a long road name wraps at phone width */
@media (hover: hover) and (pointer: fine) { .gref:hover { background: var(--ink); color: var(--canvas); } }
.gref:active { transform: scale(.97); }

.figure { margin: 28px 0 0; }
.figcap { font-size: 14px; color: var(--ink-2); margin: 10px 0 0; max-width: var(--measure); }
.figcap b { color: var(--ink); font-weight: 600; }
.mapbar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding: 10px 0; border-top: 1px solid var(--ink); font-size: 14px; }
.mapbar label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.mapbar input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
.mapbar fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; min-width: 0; }
.mapbar legend { float: left; font-weight: 600; margin-right: 2px; padding: 0; }
.mapbar label .n { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mapbar .views { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.mapbar button { font: 500 14px var(--sans); border: 1px solid var(--ink); background: var(--canvas); color: var(--ink); border-radius: 2px; padding: 5px 10px; cursor: pointer; }
.mapbar button:active { transform: scale(.97); }
/* the threshold switch: a radio group drawn as joined 2px buttons; the checked one is ink */
.mapbar fieldset.seg { gap: 0; }
.seg legend { margin-right: 10px !important; }
.seg label { position: relative; gap: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; border: 1px solid var(--ink); margin-left: -1px; padding: 5px 10px; font-weight: 500; background: var(--canvas); }
.seg label:first-of-type span { margin-left: 0; border-radius: 2px 0 0 2px; }
.seg label:last-of-type span { border-radius: 0 2px 2px 0; }
.seg input:checked + span { background: var(--ink); color: var(--canvas); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }
.mapfind { position: relative; flex-basis: 100%; }
.mapfind input { font: 14px var(--sans); color: var(--ink); width: min(440px, 100%); margin: 0; border: 1px solid var(--ink); border-radius: 2px; padding: 3px 6px; line-height: 1.4; background: var(--canvas); }
.mapfind input::placeholder { color: var(--ink-2); }
#q-res { position: absolute; z-index: 1100; top: 100%; left: 0; width: min(440px, 100%); margin: 2px 0 0; padding: 0; list-style: none; background: var(--canvas); border: 1px solid var(--ink); max-height: 320px; overflow-y: auto; }
#q-res li { padding: 7px 10px; cursor: pointer; line-height: 1.3; }
#q-res li[aria-selected="true"], #q-res li:hover { background: var(--rule); }
#q-res li .sub { display: block; color: var(--ink-2); font-size: 13px; }
#q-res li code { font-family: var(--mono); font-size: 13px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* the ramp key: one row of swatches, each band with its kilometres of main road */
.ramp { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 0 10px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--rule); }
.ramp > span { display: inline-flex; align-items: center; gap: 6px; }
.ramp .km { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ramp .off { opacity: .45; }
.ramp[hidden] { display: none; }
#map { height: min(76vh, 720px); min-height: 440px; background: var(--ground); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--ink); }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { border-radius: 2px; box-shadow: none; border: 1px solid var(--ink); }
.leaflet-popup-content { margin: 10px 12px; font-size: 14px; line-height: 1.4; }
.leaflet-popup-content p { margin: 4px 0 0; }
/* Leaflet sizes a popup by measuring its content under white-space: nowrap; `p { text-wrap: pretty }` above set the
   paragraphs back to wrap, so popups measured as their longest word (114 px). Inheriting restores the measurement
   (up to maxWidth); once sized, the text wraps again (2026-10-16). */
.leaflet-popup-content p { white-space: inherit; }
.leaflet-popup-content a { color: var(--ink); }  /* Leaflet's default link blue is off-charter */
.pop-name { font-weight: 600; }
.pop-code { font: 600 12px var(--mono); margin-right: 6px; }

.chart { width: 100%; margin-top: 8px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); fill: var(--ink-2); font-size: 13px; }
.chart .lbl { fill: var(--ink); font-size: 14px; }
.chart .val { fill: var(--ink); font-size: 13px; }
.tt { position: fixed; pointer-events: none; z-index: 1000; background: var(--canvas); color: var(--ink); border: 1px solid var(--ink); padding: 8px 10px; font-size: 13px; line-height: 1.4; max-width: 280px; opacity: 0; transition: opacity 120ms ease-out; }
.tt.on { opacity: 1; }
details.data { margin: 12px 0 0; font-size: 14px; }
details.data summary { cursor: pointer; color: var(--ink-2); }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: 'Show'; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
details.fold[open] > summary::after { content: 'Hide'; }
details.fold > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
details.fold[open] > summary { margin-bottom: 12px; }
table { border-collapse: collapse; margin-top: 10px; font-size: 14px; width: 100%; max-width: 900px; }
th, td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; border-bottom-color: var(--ink); }
td.r, th.r { text-align: right; }
td .sub { display: block; font-size: 13px; color: var(--ink-3); }
td .gref { margin: 0 6px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.src { padding-left: 18px; font-size: 15px; color: var(--ink-2); }
.src li { margin-bottom: 6px; }
footer { margin-top: 56px; border-top: 1px solid var(--ink); padding: 18px 0 48px; font-size: 14px; color: var(--ink-2); }
.cta { display: inline-block; font-weight: 600; border: 1px solid var(--ink); border-radius: 2px; padding: 10px 16px; text-decoration: none; background: var(--ink); color: var(--canvas); }
.cta:active { transform: scale(.97); }
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  header.title { padding-top: 32px; }
  .stand { font-size: 17px; }
  .two { grid-template-columns: 1fr; gap: 0; }
  .findings li { grid-template-columns: minmax(0, 1fr); }
  .findings .fc { max-width: 420px; margin-top: 10px; }
  .mapbar .views { margin-left: 0; }
  .seg legend { float: none; width: 100%; margin: 0 0 6px; }
}
@media (max-width: 560px) { .hide-n { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .mapbar, .mapfind, details.data summary, .cta { display: none; }
  details.fold > summary::after { display: none; }
  #map { height: 560px; }
  section { break-inside: avoid-page; }
}
.gate p { max-width: var(--measure); }
.gate-btn { display: inline-block; font: 600 16px var(--sans); color: var(--canvas); background: var(--ink); border: 2px solid var(--ink); border-radius: 2px; padding: 8px 16px; text-decoration: none; }
.gate-btn:active { transform: scale(.97); }
.gate-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
.gate-note p, .gate-note form { margin: 0; }
.gate-note button { font: 500 14px var(--sans); border: 1px solid var(--ink); background: var(--canvas); color: var(--ink); border-radius: 2px; padding: 3px 10px; cursor: pointer; }
.sib { font-size: 15px; margin: 12px 0 0; max-width: var(--text); }
