/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --color-black: #0b0a0d;
  --color-black-2: #1a1016;
  --color-bordeaux: #3a1420;
  --color-bordeaux-2: #521a26;
  --color-cream: #f4ece0;
  --color-cream-dim: rgba(244, 236, 224, 0.68);
  --color-cream-faint: rgba(244, 236, 224, 0.4);
  --color-rose: #e7c8c4;
  --color-gold: #c9a876;
  --color-gold-dim: rgba(201, 168, 118, 0.35);

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-s: 0.5s;
  --dur-m: 0.9s;
  --dur-l: 1.4s;

  --gutter: 28px;

  /* Zones sûres iPhone (encoche, Dynamic Island, barre du bas). 0 ailleurs. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

/* ============================================================
   RESET
   ============================================================ */
* { box-sizing: border-box; }

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

html {
  background: var(--color-black);          /* évite tout flash blanc (rebond iOS) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;                      /* pas de défilement horizontal */
  overscroll-behavior: none;               /* pas de "rebond" qui révèle le vide */
}

body {
  background: var(--color-black);
  color: var(--color-cream);
  font-family: var(--font-body);
  font-weight: 300;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent; /* pas de flash gris au toucher (iOS) */
  -webkit-touch-callout: none;              /* pas de menu "copier" au toucher long */
  -webkit-user-select: none;
  user-select: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;               /* supprime le zoom au double-toucher */
  -webkit-appearance: none;
  appearance: none;
}

input {
  -webkit-user-select: text;
  user-select: text;
}

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

::selection {
  background: var(--color-bordeaux-2);
  color: var(--color-cream);
}

a { color: inherit; }

.is-hidden { display: none !important; }

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   AMBIANCE DE FOND
   ============================================================ */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(82, 26, 38, 0.55), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(58, 20, 32, 0.45), transparent 60%),
    linear-gradient(180deg, var(--color-black) 0%, var(--color-black-2) 55%, var(--color-black) 100%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ============================================================
   PROGRESSION (3 points, un par écran)
   ============================================================ */
.progress {
  position: fixed;
  top: calc(22px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 10px;
}

.progress__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-cream-faint);
  transition: background var(--dur-m) var(--ease), transform var(--dur-m) var(--ease);
}

.progress__dot.is-current {
  background: var(--color-gold);
  transform: scale(1.35);
}

.progress__dot.is-done {
  background: var(--color-rose);
}

/* ============================================================
   BOUTON MUSIQUE
   ============================================================ */
.sound-toggle {
  position: fixed;
  top: calc(18px + var(--safe-top));
  right: calc(18px + var(--safe-right));
  z-index: 30;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-gold-dim);
  background: rgba(11, 10, 13, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: border-color var(--dur-s) var(--ease), transform var(--dur-s) var(--ease);
}

.sound-toggle:hover { border-color: var(--color-gold); }
.sound-toggle:active { transform: scale(0.94); }

/* ============================================================
   ÉCRANS
   ============================================================ */
#app {
  position: relative;
  z-index: 1;
}

.screen {
  min-height: 100vh;      /* repli pour les anciens navigateurs */
  min-height: 100svh;
  width: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    calc(96px + var(--safe-top))
    calc(var(--gutter) + var(--safe-right))
    calc(100px + var(--safe-bottom))
    calc(var(--gutter) + var(--safe-left));
  opacity: 0;
}

.screen.is-active {
  display: flex;
  animation: screen-in var(--dur-l) var(--ease) forwards;
}

.screen.is-leaving {
  display: flex;
  animation: screen-out var(--dur-m) var(--ease) forwards;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes screen-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-14px); }
}

.screen__inner {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.screen__inner--wide { max-width: 620px; }
.screen__inner--letter { max-width: 520px; }

/* Apparition douce des éléments, décalée par --d (index) via délai */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-in var(--dur-m) var(--ease) forwards;
  animation-delay: calc(var(--d, 0) * 0.14s + 0.1s);
}

