/* ==========================================================================
   Hestia — Feuille de style principale (« tech nocturne »)
   Aucune bibliothèque externe. Toutes les polices et couleurs sont locales.
   Respect strict de la CSP : aucun style inline dans index.html.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --fond: #0b1426;
  --texte: #eaf0f7;
  --texte-doux: rgba(234, 240, 247, 0.78);
  --cyan: #38d6f5;
  --ambre: #f5a524;
  --or-chaud: #ffd166;
  --ardoise: #16223b;
  --bordure-neutre: rgba(234, 240, 247, 0.22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Fond bleu nuit posé immédiatement sur html pour éviter tout flash blanc au chargement */
html {
  background-color: var(--fond);
  color: var(--texte);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--fond);
  color: var(--texte);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Résumé invisible à l'écran mais lu par les lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Contour clavier bien visible sur tout élément interactif */
:focus-visible {
  outline: 3px solid var(--ambre);
  outline-offset: 3px;
}

/* Bandeau discret de démo (neutre : jamais d'ambre dans les scènes 1 à 3) */
.bandeau-demo {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(234, 240, 247, 0.25);
  background-color: rgba(15, 27, 50, 0.9);
  color: var(--texte-doux);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

/* Barres de contrôles discrets (cibles tactiles >= 44 x 44 px) */
.barre-haut {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

/* Sur petit écran, décale les boutons sous le bandeau démo s'il est affiché */
@media (max-width: 680px) {
  .bandeau-demo:not([hidden]) {
    top: calc(8px + env(safe-area-inset-top));
    font-size: 0.72rem;
    padding: 4px 12px;
  }

  .bandeau-demo:not([hidden]) + .barre-haut {
    top: calc(44px + env(safe-area-inset-top));
  }
}

.barre-bas {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 25;
  pointer-events: none;
}

.ctrl-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--bordure-neutre);
  background-color: rgba(11, 20, 38, 0.72);
  color: var(--texte-doux);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.ctrl-btn:hover {
  color: var(--texte);
  border-color: rgba(234, 240, 247, 0.55);
  background-color: rgba(22, 34, 59, 0.92);
}

.ctrl-passer[hidden],
.bandeau-demo[hidden],
.calque-finale[hidden],
.secours-statique[hidden] {
  display: none;
}

/* Quand "Passer →" est masqué, "Son" reste calé à droite */
.ctrl-son {
  margin-left: auto;
}

.icone-ctrl {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl-son .icone-son-actif {
  display: none;
}

.ctrl-son[aria-pressed="true"] .icone-son-coupe {
  display: none;
}

.ctrl-son[aria-pressed="true"] .icone-son-actif {
  display: inline;
}

.ctrl-son[aria-pressed="true"] {
  color: var(--texte);
  border-color: rgba(234, 240, 247, 0.5);
}

/* Mode ?video : masque tous les contrôles interactifs et le bandeau pour capture propre */
html.mode-video .barre-haut,
html.mode-video .barre-bas,
html.mode-video .bandeau-demo {
  display: none;
}

/* Conteneur principal plein écran */
.scene-app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ==========================================================================
   Illustration SVG adaptative (Paysage vs Portrait)
   ========================================================================== */
.scene-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scene-svg-portrait {
  display: none;
}

@media (orientation: portrait) {
  .scene-svg-paysage {
    display: none;
  }
  .scene-svg-portrait {
    display: block;
  }
}

/* Nuages génériques (cyan en scènes 1-3, effacés en scène 4) */
.nuages-groupe {
  opacity: 0.72;
  transition: opacity 0.6s ease;
}

.nuage-forme {
  fill: rgba(56, 214, 245, 0.06);
  stroke: var(--cyan);
  stroke-width: 2.2;
  stroke-opacity: 0.65;
}

/* Lignes de données : will-change limité aux éléments animés en scène 4 */
.ligne-cyan {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 16 14;
  opacity: 0.72;
  will-change: stroke-dashoffset, opacity;
}

.ligne-ambre {
  fill: none;
  stroke: var(--ambre);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 28 100;
  opacity: 0;
  will-change: stroke-dashoffset, opacity;
}

/* Bureau central */
.bureau-corps {
  fill: rgba(18, 32, 58, 0.92);
  stroke: rgba(234, 240, 247, 0.36);
  stroke-width: 2.2;
}

.bureau-toit {
  fill: none;
  stroke: rgba(234, 240, 247, 0.42);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bureau-foyer-cadre {
  fill: rgba(11, 20, 38, 0.9);
  stroke: rgba(234, 240, 247, 0.25);
  stroke-width: 2;
}

/* Foyer Hestia (éteint en scènes 1-3, allumé progressivement en scène 4) */
.foyer-halo-large,
.foyer-halo-coeur,
.foyer-flamme {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform, opacity;
}

.foyer-onde {
  fill: none;
  stroke: var(--ambre);
  stroke-width: 1.8;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform, opacity;
}

.flamme-externe {
  fill: var(--ambre);
}

.flamme-interne {
  fill: var(--or-chaud);
}

/* Scène 5 : documents ambre reliés au foyer */
.groupe-documents {
  opacity: 0;
}

.fil-doc {
  fill: none;
  stroke: var(--ambre);
  stroke-width: 1.8;
  stroke-dasharray: 20 10;
  opacity: 0.75;
}

.doc-carte {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.doc-feuille {
  fill: rgba(245, 165, 36, 0.14);
  stroke: var(--ambre);
  stroke-width: 2;
  stroke-linejoin: round;
}

.doc-pli {
  fill: none;
  stroke: var(--ambre);
  stroke-width: 2;
  stroke-linejoin: round;
}

.doc-ligne {
  stroke: var(--or-chaud);
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: 0.8;
}

/* ==========================================================================
   Calques textuels & scènes 1 à 6
   ========================================================================== */
.calque-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.calque-scene.est-visible {
  opacity: 1;
}

.calque-scene.est-masque {
  display: none;
}

/* Légendes des scènes 1 et 5 : placées en bas pour laisser le foyer central dégagé */
.calque-legende {
  align-items: flex-end;
  padding-bottom: clamp(58px, 12dvh, 110px);
}

.phrase-film {
  margin: 0;
  text-align: center;
  font-size: clamp(1.25rem, 4.2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--texte);
  text-shadow: 0 4px 24px rgba(11, 20, 38, 0.92);
  max-width: 34ch;
}

/* Sur téléphone à l'horizontale, les phrases tiennent sur une seule ligne */
@media (orientation: landscape) and (max-height: 540px) {
  .calque-legende {
    padding-bottom: 52px;
  }
  .phrase-film {
    font-size: clamp(1rem, 2.5vw, 1.45rem);
    white-space: nowrap;
    max-width: none;
  }
}

/* Scène 2 : fenêtre système neutre et générique */
.fenetre-neutre {
  width: min(360px, 88vw);
  border-radius: 12px;
  border: 1px solid rgba(234, 240, 247, 0.28);
  background-color: rgba(15, 26, 48, 0.96);
  box-shadow: 0 20px 50px rgba(4, 9, 20, 0.65);
  overflow: hidden;
  transform: translateY(8px) scale(0.97);
  transition: transform 0.35s ease;
}

.calque-modal.est-visible .fenetre-neutre {
  transform: translateY(0) scale(1);
}

.fenetre-entete {
  display: flex;
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(234, 240, 247, 0.14);
  background-color: rgba(255, 255, 255, 0.03);
}

.fenetre-point {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: rgba(234, 240, 247, 0.25);
}

.fenetre-corps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 20px;
}

.icone-alerte {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-linecap: round;
}

.fenetre-message {
  margin: 0;
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  font-weight: 700;
  color: var(--texte);
}

/* Scène 3 : les trois points d'attente */
.points-attente {
  margin: 0;
  display: flex;
  gap: 14px;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 700;
  color: var(--texte);
  letter-spacing: 0.08em;
  transform: translateY(-96px);
}

.point-attente {
  opacity: 0;
  transition: opacity 0.28s ease;
}

.point-attente.est-allume {
  opacity: 1;
}

/* Scène 6 : logo contour, signature, installation et UNIQUE bouton plein ambre */
.calque-finale {
  pointer-events: auto;
  padding: 58px 20px 64px;
}

.finale-carte {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 680px;
  width: 100%;
  padding: 28px 24px;
  border-radius: 20px;
  background-color: rgba(11, 20, 38, 0.78);
  border: 1px solid rgba(245, 165, 36, 0.24);
}

.finale-etape {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.finale-etape.est-visible {
  opacity: 1;
  transform: translateY(0);
}

.finale-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Contour ambre uniquement : seul le bouton d'audit est plein en ambre */
.logo-flamme-contour {
  width: 56px;
  height: 56px;
  fill: none;
  stroke: var(--ambre);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finale-marque {
  margin: 0;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--texte);
}

.finale-signature {
  margin: 0;
  font-size: clamp(1.15rem, 3.4vw, 1.65rem);
  font-weight: 700;
  color: var(--or-chaud);
  line-height: 1.3;
}

.finale-installation {
  margin: 0;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  color: var(--texte-doux);
  line-height: 1.4;
}

.finale-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

/* Seul élément plein en ambre de la scène 6 (texte bleu nuit pour contraste maximal) */
.btn-audit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: 999px;
  background-color: var(--ambre);
  color: var(--fond);
  font-size: clamp(1rem, 2.8vw, 1.125rem);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-audit:hover {
  background-color: var(--or-chaud);
  transform: translateY(-1px);
}

.bloc-secours-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.adresse-secours {
  font-size: 0.9rem;
  color: var(--texte-doux);
  user-select: all;
}

.btn-copier {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(234, 240, 247, 0.35);
  background-color: transparent;
  color: var(--texte);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.btn-copier:hover {
  border-color: var(--ambre);
  background-color: rgba(245, 165, 36, 0.1);
}

/* Adaptation compacte pour téléphone horizontal afin d'éviter tout défilement */
@media (orientation: landscape) and (max-height: 480px) {
  .calque-finale {
    padding: 16px 64px 20px;
  }
  .finale-carte {
    gap: 8px;
    padding: 16px 20px;
  }
  .logo-flamme-contour {
    width: 40px;
    height: 40px;
  }
  .finale-marque {
    font-size: 1.45rem;
  }
  .finale-signature {
    font-size: 1.05rem;
  }
  .finale-installation {
    font-size: 0.9rem;
  }
  .btn-audit {
    min-height: 44px;
    padding: 10px 22px;
    font-size: 0.95rem;
  }
  .finale-actions {
    margin-top: 2px;
    gap: 8px;
  }
}

/* Version de secours sans JavaScript (ou en cas d'erreur script) */
.secours-statique {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--fond);
  color: var(--texte);
}

.secours-contenu {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 520px;
}

.secours-cta {
  margin: 8px 0 0;
  padding: 12px 24px;
  border-radius: 999px;
  background-color: var(--ambre);
  color: var(--fond);
  font-weight: 700;
}

/* ==========================================================================
   Accessibilité : « Réduire les animations » (prefers-reduced-motion)
   Remplace les déplacements rapides par des fondus doux et garde tout lisible.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
  }

  .calque-scene,
  .finale-etape,
  .nuages-groupe,
  .point-attente {
    transition-duration: 0.8s;
  }

  .fenetre-neutre,
  .btn-audit:hover {
    transform: none;
  }
}
