:root {
  --plane: #eef1f4;
  --surface: #fbfcfd;
  --ink: #0e1216;
  --ink2: #4a525b;
  --muted: #7f8790;
  --grid: #e0e4e9;
  --axis: #bfc6ce;
  --border: rgba(14, 18, 22, 0.10);
  --wash: rgba(14, 18, 22, 0.05);
  --s-diesel: #2a78d6;
  --s-diesel-soft: #9ec5f4;
  --s-petrol: #eb6834;
  --s-crude: #1baf7a;
  --s-country: #e87ba4;
  --s-context: #a9b0b8;
  --s-violet: #4a3aa7;
  --s-yellow: #eda100;
  --good: #006300;
  --bad: #b3261e;
  --receipt: #ffffff;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --plane: #0c0e11;
    --surface: #15181c;
    --ink: #ffffff;
    --ink2: #c0c6cd;
    --muted: #868d96;
    --grid: #262a30;
    --axis: #363b42;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.06);
    --s-diesel: #3987e5;
    --s-diesel-soft: #184f95;
    --s-petrol: #d95926;
    --s-crude: #199e70;
    --s-country: #d55181;
    --s-context: #4d545c;
    --s-violet: #9085e9;
    --s-yellow: #c98500;
    --good: #0ca30c;
    --bad: #e66767;
    --receipt: #1b1f24;
  }
}
:root[data-theme="dark"] {
  --plane: #0c0e11;
  --surface: #15181c;
  --ink: #ffffff;
  --ink2: #c0c6cd;
  --muted: #868d96;
  --grid: #262a30;
  --axis: #363b42;
  --border: rgba(255, 255, 255, 0.10);
  --wash: rgba(255, 255, 255, 0.06);
  --s-diesel: #3987e5;
  --s-diesel-soft: #184f95;
  --s-petrol: #d95926;
  --s-crude: #199e70;
  --s-country: #d55181;
  --s-context: #4d545c;
  --s-violet: #9085e9;
  --s-yellow: #c98500;
  --good: #0ca30c;
  --bad: #e66767;
  --receipt: #1b1f24;
}

* { box-sizing: border-box; }
body {
  background: var(--plane);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}
.page {
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 20px;
  padding-block: 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
h1, h2, h3, p, ul, figure { margin: 0; }
h1, h2 { font-family: var(--display); text-wrap: balance; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; line-height: 1.15; font-weight: 700; }
.lede { color: var(--ink2); max-width: 65ch; }
.eyebrow {
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--s-diesel); outline-offset: 2px; border-radius: 4px; }

/* masthead */
.mast { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.wordmark small { font-family: var(--body); font-weight: 400; font-size: 0.75rem; color: var(--muted); margin-left: 6px; }
.markets { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; font-size: 0.875rem; color: var(--muted); }
.markets .on { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--s-diesel); }
.markets a { color: inherit; text-decoration: none; }
.markets a:hover { color: var(--ink); }
.markets .soon::after { content: " · kommer"; font-size: 0.7rem; }
.proto { font-size: 0.8rem; color: var(--ink2); background: var(--wash); border-radius: 6px; padding: 6px 10px; margin-left: auto; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px 48px; align-items: end; }
.price { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); font-weight: 700; line-height: 0.9; }
.price .num { font-size: clamp(4.5rem, 16vw, 8.5rem); letter-spacing: -0.04em; }
.price .unit { font-size: 1.25rem; font-weight: 500; color: var(--ink2); letter-spacing: 0; }
.hero-left { display: flex; flex-direction: column; gap: 14px; }
.hero-right { display: flex; flex-direction: column; gap: 20px; }
.verdict { font-size: 1.125rem; line-height: 1.5; max-width: 56ch; }
.deltas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 24px; }
.delta { border-top: 1px solid var(--axis); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.delta .lab { font-size: 0.8rem; color: var(--ink2); }
.delta .val { font-size: 1.35rem; font-weight: 600; }
.delta .val.up { color: var(--bad); }
.delta .val.down { color: var(--good); }
.delta .sub { font-size: 0.8rem; color: var(--muted); }

/* receipt */
.tank { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 24px 48px; align-items: center; }
.tank-ctl { display: flex; flex-direction: column; gap: 10px; }
.tank-ctl label { font-weight: 600; }
.tank-ctl input[type="range"] { width: 100%; max-width: 420px; accent-color: var(--s-diesel); }
.receipt {
  background: var(--receipt); border: 1px solid var(--border); border-radius: 3px;
  padding: 16px 18px; font-family: var(--mono); font-size: 0.85rem; line-height: 1.7;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 0 var(--border), 0 8px 24px -16px rgba(14, 18, 22, 0.35);
}
.receipt .row { display: flex; justify-content: space-between; gap: 12px; }
.receipt .row span:first-child { color: var(--ink2); }
.receipt .total { border-top: 1px dashed var(--axis); border-bottom: 1px dashed var(--axis); margin-block: 6px; padding-block: 4px; font-weight: 500; font-size: 1rem; }
.receipt .head { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; }

/* filter row */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  border-block: 1px solid var(--axis); padding-block: 12px;
}
.filters .lab { font-size: 0.8rem; color: var(--ink2); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 5px 14px; font-size: 0.875rem; cursor: pointer; color: var(--ink2);
}
.seg button:hover { background: var(--wash); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--plane); border-color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; }
.check input { accent-color: var(--s-petrol); width: 16px; height: 16px; }