@keyframes reveal-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TYPOGRAPHIE
   ============================================================ */
.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin: 0 0 22px;
}

.title-lg {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  line-height: 1.18;
  margin: 0 0 22px;
  color: var(--color-cream);
}

.title-md {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: normal;
  font-size: clamp(1.8rem, 7vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 36px;
  color: var(--color-cream);
}

.subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-cream-dim);
  margin: 0 0 48px;
  font-weight: 300;
}

/* ============================================================
   BOUTON CONTINUER
   ============================================================ */
.btn--continue {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px;
  border: 1px solid var(--color-gold-dim);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-cream);
  transition: border-color var(--dur-s) var(--ease), background var(--dur-s) var(--ease), transform var(--dur-s) var(--ease), letter-spacing var(--dur-s) var(--ease), opacity var(--dur-s) var(--ease);
  min-height: 48px;
}

.btn--continue:hover {
  border-color: var(--color-gold);
  background: rgba(201, 168, 118, 0.06);
  letter-spacing: 0.18em;
}

.btn--continue:active { transform: scale(0.97); }

.btn__arrow {
  transition: transform var(--dur-s) var(--ease);
}

.btn--continue:hover .btn__arrow { transform: translateX(3px); }

/* ============================================================
   QUESTION FINALE DE L'ÉCRAN 2
   ============================================================ */
.decision {
  margin-top: 8px;
  text-align: center;
}

.decision__question {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 5.6vw, 1.7rem);
  color: var(--color-cream);
  margin: 0 0 36px;
}

.decision__zone {
  position: relative;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.btn--dodge {
  display: inline-flex;
  align-items: center;
  padding: 16px 26px;
  border: 1px solid rgba(244, 236, 224, 0.18);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream-dim);
  min-height: 48px;
  white-space: nowrap;
  transition: left 0.32s var(--ease), top 0.32s var(--ease), transform 0.15s var(--ease), border-color 0.3s ease;
}

.btn--dodge:hover { border-color: var(--color-gold-dim); }

/* ============================================================
   ÉCRAN 3 — LETTRE
   ============================================================ */
.screen--three [data-letter-title] { margin-bottom: 36px; }

.letter-text {
  min-height: 170px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  margin-bottom: 40px;
}

.letter-step {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 6vw, 1.8rem);
  line-height: 1.55;
  color: var(--color-cream);
  font-weight: 400;
  margin: 0;
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* Fondu de sortie du texte actuellement affiché, juste avant que la
   fumée n'en "écrive" un nouveau. */
.letter-step.is-hiding {
  transition: opacity 0.42s ease, filter 0.42s ease, transform 0.42s var(--ease);
  opacity: 0;
  filter: blur(6px);
  transform: translateY(-6px);
}

/* Chaque bloc de texte est découpé en paragraphes (un par saut de
   ligne double dans le contenu), eux-mêmes découpés en mots. */
.letter-para {
  margin: 0 0 0.85em;
}

.letter-para:last-child { margin-bottom: 0; }

/* Passage en gras (**...** dans config.js) */
.letter-bold {
  font-weight: 600;
}

/* Étape très longue : un peu plus compacte pour tenir sur un téléphone */
.letter-step--long {
  font-size: clamp(1.2rem, 5.2vw, 1.55rem);
  line-height: 1.5;
}

.letter-step--climax-1 {
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  font-style: italic;
  color: var(--color-cream);
}

.letter-step--climax-2 {
  font-size: clamp(1.7rem, 8vw, 2.4rem);
  font-style: italic;
  color: var(--color-rose);
}

/* Le prénom, mis en valeur avec un léger dégradé scintillant */
.name-highlight {
  position: relative;
  display: inline-block;
  font-style: italic;
  background: linear-gradient(90deg, var(--color-gold), var(--color-rose), var(--color-gold));
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: name-shimmer 3.2s linear infinite;
}

