/* Le décor du clap : un fond différent pour chaque métier (choix d'Issa du 15/11/2026).
   Tournage : le viseur d'une caméra. Montage : une table de montage. Motion design : un éditeur de courbes. Publicité 3D : un studio virtuel (éclairages, caméra, plateau tournant).
   Le moteur (assets-3d/scene3d.js) écrit sur la scène data-cran="0…4" (étape affichée).
   Les calques sont créés par decor-clap.js. Règle de fluidité : seules l'opacité et la position (transform) bougent. */

.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ================================================================= Les quatre décors
   Quatre calques de traits fins. Un seul est visible à la fois ; ses petites animations ne tournent que lorsqu'il est affiché. */
.fond-3 .d3-fond::before { opacity: 0; }                    /* la grille carrée d'origine laisse la place aux décors */
.fx3 { --sens: 1; --trait: rgba(244, 242, 238, 0.34); --fin: rgba(244, 242, 238, 0.12); --rouge: #f03a2e;
  font: 500 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.08em; color: rgba(244, 242, 238, 0.6); }

/* Le passage d'un décor à l'autre (refait le 15/11/2026 : l'ancien fondu donnait un à-coup sur iPhone).
   Comme une caméra qui avance : le décor qu'on quitte grossit et s'efface (on le traverse), puis le suivant arrive de plus loin et se pose.
   En revenant en arrière, c'est l'inverse. decor-clap.js pose les classes : .actif (décor affiché), .entre (il arrive), .sort (il part),
   et --sens (1 = on avance, -1 = on recule).
   Fluidité : les quatre calques restent toujours prêts dans la carte graphique (will-change, opacité presque nulle mais pas nulle) ;
   au changement, le téléphone n'a rien à redessiner, il ne fait que déplacer et fondre des images déjà faites. */
.fx3-c { position: absolute; inset: 0; opacity: 0.002; transform-origin: 50% 54%; will-change: opacity, transform; }
.fx3-c.actif { opacity: 1; }
.fx3-c.entre { animation: fx-entre 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both; }
.fx3-c.sort { animation: fx-sort 0.32s cubic-bezier(0.55, 0, 0.85, 0.35) both; }
@keyframes fx-entre { from { opacity: 0; transform: scale(calc(1 - 0.06 * var(--sens))); } to { opacity: 1; transform: scale(1); } }
@keyframes fx-sort { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(calc(1 + 0.09 * var(--sens))); } }
/* les petites animations d'un décor ne tournent que lorsqu'il est affiché (ou en train de partir, pour ne pas se figer pendant le fondu) */
.fx3-c *, .fx3-c *::before, .fx3-c *::after { animation-play-state: paused !important; }
.fx3-c.actif *, .fx3-c.actif *::before, .fx3-c.actif *::after,
.fx3-c.sort *, .fx3-c.sort *::before, .fx3-c.sort *::after { animation-play-state: running !important; }

