/* Headings use a DIN-style face where the system has one: the lettering of road signs. */
:root {
  color-scheme: light dark;
  --page: #f9f9f9;
  --surface: #ffffff;
  --ink: #191919;
  --secondary: #666666;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --petrol: #257de0;
  --diesel: #f47230;
  --hev: #00b894;
  --phev: #f2a600;
  --bev: #ee7fac;
  --rest: #b5b5b5;
  --range: #bcd7f6;
  --sign: "Bahnschrift", "DIN Alternate", "Barlow Semi Condensed", "Roboto Condensed", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b0b0b;
    --surface: #191919;
    --ink: #efefef;
    --secondary: #9c9c9c;
    --grid: #303030;
    --axis: #474747;
    --petrol: #338ced;
    --diesel: #e76624;
    --hev: #00a888;
    --phev: #d28e05;
    --bev: #e24d8b;
    --rest: #6b6b6b;
    --range: #1e3f66;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 var(--text);
}

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
a { color: inherit; text-underline-offset: 2px; }
.skip { position: absolute; left: -999rem; }
.skip:focus { left: .5rem; top: .5rem; z-index: 20; background: var(--surface); padding: .4rem .7rem; }
main:focus { outline: none; }

.masthead { background: var(--surface); border-bottom: 2px solid var(--ink); padding-top: 1.75rem; }
.masthead h1 { font: 600 clamp(1.75rem, 4.5vw, 2.75rem)/1.1 var(--sign); margin: 0 0 .5rem; }
.lede { max-width: 42rem; color: var(--secondary); margin: 0 0 1.25rem; }

nav { display: flex; flex-wrap: wrap; gap: .25rem; }
nav a {
  font: 600 1.05rem var(--sign);
  color: var(--ink);
  text-decoration: none;
  padding: .55rem .9rem;
  border-radius: 6px 6px 0 0;
}
nav a:hover { background: var(--grid); }
nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }

main.wrap { padding-top: 2rem; padding-bottom: 3rem; }
h2 { font: 600 1.6rem/1.2 var(--sign); margin: 0 0 .5rem; }
h3 { font: 600 1.2rem/1.3 var(--sign); margin: 0 0 .25rem; }
p { max-width: 42rem; }
.answer { font: 400 1.4rem/1.4 var(--sign); max-width: 46rem; margin: 0 0 1rem; }
.note { color: var(--secondary); font-size: .9rem; margin-top: .25rem; }

.block { margin-top: 2.75rem; }
.panel { background: var(--surface); border: 1px solid var(--grid); border-radius: 4px; padding: 1rem; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.5rem; }
.pair > * { min-width: 0; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: end; margin: 1.5rem 0 1rem; }
.filters label { display: grid; gap: .2rem; font-size: .85rem; color: var(--secondary); }
select, input, button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--axis);
  border-radius: 4px;
  padding: .4rem .6rem;
  max-width: 100%;
}
button { cursor: pointer; }
button:hover { border-color: var(--ink); }
:focus-visible { outline: 3px solid var(--petrol); outline-offset: 2px; }

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { fill: var(--secondary); font: 12px var(--text); }
svg text.strong { fill: var(--ink); }
svg .gridline { stroke: var(--grid); stroke-width: 1; }
svg .axisline { stroke: var(--axis); stroke-width: 1; }
svg .hit { fill: transparent; }
svg [role="button"] { cursor: pointer; }
svg [role="button"]:hover .hit, svg [role="button"].selected .hit { fill: var(--grid); opacity: .6; }

.legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; list-style: none; padding: 0; margin: .5rem 0; font-size: .85rem; }
.legend li { display: flex; align-items: center; gap: .4rem; }
.swatch { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }
.swatch.dot { border-radius: 50%; }
.swatch.tick { width: 3px; }

.sheet { align-self: start; position: sticky; top: 1rem; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); padding: 1rem 1.1rem; }
.sheet .figure { font: 600 2rem/1.1 var(--sign); margin: .5rem 0 0; }
.sheet dl { display: grid; grid-template-columns: auto auto; gap: .2rem 1rem; margin: .75rem 0 0; font-size: .92rem; }
.sheet dt { color: var(--secondary); }
.sheet dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.explorer { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.5rem; }
@media (max-width: 52rem) {
  .explorer { grid-template-columns: minmax(0, 1fr); }
  .sheet { position: static; order: -1; }
}

.verdict { border-left: 6px solid var(--diesel); padding-left: 1rem; }

details { margin-top: .6rem; font-size: .9rem; }
summary { cursor: pointer; color: var(--secondary); }
.scroll { overflow: auto; max-height: 24rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .9rem; }
th, td { padding: .35rem .6rem; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; background: var(--surface); font-weight: 600; }

.limits li { max-width: 42rem; margin-bottom: .35rem; }

footer.wrap { border-top: 1px solid var(--axis); padding-top: 1.5rem; padding-bottom: 3rem; color: var(--secondary); font-size: .9rem; }

.tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  border-radius: 4px;
  padding: .45rem .65rem;
  font-size: .85rem;
  line-height: 1.4;
  max-width: 18rem;
}
.tooltip strong { display: block; }
