:root {
  color-scheme: light;
  --plane: #eef1f2;
  --surface: #fcfcfb;
  --ink: #14202b;
  --ink-2: #4a5662;
  --ink-muted: #7b858e;
  --rule: #d5dadd;
  --grid: #e1e4e6;
  --baseline: #b9c0c5;
  --sign-bg: #14202b;
  --sign-ink: #f6f3ea;
  --sign-amber: #f2b33d;
  --focus: #2a78d6;
  --notice-bg: #fff4d6;
  --notice-ink: #5b4300;
  --s-crude: #2a78d6;
  --s-remainder: #eb6834;
  --s-distribution_obligation: #6250d6;
  --s-vat: #1baf7a;
  --s-excise_energy: #eda100;
  --s-excise_co2: #e87ba4;
  --s-security_of_supply: #008300;
  --hatch: rgba(255, 255, 255, 0.55);
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0f1418;
    --surface: #171d22;
    --ink: #eef0ee;
    --ink-2: #b9c1c6;
    --ink-muted: #85909a;
    --rule: #2b343b;
    --grid: #252d33;
    --baseline: #3a444c;
    --sign-bg: #05080a;
    --notice-bg: #3a2f10;
    --notice-ink: #f6dfa0;
    --s-crude: #3987e5;
    --s-remainder: #d95926;
    --s-distribution_obligation: #9085e9;
    --s-vat: #199e70;
    --s-excise_energy: #c98500;
    --s-excise_co2: #d55181;
    --s-security_of_supply: #008300;
    --hatch: rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0f1418;
  --surface: #171d22;
  --ink: #eef0ee;
  --ink-2: #b9c1c6;
  --ink-muted: #85909a;
  --rule: #2b343b;
  --grid: #252d33;
  --baseline: #3a444c;
  --sign-bg: #05080a;
  --notice-bg: #3a2f10;
  --notice-ink: #f6dfa0;
  --s-crude: #3987e5;
  --s-remainder: #d95926;
    --s-distribution_obligation: #9085e9;
  --s-vat: #199e70;
  --s-excise_energy: #c98500;
  --s-excise_co2: #d55181;
  --s-security_of_supply: #008300;
  --hatch: rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); max-width: 14ch; }
h2 { font-size: clamp(1.6rem, 3vw, 2.125rem); margin-bottom: 0.5rem; }
h3 { font-size: 1.375rem; margin: 2rem 0 0.5rem; }

.masthead, main, .footer { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .masthead, main, .footer { padding: 0 32px; } }

.masthead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-top: 1.25rem; padding-bottom: 1.25rem;
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.5rem; text-decoration: none; }
.masthead nav { display: flex; gap: 1.25rem; font-size: 0.95rem; color: var(--ink-2); }

.notice {
  background: var(--notice-bg); color: var(--notice-ink);
  border-radius: 6px; padding: 0.75rem 1rem; margin: 0 0 1.5rem; max-width: 72ch;
}
.notice strong { font-weight: 600; }

/* Hero: price sign beside the litre */
.hero {
  display: grid; gap: 2.5rem; align-items: start;
  padding: 1.5rem 0 3.5rem; border-bottom: 1px solid var(--rule);
}
@media (min-width: 820px) { .hero { grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 3rem; padding-top: 2.5rem; } }

.sign {
  display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto;
  column-gap: 0.75rem; align-items: end;
  margin-top: 2rem; padding: 1rem 1.5rem 1.1rem;
  background: var(--sign-bg); color: var(--sign-ink); border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}
.sign-grade {
  grid-column: 1 / -1; font-family: var(--display); font-weight: 600; font-size: 1.125rem;
  color: var(--sign-amber); letter-spacing: 0.04em;
}
.sign-price {
  font-family: var(--display); font-weight: 600; font-size: clamp(4.5rem, 13vw, 7.5rem); line-height: 0.9;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.sign-unit { font-family: var(--display); font-weight: 500; font-size: 1.75rem; padding-bottom: 0.5rem; }
.sign-caption { color: var(--ink-2); margin: 0.75rem 0 0; max-width: 46ch; }

.pressure {
  margin: 2rem 0 0; max-width: 46ch; padding-left: 1rem; border-left: 3px solid var(--ink);
}
.pressure b { font-weight: 600; white-space: nowrap; }

.litre { margin: 0; }
.litre-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.litre figcaption { color: var(--ink-muted); font-size: 0.875rem; margin-top: 0.75rem; }
.litre .label-name { font: 500 14px var(--text); fill: var(--ink); }
.litre .label-value { font: 400 13px var(--text); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.litre .tick { font: 400 12px var(--text); fill: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Breakdown table */
.breakdown, .history, .method { padding: 3rem 0; border-bottom: 1px solid var(--rule); }
.method { border-bottom: 0; }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.components { max-width: 640px; margin-top: 1rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--grid); vertical-align: baseline; }
thead th { font-weight: 500; color: var(--ink-muted); font-size: 0.875rem; }
tfoot th, tfoot td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--ink); }
.num { text-align: right; white-space: nowrap; }
@media (max-width: 520px) {
  /* The swatch texture and the legend below already say which parts are exact. */
  .components th:nth-child(4), .components td:nth-child(4) { display: none; }
  .components th, .components td { padding-right: 0.5rem; }
}
.component-name { display: flex; gap: 0.6rem; align-items: center; }