/* ---------- 1. Tournage : le viseur de la caméra ---------- */
.fx3 .cadre { position: absolute; inset: 13% 7% 7% 4%; }
.fx3 .cadre > b { position: absolute; width: 44px; height: 44px; border: 0 solid var(--trait); }
.fx3 .cadre > .hg { left: 0; top: 0; border-width: 2px 0 0 2px; }
.fx3 .cadre > .hd { right: 0; top: 0; border-width: 2px 2px 0 0; }
.fx3 .cadre > .bg { left: 0; bottom: 0; border-width: 0 0 2px 2px; }
.fx3 .cadre > .bd { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.fx3 .tiers { position: absolute; background: var(--fin); }
.fx3 .tiers.v1, .fx3 .tiers.v2 { top: 0; bottom: 0; width: 1px; }
.fx3 .tiers.v1 { left: 33.33%; } .fx3 .tiers.v2 { left: 66.66%; }
.fx3 .tiers.h1, .fx3 .tiers.h2 { left: 0; right: 0; height: 1px; }
.fx3 .tiers.h1 { top: 33.33%; } .fx3 .tiers.h2 { top: 66.66%; }
.fx3 .hud { position: absolute; display: flex; align-items: center; gap: 0.7em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx3 .hud.rec { left: 22px; top: 20px; color: #fff; }
.fx3 .hud.rec em { width: 10px; height: 10px; border-radius: 50%; background: var(--rouge); animation: fx-clignote 1.2s steps(1) infinite; }
.fx3 .hud.rec tt { font: inherit; color: rgba(244, 242, 238, 0.6); }
.fx3 .hud.fmt { right: 22px; top: 20px; }
.fx3 .hud.fmt i { position: relative; width: 22px; height: 11px; border: 1px solid currentColor; border-radius: 2px; }
.fx3 .hud.fmt i::before { content: ""; position: absolute; inset: 2px 6px 2px 2px; background: currentColor; }
.fx3 .hud.fmt i::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 3px; background: currentColor; }
.fx3 .hud.expo { left: 22px; bottom: 20px; }
.fx3 .hud.son { right: 22px; bottom: 20px; flex-direction: column; align-items: flex-end; gap: 4px; }
.fx3 .hud.son u { display: block; width: 110px; height: 4px; background: var(--fin); overflow: hidden; }
.fx3 .hud.son u::before { content: ""; display: block; height: 100%; background: rgba(244, 242, 238, 0.6); transform-origin: left; animation: fx-niveau 1.6s ease-in-out infinite alternate; }
.fx3 .hud.son u + u::before { animation-duration: 1.1s; animation-delay: -0.4s; }
@keyframes fx-clignote { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
@keyframes fx-niveau { 0% { transform: scaleX(0.25); } 40% { transform: scaleX(0.7); } 70% { transform: scaleX(0.45); } 100% { transform: scaleX(0.9); } }

/* ---------- 2. Montage : la table de montage ---------- */
.fx3 .bande { position: absolute; left: 0; right: 0; top: 43%; height: 168px; --masque: linear-gradient(90deg, transparent, #000 9%, #000 27%, transparent 31.5%, transparent 68.5%, #000 73%, #000 91%, transparent);
  -webkit-mask-image: var(--masque); mask-image: var(--masque); }
.fx3 .defile { display: flex; width: max-content; height: 100%; animation: fx-defile 46s linear infinite; }
.fx3 .moitie { width: 1800px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.fx3 .regle { height: 16px; flex: none; background:
    repeating-linear-gradient(90deg, var(--trait) 0 1px, transparent 1px 150px) left bottom / 100% 100% no-repeat,
    repeating-linear-gradient(90deg, var(--fin) 0 1px, transparent 1px 15px) left bottom / 100% 7px no-repeat;
  border-bottom: 1px solid var(--fin); }
.fx3 .piste { display: flex; gap: 4px; height: 38px; flex: none; }
.fx3 .piste span { flex: none; height: 100%; border: 1px solid var(--trait); border-radius: 5px; background: rgba(244, 242, 238, 0.04); box-sizing: border-box; }
.fx3 .piste span.vide { border-color: transparent; background: none; }
.fx3 .piste span.fort { border-color: rgba(240, 58, 46, 0.6); background: rgba(240, 58, 46, 0.13); }
.fx3 .piste.son span:not(.vide) { background-repeat: repeat-x; background-position: left center; background-size: auto 78%; }
.fx3 .tete { position: absolute; left: 17%; top: calc(43% - 14px); width: 2px; height: 196px; background: var(--rouge); }
.fx3 .tete::before { content: ""; position: absolute; left: -6px; top: -2px; border: 7px solid transparent; border-top: 10px solid var(--rouge); }
.fx3 .compteur { position: absolute; left: calc(17% + 14px); top: calc(43% - 34px); font-variant-numeric: tabular-nums; }
@keyframes fx-defile { to { transform: translateX(-1800px); } }

/* ---------- 3. Motion design : l'éditeur de courbes ---------- */
.fx3 .graphe { position: absolute; inset: 17.5% 7% 15% 4%; border-left: 1px solid var(--trait); border-bottom: 1px solid var(--trait); }
.fx3 .courbes { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fx3 .courbes path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.fx3 .courbes .g { stroke: rgba(244, 242, 238, 0.07); stroke-width: 1; }
.fx3 .courbes .aire { fill: url(#fx-aire); stroke: none; }
.fx3 .courbes .c1 { stroke: rgba(244, 242, 238, 0.66); stroke-width: 2; }
.fx3 .courbes .c2 { stroke: rgba(244, 242, 238, 0.34); stroke-width: 1.5; }
.fx3 .courbes .c3 { stroke: rgba(244, 242, 238, 0.28); stroke-width: 1.5; stroke-dasharray: 5 7; }
.fx3 .cle { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; transform: rotate(45deg); border: 1px solid rgba(244, 242, 238, 0.7); background: #14171c; box-sizing: border-box; }
.fx3 .cle.c2, .fx3 .cle.c3 { border-color: rgba(244, 242, 238, 0.45); }
.fx3 .cle::before { content: ""; position: absolute; inset: -4px; background: var(--rouge); opacity: 0; animation: fx-cle 9s linear infinite; animation-delay: var(--d, 0s); }
.fx3 .poignee { position: absolute; height: 1px; background: rgba(244, 242, 238, 0.3); }
.fx3 .poignee::before, .fx3 .poignee::after { content: ""; position: absolute; top: -2.5px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid rgba(244, 242, 238, 0.55); background: #14171c; box-sizing: border-box; }
.fx3 .poignee::before { left: -3px; } .fx3 .poignee::after { right: -3px; }
.fx3 .curseur { position: absolute; left: 0; top: -12px; bottom: 0; width: 100%; animation: fx-curseur 9s linear infinite; }
.fx3 .curseur::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--rouge); }
.fx3 .curseur::after { content: ""; position: absolute; left: -6px; top: -2px; border: 6px solid transparent; border-top: 9px solid var(--rouge); }
.fx3 .temps { position: absolute; left: 0; right: 0; bottom: -24px; display: flex; justify-content: space-between; }
.fx3 .temps span:not(:first-child):not(:last-child) { visibility: hidden; }
.fx3 .props { position: absolute; left: 18px; top: 14px; display: flex; flex-direction: column; gap: 10px; }
.fx3 .props span { display: flex; align-items: center; gap: 0.8em; }
.fx3 .props span::before { content: ""; width: 20px; border-top: 2px solid rgba(244, 242, 238, 0.66); }
.fx3 .props .p2::before { border-top-color: rgba(244, 242, 238, 0.34); }
.fx3 .props .p3::before { border-top: 2px dashed rgba(244, 242, 238, 0.34); }
@keyframes fx-curseur { to { transform: translateX(100%); } }
@keyframes fx-cle { 0% { opacity: 1; transform: scale(1.45); } 7% { opacity: 0; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* ---------- 4. Publicité 3D : le studio virtuel ---------- */
.fx3 .sol-vue { position: absolute; inset: 0; perspective: 640px; perspective-origin: 50% 46%; }
.fx3 .sol { position: absolute; left: -40%; right: -40%; bottom: -4%; height: 52%; transform: rotateX(66deg); transform-origin: 50% 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(to top, #000 8%, transparent 86%); mask-image: linear-gradient(to top, #000 8%, transparent 86%); }
.fx3 .sol i { position: absolute; left: 0; right: 0; top: -72px; bottom: 0; animation: fx-avance 3.4s linear infinite;
  background-image: linear-gradient(rgba(244, 242, 238, 0.26) 1px, transparent 1px), linear-gradient(90deg, rgba(244, 242, 238, 0.26) 1px, transparent 1px);
  background-size: 72px 72px; background-position: center bottom; }
.fx3 .horizon { position: absolute; left: 0; right: 0; top: 49%; height: 1px; background: linear-gradient(90deg, transparent, rgba(244, 242, 238, 0.22) 30%, rgba(244, 242, 238, 0.22) 70%, transparent); }
/* le plateau tournant et la caméra en orbite : un plan couché sous le clap (sa place vient de decor-clap.js).
   Les deux cercles gradués tournent ; la caméra va et vient sur le côté gauche, comme sur un rail. */
.fx3 .studio { position: absolute; left: var(--clap-x, 50%); top: var(--clap-sol, 76%); width: 0; height: 0; perspective: 1100px; }
.fx3 .plan { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; transform: rotateX(70deg); }
.fx3 .orbite, .fx3 .tournette { position: absolute; width: calc(var(--r) * 2); height: calc(var(--r) * 2); left: calc(var(--r) * -1); top: calc(var(--r) * -1); }
.fx3 .orbite { --r: calc(var(--clap-l, 36vw) * 0.94); animation: fx-tour 60s linear infinite; }
.fx3 .tournette { --r: calc(var(--clap-l, 36vw) * 0.64); animation: fx-tour 44s linear infinite reverse; }
.fx3 .orbite svg, .fx3 .tournette svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fx3 .bras { --r: calc(var(--clap-l, 36vw) * 0.94); position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; transform: rotateZ(262deg); animation: fx-rail 11s ease-in-out infinite alternate; }
.fx3 .visee { position: absolute; left: 0; top: calc(var(--r) * -1); width: 1px; height: var(--r); opacity: 0.7; background: repeating-linear-gradient(to bottom, var(--trait) 0 4px, transparent 4px 13px); }
.fx3 .cam { position: absolute; left: -24px; top: calc(var(--r) * -1 - 19px); width: 48px; height: 38px; transform: rotateZ(-262deg) rotateX(-70deg); animation: fx-rail-cam 11s ease-in-out infinite alternate; }
.fx3 .cam svg { display: block; width: 100%; height: 100%; }
/* un voile sombre derrière le texte du bas, pour qu'il reste lisible par-dessus les cercles */
.fx3 .voile { position: absolute; left: 22%; right: 22%; bottom: 0; height: 21%; background: radial-gradient(50% 62% at 50% 56%, rgba(13, 15, 19, 0.9) 40%, transparent 100%); }
.fx3 .lampe { position: absolute; top: 26%; width: 150px; height: 205px; }
.fx3 .lampe.g { left: 6%; } .fx3 .lampe.d { right: 8%; }
.fx3 .lampe svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.fx3 .lampe.d svg { transform: scaleX(-1); }
.fx3 .lampe::before { content: ""; position: absolute; left: 30%; top: -24%; width: 360px; height: 320px; background: radial-gradient(closest-side, rgba(255, 240, 215, 0.11), transparent); }
.fx3 .lampe.d::before { left: auto; right: 30%; }
.fx3 .lampe span { position: absolute; left: 0; bottom: -26px; white-space: nowrap; }
.fx3 .lampe.d span { left: auto; right: 0; }
.fx3 .hud.vue3d { left: 4%; top: 14.5%; }
.fx3 .hud.rendu { right: 7%; bottom: 8.5%; font-variant-numeric: tabular-nums; }
.fx3 .hud.rendu tt { font: inherit; color: #fff; }
.fx3 .hud.rendu u { display: block; width: 120px; height: 3px; margin-left: 0.5em; background: var(--fin); }
.fx3 .hud.rendu u b { display: block; height: 100%; background: rgba(244, 242, 238, 0.66); transform-origin: left; transform: scaleX(0); transition: transform 0.12s linear; }
@keyframes fx-avance { to { transform: translateY(72px); } }
@keyframes fx-avance-tel { to { transform: translateY(48px); } }
@keyframes fx-tour { to { transform: rotateZ(360deg); } }
@keyframes fx-rail { from { transform: rotateZ(236deg); } to { transform: rotateZ(300deg); } }
@keyframes fx-rail-cam { from { transform: rotateZ(-236deg) rotateX(-70deg); } to { transform: rotateZ(-300deg) rotateX(-70deg); } }

/* ---------- Écran étroit : le clap prend toute la largeur, les décors passent au-dessus et autour ---------- */
@media (max-width: 899px) {
  .fx3 { font-size: 10px; }
  .fx3 .cadre { inset: 18% 4% 26.5% 4%; }
  .fx3 .cadre > b { width: 26px; height: 26px; }
  .fx3 .hud.rec { left: 12px; top: 12px; } .fx3 .hud.fmt { right: 12px; top: 12px; }
  .fx3 .hud.expo, .fx3 .hud.son { display: none; }
  .fx3 .bande { top: 17.5%; height: 106px; --masque: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
  .fx3 .moitie { gap: 5px; } .fx3 .regle { height: 11px; } .fx3 .piste { height: 24px; }
  .fx3 .tete { left: 22%; top: calc(17.5% - 8px); height: 120px; }
  .fx3 .compteur { display: none; }
  .fx3 .graphe { inset: 16.5% 0 27% 0; border-left: 0; }
  .fx3 .props, .fx3 .temps { display: none; }
  .fx3 .lampe { top: 16.5%; width: 80px; height: 110px; } .fx3 .lampe.g { left: 2%; } .fx3 .lampe.d { right: 2%; }
  .fx3 .lampe::before { width: 190px; height: 180px; } .fx3 .lampe span { display: none; }
  .fx3 .hud.vue3d { left: 50%; top: 18.5%; transform: translateX(-50%); }
  .fx3 .hud.rendu { right: auto; left: 50%; bottom: auto; top: 22.5%; transform: translateX(-50%); } .fx3 .hud.rendu u { width: 56px; }
  .fx3 .voile { left: 0; right: 0; height: 27%; background: radial-gradient(62% 60% at 50% 56%, rgba(13, 15, 19, 0.9) 45%, transparent 100%); }
  .fx3 .bras { display: none; }   /* sur écran étroit le rail de la caméra sort de l'écran : on ne l'anime pas */
  .fx3 .sol { height: 60%; transform: rotateX(57deg); -webkit-mask-image: linear-gradient(to top, #000 30%, transparent 96%); mask-image: linear-gradient(to top, #000 30%, transparent 96%); }
  .fx3 .sol i { top: -48px; background-size: 48px 48px; animation-name: fx-avance-tel; }
  .fx3 .horizon { top: 70.5%; }
}
@media (prefers-reduced-motion: reduce) {
  .fx3-c *, .fx3-c *::before, .fx3-c *::after { animation: none !important; }
  .fx3-c.entre, .fx3-c.sort { animation: none; }
}