.name-highlight::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -2px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  opacity: 0.65;
}

@keyframes name-shimmer {
  to { background-position: -220% center; }
}

/* Chaque mot est invisible au départ : la fumée colorée le révèle à
   son passage, comme si elle l'écrivait au fil de la ligne. */
.letter-word {
  display: inline-block;
  opacity: 0;
  filter: blur(5px);
  transform: translateY(5px) scale(0.98);
  transition: opacity 0.32s ease, filter 0.32s ease, transform 0.32s var(--ease);
}

.letter-word.is-revealed {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
}

/* Le canevas sur lequel est dessinée la fumée colorée (rubans fins
   qui traversent chaque ligne de gauche à droite). Dépasse
   légèrement le texte pour laisser la fumée monter/dériver. */
.smoke-canvas {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
  filter: blur(0.7px);
  /* bords fondus : la fumée n'est jamais coupée net */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
}

.letter-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  row-gap: 12px;
}

.btn--ghost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid rgba(244, 236, 224, 0.14);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream-dim);
  min-height: 44px;
  transition: border-color var(--dur-s) var(--ease), color var(--dur-s) var(--ease), transform var(--dur-s) var(--ease);
}

.btn--ghost:hover {
  border-color: var(--color-gold-dim);
  color: var(--color-cream);
}

.btn--ghost:active { transform: scale(0.97); }

.letter-home {
  margin-top: 34px;
}

.letter-final {
  animation: reveal-in var(--dur-l) var(--ease) forwards;
}

.final-line {
  position: relative;
  overflow: visible;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  color: var(--color-cream);
  margin: 0 0 18px;
  min-height: 1.4em;
}

.final-note {
  font-size: 13px;
  color: var(--color-cream-faint);
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.final-note.is-visible { opacity: 1; }

/* ============================================================
   SÉQUENCE FINALE — la demande
   Trois temps : un paragraphe qui apparaît doucement, une phrase de
   transition qui hésite, puis la question, mise à part. Les éléments
   sont tous présents (invisibles) dès le départ : rien ne bouge.
   ============================================================ */
.proposal {
  --soft: cubic-bezier(0.33, 0, 0.2, 1);
  position: relative;
  text-align: center;
  margin: 0 0 clamp(34px, 7vh, 60px);
}

/* Le texte déjà lu reste grisé ; le suivant n'occupe de place qu'au
   moment d'arriver, puis la page défile et repousse l'ancien vers le haut. */
.proposal__bridge:not(.is-shown),
.proposal__ask:not(.is-shown) { display: none; }
.proposal__intro,
.proposal__bridge {
  transition: opacity 2.6s var(--soft);
}
.proposal__intro { margin-bottom: clamp(26px, 5vh, 42px); }
.proposal__intro.is-dim    { opacity: 0.5; }
.proposal__intro.is-dimmer { opacity: 0.26; }
.proposal__bridge.is-dim   { opacity: 0.6; }

/* 1. Premier paragraphe : phrase après phrase */
.proposal__line {
  margin: 0 0 0.55em;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5.4vw, 1.6rem);
  line-height: 1.5;
  color: var(--color-cream);
  opacity: 0;
  filter: blur(6px);
  transform: translateY(10px);
  transition:
    opacity 2s var(--soft),
    filter 2s var(--soft),
    transform 2.4s var(--ease);
}
.proposal__line:last-child { margin-bottom: 0; }
.proposal__line.is-in {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
/* « Mais moi, je sais… » : le pivot du paragraphe */
.proposal__line--turn {
  margin-top: 0.9em;
  font-style: italic;
  font-size: clamp(1.32rem, 5.8vw, 1.72rem);
}

/* 2. La transition : mot à mot, teintée de rose */
.proposal__bridge {
  margin: 0 0 clamp(30px, 6vh, 50px);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 5.8vw, 1.75rem);
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--color-rose);
}

