/* energie-fond.css — Fond animé du hero Énergie
 * Filigrane façon « Matrix » (LATRACTION, L'ATTRACTION, LA TRACTION), halo géométrique fin autour
 * de l'image, grille et ligne de balayage. Tout reste décoratif, discret et derrière le contenu.
 * ============================================================ */

.energy-hero > .container { position: relative; z-index: 2; }

.en-fond, .en-halo {
  --en-or: 244, 213, 55;
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  contain: strict;
}

/* Calque fixe derrière toute la page (z-index négatif : sous le contenu, au-dessus du fond du document) */
.en-fond--page {
  position: fixed; z-index: -1;
  background: radial-gradient(120% 80% at 70% 0%, #121512 0%, #070807 55%, #030303 100%);
}
/* La pluie reste nette sur les bords et s'efface derrière la colonne de lecture */
.en-fond--page .en-fond-pluie {
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .42) 26%, rgba(0, 0, 0, .26) 50%, rgba(0, 0, 0, .42) 74%, #000 100%);
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .42) 26%, rgba(0, 0, 0, .26) 50%, rgba(0, 0, 0, .42) 74%, #000 100%);
}
.en-fond--page .en-fond-grille {
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 50% 50%, #000 0%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 75% at 50% 50%, #000 0%, transparent 80%);
}
.en-fond--page .en-fond-mot { -webkit-text-stroke-color: rgba(var(--en-or), .1); }
.en-fond--page .en-fond-scan { opacity: .55; }

/* Les sections laissent voir le fond ; cartes et pied de page restent opaques pour la lecture */
body.site-unified.im-energy.en-page .hero.energy-hero,
body.site-unified.im-energy.en-page :is(section.energy-methode, section.prestations, section.energy-pour-qui, section.avis-section, section.discover-hubs) {
  background: transparent !important;
}
body.site-unified.im-energy.en-page { --card-bg: rgba(14, 16, 16, .88); }

/* Grille fine qui dérive lentement */
.en-fond-grille {
  position: absolute; inset: -64px;
  background-image:
    linear-gradient(rgba(var(--en-or), .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--en-or), .05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 65% 70% at 62% 48%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 65% 70% at 62% 48%, #000 0%, transparent 72%);
  animation: en-grille 40s linear infinite;
}
@keyframes en-grille { to { transform: translate3d(64px, 64px, 0); } }

/* Pluie de lettres : plus présente à droite, très discrète derrière le texte */
.en-fond-pluie {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, .7) 40%, #000 70%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, .7) 40%, #000 70%);
}

/* Halo géométrique centré sur l'image (position calculée par le script) */
.en-fond-geo {
  position: absolute; left: var(--gx, 72%); top: var(--gy, 50%); width: var(--gs, 760px); height: var(--gs, 760px);
  transform: translate(-50%, -50%); overflow: visible;
}
.en-fond-geo .g-a { transform-origin: 400px 400px; animation: en-tourne 140s linear infinite; }
.en-fond-geo .g-b { transform-origin: 400px 400px; animation: en-tourne 100s linear infinite reverse; }
.en-fond-geo .g-c { transform-origin: 400px 400px; animation: en-tourne 220s linear infinite; }
.en-fond-geo .trait { fill: none; stroke: rgba(var(--en-or), .22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.en-fond-geo .trait.fin { stroke: rgba(var(--en-or), .12); stroke-dasharray: 2 7; }
.en-fond-geo .noeud { fill: rgb(var(--en-or)); opacity: .5; animation: en-pulse 4.5s ease-in-out infinite; }
.en-fond-geo .noeud:nth-child(2n) { animation-delay: -1.5s; }
.en-fond-geo .noeud:nth-child(3n) { animation-delay: -3s; }
@keyframes en-tourne { to { transform: rotate(360deg); } }
@keyframes en-pulse { 0%, 100% { opacity: .18; } 50% { opacity: .75; } }

/* Ligne de balayage */
.en-fond-scan {
  position: absolute; left: 0; right: 0; top: 0; height: 120px;
  background: linear-gradient(180deg, transparent, rgba(var(--en-or), .05) 70%, rgba(var(--en-or), .16) 99%, transparent);
  animation: en-scan 9s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes en-scan { 0% { transform: translateY(-140px); } 100% { transform: translateY(110vh); } }

/* Grand mot en filigrane : LATRACTION, L'ATTRACTION, LA TRACTION */
.en-fond-mot {
  position: absolute; left: 50%; bottom: -.16em; transform: translateX(-50%);
  font: 700 clamp(72px, 15vw, 250px)/1 Inter, system-ui, sans-serif; letter-spacing: .02em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(var(--en-or), .15);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
  .en-fond-mot { font-size: 22vw; -webkit-text-stroke-color: rgba(var(--en-or), .08); }
}

@media (prefers-reduced-motion: reduce) {
  .en-fond-grille, .en-fond-geo .g-a, .en-fond-geo .g-b, .en-fond-geo .g-c, .en-fond-geo .noeud { animation: none; }
  .en-fond-scan { display: none; }
}
@media print { .en-fond, .en-halo { display: none; } }
