@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url(fonts/barlow-semi-condensed-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-display: swap; src: url(fonts/barlow-semi-condensed-700.woff2) format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 200 900; font-display: swap; src: url(fonts/source-sans-3.woff2) format('woff2'); }

:root {
  color-scheme: light dark;
  --display: 'Barlow Semi Condensed', sans-serif;
  --body: 'Source Sans 3', system-ui, sans-serif;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --line: #D8DFE9;
  --line-soft: #EDF0F5;
  --rule: #0F2440;
  --ink: #0F2440;
  --text: #33415C;
  --muted: #4A5872;
  --field: #8A96AB;
  --link: #1F5FAD;
  --link-hover: #123F78;
  --figure: #1F5FAD;
  --lpg: #1F5FAD;
  --petrol: #7A8499;
  --track: #EDF0F5;
  --accent: #F28C28;
  --on-accent: #0F2440;
  --accent-busy: #F8C595;
  --on-accent-busy: #4A3A20;
  --plate-edge: #0F2440;
  --ok: #1B6B3A;
  --err: #A11B1B;
  --own-bg: #FFF8E8;
  --own-ink: #7A4A00;
  --warn-bg: #FFF4DB;
  --warn-line: #F1D59A;
  --warn-ink: #5C3A00;
  --soft-blue: #EEF3FA;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1626;
    --surface: #13223A;
    --line: #24385A;
    --line-soft: #24385A;
    --rule: #A3B1C7;
    --ink: #E8EEF7;
    --text: #C9D3E3;
    --muted: #A3B1C7;
    --field: #5A7299;
    --link: #7DB2F0;
    --link-hover: #A9CBF5;
    --figure: #7DB2F0;
    --lpg: #5B9BE6;
    --petrol: #8A94A8;
    --track: #1B2D4B;
    --accent: #F59A3E;
    --on-accent: #0B1626;
    --plate-edge: #0B1626;
    --ok: #7CD39A;
    /* The dark board doesn't draw these; derived from the light values. */
    --accent-busy: #8A5F34;
    --on-accent-busy: #F5E6D3;
    --err: #FF9C9C;
    --own-bg: #2E2610;
    --own-ink: #F0C674;
    --warn-bg: #3A2C10;
    --warn-line: #6B5220;
    --warn-ink: #F5DFA8;
    --soft-blue: #1A2E4F;
  }
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); font-variant-numeric: tabular-nums; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; }
h1 { font-size: 52px; line-height: 1.05; letter-spacing: -0.01em; }
h2 { font-size: 34px; line-height: 1.15; }
h2 .plain { color: var(--muted); font-weight: 600; }
h3 { font-size: 24px; }