.swatch, .swatch-key {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none;
  background: var(--ink-muted);
}
.swatch.estimate, .swatch-key.estimate {
  background-image: repeating-linear-gradient(45deg, var(--hatch) 0 2px, transparent 2px 5px);
}
.swatch.residual, .swatch-key.residual {
  background-image: radial-gradient(var(--hatch) 1.1px, transparent 1.3px);
  background-size: 4px 4px;
}
.basis-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; color: var(--ink-2); font-size: 0.9rem; margin: 1rem 0 0; }
.basis-legend span { display: inline-flex; gap: 0.5rem; align-items: center; }

/* History */
.lede { color: var(--ink-2); max-width: 64ch; margin: 0 0 1rem; }
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 0 0 1.25rem; }
.control { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.control-label { font-size: 0.9rem; color: var(--ink-2); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.seg { position: relative; display: block; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; padding: 0.3rem 0.8rem; border-radius: 6px; font-size: 0.95rem; color: var(--ink-2); white-space: nowrap; }
.seg input:hover + span { background: var(--grid); }
.seg input:checked + span { background: var(--ink); color: var(--plane); font-weight: 500; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 1rem; }
.legend span { display: inline-flex; gap: 0.45rem; align-items: center; }
.history-chart { background: var(--surface); border-radius: 8px; padding: 1rem 0.5rem 0.5rem; }
.history-chart svg { display: block; width: 100%; height: auto; }
.history-chart .tick { font: 400 12px var(--text); fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.history-chart .gridline { stroke: var(--grid); stroke-width: 1; }
.history-chart .baseline { stroke: var(--baseline); stroke-width: 1; }
.history-chart .hit { fill: transparent; cursor: crosshair; }
.history-chart .band-line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.history-chart .band-divider { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.history-chart .band-label { font: 500 13px var(--text); fill: var(--ink-2); }
.band-key { display: inline-block; width: 16px; height: 8px; border: 1.5px solid var(--ink-2); border-bottom: 0; flex: none; }
.history-chart .hit:hover, .history-chart .hit:focus-visible { fill: var(--ink); fill-opacity: 0.06; outline: none; }

.table-view { margin-top: 1.25rem; }
.table-view summary { cursor: pointer; color: var(--ink-2); }
.table-scroll { overflow-x: auto; margin-top: 0.75rem; }
#history-table { font-size: 0.875rem; min-width: 640px; }
#history-table th, #history-table td { padding-right: 1rem; white-space: nowrap; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 220px;
  background: var(--surface); color: var(--ink); border-radius: 8px; padding: 0.65rem 0.8rem;
  box-shadow: 0 0 0 1px var(--rule), 0 8px 24px rgba(20, 32, 43, 0.16);
  font-size: 0.875rem; font-variant-numeric: tabular-nums;
}
.tooltip h4 { margin: 0 0 0.4rem; font: 600 1rem var(--display); }
.tooltip dl { display: grid; grid-template-columns: auto 1fr auto; gap: 0.2rem 0.5rem; margin: 0; align-items: center; }
.tooltip dt { display: contents; }
.tooltip dd { margin: 0; text-align: right; }
.tooltip .tt-note { margin: -0.2rem 0 0.45rem; color: var(--ink-2); }
.tooltip .tt-total { border-top: 1px solid var(--rule); padding-top: 0.3rem; margin-top: 0.2rem; font-weight: 600; }

/* Method */
.method ol, .method p, .method ul { max-width: 68ch; }
.method ol { padding-left: 1.25rem; margin: 1rem 0 1.5rem; }
.method li { margin-bottom: 0.6rem; padding-left: 0.25rem; }
.sources { padding-left: 1.25rem; }

.footer { color: var(--ink-muted); font-size: 0.875rem; padding-bottom: 3rem; }
.footer p { margin: 0 0 0.5rem; }
.footer .author { color: var(--ink-2); }

@media (forced-colors: active) {
  .swatch, .swatch-key { forced-color-adjust: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .litre-chart .layer { transform-box: fill-box; transform-origin: bottom; animation: fill 700ms cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}