.proposal__word {
  display: inline-block;
  opacity: 0;
  filter: blur(5px);
  transform: translateY(8px);
  transition:
    opacity 1.4s var(--soft),
    filter 1.4s var(--soft),
    transform 1.6s var(--ease);
}
.proposal__word.is-in {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
.proposal__tail {
  display: inline-block;
  white-space: nowrap;
}
.proposal__ellipsis {
  transition-duration: 1.8s, 1.8s, 1.8s;
}

/* 3. La question : seule, plus grande, éclairée par un halo discret */
.proposal__ask {
  position: relative;
  isolation: isolate;
  padding: 0 4px 8px;
}

.proposal__rule {
  display: block;
  width: 56px;
  height: 1px;
  margin: 0 auto clamp(22px, 4vh, 32px);
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  opacity: 0;
  transform: scaleX(0);
  transition: transform 1.9s var(--ease), opacity 1.9s var(--soft);
}
.proposal__ask.is-open .proposal__rule {
  opacity: 0.9;
  transform: scaleX(1);
}

.proposal__halo {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 62%;
  width: min(130%, 560px);
  aspect-ratio: 1.5;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(150, 52, 74, 0.34), rgba(92, 28, 46, 0.16) 55%, transparent 100%);
  filter: blur(18px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  transition: opacity 3.2s var(--soft), transform 3.4s var(--ease);
}
.proposal__ask.is-open .proposal__halo {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: proposal-halo 7s ease-in-out 3.5s infinite;
}
@keyframes proposal-halo {
  0%, 100% { opacity: 1;    transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.78; transform: translate(-50%, -50%) scale(1.07); }
}

.proposal__question {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.9rem, 8.6vw, 2.8rem);
  line-height: 1.22;
  letter-spacing: 0.005em;
  color: var(--color-cream);
  text-shadow: 0 0 34px rgba(231, 200, 196, 0.28);
  text-wrap: balance;
}

/* Le cœur : arrive en dernier, puis bat très doucement (deux battements, puis repos) */
.proposal__heart {
  display: inline-block;
  font-style: normal;
  font-size: 0.78em;
  margin-left: 0.06em;
  vertical-align: 0.04em;
  opacity: 0;
  transform: scale(0.4);
  filter: blur(4px) drop-shadow(0 0 0 rgba(224, 62, 92, 0));
}
.proposal__heart.is-in {
  animation:
    proposal-heart-in 1.7s var(--ease) forwards,
    proposal-heart-beat 4.4s ease-in-out 2s infinite;
}
@keyframes proposal-heart-in {
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) drop-shadow(0 0 12px rgba(224, 62, 92, 0.5));
  }
}
@keyframes proposal-heart-beat {
  0%, 100% { opacity: 1; transform: scale(1);    filter: blur(0) drop-shadow(0 0 10px rgba(224, 62, 92, 0.42)); }
  12%      { opacity: 1; transform: scale(1.1);  filter: blur(0) drop-shadow(0 0 16px rgba(224, 62, 92, 0.68)); }
  24%      { opacity: 1; transform: scale(1);    filter: blur(0) drop-shadow(0 0 10px rgba(224, 62, 92, 0.42)); }
  36%      { opacity: 1; transform: scale(1.06); filter: blur(0) drop-shadow(0 0 14px rgba(224, 62, 92, 0.58)); }
  52%      { opacity: 1; transform: scale(1);    filter: blur(0) drop-shadow(0 0 10px rgba(224, 62, 92, 0.42)); }
}

/* Après la question : la note et le retour à l'accueil restent cachés
   jusqu'à la fin d'une longue pause (la question ne bouge pas). */
