/* ECO-FUTUR — schémas animés de La Carte.
 * Style « maquette d'architecte » : traits bleu nuit sur porcelaine, énergie et chaleur en cuivre,
 * fraîcheur en bleu nuit. Les animations ne tournent que sur un schéma visible, non mis en pause,
 * et jamais si le visiteur a demandé moins d'animations (classe .is-playing posée par site.js).
 * Ce sont des schémas de principe : ils montrent comment fonctionne un équipement, pas une installation réelle. */

/* ---------- Cadre commun ---------- */
.scene { position: relative; margin: clamp(1.75rem, 3vw, 2.5rem) 0 0; padding: clamp(0.85rem, 2vw, 1.25rem); background: var(--porcelain); box-shadow: var(--lift); max-width: 34rem; }
.scene::before { content: ""; position: absolute; inset: 0.5rem; border: 1px solid var(--line); pointer-events: none; }
.scene svg { position: relative; display: block; width: 100%; height: auto; }
.scene__bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; margin-top: 0.6rem; }
.scene__cap { font-size: 0.8125rem; line-height: 1.5; color: var(--ink-3); flex: 1 1 14rem; }
.scene__toggle {
  min-height: 2.75rem; padding: 0 0.1rem; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.8125rem; color: var(--ink-3); text-decoration: underline; text-underline-offset: 0.2em;
}
.scene__toggle:hover { color: var(--ink); }
.scene__modes { position: relative; display: inline-flex; margin-top: 0.75rem; border: 1px solid var(--field-line); }
.scene__modes button {
  min-height: 2.75rem; padding: 0 1rem; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--ink);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.scene__modes button + button { border-left: 1px solid var(--field-line); }
.scene__modes button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }
.scene :focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

