/* ==========================================================================
   07 · Hero-animatie van de homepage (alle talen)
   Rechts in de rode hero: SmartgridOne in het midden (witte productkaart) met vier toestellen op één iso-ring en een
   marktkaart bovenaan, verbonden met vijf rechte spaken. Drie scènes wisselen elkaar af: residentieel, commercieel,
   SmartgridX en SmartgridOne Cloud (7 s per scène, met scèneknoppen eronder).
   Markup: src/lib/hero-animatie.mjs (vervangt de Lottie bij de build), gedrag: src/scripts/componenten/hero-animatie.ts.
   Elke regel staat onder .hero-anim-wrap. Alleen transform, opacity en stroke-dashoffset bewegen.
   ========================================================================== */

/* 1. Kader: vaste verhouding (1000 x 870, mobiel 1000 x 1150), dus geen verschuiving bij het laden of wisselen */
.hero-anim-wrap {
  --ha-ink: #231f20;
  --ha-muted: #5c5657;
  --ha-web-red: #ff1500;
  --ha-rood: #9b1915;
  --ha-ease: cubic-bezier(.2, .75, .25, 1);
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 0 0 0 auto;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}
.hero-anim-wrap .ha-stage { position: relative; width: 100%; aspect-ratio: 1000 / 790; container-type: inline-size; }
@media (min-width: 768px) and (max-width: 991px) {
  .hero-anim-wrap { max-width: 560px; margin-inline: auto; }
}

/* 2. Ringlaag: ring en spaken (wit op rood, bewegen nooit), lichtpulsen in de richting van de stroom */
.hero-anim-wrap .ha-ring { position: absolute; left: 0; top: var(--ha-rt, 0px); width: 100%; aspect-ratio: 1000 / 900; }
.hero-anim-wrap .ha-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hero-anim-wrap .ha-orbit { fill: none; stroke: #fff; stroke-opacity: .2; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hero-anim-wrap .ha-spaak { fill: none; stroke: #fff; stroke-opacity: .38; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hero-anim-wrap .ha-puls {
  fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: .1 1.3; stroke-dashoffset: .1; opacity: 0; transition: opacity .35s ease;
}
.hero-anim-wrap .ha-puls.is-on { opacity: 1; animation: ha-stroom 2000ms linear infinite; }
.hero-anim-wrap .ha-puls.is-in { animation-direction: reverse; }
.hero-anim-wrap .ha-puls.ha-puls-b { animation-delay: -1000ms; }
.hero-anim-wrap.is-wissel .ha-puls { opacity: 0; }
.hero-anim-wrap.is-pauze .ha-puls { animation-play-state: paused; }
@keyframes ha-stroom { from { stroke-dashoffset: .1; } to { stroke-dashoffset: -1.2; } }

/* 3. Toestellen: anker (x, y) in % van de ringlaag, breedte w in %, ay = hoogte van het anker in het beeld */
.hero-anim-wrap .ha-node {
  position: absolute; left: calc(var(--x) * 1% - var(--w) * .5%); top: calc(var(--y) * 1%); width: calc(var(--w) * 1%);
  transform: translateY(calc(var(--ay) * -100%)); pointer-events: none;
}
.hero-anim-wrap .ha-node img {
  display: block; width: 100%; height: auto; max-width: none;
  opacity: 0; transform: translateY(12px) scale(.96); transform-origin: 50% 90%;
  transition: opacity 300ms ease-in, transform 300ms ease-in; transition-delay: calc(var(--i) * 30ms);
}
.hero-anim-wrap .is-on > .ha-node img {
  opacity: 1; transform: none;
  transition: opacity 600ms ease-out, transform 900ms var(--ha-ease); transition-delay: calc(var(--i) * 70ms);
}
.hero-anim-wrap.is-wissel .ha-node img { will-change: transform, opacity; }

/* 4. Kern: het product vrijstaand op rood, zonder kader; de inhoud van de scènes kruist, nooit leeg */
.hero-anim-wrap .ha-hub {
  position: absolute; left: 35%; top: calc(50% - 15cqw); width: 30%; aspect-ratio: 1;
}
.hero-anim-wrap .ha-hubc {
  position: absolute; inset: 0; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; padding: 12% 10% 10%;
  opacity: 0; transform: scale(.94); transition: opacity 300ms ease-in, transform 300ms ease-in;
}
.hero-anim-wrap .ha-hubc.is-on {
  opacity: 1; transform: none;
  transition: opacity 500ms ease-out 150ms, transform 800ms var(--ha-ease) 150ms;
}
.hero-anim-wrap .ha-hubc img { filter: drop-shadow(0 14px 18px rgba(40, 0, 0, .35)); }
.hero-anim-wrap .ha-hubc img.ha-logo { filter: brightness(0) invert(1); }
.hero-anim-wrap .ha-hubc img { display: block; flex: 1 1 0; min-height: 0; width: 100%; height: 0; max-width: 100%; object-fit: contain; }
.hero-anim-wrap .ha-hubc img.ha-logo { flex: none; width: 86%; height: auto; margin: 12% 0 6%; }
.hero-anim-wrap .ha-hubc b {
  flex: none; font: 700 max(10.5px, 2.5cqw)/1.2 var(--headers, Sora), Arial, sans-serif;
  color: #fff; letter-spacing: -.01em; white-space: nowrap;
}

