/* =========================================================
   benebabe.fr — feuille de style
   Thème « aquarelle douce » : mauve / rose / bleu ciel
   Sommaire :
   1. Réglages & palette
   2. Base
   3. Fond aquarelle animé
   4. Typographie & éléments communs
   5. Bouton son
   6. Écran QR (ordinateur)
   7. Écran 1 — énigme + dissolution en fumée
   8. Écran 2 — histoire (scroll storytelling)
   9. Écran 3 — mood du hérisson
   10. Écran 4 — programme
   11. Accessibilité / mouvement réduit
   ========================================================= */

/* ---------- 1. RÉGLAGES & PALETTE ---------- */
:root{
  /* Palette imposée */
  --mauve:        #C9A7EB;
  --mauve-fonce:  #B497D6;
  --rose:         #F7C6D9;
  --rose-vif:     #F4A9C4;
  --bleu:         #A7D8E8;
  --bleu-clair:   #BEE3F0;
  --creme:        #FDF6F9;

  /* Dérivés */
  --encre:        #4E3F6B;   /* texte sur fond clair */
  --encre-douce:  #7A6B96;
  --nuit:         #16142B;   /* fond de l'histoire */
  --nuit-mauve:   #2E2350;

  /* Rythme */
  --r-xl: 34px;
  --r-l:  26px;
  --r-m:  18px;
  --ombre-douce: 0 18px 40px -18px rgba(120, 90, 160, .45);
  --ombre-glow:  0 0 0 2px rgba(201,167,235,.55), 0 14px 34px -14px rgba(244,169,196,.8);
  --easing: cubic-bezier(.42, 0, .18, 1);
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after{ box-sizing: border-box; }

/* L'attribut hidden doit toujours l'emporter sur nos display: flex/grid */
[hidden]{ display: none !important; }

html, body{
  height: 100%;
  margin: 0;
  padding: 0;
}

body{
  background: var(--creme);
  color: var(--encre);
  font-family: "Quicksand", system-ui, -apple-system, sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.6;
  overflow: hidden;              /* chaque écran gère son propre scroll */
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

img{ max-width: 100%; display: block; }

.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;
}

/* --- Les écrans --- */
.ecran{
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s var(--easing), visibility 1s;
}
.ecran.est-visible{ opacity: 1; visibility: visible; }

.ecran--centre{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(22px, 7vw, 48px);
  padding-top: max(72px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.ecran--scroll{
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.contenu{
  width: 100%;
  max-width: 560px;
  text-align: center;
  transition: opacity .8s var(--easing), transform .8s var(--easing), filter .8s var(--easing);
}
.contenu[hidden]{ display: none; }
.contenu.part{ opacity: 0; transform: translateY(-12px); filter: blur(6px); }

/* ---------- 3. FOND AQUARELLE ANIMÉ ---------- */
.aquarelle{
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--creme);
}

.calque{
  position: absolute;
  inset: -20%;
  transition: opacity 2.8s var(--easing);
}
.calque--nuit{ opacity: 0; background: radial-gradient(120% 90% at 50% 0%, var(--nuit-mauve), var(--nuit) 70%); }
.calque--jour{ opacity: 1; }

/* Bascule pilotée par body[data-ambiance] */
body[data-ambiance="nuit"] .calque--jour{ opacity: 0; }
body[data-ambiance="nuit"] .calque--nuit{ opacity: 1; }

/* Taches de peinture : gros dégradés radiaux très flous qui dérivent */
.tache{
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(48px);
  will-change: transform;
}
.calque--jour .tache--1{ width:70vw; height:70vw; left:-14vw; top:-8vw;  background: radial-gradient(circle at 40% 40%, var(--mauve), transparent 68%); opacity:.85; animation: derive1 26s ease-in-out infinite alternate; }
.calque--jour .tache--2{ width:66vw; height:66vw; right:-18vw; top:12vh; background: radial-gradient(circle at 50% 50%, var(--rose), transparent 66%);  opacity:.8;  animation: derive2 31s ease-in-out infinite alternate; }
.calque--jour .tache--3{ width:80vw; height:80vw; left:-10vw; bottom:-22vh; background: radial-gradient(circle at 50% 50%, var(--bleu-clair), transparent 68%); opacity:.85; animation: derive3 35s ease-in-out infinite alternate; }
.calque--jour .tache--4{ width:52vw; height:52vw; right:-6vw; bottom:6vh; background: radial-gradient(circle at 50% 50%, var(--rose-vif), transparent 64%); opacity:.5; animation: derive1 29s ease-in-out infinite alternate-reverse; }

.calque--nuit .tache--1{ width:78vw; height:78vw; left:-20vw; top:-10vh; background: radial-gradient(circle at 45% 45%, #4B3A7E, transparent 68%); opacity:.9; animation: derive2 33s ease-in-out infinite alternate; }
.calque--nuit .tache--2{ width:64vw; height:64vw; right:-18vw; top:22vh; background: radial-gradient(circle at 50% 50%, #2B4E7A, transparent 66%); opacity:.85; animation: derive3 38s ease-in-out infinite alternate; }
.calque--nuit .tache--3{ width:72vw; height:72vw; left:-16vw; bottom:-18vh; background: radial-gradient(circle at 50% 50%, #6A4E93, transparent 70%); opacity:.75; animation: derive1 30s ease-in-out infinite alternate; }
.calque--nuit .tache--4{ width:40vw; height:40vw; right:8vw; bottom:14vh; background: radial-gradient(circle at 50% 50%, #7E6BB8, transparent 62%); opacity:.5; animation: derive2 27s ease-in-out infinite alternate-reverse; }

@keyframes derive1{ from{ transform: translate3d(0,0,0) scale(1);} to{ transform: translate3d(6vw,4vh,0) scale(1.12);} }
@keyframes derive2{ from{ transform: translate3d(0,0,0) scale(1.08);} to{ transform: translate3d(-7vw,5vh,0) scale(.95);} }
@keyframes derive3{ from{ transform: translate3d(0,0,0) scale(1);} to{ transform: translate3d(5vw,-6vh,0) scale(1.1);} }

/* Lueur d'aube : flashe doucement pendant la transition nuit -> jour */
.calque--aube{
  background: radial-gradient(120% 70% at 50% 100%, rgba(255, 198, 170, .85), rgba(247,198,217,.4) 45%, transparent 72%);
  opacity: 0;
  transition: opacity 1.4s var(--easing);
}
body.aube-en-cours .calque--aube{ opacity: 1; }

/* Grain « papier aquarelle » */
.grain{
  position: absolute;
  inset: 0;
  background-image: url("../img/texture-aquarelle.svg");
  background-size: 320px 320px;
  opacity: .5;
  mix-blend-mode: soft-light;
}

/* ---------- 4. TYPOGRAPHIE & COMMUNS ---------- */
.titre{
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  line-height: 1.22;
  margin: 0 0 .5em;
  letter-spacing: .01em;
  text-wrap: balance;
}
.titre--l{ font-size: clamp(30px, 8.4vw, 42px); }
.titre--m{ font-size: clamp(24px, 6.4vw, 30px); }

.surtitre{
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--encre-douce);
  margin: 0 0 1.2em;
}

.texte{ margin: 0 0 1em; color: var(--encre); }
.texte--url{ font-size: 15px; color: var(--encre-douce); }
.texte--url a{ color: var(--mauve-fonce); font-weight: 600; }

/* Boutons */
.btn{
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 15px 30px;
  cursor: pointer;
  transition: transform .35s var(--easing), box-shadow .35s var(--easing), opacity .35s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active{ transform: scale(.96); }

.btn--plein{
  background: linear-gradient(120deg, var(--mauve), var(--rose-vif));
  color: #fff;
  box-shadow: var(--ombre-douce);
}
.btn--doux{
  background: rgba(255,255,255,.72);
  color: var(--encre);
  box-shadow: var(--ombre-douce);
  backdrop-filter: blur(6px);
}
.btn--fantome{
  background: transparent;
  color: var(--encre-douce);
  text-decoration: underline;
  text-underline-offset: 5px;
  padding: 12px 16px;
  font-weight: 500;
}

:focus-visible{
  outline: 3px solid var(--mauve-fonce);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- 5. BOUTON SON ---------- */
.btn-son{
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 50;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  color: var(--mauve-fonce);
  box-shadow: 0 6px 18px -8px rgba(120,90,160,.6);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background .4s, color .4s, transform .3s var(--easing);
}
.btn-son:active{ transform: scale(.9); }
.btn-son svg{ width: 22px; height: 22px; }
.btn-son__barre{ opacity: 0; transition: opacity .3s; }
.btn-son[aria-pressed="true"] .btn-son__barre{ opacity: 1; }   /* aria-pressed = son coupé */
body[data-ambiance="nuit"] .btn-son{ background: rgba(255,255,255,.14); color: #E8DEF8; }

/* ---------- 6. ÉCRAN QR (ordinateur) ---------- */
.bloc-qr{
  text-align: center;
  max-width: 420px;
  padding: clamp(28px, 4vw, 44px);
  border-radius: var(--r-xl);
  background: rgba(255,255,255,.55);
  box-shadow: var(--ombre-douce);
  backdrop-filter: blur(10px);
}
.qr{
  width: 220px;
  margin: 0 auto 26px;
  padding: 14px;
  background: var(--creme);
  border-radius: var(--r-m);
  box-shadow: inset 0 0 0 1px rgba(180,151,214,.35);
}
.qr img, .qr canvas{ margin: 0 auto; }

/* ---------- 7. ÉCRAN 1 — ÉNIGME ---------- */
.cases{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 6px 0 30px;
}
.cases__mot{
  display: flex;
  gap: 7px;
}
.case{
  width: 20px;
  height: 30px;
  border-bottom: 3px solid var(--mauve-fonce);
  display: grid;
  place-items: center;
  font-family: "Dancing Script", cursive;
  font-size: 26px;
  font-weight: 700;
  color: var(--encre);
  transition: color .3s, border-color .3s, transform .3s var(--easing);
}
.case.est-remplie{ transform: translateY(-3px); border-color: var(--rose-vif); }

.champ{
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.champ__input{
  flex: 1 1 200px;
  min-width: 0;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--encre);
  text-align: center;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  box-shadow: var(--ombre-douce);
  outline-offset: 3px;
}
.champ__input::placeholder{ color: var(--encre-douce); font-weight: 400; }

.indice{
  min-height: 1.6em;
  margin: 20px 0 0;
  font-size: 15px;
  color: var(--encre-douce);
  opacity: 0;
  transition: opacity .5s;
}
.indice.est-visible{ opacity: 1; }

/* --- Dissolution en fumée --- */
.voile-fumee{
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}
.voile-fumee span{
  position: absolute;
  bottom: -30vh;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(253,246,249,.95), rgba(201,167,235,.35) 60%, transparent 72%);
  filter: blur(30px);
}
.voile-fumee span:nth-child(1){ left: -12vw; animation-delay: 0s; }
.voile-fumee span:nth-child(2){ left: 18vw;  animation-delay: .12s; }
.voile-fumee span:nth-child(3){ left: 48vw;  animation-delay: .06s; }
.voile-fumee span:nth-child(4){ left: -4vw;  animation-delay: .22s; }
.voile-fumee span:nth-child(5){ left: 34vw;  animation-delay: .3s; }

#ecran-enigme.se-dissout .voile-fumee{ opacity: 1; }
#ecran-enigme.se-dissout .voile-fumee span{ animation: fumee 1.9s var(--easing) forwards; }
#ecran-enigme.se-dissout .contenu{
  animation: disparait-en-fumee 1.7s var(--easing) forwards;
}
@keyframes fumee{
  from{ transform: translateY(0) scale(.6); opacity: 0; }
  35% { opacity: .95; }
  to  { transform: translateY(-105vh) scale(1.7); opacity: 0; }
}
@keyframes disparait-en-fumee{
  from{ opacity: 1; filter: blur(0); transform: scale(1); }
  to  { opacity: 0; filter: blur(16px); transform: scale(1.12) translateY(-18px); }
}

/* ---------- 8. ÉCRAN 2 — HISTOIRE ---------- */
#ecran-histoire{ color: #FFFFFF; }

.decor{
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  margin-bottom: -100vh;
  margin-bottom: -100svh;
  z-index: 0;
  pointer-events: none;
}
.decor__item{
  position: absolute;
  opacity: .5;
  filter: blur(.3px) drop-shadow(0 10px 24px rgba(0,0,0,.25));
  will-change: transform;
  animation: flotte 9s ease-in-out infinite alternate;
}
.decor__item--herisson{ opacity: .75; animation-duration: 7s; }
@keyframes flotte{
  from{ translate: 0 0; }
  to  { translate: 0 -14px; }
}

.recit{ position: relative; z-index: 1; }
.recit__section{
  height: 100vh;
  height: 100svh;
  scroll-snap-align: center;
  display: grid;
  place-items: center;
  padding: 0 9vw;
}
.recit__section--fin{ height: 60svh; }

.recit__texte{
  margin: 0;
  font-family: "Dancing Script", cursive;
  font-weight: 500;
  font-size: clamp(30px, 8.6vw, 44px);
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 6px 30px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(26px);
  filter: blur(8px);
  transition: opacity 1.1s var(--easing), transform 1.1s var(--easing), filter 1.1s var(--easing);
}
.recit__section.est-visible .recit__texte{
  opacity: 1;
  transform: none;
  filter: blur(0);
}

.fleche-scroll{
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  translate: -50% 0;
  z-index: 3;
  transition: opacity .6s;
}
.fleche-scroll span{
  display: block;
  width: 12px; height: 12px;
  border-right: 2px solid rgba(255,255,255,.7);
  border-bottom: 2px solid rgba(255,255,255,.7);
  rotate: 45deg;
  animation: descend 2.2s ease-in-out infinite;
}
.fleche-scroll.est-cachee{ opacity: 0; }
@keyframes descend{
  0%,100%{ transform: translateY(0); opacity: .3; }
  50%    { transform: translateY(8px); opacity: 1; }
}

/* ---------- 9. ÉCRAN 3 — MOOD ---------- */
.moods{
  display: grid;
  gap: 14px;
  margin-top: 8px;
}
.mood{
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  color: var(--encre);
  padding: 20px 22px;
  border: 0;
  border-radius: var(--r-l);
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.5)),
    linear-gradient(135deg, var(--mauve), var(--bleu-clair));
  box-shadow: var(--ombre-douce);
  transition: transform .4s var(--easing), box-shadow .4s var(--easing), filter .9s var(--easing), opacity .9s;
  -webkit-tap-highlight-color: transparent;
}
.mood:nth-child(2){ background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.5)), linear-gradient(135deg, var(--rose-vif), var(--mauve)); }
.mood:nth-child(3){ background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.5)), linear-gradient(135deg, var(--bleu), var(--rose)); }
.mood:active{ transform: scale(.97); }

/* Le menu qui « fond » comme de la peinture (hérisson bougon) */
#liste-moods.fond .mood{
  animation: coule 1.5s var(--easing) forwards;
}
#liste-moods.fond .mood:nth-child(2){ animation-delay: .12s; }
#liste-moods.fond .mood:nth-child(3){ animation-delay: .06s; }
@keyframes coule{
  0%  { transform: translateY(0) scaleY(1) skewX(0); filter: blur(0); opacity: 1; }
  40% { transform: translateY(14px) scaleY(1.25) skewX(-2deg); filter: blur(2px); border-radius: 40% 40% 55% 55% / 30% 30% 70% 70%; }
  100%{ transform: translateY(70vh) scaleY(2.4) skewX(3deg); filter: blur(16px); opacity: 0; border-radius: 50% 50% 60% 60% / 20% 20% 80% 80%; }
}

/* Feu d'artifice (canvas plein écran) */
.canvas-feu{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Carte-lien vers la soirée */
.carte-lien{
  display: block;
  text-decoration: none;
  color: var(--encre);
  padding: 26px 24px;
  margin-bottom: 22px;
  border-radius: var(--r-l);
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,255,255,.6));
  box-shadow: var(--ombre-douce);
  transition: transform .35s var(--easing), box-shadow .35s var(--easing);
}
.carte-lien:active{ transform: scale(.98); }
.carte-lien__eyebrow{
  display: block; font-size: 12px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--encre-douce); margin-bottom: 6px;
}
.carte-lien__titre{
  display: block;
  font-family: "Dancing Script", cursive;
  font-size: 30px; font-weight: 700; line-height: 1.2;
}
.carte-lien__url{ display: block; margin-top: 8px; font-size: 14px; color: var(--mauve-fonce); font-weight: 600; }

/* Vidéo responsive 16/9 */
.video{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 22px;
  border-radius: var(--r-m);
  overflow: hidden;
  box-shadow: var(--ombre-douce);
  background: rgba(255,255,255,.4);
}
.video iframe{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ---------- 10. ÉCRAN 4 — PROGRAMME ---------- */
.programme{
  list-style: none;
  margin: 6px 0 28px;
  padding: 0;
  display: grid;
  gap: 12px;
}
.carte{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--encre);
  padding: 16px 20px;
  border: 2px solid transparent;
  border-radius: var(--r-l);
  background: rgba(255,255,255,.62);
  box-shadow: var(--ombre-douce);
  cursor: pointer;
  transition: transform .3s var(--easing), box-shadow .45s var(--easing), background .45s, border-color .45s;
  -webkit-tap-highlight-color: transparent;
}
.carte__icone{ font-size: 22px; line-height: 1; }
.carte:active{ transform: scale(.98); }
.carte[aria-pressed="true"]{
  background: linear-gradient(120deg, rgba(247,198,217,.85), rgba(201,167,235,.85));
  border-color: rgba(255,255,255,.9);
  box-shadow: var(--ombre-glow);
}

.final .titre{
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition: opacity 1.1s var(--easing), transform 1.1s var(--easing), filter 1.1s var(--easing);
}
.final .titre.est-visible{ opacity: 1; transform: none; filter: blur(0); }

/* ---------- 11. MOUVEMENT RÉDUIT ---------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .2s !important;
  }
  .recit__texte{ opacity: 1; transform: none; filter: none; }
}