/* chart sections */
.block { display: flex; flex-direction: column; gap: 14px; }
.block-head { display: flex; flex-direction: column; gap: 6px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.8rem; color: var(--ink2); padding-inline: 6px; }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend .key i { width: 16px; height: 0; border-top: 2px solid var(--c); border-radius: 2px; display: inline-block; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--body); font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.endlab { fill: var(--ink); font-weight: 600; font-size: 11.5px; }
.tip {
  position: absolute; top: 6px; pointer-events: none; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 0.8rem; min-width: 150px;
  box-shadow: 0 6px 20px -10px rgba(14, 18, 22, 0.45);
}
.tip .when { color: var(--ink2); font-size: 0.75rem; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tip .r i { width: 12px; border-top: 2px solid var(--c); display: inline-block; }
.tip .r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .r span { color: var(--ink2); }
.note { font-size: 0.8rem; color: var(--muted); max-width: 80ch; padding-inline: 6px; }

/* country bars */
.split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.bars { display: flex; flex-direction: column; gap: 10px; padding: 6px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: 0.85rem; border-radius: 4px; }
.bar-row:hover .bar { filter: brightness(1.08); }
.bar-row .name { color: var(--ink2); }
.bar-row.me .name { color: var(--ink); font-weight: 600; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar { height: 18px; background: var(--s-diesel-soft); border-radius: 0 4px 4px 0; flex: none; }
.bar-row.me .bar { background: var(--s-diesel); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bar-val small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.card h3 { font-size: 0.85rem; font-weight: 600; color: var(--ink2); padding-inline: 6px; }

/* tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink2); font-size: 0.78rem; position: sticky; top: 0; background: var(--surface); }
details.data { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
details.data summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
details.data .scroll { max-height: 420px; overflow-y: auto; margin-top: 10px; }
table.plan { min-width: 680px; }
.plan td, .plan th { text-align: left; white-space: normal; vertical-align: top; }
.plan td:first-child { font-weight: 600; white-space: nowrap; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 1px 9px; border: 1px solid var(--border); white-space: nowrap; }
.pill.free::before { content: "✓ "; color: var(--good); }
.pill.paid::before { content: "kr "; color: var(--bad); }
.sources { font-size: 0.85rem; color: var(--ink2); display: flex; flex-direction: column; gap: 6px; max-width: 80ch; }
.sources ul { padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }

@media (max-width: 760px) {
  .hero, .tank, .split { grid-template-columns: minmax(0, 1fr); }
  .proto { margin-left: 0; }
  h2 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .bar { transition: width 0.35s ease; }
}

/* price breakdown: one stacked bar + a readable list, rendered server-side */
.split-bar { display: flex; gap: 2px; height: 44px; border-radius: 6px; overflow: hidden; }
.split-bar span { display: block; min-width: 2px; background: var(--c); }
.split-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 28px; }
.split-list li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; border-top: 1px solid var(--grid); padding-top: 8px; }
.split-list .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); align-self: center; }
.split-list .nm { font-weight: 600; }
.split-list .kr { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.split-list .kr small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.split-list .ex { grid-column: 2 / -1; font-size: 0.85rem; color: var(--ink2); }
.split-groups { display: flex; gap: 2px; font-size: 0.78rem; color: var(--ink2); }
.split-groups span { border-top: 2px solid var(--axis); padding-top: 4px; min-width: 0; overflow-wrap: anywhere; }
.explain { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--s-diesel); border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; max-width: 80ch; }
.explain h3 { font-size: 1rem; font-family: var(--display); }
.explain p { color: var(--ink2); font-size: 0.95rem; }
.zone-note { font-size: 0.8rem; color: var(--muted); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.home-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.home-card:hover { border-color: var(--s-diesel); }
.home-card .big { font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; letter-spacing: -0.03em; }
.home-card .big small { font-family: var(--body); font-size: 0.9rem; font-weight: 500; color: var(--ink2); letter-spacing: 0; margin-left: 6px; }
.home-card .more { color: var(--s-diesel); font-weight: 600; font-size: 0.9rem; margin-top: 4px; }
h1.page-title { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; font-weight: 700; }
.split-block { display: flex; flex-direction: column; gap: 6px; }
.split-block .cap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-size: 0.9rem; }
.split-block .cap b { font-weight: 600; }
.split-block .cap span { color: var(--ink2); font-variant-numeric: tabular-nums; }
.split-block .split-bar span { position: relative; }
.split-list .kr .then { display: block; font-weight: 400; font-size: 0.78rem; color: var(--muted); text-align: right; }