/* 5. Marktkaart bovenaan: day-ahead (a, b) of de energiemarkten (c); Web Red alleen voor de "nu"-markering */
.hero-anim-wrap .ha-top {
  position: absolute; z-index: 2; left: 24%; width: 52%; top: 0;
  display: grid; background: #fff; color: var(--ha-ink); border-radius: 16px; box-shadow: 0 12px 30px rgba(60, 0, 0, .22);
  font-family: var(--text, Inter), Arial, sans-serif; text-align: left;
}
.hero-anim-wrap .ha-topc {
  grid-area: 1 / 1; box-sizing: border-box; padding: 3.2% 4.5% 4.2%;
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 5%;
  opacity: 0; transform: scale(.94); transition: opacity 300ms ease-in, transform 300ms ease-in;
}
.hero-anim-wrap .ha-topc.is-on {
  opacity: 1; transform: none;
  transition: opacity 500ms ease-out 150ms, transform 800ms var(--ha-ease) 150ms;
}
.hero-anim-wrap .ha-k {
  display: flex; justify-content: space-between; gap: 1em;
  font-size: max(11px, 2.05cqw); line-height: 1.3; color: var(--ha-muted); white-space: nowrap;
}
.hero-anim-wrap .ha-top p { margin: 0; padding: 0; color: var(--ha-ink); }
.hero-anim-wrap .ha-top .ha-p {
  margin: .35em 0 .2em; font: 700 max(20px, 4.6cqw)/1.1 var(--headers, Sora), Arial, sans-serif;
  letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.hero-anim-wrap .ha-p small { font: 500 max(11px, 2cqw) var(--text, Inter), Arial, sans-serif; letter-spacing: 0; color: var(--ha-muted); }
.hero-anim-wrap .ha-top .ha-s { font-size: max(11px, 2.05cqw); line-height: 1.3; white-space: nowrap; }
.hero-anim-wrap .ha-spark { display: block; width: 100%; height: auto; overflow: visible; }
.hero-anim-wrap .ha-lijn { fill: none; stroke: var(--ha-ink); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hero-anim-wrap .ha-vlak { fill: rgba(35, 31, 32, .07); }
.hero-anim-wrap .ha-nu { stroke: var(--ha-web-red); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hero-anim-wrap .ha-stip { fill: var(--ha-web-red); }
.hero-anim-wrap .ha-spark text { font: 500 11px var(--text, Inter), Arial, sans-serif; fill: var(--ha-muted); }
.hero-anim-wrap .ha-mkt { grid-template-columns: 1fr; align-content: center; }
.hero-anim-wrap .ha-chips { display: flex; flex-wrap: nowrap; gap: 6px; margin-top: 6px; }
.hero-anim-wrap .ha-k + .ha-chips { margin-top: 3%; }
.hero-anim-wrap .ha-chips span {
  font: 600 max(11px, 1.95cqw)/1.2 var(--text, Inter), Arial, sans-serif; color: var(--ha-ink);
  background: #f7f4f4; border: 1px solid #e6e2e2; border-radius: 8px; padding: .45em .8em; white-space: nowrap;
}


/* 7. Segmentlinks onder de hero: de link van de actieve scène licht op (blijft een link, zelfde maat) */
.section.hero a.flex_horizontal.link { transition: background-color .45s ease, border-color .45s ease, box-shadow .45s ease, opacity .45s ease; }
.section.hero a.flex_horizontal.link > * { transition: color .45s ease, filter .45s ease; }
.section.hero:has(.ha-segment-actief) a.flex_horizontal.link:not(.ha-segment-actief) { opacity: .62; }
.section.hero a.flex_horizontal.link.ha-segment-actief {
  opacity: 1; background-color: #fff; border-color: #fff; box-shadow: 0 10px 28px rgba(60, 0, 0, .3);
}
.section.hero a.flex_horizontal.link.ha-segment-actief > div { color: #9b1915 !important; }
/* Wit icoon wordt Eniris Red (#9b1915) */
.section.hero a.flex_horizontal.link.ha-segment-actief > img {
  filter: brightness(0) saturate(100%) invert(13%) sepia(63%) saturate(4900%) hue-rotate(352deg) brightness(88%) contrast(98%);
}

/* 8. Mobiel: hoger kader, de ringlaag schuift onder de marktkaart, grotere hubkaart, kleinere knoppen */
@media (max-width: 767px) {
  .hero-anim-wrap { max-width: none; margin: 0; }
  .hero-anim-wrap .ha-stage { aspect-ratio: 1000 / 1090; }
  .hero-anim-wrap .ha-ring { --ha-rt: 17cqw; }
  .hero-anim-wrap .ha-hub { left: 32%; width: 36%; top: calc(50% - 18cqw); }
  .hero-anim-wrap .ha-top { left: 10%; width: 80%; }
  .hero-anim-wrap .ha-hubc b { font-size: max(10px, 2.4cqw); letter-spacing: -.02em; }
}

/* 9. Minder beweging: scène a stilstaand en volledig, geen pulsen, knoppen wisselen meteen */
@media (prefers-reduced-motion: reduce) {
  .hero-anim-wrap * { transition: none !important; animation: none !important; }
  .hero-anim-wrap .ha-puls { opacity: 0 !important; }
}
