@font-face {
  font-family: "Figtree";
  src: url("figtree.woff2") format("woff2");
  font-weight: 400 800;
  font-display: block;
}
:root {
  --bg: #15130f;
  --ink: #f0ebe1;
  --lijn: color-mix(in oklch, var(--bg) 42%, var(--ink));
  --fijn: color-mix(in oklch, var(--bg) 60%, var(--ink));
  --draad: color-mix(in oklch, var(--bg) 76%, var(--ink));
  --vlak: color-mix(in oklch, var(--bg) 92%, var(--ink));
  /* tekstkleuren: controle_contrast.py toetst deze tegen --bg en --vlak */
  --tekst-label: #c9c1b3;
  --tekst-stil: #a59d90;
  --zon: #f2a93b;
  --net: #6fa9e2;
  --huis: #3fc99d;
  --accu: #a48ff7;
  --grens: #dd8f00;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Figtree", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* kop */
.kop {
  position: fixed; inset: 0 0 auto 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--kop-rand) 40px; pointer-events: none;
}
/* --logo-onder: onderkant van het logo (rand + 28 px merk) plus 8 px lucht */
:root { --kop-rand: 26px; --logo-onder: calc(var(--kop-rand) + 36px); }
/* klein liggend scherm: de tekening krimpt, het logo niet; minder rand houdt ruimte voor de kop */
@media (min-aspect-ratio: 1/1) and (max-height: 560px) {
  :root { --kop-rand: 12px; }
}
.kop a { pointer-events: auto; text-decoration: none; }
.merk { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.teken { width: 24px; height: 24px; }
.teken-grens { fill: var(--grens); }
.teken-boog { fill: var(--ink); }
.kop-rechts { display: flex; align-items: center; gap: 18px; }
.taal { font-size: 15px; color: var(--tekst-stil); padding: 6px 0; }
.inlog {
  font-size: 15px; color: var(--ink); white-space: nowrap;
  border: 1px solid var(--draad); border-radius: 8px;
  padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center;
  margin: -8px 0;
}
.inlog:hover, .inlog:focus-visible { border-color: var(--lijn); background: var(--vlak); }
.inlog:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.taal:hover, .taal:focus-visible { color: var(--ink); }

/* het toneel: de tekening staat vast, de pagina scrolt eronder */
.buhne { position: relative; }
.js .buhne { position: fixed; inset: 0; display: grid; place-items: center; }
.vlak {
  position: relative;
  width: min(100vw, 160vh);
  width: min(100vw, 160dvh);
  aspect-ratio: 1440 / 900;
  container-type: inline-size;
  --u: calc(100cqw / 1440);
}
.huis { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* lijnen */
.l { fill: none; stroke: var(--lijn); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.f { fill: none; stroke: var(--fijn); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.d { fill: none; stroke: var(--draad); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.licht { opacity: var(--aan, 0); }
.schaal-y { transform: scaleY(var(--w, .4)); transform-box: fill-box; transform-origin: 50% 100%; }
.fase { fill: var(--net); fill-opacity: .8; }
#grensbalk > rect { opacity: calc(.55 + .45 * var(--aan, 0)); }
.licht .waaier { transform-box: fill-box; transform-origin: center; animation: draai 2.4s linear infinite; }

.stroom path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.stroom .draad { stroke: var(--draad); stroke-width: 1.4; }
.stroom .gloed { stroke: var(--kleur); stroke-width: calc(6px + var(--b, 0) * 16px); opacity: calc(min(1, var(--b, 0) * 6) * .13); }
.stroom .kern { stroke: var(--kleur); stroke-width: calc(1.2px + var(--b, 0) * 4.6px); opacity: min(1, calc(var(--b, 0) * 6)); }
.stroom .punt {
  stroke: color-mix(in oklch, var(--kleur) 40%, var(--ink));
  stroke-width: calc(1.6px + var(--b, 0) * 2.4px);
  /* meer stroom: punten dichter op elkaar en sneller (één periode per lus, dus naadloos) */
  --tussen: calc(36px - var(--b, 0) * 22px);
  stroke-dasharray: 0 var(--tussen);
  opacity: min(1, calc(var(--b, 0) * 6));
  animation: heen 1s linear infinite;
}
.stroom.terug .punt { animation-direction: reverse; }
@keyframes heen { to { stroke-dashoffset: calc(-1 * var(--tussen)); } }
@keyframes draai { to { transform: rotate(360deg); } }

.vergroting { opacity: var(--aan, 0); }
.vergroting .kader { fill: var(--vlak); stroke: var(--fijn); stroke-width: 1.3; }
.vergroting .aanwijs { fill: none; stroke: var(--fijn); stroke-width: 1; stroke-dasharray: 3 4; }
.aanwijslijn { opacity: 0; }
.aanwijslijn path { fill: none; stroke: var(--tekst-stil); stroke-width: 1; }
.aanwijslijn circle { fill: var(--tekst-stil); }

/* tekst in de tekening: alles in viewBox-maten via --u */
.label, .cijfer, .zin, .voorbeeld { position: absolute; margin: 0; }
.label {
  font-size: calc(14 * var(--u)); line-height: 1.2; color: var(--tekst-label);
  white-space: nowrap; transform: translate(calc(6 * var(--u)), -50%); opacity: 0;
}
.label.blok { white-space: normal; text-wrap: balance; }
.label.links { transform: translate(calc(-100% - 6 * var(--u)), -50%); text-align: right; }
.label.midden { transform: translate(-50%, calc(4 * var(--u))); }
.label.boven { transform: translate(-50%, calc(-100% - 4 * var(--u))); }
.cijfer {
  font-size: calc(15 * var(--u)); font-weight: 600; color: var(--ink);
  white-space: nowrap; transform: translate(0, -50%); opacity: 0;
}
.cijfer.links { transform: translate(-100%, -50%); }
.cijfer.midden { transform: translate(-50%, -50%); }
.zinnen { position: absolute; left: calc(40 / 1440 * 100%); top: calc(110 / 900 * 100%); width: calc(480 / 1440 * 100%); }
.zin {
  top: 0; left: 0; right: 0;
  font-size: calc(34 * var(--u)); font-weight: 500; line-height: 1.16; letter-spacing: -.012em;
  text-wrap: balance;
}
/* boven een kaart (--kaart-y, zet bouw.py uit #kader) staat de kop hooguit tot 28 boven de kaart:
   een kop van drie regels schuift omhoog, een kortere blijft op y 110. Ondergrens: de bovenkant
   blijft onder het logo (--logo-onder, in schermpixels; het vlak staat midden in het scherm, dus
   zijn bovenrand is (100dvh - 900u) / 2). */
.zin.boven-kaart {
  transform: translateY(clamp(
    calc(var(--logo-onder) - (100dvh - 900 * var(--u)) / 2 - 110 * var(--u)),
    calc((var(--kaart-y) - 28 - 110) * var(--u) - 100%),
    0px));
}
/* zonder JS alleen de eerste zin; met JS zet huis.js de dekking per scène */
.zin:not(:first-child), .ucijfer { opacity: 0; }
.voorbeeld { right: calc(40 / 1440 * 100%); bottom: calc(28 / 900 * 100%); font-size: calc(14 * var(--u)); color: var(--tekst-stil); }
.labelregels, .uitsnede, .voortgang { display: none; }

/* de scrollkolom: één scherm per scène */
.scenes { position: relative; z-index: 1; }
.js .scene { height: 100vh; }
.js .scene > * { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.scene h2 { font-size: 24px; font-weight: 500; margin: 0 0 6px; }
.scene ul { margin: 0 0 32px; padding-left: 20px; color: var(--tekst-label); }
html:not(.js) .scenes { padding: 24px 40px 60px; }

/* smal scherm: tekening boven over de volle breedte, zin eronder */
@media (max-aspect-ratio: 1/1) {
  .kop { padding: 16px 20px; }
  .js .buhne { place-items: start center; padding-top: 64px; align-content: start; }
  /* zonder JS: uitsnede en zin zijn werk van huis.js; de zinnen staan in de tekstkolom */
  html:not(.js) .buhne { padding-top: 64px; }
  html:not(.js) .zinnen, html:not(.js) .uitsnede { display: none; }
  .vlak { width: 100vw; }
  /* --uh zet huis.js per scène: de uitsnede krijgt wat zin en labels overlaten */
  .uitsnede {
    display: block; width: calc(100vw - 32px); height: var(--uh, calc((100vw - 32px) * 2 / 3)); margin-top: 12px;
    border: 1px solid var(--fijn); border-radius: 10px;
  }
  .zinnen { left: 20px; right: 20px; width: auto; top: calc(100% + 12px + var(--uh, calc((100vw - 32px) * 2 / 3)) + 18px); }
  .zin { font-size: 24px; }
  .zin.boven-kaart { transform: none; }
  .label, .cijfer, .aanwijslijn { display: none; }
  .labelregels { display: block; position: relative; width: 100vw; margin-top: 18px; }
  .labelregel span { display: block; }
  .labelregel {
    position: absolute; left: 20px; right: 20px; top: 0; margin: 0;
    font-size: 15px; line-height: 1.4; color: var(--tekst-label); opacity: 0;
  }
  .voorbeeld { font-size: 12px; right: 12px; bottom: 6px; }
  /* de cijfers in de uitsnede: SVG-tekst met een vaste schermmaat, --px zet huis.js */
  .ucijfer {
    font-size: calc(var(--px, 1) * 14px); font-weight: 600; fill: var(--ink);
    dominant-baseline: central; text-anchor: start;
  }
  .ucijfer.links { text-anchor: end; }
  .ucijfer.midden { text-anchor: middle; }
  .ucijfer.groot { font-size: calc(var(--px, 1) * 20px); font-weight: 500; }
  .ucijfer.stil { font-size: calc(var(--px, 1) * 12px); font-weight: 400; fill: var(--tekst-stil); }
  .breuklijn { fill: none; stroke: var(--fijn); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }

  /* per scène: één veeg is één scène verder (eigenaar 2026-11-16, "Per scène klikken"). De secties
     blijven 100vh; met de adresbalk in beeld is een sectie iets hoger dan het scherm, huis.js rondt
     de stand dan af op de dichtstbijzijnde scène. */
  html.js { scroll-snap-type: y mandatory; }
  .js .scene { scroll-snap-align: start; scroll-snap-stop: always; }
  /* huis.js schrijft alleen bij een sprong; het huis vloeit dan over */
  .overgang :is(.licht, .vergroting, #grensbalk > rect, .schaal-y, .stroom path) {
    transition: opacity .42s ease, stroke-width .42s ease, stroke .42s ease, transform .42s ease, stroke-dasharray .42s ease;
  }
  /* uitsnede, zin en labels: uit (180 ms, WISSEL_MS in huis.js), onzichtbaar wisselen, weer in */
  .uitsnede, .zinnen, .labelregels { transition: opacity .24s ease-out; }
  .buhne.wissel :is(.uitsnede, .zinnen, .labelregels) { opacity: 0; transition: opacity .18s ease-in; }
  /* waar je bent en dat er meer komt: twaalf streepjes aan de rechterrand */
  .voortgang {
    display: flex; flex-direction: column; gap: 6px;
    position: fixed; right: 6px; top: 50%; transform: translateY(-50%);
  }
  .voortgang i { width: 2px; height: 12px; border-radius: 1px; background: var(--fijn); transition: background-color .42s ease; }
  .voortgang i.nu { background: var(--tekst-label); }
}
@media (prefers-reduced-motion: reduce) {
  .stroom .punt, .licht .waaier { animation: none; }
  .overgang *, .uitsnede, .zinnen, .labelregels, .buhne.wissel * { transition: none !important; }
}
.vergroting .strook { fill: none; stroke: var(--fijn); stroke-width: 2.8; }
.vergroting .strook.laad { stroke: var(--accu); }
.vergroting .as { fill: none; stroke: var(--fijn); stroke-width: 1; }
.vergroting .lijn-zonder { fill: none; stroke: var(--tekst-stil); stroke-width: 1.8; }
.vergroting .lijn-met { fill: none; stroke: var(--accu); stroke-width: 2.2; }
.cijfer.groot { font-size: calc(24 * var(--u)); font-weight: 500; }
.cijfer.stil { font-size: calc(13 * var(--u)); font-weight: 400; color: var(--tekst-stil); }
/* scène 5: fasedraden van de Deye; het meterpuntje knippert bij elke meting */
.fasedraden path { fill: none; stroke: var(--net); stroke-width: 1.2; stroke-linejoin: round; }
.licht .knipper { animation: knipper 1.6s steps(1) infinite; }
@keyframes knipper { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .licht .knipper { animation: none; } }
/* scènes 9-11: gegevens zijn geen stroom: gestippelde inkt zonder gloed */
.gegevens { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 0 6; }
.gegevens rect { stroke-width: 1.3; stroke-dasharray: none; }
.vink { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* scènes 9-10: gegevenspunten lopen in de richting van het bericht */
.gegevens.loopt { animation: gegevens 0.9s linear infinite; }
@keyframes gegevens { to { stroke-dashoffset: -6; } }
.knipper-altijd { animation: knipper 1.6s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .gegevens.loopt, .knipper-altijd { animation: none; } }
/* scène 10: slotjes op laaddoel en reserve, in de accu zelf */
.slotjes rect { fill: var(--ink); }
.slotjes path { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.slotjes .gat { fill: var(--bg); }
/* scène 10: mobiel toont de berging op ~0,7×: de lijnen van bus en telefoon dikker, anders vallen ze weg */
@media (max-aspect-ratio: 1/1) { #afstand-lijn, #toestemming-lijn { stroke-width: 2.6; } }
.slotjes-groot path { stroke-width: 3; }
/* scène 8: munten (dicht gevuld, zodat de bovenste de onderste afdekt) */
.munt path, .munt ellipse { stroke-width: 1.6; }
.munt-accu path, .munt-accu ellipse, .munt-accu circle { fill: color-mix(in oklch, var(--accu) 42%, var(--vlak)); stroke: var(--accu); }
.munt-zon path, .munt-zon ellipse { fill: color-mix(in oklch, var(--zon) 42%, var(--vlak)); stroke: var(--zon); }
.munt ellipse.rand { fill: none; stroke-width: 1.2; }
.dagmunt circle { stroke-width: 1.4; }
.dagmunt .vandaag { fill: none; stroke: var(--accu); stroke-width: 1.6; }
.verlies circle { fill: var(--vlak); stroke: var(--fijn); stroke-width: 1.6; }
.verlies path { fill: none; stroke: var(--fijn); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vergroting .pijl { fill: none; stroke: var(--tekst-stil); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vergroting .kop-band { fill: var(--fijn); fill-opacity: .35; }
.vergroting .ring { fill: none; stroke: var(--lijn); stroke-width: 4; stroke-linecap: round; }
.vergroting .papier { fill: var(--vlak); stroke: var(--lijn); stroke-width: 1.6; stroke-linejoin: round; }
.vergroting .regel { fill: none; stroke: var(--fijn); stroke-width: 2.4; stroke-linecap: round; }
.vergroting .handtekening { fill: none; stroke: var(--tekst-label); stroke-width: 1.8; stroke-linecap: round; }
/* scène 11: de loep toont het echte huis; het vak in het huis zegt waar */
.vergroting .kader-rand { fill: none; stroke: var(--fijn); stroke-width: 1.3; }
.vergroting .loepvak { fill: none; stroke: var(--fijn); stroke-width: 1; stroke-dasharray: 3 4; }
/* scène 7: de kabel van de omvormer naar de cloud van de fabrikant is doorgeknipt. Kabel grijs (voert
   niets), wolk en stippellijn dof (doen niet meer mee); alleen de twee losse einden lichten op in inkt */
.op-afstand path { fill: none; stroke: var(--lijn); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.op-afstand .eind { stroke: var(--ink); stroke-width: 4.4; }
.op-afstand .draadjes { stroke: var(--ink); stroke-width: 2.4; }
.op-afstand .ver { stroke: var(--fijn); stroke-width: 1.8; stroke-dasharray: 5 6; }
.op-afstand .wolk { stroke: var(--fijn); stroke-width: 1.8; }
/* mobiel toont de uitsnede op ~0,55×: alles dikker, anders valt de knip weg */
@media (max-aspect-ratio: 1/1) {
  .op-afstand path { stroke-width: 4.4; }
  .op-afstand .eind { stroke-width: 6.4; }
  .op-afstand .draadjes { stroke-width: 3.4; }
  .op-afstand .ver, .op-afstand .wolk { stroke-width: 2.6; }
}