.letter-final .final-note {
  max-width: 34ch;
  margin: 0 auto;
  line-height: 1.6;
  transition-duration: 2.6s;
}
.letter-final .letter-home {
  opacity: 1;
  transition:
    opacity 1.8s var(--soft),
    border-color var(--dur-s) var(--ease),
    color var(--dur-s) var(--ease),
    transform var(--dur-s) var(--ease);
}
.letter-final:not(.is-complete) .letter-home {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-height: 700px) {
  .proposal__intro { margin-bottom: 22px; }
  .proposal__bridge { margin-bottom: 26px; }
  .proposal__question { font-size: clamp(1.75rem, 7.8vw, 2.5rem); }
}

/* ============================================================
   PLUIE DE FLEURS (moment "je crois que je suis amoureux de toi")
   ============================================================ */
.flower-rain {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
}

.flower-bit {
  position: absolute;
  top: -10%;
  left: 0;
  opacity: 0;
  will-change: transform, opacity;
  animation-name: flower-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.28));
}

@keyframes flower-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.95; }
  100% { transform: translate(var(--drift), 118vh) rotate(var(--rot)); opacity: 0.85; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 1024px) {
  .screen { padding-top: 110px; }
  .screen__inner--wide { max-width: 620px; }
}

/* Petits écrans très bas (ex : iPhone SE en paysage) */
@media (max-height: 560px) {
  .screen { padding-top: 70px; padding-bottom: calc(88px + var(--safe-bottom)); }
  .title-lg, .title-md { margin-bottom: 16px; }
  .subtitle { margin-bottom: 28px; }
}

/* Accessibilité clavier */
.btn--continue:focus-visible,
.btn--dodge:focus-visible,
.sound-toggle:focus-visible {
  outline: 1px solid var(--color-gold);
  outline-offset: 3px;
}

/* ============================================================
   ÉCRAN DE VERROUILLAGE
   ============================================================ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(32px + var(--safe-top)) calc(32px + var(--safe-right)) calc(32px + var(--safe-bottom)) calc(32px + var(--safe-left));
  overflow-y: auto;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(82, 26, 38, 0.55), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(58, 20, 32, 0.45), transparent 60%),
    linear-gradient(180deg, var(--color-black) 0%, var(--color-black-2) 55%, var(--color-black) 100%);
}

.lock-screen.is-fading {
  animation: screen-out var(--dur-m) var(--ease) forwards;
}

.lock-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.lock-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 6vw, 1.6rem);
  color: var(--color-cream);
  margin: 0 0 34px;
  line-height: 1.4;
}

.lock-form { margin: 0; }

.lock-input-wrap {
  position: relative;
  margin-bottom: 10px;
}

.lock-input {
  width: 100%;
  padding: 15px 46px 15px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-gold-dim);
  background: rgba(244, 236, 224, 0.04);
  color: var(--color-cream);
  font-family: var(--font-body);
  font-size: 16px;                         /* < 16px = zoom automatique sur iPhone */
  letter-spacing: 0.04em;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-s) var(--ease);
}

.lock-input:focus {
  outline: none;
  border-color: var(--color-gold);
}

.lock-input::placeholder { color: var(--color-cream-faint); }

.lock-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity var(--dur-s) var(--ease);
}

.lock-eye:hover { opacity: 1; }

.lock-error {
  font-size: 12.5px;
  color: var(--color-rose);
  opacity: 0;
  height: 0;
  margin: 0 0 6px;
  transition: opacity 0.3s ease;
}

.lock-error.is-visible {
  opacity: 1;
  height: auto;
  margin: 0 0 18px;
}

.lock-card.is-shaking {
  animation: lock-shake 0.4s ease;
}

@keyframes lock-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

/* ============================================================
   LE FILM — PREMIÈRE PARTIE (écran 2), plein écran
   Piloté par js/app.js à partir de TIMELINE (js/config.js).
   ============================================================ */