/* ---------- Vocabulaire graphique commun (dans les SVG) ---------- */
.sc-line { fill: none; stroke: var(--navy); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sc-thin { fill: none; stroke: var(--navy); stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; }
.sc-face { fill: var(--porcelain); stroke: var(--navy); stroke-width: 1.5; stroke-linejoin: round; }
.sc-shade { fill: var(--cream); stroke: var(--navy); stroke-width: 1.5; stroke-linejoin: round; }
.sc-tone { fill: var(--line); stroke: var(--navy); stroke-width: 1.5; stroke-linejoin: round; }
.sc-ground { fill: none; stroke: var(--field-line); stroke-width: 1; }
.sc-label { font-family: var(--f-body); font-size: 17px; font-weight: 600; fill: var(--navy); }
.sc-note { font-family: var(--f-body); font-size: 13px; font-weight: 500; fill: var(--grey); }
.sc-hot { fill: var(--copper); }
.sc-cold { fill: var(--navy); }

/* Flux : pointillés qui avancent. Chaud ou énergie = cuivre, frais ou retour = bleu nuit. */
.sc-flow { fill: none; stroke: var(--copper); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0.1 9; }
.sc-flow--cold { stroke: var(--navy); }
.sc-flow--soft { stroke-width: 1.75; stroke-dasharray: 0.1 7; }
.scene.is-playing .sc-flow { animation: sc-flow 0.9s linear infinite; }
.scene.is-playing .sc-flow--slow { animation-duration: 1.6s; }
.scene.is-playing .sc-spin { animation: sc-spin 2.4s linear infinite; }
.scene.is-playing .sc-pulse { animation: sc-pulse 2.4s ease-in-out infinite; }
.sc-spin { transform-box: fill-box; transform-origin: center; }
@keyframes sc-flow { to { stroke-dashoffset: -9.1; } }
.scene.is-playing .sc-flow--soft { animation-name: sc-flow-soft; }
@keyframes sc-flow-soft { to { stroke-dashoffset: -7.1; } }
@keyframes sc-spin { to { transform: rotate(360deg); } }
@keyframes sc-pulse { 50% { opacity: 0.35; } }

/* Les états d'un schéma à deux modes (data-mode sur la figure) se déclarent par schéma, plus bas. */

@media print { .scene__toggle, .scene__modes { display: none; } }
/* Sans JavaScript, les boutons ne feraient rien : on ne les montre pas (le schéma reste dans son premier état). */
html:not(.js) .scene__toggle, html:not(.js) .scene__modes { display: none; }
/* Lisibilité des étiquettes : marge réduite sur téléphone, et une seule colonne entre 861 et 1100 px,
   où la colonne de gauche serait trop étroite pour le schéma. */
@media (max-width: 480px) { .scene { padding: 0.5rem; } .scene::before { inset: 0.25rem; } }
@media (min-width: 861px) and (max-width: 1100px) { .dish:has(.scene) { grid-template-columns: 1fr; } .dish:has(.scene) .scene { max-width: 36rem; } }

/* ---------- Schémas (un bloc par métier) ---------- */
/* Onduleur central ou micro-onduleurs (simulateur de La Maison) : un nuage passe devant le soleil et ombre
   un panneau. À l'arrêt, l'état ombré reste affiché, pour que le message se lise sans animation. */
.scene--ombre .om-halo { fill: none; stroke: var(--copper); stroke-width: 1.5; opacity: 0.8; }
.scene--ombre .om-shade { fill: var(--navy); opacity: 0.45; }
.scene--ombre .om-dim { opacity: 0.3; }
.scene--ombre.is-playing .om-cloud { animation: om-cloud 10s linear infinite; }
.scene--ombre.is-playing .om-shade { animation: om-shade 10s linear infinite; }
.scene--ombre.is-playing .om-dim { animation: om-dim 10s linear infinite; }
@keyframes om-cloud { 0% { transform: translateX(-150px); opacity: 0; } 10% { opacity: 1; } 30%, 70% { transform: translateX(0); } 90% { opacity: 1; } 100% { transform: translateX(150px); opacity: 0; } }
@keyframes om-shade { 0%, 24% { opacity: 0; } 32%, 68% { opacity: 0.45; } 76%, 100% { opacity: 0; } }
@keyframes om-dim { 0%, 24% { opacity: 1; } 32%, 68% { opacity: 0.3; } 76%, 100% { opacity: 1; } }


/* Photovoltaïque en autoconsommation (#photovoltaique). Un seul mode.
 * Halo du soleil et lueur de la lampe : trait cuivre fin, qui pulse avec .sc-pulse (scenes.css). */
.scene--pv .pv-halo { fill: none; stroke: var(--copper); stroke-width: 1.5; stroke-linecap: round; opacity: 0.8; }

/* Pompe à chaleur air-eau : murs de la maison en coupe (poché gris clair, trait fin). */
.scene--pac .pac-wall { fill: var(--line); stroke: var(--navy); stroke-width: 1; stroke-linejoin: round; }

/* ---------- La climatisation réversible (#climatisation) ---------- */
/* Pictogrammes soleil et flocon dans les boutons Été et Hiver. */
.scene--clim .scene__modes button { display: inline-flex; align-items: center; gap: 0.45em; }
.scene--clim .scene__modes svg {
  display: inline-block; width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
/* Rayons du soleil, dans le schéma. */
.scene--clim .clim-ray { fill: none; stroke: var(--copper); stroke-width: 1.5; stroke-linecap: round; }

/* Deux saisons : on montre les éléments de la saison affichée, en fondu de 0,4 s. */
.scene--clim .clim-ete,
.scene--clim[data-mode="hiver"] .clim-hiver { opacity: 1; visibility: visible; transition: opacity 0.4s ease, visibility 0s linear 0s; }
.scene--clim .clim-hiver,
.scene--clim[data-mode="hiver"] .clim-ete { opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0s linear 0.4s; }

/* En hiver, la vanne d'inversion renverse le sens du fluide dans les deux tubes. */
.scene--clim.is-playing[data-mode="hiver"] .clim-loop { animation-direction: reverse; }

@media (prefers-reduced-motion: reduce) {
  .scene--clim .clim-ete,
  .scene--clim .clim-hiver,
  .scene--clim[data-mode="hiver"] .clim-ete,
  .scene--clim[data-mode="hiver"] .clim-hiver { transition: none; }
}

/* Ballon thermodynamique (#chauffe-eau). Aucune animation propre : flux, ventilateur et pulsation
   viennent du vocabulaire commun (.sc-flow, .sc-spin, .sc-pulse), actifs seulement sous .is-playing. */
.scene--ballon .bl-pipe { fill: none; stroke: var(--line); stroke-width: 7; stroke-linejoin: round; }
.scene--ballon .bl-coil { fill: none; stroke: var(--copper); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scene--ballon .bl-water { fill: none; stroke: var(--copper); stroke-width: 1.5; stroke-linecap: round; }
.scene--ballon .bl-water--cold { stroke: var(--navy); }

/* La batterie, physique ou virtuelle (#batterie). Deux modes : data-mode="physique" | "virtuelle".
 * Halo du soleil et de la lampe : trait cuivre fin, qui pulse avec .sc-pulse (scenes.css), comme le schéma photovoltaïque.
 * Le téléphone est un aperçu fictif : textes à 12 unités au plus petit. */
.scene--batterie .bt-halo { fill: none; stroke: var(--copper); stroke-width: 1.5; stroke-linecap: round; opacity: 0.8; }
.scene--batterie .bt-link { stroke-dasharray: 3 4; }
.scene--batterie .bt-rule { fill: none; stroke: var(--line); stroke-width: 1; }

/* Écran du téléphone */
.scene--batterie .bt-app { font-family: var(--f-body); font-size: 13px; font-weight: 700; fill: var(--navy); }
.scene--batterie .bt-big { font-family: var(--f-display); font-size: 30px; font-weight: 800; fill: var(--navy); }
.scene--batterie .bt-unit { font-family: var(--f-body); font-size: 15px; font-weight: 700; }
.scene--batterie .bt-key { font-family: var(--f-body); font-size: 12px; font-weight: 500; fill: var(--grey); }
.scene--batterie .bt-val { font-family: var(--f-body); font-size: 15px; font-weight: 700; fill: var(--navy); }

/* Modes : physique par défaut, virtuelle sur data-mode="virtuelle".
 * Fondu en 0,4 s, en deux temps : l'ancien mode s'efface (0,2 s), puis le nouveau apparaît (0,2 s),
 * pour que les textes de l'écran ne se superposent jamais. */
.scene--batterie .bt-phys,
.scene--batterie[data-mode="virtuelle"] .bt-virt { opacity: 1; visibility: visible; transition: opacity 0.2s ease 0.2s, visibility 0s linear 0.2s; }
.scene--batterie .bt-virt,
.scene--batterie[data-mode="virtuelle"] .bt-phys { opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0s linear 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .scene--batterie .bt-phys,
  .scene--batterie .bt-virt,
  .scene--batterie[data-mode="virtuelle"] .bt-phys,
  .scene--batterie[data-mode="virtuelle"] .bt-virt { transition: none; }
}