/* landing: the price board. One deliberate look in both themes, like the sign at a station. */
.board { background: #12161b; color: #f4f6f8; border-radius: 12px; padding: 8px 0; display: flex; flex-direction: column; box-shadow: 0 18px 40px -28px rgba(14, 18, 22, 0.7); }
.board-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) auto minmax(64px, 0.5fr) minmax(0, 1fr); align-items: baseline; gap: 4px 16px; padding: 14px 24px; color: inherit; text-decoration: none; border-top: 1px solid rgba(255, 255, 255, 0.10); }
.board-row:first-child { border-top: 0; }
.board-row:hover, .board-row:focus-visible { background: rgba(255, 255, 255, 0.06); }
.board .b-name { font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: #c9d1d9; }
.board .b-val { font-family: var(--mono); font-weight: 500; font-size: clamp(1.7rem, 5.2vw, 2.6rem); line-height: 1; font-variant-numeric: tabular-nums; text-align: right; color: #ffffff; }
.board .b-unit { font-size: 0.85rem; color: #c9d1d9; }
.board .b-tag { font-size: 0.78rem; color: #8f99a3; text-align: right; }
.home-card .spark { width: 100%; height: 52px; display: block; margin-block: 4px; }
.home-card .line { font-size: 0.9rem; color: var(--ink2); }
@media (max-width: 560px) {
  .board-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 16px; }
  .board .b-tag { grid-column: 1 / -1; text-align: left; }
}

/* bars that can go below zero */
.sbars { display: flex; flex-direction: column; gap: 9px; padding: 6px; }
.sbar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 62px; gap: 10px; align-items: center; font-size: 0.85rem; }
.sbar-row .name { color: var(--ink2); overflow-wrap: anywhere; }
.sbar-track { position: relative; height: 18px; }
.sbar-track .bar { position: absolute; top: 0; height: 18px; background: var(--s-diesel); }
.sbar-track .zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.sbar-row .bar-val { text-align: right; }
.bars.wide .bar-row { grid-template-columns: minmax(0, 150px) minmax(0, 1fr); }
.bars.wide .bar-row .name { overflow-wrap: anywhere; }

/* small forms */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field input[type="number"], .field select { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface); color: var(--ink); max-width: 220px; }
.convert { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; }
.convert output { font-family: var(--display); font-weight: 700; font-size: 1.6rem; }
@media (max-width: 560px) {
  /* long values ("1,04 prosentpoeng 20 %") get their own row instead of squeezing the name */
  .split-list .kr { grid-column: 2 / -1; }
  th, td { padding: 7px 6px; }
}