.film {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  background: #060506;
  padding:
    calc(62px + var(--safe-top))
    calc(22px + var(--safe-right))
    calc(88px + var(--safe-bottom))
    calc(22px + var(--safe-left));
  opacity: 0;
  transition: opacity 1.4s ease;
}
.film.is-live { opacity: 1; }
.film.is-ending { opacity: 0; transition: opacity 1.2s ease; }

/* deux calques de fond en fondu enchaîné (un dégradé ne peut pas s'animer) */
.film__bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 2s ease;
}
.film__bg.is-on { opacity: 1; }

.film__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* particules lumineuses / étoiles */
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
  animation: particle-float var(--dur, 7s) ease-in-out var(--delay, 0s) infinite;
}
.particle--dust { filter: blur(0.5px); }
.particle--star { box-shadow: 0 0 6px 1px rgba(244, 236, 224, 0.5); }

@keyframes particle-float {
  0%   { opacity: 0; transform: translate(0, 6px) scale(0.7); }
  15%  { opacity: 1; }
  50%  { transform: translate(var(--dx, 12px), -16px) scale(1); }
  85%  { opacity: 0.85; }
  100% { opacity: 0; transform: translate(calc(var(--dx, 12px) * -1), -30px) scale(0.85); }
}

/* ---------- zone média (photo OU vidéo) ---------- */
.film__media {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 560px;
  display: none;
}
.film.has-photo .film__media,
.film.has-video .film__media { display: block; }
.film.is-bigvideo .film__media { max-width: min(820px, 100%); }
/* deux photos côte à côte : la zone média s'élargit */
.film.has-pair .film__media { max-width: min(860px, 100%); }

/* ---------- photo ---------- */
.film__photo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  overflow: hidden;
  transition: opacity 1.4s ease;
}
.film__photo.is-in { opacity: 1; }

/* cadre d'une photo (une ou deux par séquence) */
.film__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}
.film__photo.is-pair { gap: clamp(8px, 2.4vw, 22px); }
.film__photo.is-pair .film__frame { flex: 1 1 0; height: 100%; }
/* la 2e photo arrive un peu après la 1re, légèrement décalée */
.film__photo.is-pair .film__frame--2 { transform: translateY(14px); opacity: 0; }
.film__photo.is-pair.is-in .film__frame--2 {
  transform: none; opacity: 1;
  transition: opacity 1.6s ease 0.9s, transform 1.8s var(--ease) 0.9s;
}
.film__photo.is-out { opacity: 0; transition: opacity 1.2s ease; }

.film__photo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 0 46px 4px rgba(201, 168, 118, 0.16);
}

.film__photo--portrait-focus .film__frame {
  width: min(100%, 360px);
  height: 100%;
}

.film__photo--portrait-focus img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center top;
}

.film.has-portrait-focus .film__text {
  min-height: 5rem;
  margin-bottom: 14px;
}

.film.has-portrait-focus .film__media {
  position: absolute;
  inset: calc(62px + var(--safe-top)) calc(22px + var(--safe-right))
    calc(78px + var(--safe-bottom)) calc(22px + var(--safe-left));
  flex: none;
  width: auto;
  max-width: none;
}

.film__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 260px);
  height: min(100%, 320px);
  border-radius: 14px;
  border: 1px solid rgba(244, 236, 224, 0.14);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-cream-faint);
}

/* effet 1 — apparition douce et cinématique, léger mouvement lent */
.fx-fade-drift { transition-duration: 2.8s; }
.fx-fade-drift img { transform: scale(1.07); }
.fx-fade-drift.is-in img { transform: scale(1); transition: transform 16s ease-out; }

/* effet 2 — glisse depuis la gauche en devenant net */
.fx-blur-slide img { transform: translateX(-38px); filter: blur(11px); }
.fx-blur-slide.is-in img { transform: none; filter: blur(0); transition: transform 2.4s var(--ease), filter 2.2s var(--ease); }

