/* ============================================================
   Effets speciaux stellaires - pages "En savoir plus"
   Module reutilisable : champ d'etoiles, nebuleuse, glow, apparitions.
   Pense pour le theme sombre (fond nuit, accents teal/orange).
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Bungee&family=JetBrains+Mono:wght@400;600&family=Lilita+One&display=swap");

/* Le canvas du champ d'etoiles couvre tout l'ecran, derriere le contenu. */
#cielEtoile {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* On remonte le contenu au-dessus du ciel etoile. */
#entete,
#contenu,
#pied {
  position: relative;
  z-index: 1;
}

/* ---- Nebuleuse animee derriere l'en-tete ---- */
#entete {
  isolation: isolate;
}
#entete::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 220%;
  z-index: -1;
  background:
    radial-gradient(40% 55% at 22% 30%, rgba(90, 209, 196, 0.30), transparent 70%),
    radial-gradient(45% 60% at 80% 25%, rgba(155, 110, 220, 0.30), transparent 70%),
    radial-gradient(50% 60% at 55% 75%, rgba(255, 184, 107, 0.22), transparent 70%);
  filter: blur(14px);
  opacity: 0.85;
  animation: nebuleuseDerive 22s ease-in-out infinite alternate;
}

@keyframes nebuleuseDerive {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1);    opacity: 0.65; }
  50%  { transform: translate3d(3%, 2%, 0)  scale(1.12);  opacity: 0.95; }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.04);  opacity: 0.75; }
}

/* ---- Titre lumineux (glow qui respire) ---- */
#titre-principal {
  text-shadow: 0 0 18px rgba(90, 209, 196, 0.35);
  animation: titreGlow 5s ease-in-out infinite;
}
@keyframes titreGlow {
  0%, 100% { text-shadow: 0 0 14px rgba(90, 209, 196, 0.25); }
  50%      { text-shadow: 0 0 26px rgba(90, 209, 196, 0.55), 0 0 46px rgba(155, 110, 220, 0.30); }
}

/* Le surtitre prend un petit pouls lumineux. */
#entete .surtitre {
  animation: surtitrePouls 3.4s ease-in-out infinite;
}
@keyframes surtitrePouls {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ---- Apparition des sections au defilement ---- */
.section.revele-init {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(2px);
}
.section.revele-on {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.21, 0.9, 0.32, 1), filter 0.7s ease;
}

/* ---- Halo au survol des sections ---- */
.section {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.section:hover {
  border-color: rgba(90, 209, 196, 0.55);
  box-shadow: 0 0 0 1px rgba(90, 209, 196, 0.25), 0 14px 40px -18px rgba(90, 209, 196, 0.45);
  transform: translateY(-2px);
}

/* Les boutons d'action gagnent une petite aura. */
.action {
  box-shadow: 0 0 0 0 rgba(90, 209, 196, 0.0);
}
.action:hover {
  box-shadow: 0 0 18px -2px rgba(90, 209, 196, 0.7);
}

/* ---- Sous-titres = ancres cliquables (deep-link vers une section) ---- */
html { scroll-behavior: smooth; }
#contenu .section { scroll-margin-top: 18px; }

.section-titre a.ancre-titre {
  color: inherit;
  text-decoration: none;
}
.section-titre a.ancre-titre .marque-ancre {
  margin-left: 0.4em;
  color: var(--couleurAccent);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.section-titre:hover a.ancre-titre .marque-ancre,
.section-titre a.ancre-titre:focus-visible .marque-ancre {
  opacity: 0.85;
}

/* Section visee par l'ancre : petit flash lumineux a l'arrivee. */
#contenu .section:target {
  border-color: var(--couleurAccent);
  box-shadow: 0 0 0 1px var(--couleurAccent), 0 0 36px -8px var(--couleurAccent);
  animation: cibleFlash 1.6s ease;
}
@keyframes cibleFlash {
  0%   { box-shadow: 0 0 0 2px var(--couleurAccent), 0 0 60px -2px var(--couleurAccent); }
  100% { box-shadow: 0 0 0 1px var(--couleurAccent), 0 0 36px -8px var(--couleurAccent); }
}

/* ---- Accessibilite : on coupe le mouvement si demande ---- */
@media (prefers-reduced-motion: reduce) {
  #entete::before,
  #titre-principal,
  #entete .surtitre {
    animation: none !important;
  }
  .section.revele-init {
    opacity: 1;
    transform: none;
    filter: none;
  }
  html { scroll-behavior: auto; }
  #contenu .section:target { animation: none; }
}

/* ============================================================
   Entete ludique colorblock (aqua + astronaute + etoiles)
   Garde le corps spatial, mais pose un bandeau colorblock clair
   et joueur en haut de la page. Charge apres le <style> de la page,
   donc surclasse l'ancien en-tete sombre.
   ============================================================ */
#entete {
  max-width: 880px;
  margin: 26px auto 10px;
  padding: 30px 28px 28px;
  text-align: center;
  background: linear-gradient(135deg, #22d3ee 0%, #5ad1c4 100%);
  border: 5px solid #111;
  border-radius: 24px;
  box-shadow: 10px 10px 0 #111;
  overflow: hidden;
}
#entete::before { display: none; }   /* on retire la nebuleuse derriere le bandeau clair */

#entete .surtitre {
  display: inline-block;
  font-family: 'Bungee', cursive;
  font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: #fff; background: #0a2540;
  border: 3px solid #111; border-radius: 999px;
  padding: 6px 16px; margin: 0 0 14px;
  box-shadow: 4px 4px 0 #111;
  animation: none; opacity: 1;
  position: relative; z-index: 2;
}
#entete .surtitre::before { content: "\1F680  "; }

#titre-principal {
  font-family: 'Lilita One', cursive;
  color: #0a2540;
  text-shadow: 3px 3px 0 #fff;
  animation: none;
  position: relative; z-index: 2;
}
#sous-titre {
  color: #0a3a40; font-weight: 700;
  position: relative; z-index: 2;
}

/* Decor injecte par effets-stellaires.js */
.entete-decor { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.entete-decor svg { position: absolute; }
.entete-decor .astronaute { left: 16px; bottom: -8px; width: 92px; height: auto; animation: flotteAstro 5s ease-in-out infinite; }
.entete-decor .planete { right: 18px; top: 8px; width: 104px; height: auto; }
.entete-decor .etoile-deco { filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.25)); }
.entete-decor .etoile-1 { right: 38%; top: 12px; width: 22px; }
.entete-decor .etoile-2 { left: 36%; bottom: 14px; width: 16px; }
.entete-decor .etoile-3 { right: 22%; bottom: 18px; width: 14px; }

@keyframes flotteAstro {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-9px) rotate(4deg); }
}

@media (max-width: 620px) {
  #entete { margin: 16px 12px 10px; }
  .entete-decor .astronaute, .entete-decor .planete { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .entete-decor .astronaute { animation: none; }
}
