/* Page Secret4 « Le film » (DESIGN.md). Une scène épinglée, autant d'étapes que de chapitres : js/film.js choisit l'étape
   d'après le défilement et pose les classes is-debut, is-dimanche, is-partage, is-essai sur la scène. La chemise, les
   boutons et le titre viennent de chemise.css ; le téléphone, le ruban, le post-it et la bulle de secret4.css. */

.film { position: relative; }

.f-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; isolation: isolate;
  /* Le cuir du bureau de l'app (assets/textures/bureau.jpg), sa lampe comprise. */
  background: #0A0C14 url("../assets/textures/bureau.jpg") center top / cover no-repeat;
}
/* La lampe passe au rouge : un calque qui s'allume par-dessus le bureau, le dimanche. */
.f-stage::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity .8s ease; pointer-events: none;
  background: radial-gradient(90% 56% at 50% -6%, rgba(224, 65, 47, .62), transparent 72%), rgba(42, 13, 18, .72);
}
.f-stage.is-dimanche::before { opacity: 1; }

/* ---------- Le fil rouge : la progression, une punaise par étape ---------- */
.f-fil {
  position: absolute; z-index: 6; left: 50%; top: 62px; transform: translateX(-50%); width: min(calc(100% - 44px), 520px);
  display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 0; list-style: none;
}
.f-fil::before, .f-fil::after { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 2.5px; margin-top: -1.25px; border-radius: 2px; }
.f-fil::before { background: rgba(255, 255, 255, .14); }
.f-fil::after { background: var(--rouge-fil); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .7s var(--expo); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.f-fil li { position: relative; z-index: 1; line-height: 0; }
.f-fil button {
  width: 26px; height: 26px; margin: -6px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; position: relative;
}
.f-fil button::before {
  content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #3A3C49; transition: transform .4s var(--expo), background-color .3s ease, box-shadow .3s ease;
}
.f-fil .is-fait button::before { background: radial-gradient(circle at 35% 30%, #FF8A7A, var(--rouge) 45%, #8E1E12 100%); box-shadow: 0 3px 5px rgba(0, 0, 0, .45); }
.f-fil .is-ici button::before { transform: scale(1.5); }

/* ---------- Le ruban du dimanche ---------- */
.f-tape { position: absolute; z-index: 5; left: -10px; right: -10px; top: 92px; margin: 0; opacity: 0; transform: rotate(-1.2deg) translateX(-104%); transition: transform .9s var(--expo), opacity .3s ease; }
.is-dimanche .f-tape { opacity: 1; transform: rotate(-1.2deg); }

/* ---------- Le téléphone ---------- */
.f-tel {
  position: absolute; z-index: 2; left: 0; right: 0; top: 104px; display: flex; justify-content: center;
  transition: transform .9s var(--expo);
}
.is-debut .f-tel { transform: translateY(var(--y0, 420px)); }
.p-film .demo-phone { margin: 0; flex: none; }
.p-film .demo-phone .screen { position: relative; }
.p-film .demo-phone .screen img { object-position: top; z-index: 2; }
/* La grille d'essai n'apparaît qu'à la dernière étape. */
.p-film #demo { visibility: hidden; }
.is-essai #demo { visibility: visible; }
.p-film .p-try { left: calc(50% - 160px); top: -30px; font-size: 20px; opacity: 0; transition: opacity .3s ease; z-index: 4; }
.is-essai .p-try { opacity: 1; }
.f-bulle { position: absolute; z-index: 3; left: 50%; top: 34%; opacity: 0; transform: translate(-50%, 16px) scale(.9); transition: opacity .4s ease, transform .6s var(--expo); pointer-events: none; }
.f-bulle .p-share { width: min(280px, 72vw); }
.is-partage .f-bulle { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Les textes : le haut de page, puis une chemise kraft par chapitre ---------- */
.f-txt { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.f-txt > * { pointer-events: auto; }
.f-hero {
  position: absolute; left: 22px; right: 22px; top: 104px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  transition: opacity .4s ease, transform .7s var(--expo);
}
.f-hero:not(.is-on) { opacity: 0; transform: translateY(-30px); pointer-events: none; }
.f-leg {
  position: absolute; left: 16px; right: 16px; bottom: 20px; opacity: 0; transform: translateY(34px);
  transition: opacity .35s ease, transform .7s var(--expo); pointer-events: none;
}
.f-leg.is-on { opacity: 1; transform: none; pointer-events: auto; }
.f-leg .chemise { max-width: 460px; margin-inline: auto; }
.s4 .p-text::before { content: attr(data-onglet) !important; text-transform: uppercase; white-space: nowrap; }
/* Le tampon s'abat quand la légende arrive. */
.f-leg.is-on .stamp { animation: tampon .5s cubic-bezier(.3, 1.4, .5, 1) .3s both; }
@keyframes tampon { from { opacity: 0; transform: rotate(-9deg) scale(2); } to { opacity: 1; transform: rotate(-9deg) translateY(-.12em) scale(1); } }

.f-essai { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.f-essai h2 { display: none; margin: 0; font: 900 clamp(30px, 4vw, 48px)/1.05 "Fraunces", Georgia, serif; color: var(--texte); }
.f-essai .s4-actions { justify-content: center; flex-wrap: nowrap; }
.f-essai .btn-desk { display: none; }

@media (min-width: 900px) {
  /* Écran large : le cuir est une image en hauteur ; la lampe reste en haut au centre, la nuit reprend autour. */
  .f-stage { background: radial-gradient(95% 105% at 50% -8%, transparent 26%, rgba(9, 11, 19, .9) 74%), #0A0C14 url("../assets/textures/bureau.jpg") center 8% / cover no-repeat; }
  .f-fil { top: 30px; }
  .f-tape { top: 62px; }
  .f-tel { left: 6vw; right: 50%; top: 96px; }
  .is-debut .f-tel { transform: none; }
  .p-film .p-try { left: calc(50% - 250px); font-size: 24px; }
  .f-txt { left: 50%; right: 6vw; top: 96px; bottom: 40px; inset-block: 96px 40px; inset-inline: 50% 6vw; }
  .f-hero { left: 0; right: 0; top: 50%; transform: translateY(-50%); gap: 20px; }
  .f-hero:not(.is-on) { transform: translateY(calc(-50% - 30px)); }
  .f-leg { left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(calc(-50% + 34px)); }
  .f-leg.is-on { transform: translateY(-50%); }
  .f-leg .chemise { margin-inline: 0; }
  .f-leg .ch-couv { padding: 32px 32px 32px 38px; }
  .f-essai { align-items: flex-start; text-align: left; gap: 20px; }
  .f-essai h2 { display: block; }
  .f-essai .s4-actions { justify-content: flex-start; flex-wrap: wrap; }
  .f-essai .btn-desk { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  .f-stage::before, .f-fil::after, .f-fil button::before, .f-tape, .f-tel, .f-bulle, .f-hero, .f-leg { transition: none; }
  .f-leg.is-on .stamp { animation: none; }
}

/* ---------- Sous le film : la FAQ, l'inscription et le pied de page de l'ancienne page, sur le bureau ---------- */
.p-film .p-faq { padding-top: 72px; }
.p-film footer { border-top: 1px solid rgba(255, 255, 255, .07); }

/* ---------- Sans JavaScript : les étapes se lisent l'une sous l'autre, le téléphone montre l'accueil du jeu ---------- */
html:not(.film-on) .f-stage { position: static; height: auto; overflow: visible; display: flex; flex-direction: column; padding: 96px 22px 56px; }
html:not(.film-on) .f-fil, html:not(.film-on) .f-tape, html:not(.film-on) .p-try, html:not(.film-on) .f-bulle, html:not(.film-on) #demo, html:not(.film-on) .f-essai h2 { display: none; }
html:not(.film-on) .f-txt { position: static; order: 1; }
html:not(.film-on) .f-tel { position: static; order: 2; transform: none; margin-top: 8px; }
html:not(.film-on) .p-film .demo-phone { width: min(100%, 300px); aspect-ratio: 390 / 844; }
html:not(.film-on) .f-hero, html:not(.film-on) .f-leg { position: static; opacity: 1; transform: none; pointer-events: auto; max-width: 520px; margin: 0 auto 56px; }