/* effet 3 — plus lumineux : la photo s'éclaire, un halo chaud pulse derrière */
.fx-warm-light img { transform: scale(0.95); filter: brightness(0.35) saturate(0.7); }
.fx-warm-light.is-in img { transform: none; filter: none; transition: transform 2.6s var(--ease), filter 2.6s ease; }
.fx-warm-light::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 226, 170, 0.75), transparent 62%);
  opacity: 0;
  pointer-events: none;
}
.fx-warm-light.is-in::before { animation: warm-pulse 3.2s ease forwards; }
@keyframes warm-pulse { 0% { opacity: 0; } 35% { opacity: 0.85; } 100% { opacity: 0.12; } }

/* effet 4 — dernière photo d'enfance : très lente, couleurs qui reviennent */
.fx-slow-still { transition-duration: 3.8s; }
.fx-slow-still img { filter: sepia(0.65) saturate(0.7) brightness(0.85); }
.fx-slow-still.is-in img { filter: none; transition: filter 6s ease; }

/* effet 5 — une traînée de lumière traverse l'image */
.fx-light-sweep { transition-duration: 2.2s; }
.fx-light-sweep::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 244, 214, 0.55), transparent);
  transform: skewX(-18deg);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0;
}
.fx-light-sweep.is-in::after { animation: light-sweep 2.6s ease-in-out 0.4s forwards; }
@keyframes light-sweep {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  100% { left: 125%; opacity: 0; }
}

/* effet 6 — monte doucement en se redressant */
.fx-rise-tilt img { transform: translateY(48px) rotate(-2.4deg); filter: blur(6px); }
.fx-rise-tilt.is-in img { transform: none; filter: blur(0); transition: transform 2.2s var(--ease), filter 1.8s var(--ease); }

/* effet 7 — plus doux, plus émotionnel : flou → net, halo rosé qui respire */
.fx-glow-soft { transition-duration: 3.4s; }
.fx-glow-soft img { transform: scale(1.05); filter: blur(9px); }
.fx-glow-soft.is-in img {
  transform: none;
  filter: blur(0);
  transition: transform 3.4s var(--ease), filter 3s var(--ease);
  animation: glow-breathe 4.5s ease-in-out 3s infinite alternate;
}
@keyframes glow-breathe {
  from { box-shadow: 0 0 46px 4px rgba(231, 200, 196, 0.18); }
  to   { box-shadow: 0 0 78px 14px rgba(231, 200, 196, 0.34); }
}

/* ---------- vidéo ---------- */
.film__video {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.film.has-video .film__video { display: block; }
.film__video.is-in { opacity: 1; }
.film__video.is-out { opacity: 0; transition: opacity 1.1s ease; }

.film__vwrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.film__vwrap video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 0 46px 4px rgba(0, 0, 0, 0.5);
}

/* « un petit fragment de ton quotidien » — jamais présenté comme un souvenir partagé */
.film__badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(11, 10, 13, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold);
  white-space: nowrap;
  max-width: 96%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.film__unmute {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-gold-dim);
  background: rgba(11, 10, 13, 0.7);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--color-cream);
  white-space: nowrap;
}

/* ---------- texte : les mots apparaissent un à un ---------- */
.film__text {
  position: relative;
  z-index: 3;
  flex: none;
  width: 100%;
  max-width: 520px;
  margin: auto 0;
  padding: 10px 6px;
  text-align: center;
  opacity: 1;
  transition: opacity var(--film-fade, 1.5s) ease, filter var(--film-fade, 1.5s) ease;
}

/* sous une photo / une vidéo : zone de texte réservée en bas */
.film.has-photo .film__text,
.film.has-video .film__text {
  margin: 0 0 34px;
  min-height: 8.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.film.is-bigvideo .film__text { min-height: 4.6rem; margin-bottom: 30px; }

.film__text.is-out { opacity: 0; filter: blur(4px); }

.film__text::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 280px;
  height: 220px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--halo-color, rgba(201, 168, 118, 0.25)), transparent 68%);
  filter: blur(6px);
  z-index: -1;
  pointer-events: none;
}