main { max-width: 960px; margin: 0 auto; padding: 48px 24px 64px; display: flex; flex-direction: column; gap: 40px; }
.intro, .inputs { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.lead { font-size: 20px; color: var(--text); }
.hint { font-size: 15px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
#s-km { gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.scroll { overflow-x: auto; }

label, legend { font-weight: 700; font-size: 18px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 6px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; font-weight: 400; cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--link); }
select { height: 48px; width: 100%; max-width: 300px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; font: 600 17px var(--body); color: var(--ink); background: var(--surface); }

.plate { display: flex; flex: 0 1 300px; height: 56px; border: 2px solid var(--plate-edge); border-radius: 8px; overflow: hidden; }
.plate:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.plate:has([aria-invalid="true"]) { border-color: var(--err); }
.plate span { width: 36px; flex: none; background: #1D4FA3; color: #FFFFFF; font-size: 12px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.plate input { flex: 1; min-width: 0; border: 0; outline: 0; background: #F7C600; color: #0F2440; font: 700 28px/1 var(--display); letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.plate input::placeholder { color: #0F2440B3; }

.unit { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; color: var(--muted); }
.unit:focus-within { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.unit span:last-child:not(:first-child) { font-size: 15px; }
.unit input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 600 18px var(--body); appearance: textfield; }
.unit input::-webkit-outer-spin-button, .unit input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.narrow { max-width: 300px; }
.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.prices label { font-size: 17px; }

button { cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.primary { height: 56px; padding: 0 24px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: 700 18px var(--body); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary:disabled { background: var(--accent-busy); color: var(--on-accent-busy); cursor: default; }
.primary:disabled::before { content: ''; width: 16px; height: 16px; border: 2px solid; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .primary:disabled::before { animation: none; } }
.secondary { height: 44px; padding: 0 18px; border: 1px solid var(--field); border-radius: 8px; background: transparent; color: var(--ink); font: 600 15px var(--body); }

#plate-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; font-size: 16px; color: var(--muted); }
#plate-msg:empty { display: none; }
#plate-msg.ok { color: var(--ok); font-weight: 600; }
#plate-msg.error, #plate-msg .error { color: var(--err); font-weight: 500; }
#plate-msg a { font-size: 15px; font-weight: 600; }
.info { align-self: stretch; background: var(--soft-blue); border-radius: 10px; padding: 16px; color: var(--ink); }
.info strong { display: block; font-size: 17px; }
.info p { margin-top: 4px; font-size: 15px; color: var(--text); }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 18px 20px; font-size: 15px; color: var(--warn-ink); }
#price-msg.warn { border: 0; border-radius: 8px; padding: 12px 14px; }

#s-result { display: flex; flex-direction: column; gap: 20px; }
.hero { flex-direction: row; flex-wrap: wrap; gap: 40px; padding: 32px; border-radius: 16px; }
.outcome { flex: 1 1 360px; display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-weight: 600; color: var(--muted); }
.outcome > p:not(.eyebrow, .figure, .figure-text, .payback) { color: var(--text); }
.figure { font: 700 80px/1 var(--display); color: var(--figure); }
.figure-text { font: 700 32px/1.1 var(--display); }
.payback { margin-top: 10px; font-size: 20px; }
.bars { flex: 1 1 320px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.bars .eyebrow { font-size: 15px; }
.bar { display: flex; flex-direction: column; gap: 6px; }
.bar-head { display: flex; justify-content: space-between; font-weight: 700; }
.track { height: 20px; background: var(--track); border-radius: 3px; }
.track div { height: 100%; border-radius: 3px; }
.track .petrol, .swatch.petrol { background: var(--petrol); }
.track .lpg, .swatch.lpg { background: var(--lpg); }

.receipts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.receipt h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.receipt .note { font: 400 16px var(--body); color: var(--muted); }
.swatch { width: 14px; height: 14px; flex: none; border-radius: 2px; }
.lines { width: 100%; border-collapse: collapse; font-size: 16px; }
.lines td { padding: 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.lines td:last-child { padding-left: 12px; text-align: right; white-space: nowrap; }
.receipt .lines tr:nth-last-child(2) td { border-bottom-color: var(--rule); }
.lines .total td { border-bottom: 0; padding-top: 12px; font-size: 18px; font-weight: 700; }
.fold .lines { font-size: 15px; }
.fold .lines tr:last-child td { border-bottom: 0; }

.tanks { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 16px; }
.tanks th { padding: 8px 12px; text-align: left; font-size: 14px; font-weight: 600; color: var(--muted); }
.tanks td { padding: 10px 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.tanks th:last-child, .tanks td:last-child { text-align: right; }
.tanks .picked td { background: var(--soft-blue); border-top-color: transparent; font-weight: 600; }
.in-calc { font-size: 14px; color: var(--link); }

.fold { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fold > summary { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 18px; font-weight: 700; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:focus-visible { outline-offset: -2px; }
.fold-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 18px 12px; }
.fold-name { display: flex; align-items: center; gap: 8px; }
.fold-name .swatch { width: 12px; height: 12px; }
.toggle { flex: none; display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--link); }
.toggle::before { content: 'Toon'; }
[open] > summary .toggle::before { content: 'Verberg'; }
.toggle::after { content: ''; width: 8px; height: 8px; border-right: 2px solid; border-bottom: 2px solid; transform: translateY(-2px) rotate(45deg); }
[open] > summary .toggle::after { transform: translateY(2px) rotate(225deg); }

#facts > summary { min-height: 64px; padding: 14px 24px; }
#facts .fold-title { display: flex; flex-direction: column; }
#facts .fold-title strong { font: 700 24px var(--display); }
#facts .fold-title .hint { font-weight: 400; }
#facts .fold-body { padding: 8px 24px 24px; }
.own-tag { color: var(--own-ink); }
.facts { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.facts th { padding: 16px 12px 8px; border-bottom: 2px solid var(--rule); text-align: left; font: 700 20px var(--display); }
.facts td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--text); }
.facts td:first-child { width: 30%; color: var(--muted); }
.facts td:nth-child(2) { width: 24%; font-weight: 700; color: var(--ink); }
.facts tr.own { background: var(--own-bg); }

/* Keep this breakpoint in sync with `phone` in app.js. */
@media (max-width: 40rem) {
  main { padding: 24px 16px 32px; gap: 20px; }
  h1 { font-size: 38px; }
  h2 { font-size: 24px; }
  .intro { gap: 8px; }
  .lead { font-size: 17px; }
  .inputs { gap: 20px; }
  .card { padding: 18px; }
  label, legend { font-size: 17px; }
  .plate { flex: 1 0 100%; }
  .plate span { width: 34px; }
  .plate input { font-size: 26px; }
  .primary { width: 100%; height: 52px; }
  .prices { grid-template-columns: minmax(0, 1fr); }
  #plate-msg a { display: inline-flex; align-items: center; min-height: 44px; }

  #s-result { gap: 8px; }
  #s-result > .warn { margin-bottom: 12px; }
  #s-result > .hint:last-child { margin-top: 12px; font-size: 14px; }
  .hero { gap: 18px; padding: 22px 18px; border-radius: 16px; margin-bottom: 12px; }
  .outcome { gap: 8px; }
  .outcome .eyebrow { margin-top: 6px; }
  .outcome > p:not(.eyebrow, .figure, .figure-text, .payback) { font-size: 16px; }
  .figure { font-size: 64px; }
  .payback { margin-top: 6px; font-size: 18px; }
  .bars { gap: 12px; }
  .bars .eyebrow { display: none; }
  .bar { gap: 4px; }
  .bar-head { font-size: 16px; }
  .bar-head span:last-child::after { content: ' / jaar'; }
  .track { height: 16px; }
  .receipts { display: flex; flex-direction: column; gap: 8px; }
  #lpg { order: -1; }
  [open] > summary { border-bottom: 1px solid var(--line); }
  .toggle { font-size: 15px; }
  .toggle::after { display: none; }

  #facts > summary { min-height: 52px; padding: 0 18px; }
  #facts .fold-title strong { font: 700 17px var(--body); }
  #facts .fold-title .hint { display: none; }
  #facts .fold-body { padding: 0 0 8px; gap: 0; }
  #facts .fold-body > .hint { padding: 8px 16px; }
  .facts { display: block; min-width: 0; }
  .facts tbody { display: block; }
  .facts tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  .facts tr.group { display: block; padding: 0; border: 0; }
  .facts th { display: block; padding: 14px 16px 6px; }
  .facts td, .facts td:first-child, .facts td:nth-child(2) { display: block; width: auto; padding: 0; border: 0; }
  .facts td:nth-child(2) { font-size: 16px; text-align: right; }
  .facts td:last-child { grid-column: 1 / -1; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
}
