/* Dire Oui · Faire-part animés · base commune du moteur (fp-engine.css)
   Tout est limité à .fp-root : aucun effet sur la page hôte.
   Préfixes (la page invitée utilise déjà .fp-*, par exemple .fp-date) :
     · moteur : .fp-root et classes .fpe-* uniquement (états compris :
       .fpe-in, .fpe-passe, .fpe-reduit…), variables internes --fpe-* ;
     · modèles : racine .fp-<id>, toutes leurs classes en .fp-<id>-* ;
     · jetons de coloris : variables --fp-*, posées sur la racine seulement.
   Variables lues : --fp-ui-fg, --fp-ui-bg (boutons du moteur),
   --fp-ui-font (police des boutons), --fp-intro-bg (fond du calque). */

/* ── Reset limité ── */
.fp-root {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}
.fp-root *, .fp-root *::before, .fp-root *::after { box-sizing: border-box; margin: 0; padding: 0; }
.fp-root :where(img, svg, canvas, video) { display: block; max-width: 100%; }
.fp-root :where(button) { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.fp-root :where(a) { color: inherit; }
.fp-root :where(ul, ol) { list-style: none; }
.fp-root :where(h1, h2, h3, h4, p) { font-weight: inherit; font-size: inherit; }
.fp-root [hidden] { display: none !important; }

/* Conteneur de la section Fin posé chez l'hôte (opts.finCible). */
.fp-root.fpe-fin-hote { min-height: 0; }

/* Pendant le chargement (CSS + polices), rien ne s'affiche. */
.fp-root.fpe-chargement .fpe-page,
.fp-root.fpe-chargement .fpe-intro { visibility: hidden; }

/* ── Page ── */
.fpe-page { position: relative; outline: none; }

/* Section plein écran (accueil) : hauteur stable même quand la barre d'adresse bouge. */
.fpe-plein { min-height: 100vh; min-height: 100svh; }

/* ── Calque d'ouverture ── */
.fpe-intro {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
  background: var(--fp-intro-bg, var(--fp-papier, #F7F3EC));
  outline: none;
}
.fpe-intro.fpe-sortie {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fpe-sortie, .45s) ease;
}

/* Défilement bloqué tant que le calque est là. */
html.fpe-verrou, html.fpe-verrou body { overflow: hidden !important; overscroll-behavior: none; }

/* ── Boutons du moteur (Passer, son) ── */
.fpe-ui { position: relative; z-index: 1001; }
.fpe-btn {
  position: fixed;
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--fp-ui-fg, #2B2522);
  background: var(--fp-ui-bg, rgba(255, 255, 255, .85));
  border: 1px solid color-mix(in srgb, var(--fp-ui-fg, #2B2522) 18%, transparent);
  font-family: var(--fp-ui-font, inherit);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
  transition: opacity .4s ease, transform .4s ease, background-color .2s ease;
}
.fpe-btn:focus-visible { outline: 2px solid var(--fp-ui-fg, #2B2522); outline-offset: 3px; }
.fpe-btn:active { transform: scale(.96); }

.fpe-btn-passer {
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  padding: 0 18px;
  border-radius: 22px;
  font-size: 15px;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
}
.fpe-btn-passer.fpe-visible,
.fpe-btn-passer:focus-visible { opacity: .92; pointer-events: auto; }

.fpe-btn-son {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  animation: fp-apparition .5s ease both;
}
.fpe-btn-son .fpe-barre { display: none; }
.fpe-btn-son.fpe-muet .fpe-ondes { display: none; }
.fpe-btn-son.fpe-muet .fpe-barre { display: inline; }

@keyframes fp-apparition { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Apparition au défilement (ctx.reveal) ── */
.fp-root .fpe-reveal {
  opacity: 0;
  transform: translate3d(0, var(--fpe-reveal-y, 12px), 0);
  transition:
    opacity var(--fpe-reveal-duree, .7s) cubic-bezier(.2, .7, .2, 1) var(--fpe-delai, 0s),
    transform var(--fpe-reveal-duree, .7s) cubic-bezier(.2, .7, .2, 1) var(--fpe-delai, 0s);
}
.fp-root .fpe-reveal.fpe-in { opacity: 1; transform: none; }
/* Élément dépassé par un défilement rapide : affiché sans animation. */
.fp-root .fpe-reveal.fpe-instant { transition: none; }

/* Remontage après update() : aucune transition le temps d'une image. */
.fp-root.fpe-sans-transition, .fp-root.fpe-sans-transition * { transition: none !important; }

/* ── Mouvement réduit ── */
.fp-root.fpe-reduit .fpe-reveal { opacity: 1; transform: none; transition: none; }
.fp-root.fpe-reduit .fpe-btn { transition: none; animation: none; }

/* ── Pictogrammes ── */
.fp-root .fpe-picto { display: inline-block; vertical-align: middle; flex: none; overflow: visible; }

/* ── Utilitaires ── */
.fpe-vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.fpe-nowrap { white-space: nowrap; }
.fpe-safe-bas { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }
.fp-root .fpe-mention { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.fp-root .fpe-cd-msg[hidden] { display: none; }
