/* =====================================================================
   Album d'anniversaire — styles
   Les couleurs se règlent dans config.js (rubrique « couleurs ») ;
   les valeurs ci-dessous ne servent que de secours.
   ===================================================================== */

:root {
  --fond: #FFF6EE;
  --texte: #2B2340;
  --texte-doux: #6E6484;
  --accent: #F0457A;
  --halo-1: #FFD3E2;
  --halo-2: #CFE6FF;
  --halo-3: #FFEFB5;
  --halo-4: #D3F4E4;

  --police-titre: "Fraunces", Georgia, serif;
  --police-texte: "Nunito", "Segoe UI", system-ui, sans-serif;
  --police-signature: "Caveat", "Segoe Print", "Comic Sans MS", cursive;

  /* hauteur d'écran stable sur mobile (la barre d'adresse ne fait pas sauter la page) */
  --ecran: 100vh;
}
@supports (height: 100svh) {
  :root { --ecran: 100svh; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, p, figure { margin: 0; }
[hidden] { display: none !important; }

body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  line-height: 1.5;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Fond : quelques halos pastel, sans surcharge ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.backdrop span {
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--c) 0%, transparent 66%);
  opacity: .8;
  animation: drift 44s ease-in-out infinite alternate;
}
.backdrop span:nth-child(1) { --c: var(--halo-1); top: -34vmax; left: -28vmax; }
.backdrop span:nth-child(2) { --c: var(--halo-2); top: -26vmax; right: -34vmax; animation-duration: 52s; }
.backdrop span:nth-child(3) { --c: var(--halo-3); bottom: -38vmax; left: -18vmax; animation-duration: 48s; }
.backdrop span:nth-child(4) { --c: var(--halo-4); bottom: -34vmax; right: -24vmax; animation-duration: 58s; }

@keyframes drift {
  to { transform: translate(5vmax, 4vmax) scale(1.08); }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

/* ---------- Écran d'accueil ---------- */

.hero {
  position: relative;
  min-height: var(--ecran);
  display: grid;
  place-items: center;
  padding: 10vh 20px 18vh;
  text-align: center;
}
.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__kicker {
  margin-bottom: 1.4rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--texte-doux);
  opacity: 0;
  animation: fade-up .8s .1s ease-out forwards;
}
.hero__title {
  font-family: var(--police-titre);
  font-weight: 800;
  line-height: .95;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hero__line {
  display: block;
  font-size: clamp(2.1rem, 7.2vw, 6.2rem);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -.01em;
}
.hero__name {
  display: block;
  margin-top: .06em;
  font-size: clamp(4rem, 18vw, 13.5rem);
  font-weight: 900;
  letter-spacing: -.035em;
}
.hero__name .char {
  color: var(--c, var(--accent));
  text-shadow: 0 .045em 0 rgba(43, 35, 64, .13);
}
.hero__subtitle {
  max-width: 34ch;
  margin-top: 1.8rem;
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
  color: var(--texte-doux);
  opacity: 0;
  animation: fade-up .8s 1.1s ease-out forwards;
}
.hero__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(24px, 5vh);
}
.hero__hint-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--texte-doux);
  opacity: 0;
  animation: fade-up .8s 1.6s ease-out forwards;
}
.hero__arrow {
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  animation: nudge 1.6s ease-in-out infinite;
}

/* lettres du titre qui « popent » une à une */
.word { display: inline-block; white-space: nowrap; }
.char {
  display: inline-block;
  opacity: 0;
  animation: pop .75s cubic-bezier(.2, 1.35, .35, 1) forwards;
  animation-delay: calc(120ms + var(--i, 0) * 42ms);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(.45em) scale(.5) rotate(-12deg); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes nudge {
  0%, 100% { transform: translateY(0) rotate(45deg); }
  50%      { transform: translateY(6px) rotate(45deg); }
}

/* ---------- Album : une scène fixe, les photos la traversent ---------- */

.album {
  position: relative;
  /* hauteur = défilement nécessaire pour toutes les photos + un écran */
  height: calc(var(--nb, 1) * var(--longueur, 1.2) * var(--ecran) + var(--ecran));
}
.album__stage {
  position: sticky;
  top: 0;
  height: var(--ecran);
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* photo + description + auteur = un seul bloc qui bouge d'un seul tenant */
.shot {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  visibility: hidden;
  transform-origin: 50% 60%;
  backface-visibility: hidden;
}
.shot img,
.shot video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(88vw, 900px);
  max-height: min(calc(var(--ecran) * .64), calc(var(--ecran) - 240px));
  border-radius: 12px;
  box-shadow:
    0 28px 50px -22px rgba(43, 35, 64, .38),
    0 10px 20px -12px rgba(43, 35, 64, .2);
  user-select: none;
  -webkit-user-drag: none;
}
.shot video { background: rgba(43, 35, 64, .08); }

/* vidéo : bouton pour activer / couper le son */
.shot__media { position: relative; }
.shot__sound {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(30, 24, 48, .6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.shot__sound:hover { background: rgba(30, 24, 48, .8); transform: scale(1.04); }
.shot__sound:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.shot__sound svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shot figcaption {
  max-width: min(46ch, 86vw);
  margin-top: 1.4rem;
  text-align: center;
}
.shot__desc {
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  font-weight: 600;
  line-height: 1.5;
}
.shot__author {
  margin-top: .3rem;
  font-family: var(--police-signature);
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}
.shot__missing {
  display: grid;
  place-items: center;
  width: min(80vw, 560px);
  aspect-ratio: 4 / 3;
  padding: 24px;
  border: 2px dashed rgba(43, 35, 64, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .6);
  color: var(--texte-doux);
  font-weight: 700;
  text-align: center;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.album__counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(18px, 3.5vh);
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .2em;
  font-variant-numeric: tabular-nums;
  color: var(--texte-doux);
  opacity: 0;
  transition: opacity .4s;
}
.album__counter.is-on { opacity: .85; }

/* ---------- Écran de fin ---------- */

.finale {
  min-height: var(--ecran);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.2rem;
  padding: 40px 20px;
  text-align: center;
}
.finale__title {
  font-family: var(--police-titre);
  font-size: clamp(2.6rem, 9vw, 6rem);
  font-style: italic;
  font-weight: 800;
  line-height: 1;
}
.finale__message {
  max-width: 40ch;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--texte-doux);
}
.finale__button {
  margin-top: .8rem;
  padding: .9em 1.6em;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px -12px var(--accent);
  transition: transform .2s ease;
}
.finale__button:hover { transform: translateY(-2px) rotate(-2deg); }
.finale__button:active { transform: scale(.97); }
.finale__button:focus-visible { outline: 3px solid var(--texte); outline-offset: 3px; }

/* ---------- Bandeau d'erreur si config.js est cassé ---------- */

.alerte-config {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 100;
  padding: 14px 18px;
  border-radius: 12px;
  background: #2B2340;
  color: #fff;
  font-weight: 600;
}

/* ---------- Mode sans animation (réglage « réduire les animations » du système) ---------- */

.is-static .album { height: auto; }
.is-static .album__stage {
  position: static;
  height: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16vh;
  padding: 10vh 0;
}
.is-static .shot { visibility: visible; }
.is-static .shot img,
.is-static .shot video { max-height: 80vh; }
.is-static .album__counter { display: none; }
.is-static .char,
.is-static .hero__kicker,
.is-static .hero__subtitle,
.is-static .hero__hint-in { animation: none; opacity: 1; }
.is-static .backdrop span,
.is-static .hero__arrow { animation: none; }