.film__line {
  margin: 0 0 0.55em;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.22rem, 5.5vw, 1.62rem);
  line-height: 1.5;
  color: var(--color-cream);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.film__line:last-child { margin-bottom: 0; }

.film__text--big .film__line { font-size: clamp(1.5rem, 7vw, 2.1rem); line-height: 1.4; }
.film__text--caption .film__line { font-size: clamp(1.05rem, 4.6vw, 1.3rem); color: var(--color-cream-dim); }

.film__word {
  display: inline-block;
  opacity: 0;
  filter: blur(6px);
  transform: translateY(7px);
}
.film__text.is-in .film__word,
.film__block.is-in .film__word {
  animation: film-word-in 1.3s var(--ease) both;
  animation-delay: calc(var(--i) * var(--stagger, 170ms));
}
@keyframes film-word-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(7px); }
  to   { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* séquence finale : les phrases s'empilent */
.film__text--stack { display: flex; flex-direction: column; gap: 1.7rem; }
.film__block { }

/* ---------- bouton final et « Suivant › » ---------- */
.film__actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(34px + var(--safe-bottom));
  z-index: 4;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.film__continue {
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.6s ease, transform 1.6s var(--ease), border-color var(--dur-s) var(--ease), background var(--dur-s) var(--ease), letter-spacing var(--dur-s) var(--ease);
}
.film__continue.is-in { opacity: 1; transform: none; }

.film__skip {
  position: absolute;
  right: calc(14px + var(--safe-right));
  bottom: calc(88px + var(--safe-bottom));
  z-index: 5;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-cream-faint);
  padding: 8px 12px;
  opacity: 0.5;
  transition: opacity var(--dur-s) var(--ease);
}
.film__skip:hover,
.film__skip:focus-visible { opacity: 1; }

.film__continue:focus-visible,
.film__skip:focus-visible,
.film__unmute:focus-visible {
  outline: 1px solid var(--color-gold);
  outline-offset: 3px;
}

.experience-controls {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid rgba(201, 168, 118, 0.3);
  border-radius: 999px;
  background: rgba(11, 10, 13, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.experience-controls[hidden] { display: none; }

.experience-controls__button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--color-cream);
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.experience-controls__button:hover,
.experience-controls__button:focus-visible {
  color: var(--color-gold);
  outline: 1px solid var(--color-gold-dim);
  outline-offset: 1px;
}

.experience-paused *,
.experience-paused *::before,
.experience-paused *::after {
  animation-play-state: paused !important;
}

.experience-controls__button:disabled { opacity: 0.4; }

@media (max-height: 560px) {
  .film { padding-top: calc(48px + var(--safe-top)); }
  .film.has-photo .film__text, .film.has-video .film__text { min-height: 6rem; margin-bottom: 26px; }
}

/* prefers-reduced-motion : particules figées, effets très courts */
@media (prefers-reduced-motion: reduce) {
  .particle { animation: none; opacity: 0.5; }
  .film__photo img, .film__word { animation-duration: 0.25s !important; transition-duration: 0.25s !important; }
  .fx-light-sweep::after, .fx-warm-light::before { animation: none; opacity: 0; }
  .smoke-canvas { display: none; }
  .flower-rain { display: none; }
  /* séquence finale : mêmes pauses, mais sans mouvement ni flou */
  .proposal__line, .proposal__word { filter: none; transform: none; transition-duration: 0.8s; }
  .proposal__halo, .proposal__ask.is-open .proposal__halo { animation: none; transform: translate(-50%, -50%); transition-duration: 0.8s; }
  .proposal__rule { transform: none; transition-duration: 0.8s; }
  .proposal__heart.is-in { animation: none; opacity: 1; transform: none; filter: none; }
}

