/* =====================================================================
   Bloc « choisissez, ça se montre » (partials/fx-explorateur.php),
   18 octobre 2026, sur Site web, Application, Motion design et Animation 3D.
   La version retenue par Théo : la main (« on garde la main, j'adore »).
   Charte du thème : bleu --blue, Inter, rayon de carte 18 px, bouton 10 px,
   ombres neutres, aucun halo, cibles de 44 px.
   Paliers : téléphone sous 720 px, tablette jusqu'à 1024 px, ordinateur au-delà.
   ===================================================================== */

/* ── La base commune ───────────────────────────────────────────────── */
/* Le thème saute le calcul des sections hors écran (content-visibility:auto
   sur .section) : ça enferme les éléments positionnés et rogne ce qui
   dépasse. Ce bloc reste calculé. */
.section.fx { content-visibility: visible; contain-intrinsic-size: none; }
.fx-cadre { position: relative; display: flex; flex-direction: column; gap: var(--s-5); margin-top: var(--s-6); }

.fx-stage {
  position: relative;
  display: grid; gap: var(--s-4); align-items: center; align-content: start;
  padding: var(--s-4);
  border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--paper-3);
  scroll-margin-top: 96px;
}
.fx-ecran {
  container-type: inline-size;
  position: relative; overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
}
/* Les scènes s'empilent au même endroit, sur une cale de la hauteur de la
   plus haute toile : changer de scène ne change jamais la hauteur. */
.fx-scenes { display: grid; width: 100%; }
.fx-scenes > * { grid-area: 1 / 1; align-self: center; }
.fx-cale { visibility: hidden; }
.fx-ecran .fn-scene-boite { width: calc(520px * var(--sc-echelle, 1)); max-width: 100%; margin: 0 auto; }
@supports (container-type: inline-size) {
  @container (min-width: 521px) { .fx-ecran .fn-scene-boite { --sc-echelle: 1; } }
}
.fx-charge {
  position: absolute; inset: 0; margin: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 0.8125rem; color: var(--ink-faint);
}
.fx-ecran.is-charge .fx-charge { display: flex; }

.fx-fiche { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
/* Toutes les fiches empilées, une seule visible : la plus longue donne la hauteur. */
.fx-fiches { display: grid; width: 100%; }
.fx-fi { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; visibility: hidden; }
.fx-fi.is-on { visibility: visible; }
.fx-fiche-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; }
.fx-fiche-fam { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
.fx-fiche-num { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-fiche-nom { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); text-wrap: balance; }
.fx-fiche-dit { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--ink-mute); }
.fx-fiche-texte { margin: 2px 0 0; font-size: 0.9375rem; line-height: 1.6; color: var(--ink-mute); text-align: left; }
.fx-fiche-cta {
  padding: 12px 20px; border-radius: 10px;
  background: var(--blue); color: #fff;
  transition: background .2s var(--ease);
}
.fx-fiche-cta:hover { background: var(--blue-deep); color: #fff; }
.fx-fiche-cta:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 2px; }

/* Un élément : un bouton. */
.fx-roster { position: relative; min-width: 0; }
.fx-grille { list-style: none; margin: 0; padding: 0; }
.fx-item { position: relative; margin: 0; }
.fx-t {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.fx-t:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 2px; }
.fx-ico { flex: none; display: grid; place-items: center; width: 24px; height: 24px; }
.fx-ico svg { width: 22px; height: 22px; display: block; }
.fx-t-nom { font-size: 0.875rem; font-weight: 700; line-height: 1.25; color: inherit; }
.fx-t-dit { font-size: 0.75rem; line-height: 1.35; color: var(--ink-faint); }
.fx-fam-nom { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

/* Les pièces propres à une version, cachées ailleurs. */
.fx-vig, .fx-t-num, .fx-t-fam { display: none; }

/* La scène et sa fiche côte à côte dès la tablette ; empilées sur téléphone. */
@media (min-width: 720px) {
  .fx-stage { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

/* Une animation 2D (moteur des réels, lottie_light) : la même cale que les
   scènes, 520 x 400 à l'échelle de l'écran ; son affiche dessous tant que le
   lecteur n'a pas dessiné. */
.fx-lot { position: relative; width: 100%; height: 100%; }
.fx-lot > svg, .fx-lot > .fx-lot-affiche { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.fx-lot-affiche { object-fit: contain; }
.fx-vig > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }

/* Les vues arrêtées des animations (cartes de la main) : réduites, figées à
   45 % de leur boucle, sans curseur ni fondu. */
.fx-vig .fx-sc { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.fx-vig [class*="sc-"] { animation-play-state: paused !important; animation-delay: -5.4s !important; }
.fx-vig .sc-cur, .fx-vig .sc-fin { display: none !important; }

/* =====================================================================
   1. LA MAIN
   Une carte à jouer par fonction, tenues en éventail sous la table. Sur la
   tranche gauche de chaque carte, ce qui dépasse quand elle est couverte :
   le pictogramme, le nom en long et le numéro, comme le coin d'une carte.
   Sur la face, la vue arrêtée de son animation, son accroche, sa famille.
   La carte survolée se lève et passe devant ; la carte choisie reste levée,
   sa tranche en bleu.
   ===================================================================== */
.fx--v1 .fx-stage { background: #fff; border-color: var(--line-2); box-shadow: 0 14px 34px rgba(31,36,46,.08); }
.fx--v1 .fx-fam, .fx--v1 .fx-grille { display: contents; }
.fx--v1 .fx-fam-nom { display: none; }
.fx--v1 .fx-t {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 30px 116px minmax(0, 1fr) auto;
  grid-template-areas: "ico vig" "nom vig" "nom dit" "num fam";
  gap: 0 9px; align-items: start;
  width: 100%; height: 100%; padding: 9px;
  border: 1px solid #D4DAE4; border-radius: 14px; background: #fff;
  box-shadow: -5px 6px 16px rgba(31,36,46,.10);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
/* La tranche : un bandeau teinté derrière le pictogramme, le nom, le numéro. */
.fx--v1 .fx-t::before {
  content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 42px;
  border-radius: 10px; background: #EDF1FB;
  transition: background-color .16s var(--ease);
}
.fx--v1 .fx-ico { grid-area: ico; position: relative; width: 34px; height: 28px; color: var(--blue); }
.fx--v1 .fx-ico svg { width: 20px; height: 20px; }
.fx--v1 .fx-t-nom {
  grid-area: nom; position: relative; justify-self: center; align-self: start;
  writing-mode: vertical-rl; transform: rotate(180deg);
  max-height: 100%; padding: 6px 0 2px;
  font-size: 0.75rem; font-weight: 750; line-height: 1.15; letter-spacing: 0.01em;
}
.fx--v1 .fx-t-num { display: block; grid-area: num; position: relative; justify-self: center; padding-bottom: 2px; font-size: 0.75rem; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.fx--v1 .fx-vig {
  display: block; grid-area: vig; position: relative; overflow: hidden; height: 146px;
  border: 1px solid #E2E7F0; border-radius: 9px;
  background: linear-gradient(160deg, #F6F8FD, #E8EEFA);
}
.fx--v1 .fx-vig .fn-scene-boite { --sc-echelle: .2; width: 104px; }
.fx--v1 .fx-t-dit { display: block; grid-area: dit; position: relative; margin-top: 9px; font-size: 0.75rem; line-height: 1.35; color: var(--ink-mute); }
.fx--v1 .fx-t-fam { display: block; grid-area: fam; position: relative; align-self: end; font-size: 0.6875rem; font-weight: 700; line-height: 1.2; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.fx--v1 .fx-t[aria-pressed="true"] { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: -1px; }
.fx--v1 .fx-t[aria-pressed="true"]::before { background: var(--blue); }
.fx--v1 .fx-t[aria-pressed="true"] .fx-ico,
.fx--v1 .fx-t[aria-pressed="true"] .fx-t-nom,
.fx--v1 .fx-t[aria-pressed="true"] .fx-t-num { color: #fff; }

@media (min-width: 1025px) {
  .fx--v1 .fx-roster {
    container-type: inline-size;
    height: 392px; margin-top: -6px;
    --carte-l: 174px; --carte-h: 252px;
    --pas: min(158px, calc((100cqw - var(--carte-l) - 120px) / max(var(--fx-n) - 1, 1)));
    --angle: min(3deg, calc(30deg / var(--fx-n)));
    --courbe: calc(250px / (var(--fx-n) * var(--fx-n)));
  }
  .fx--v1 .fx-item {
    --d: calc(var(--i) - (var(--fx-n) - 1) / 2);
    position: absolute; top: 74px; width: var(--carte-l); height: var(--carte-h);
    left: calc(50% - var(--carte-l) / 2 + var(--d) * var(--pas));
    transform: translateY(calc(var(--d) * var(--d) * var(--courbe))) rotate(calc(var(--d) * var(--angle)));
    transform-origin: 50% 150%;
    pointer-events: none;
  }
  /* La souris ne voit que la bande visible de chaque carte (la suivante
     couvre le reste) : la carte levée passe devant sans voler la souris à
     ses voisines, on balaie la main de gauche à droite. */
  .fx--v1 .fx-t { pointer-events: none; }
  .fx--v1 .fx-t::after { content: ""; position: absolute; left: -1px; top: -2px; bottom: -48px; width: calc(var(--pas) + 1px); pointer-events: auto; }
  .fx--v1 .fx-fam:last-of-type .fx-item:last-child .fx-t::after { width: calc(100% + 2px); }
  .fx--v1 .fx-item:has(> .fx-t[aria-pressed="true"]) { z-index: 50; }
  .fx--v1 .fx-item:hover, .fx--v1 .fx-item:has(> .fx-t:focus-visible) { z-index: 60; }
  .fx--v1 .fx-t[aria-pressed="true"] { transform: translateY(-30px); }
  .fx--v1 .fx-item:hover > .fx-t, .fx--v1 .fx-t:focus-visible {
    transform: translateY(-48px); border-color: var(--blue);
    box-shadow: -8px 16px 30px rgba(31,36,46,.18);
  }
}
/* Tablette et téléphone : la main se tient à plat et défile sous le doigt,
   d'un bord de l'écran à l'autre (elle sort de la marge du conteneur, et
   s'efface sur les bords pour dire qu'il y a d'autres cartes). La carte
   touchée vient au centre (fx-explorateur.js). */
.fx--v1 { --fx-goutte: var(--s-6); }
@media (max-width: 719px) { .fx--v1 { --fx-goutte: var(--s-5); } }
@media (max-width: 480px) { .fx--v1 { --fx-goutte: var(--s-4); } }
@media (max-width: 1024px) {
  .fx--v1 .fx-roster {
    display: flex; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scrollbar-width: none;
    margin: 0 calc(-1 * var(--fx-goutte));
    padding: 28px var(--fx-goutte) 16px;
    scroll-padding-inline: var(--fx-goutte);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fx-goutte), #000 calc(100% - var(--fx-goutte)), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 var(--fx-goutte), #000 calc(100% - var(--fx-goutte)), transparent);
  }
  /* Une page tout en animations 2D : elles prennent toute la largeur du cadre
     au lieu des paliers des scènes HTML. La cale suit la même règle, la
     hauteur reste la même d'une carte à l'autre. */
  .fx--lots .fx-ecran .fn-scene-boite { width: 100%; max-width: none; height: auto; aspect-ratio: 1040 / 800; }
  .fx--v1 .fx-ecran { touch-action: pan-y; }
  .fx--v1 .fx-roster::-webkit-scrollbar { display: none; }
  .fx--v1 .fx-item {
    flex: none; width: 152px; height: 226px; scroll-snap-align: center;
    transform: rotate(calc((mod(var(--i), 2) - .5) * 3deg));
  }
  .fx--v1 .fx-item + .fx-item { margin-left: -30px; }
  .fx--v1 .fx-item:has(> .fx-t[aria-pressed="true"]) { z-index: 50; }
  .fx--v1 .fx-t { grid-template-rows: 28px 100px minmax(0, 1fr) auto; }
  .fx--v1 .fx-vig { height: 128px; }
  /* Carte étroite : la famille passait sur l'accroche quand elle tient sur
     deux lignes (« Ce que vous recevez ») ; la fiche la donne déjà. */
  .fx--v1 .fx-t-fam { display: none; }
  .fx--v1 .fx-t-dit { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
  .fx--v1 .fx-vig .fn-scene-boite { --sc-echelle: .17; width: 88px; }
  .fx--v1 .fx-t[aria-pressed="true"] { transform: translateY(-16px); }
}

/* Téléphone (Théo, 18 octobre 2026 : « en responsive, le bloc plus UX ») :
   l'animation en grand, la main juste dessous, la fiche en dernier. Toucher
   une carte change l'animation juste au-dessus, sans faire défiler la page ;
   glisser sur l'animation passe à la carte suivante ou précédente. Le cadre
   blanc de l'ordinateur s'efface (display: contents) : il doublait le bord
   de l'animation et lui volait 60 px de large. */
@media (max-width: 719px) {
  .fx--v1 .fx-cadre { gap: 0; }
  .fx--v1 .fx-stage { display: contents; }
  .fx--v1 .fx-ecran {
    /* Une marge intérieure, comme sur ordinateur (Théo, 20 octobre 2026 :
       « sur les petits écrans on voit pas toute la vidéo ») : plusieurs
       animations vont jusqu'au bord de leur toile (le téléphone qui sort par
       le bas, une étiquette contre le bord droit) ; sans marge, elles
       touchaient le bord arrondi du cadre et semblaient coupées. */
    order: 1; margin: 0 calc(8px - var(--fx-goutte)); padding: 10px;
    border-color: var(--line-2); border-radius: 16px;
    box-shadow: 0 12px 28px rgba(31,36,46,.08);
    scroll-margin-top: 72px;
  }
  .fx--v1 .fx-roster { order: 2; }
  .fx--v1 .fx-fiche { order: 3; align-items: center; gap: 16px; padding-top: 4px; }
  .fx--v1 .fx-fi { align-items: center; }
  .fx--v1 .fx-fiche-tete { justify-content: center; }
  .fx--v1 .fx-fiche-nom, .fx--v1 .fx-fiche-dit { text-align: center; }
  .fx--v1 .fx-fiche-texte { align-self: stretch; }
}

/* Défilement fluide (20 octobre 2026) : les scènes en CSS (3D, scènes HTML
   du bloc, scène du haut de page) recalculent leur caméra à chaque image sur
   le fil principal. Elles se figent pendant le défilement (« bwf-defile »
   sur <html>, posé par fx-explorateur.js) et hors de l'écran ; elles
   reprennent là où elles étaient. */
.bwf-defile .fn-scene [class*="sc-"],
.fx--hors .fx-ecran [class*="sc-"],
.fn-scene.sc-hors [class*="sc-"] { animation-play-state: paused !important; }

/* « Une à la fois », sur téléphone (Théo, 20 octobre 2026, piste D) : la main
   défilante cède la place à une barre de navigation sous l'animation. Le
   centre a une hauteur fixe (deux lignes de nom et le rang) : passer d'un nom
   court à un nom long ne fait rien bouger dessous. Le rang de la fiche est
   masqué, la barre le donne déjà. */
.fx-pas { display: none; }
@media (max-width: 719px) {
  .fx--v1 .fx-roster { display: none; }
  .fx--v1 .fx-fiche-num { display: none; }
  .fx--v1 .fx-pas { display: block; order: 2; padding: 12px 0 0; }
  .fx-pas-nav { display: flex; align-items: center; gap: 10px; }
  .fx-pas-btn {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
  }
  .fx-pas-btn svg { width: 20px; height: 20px; display: block; }
  .fx-pas-btn--suiv { background: var(--blue); border-color: var(--blue); color: #fff; }
  .fx-pas-btn--suiv:active { background: var(--blue-deep); }
  .fx-pas-btn:focus-visible, .fx-pas-trait:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 2px; }
  .fx-pas-centre {
    flex: 1; min-width: 0; height: 56px; margin: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  }
  .fx-pas-nom { font-size: 0.9375rem; font-weight: 700; line-height: 1.25; color: var(--ink); text-wrap: balance; }
  .fx-pas-compte { font-size: 0.75rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
  .fx-pas-traits { display: flex; gap: 4px; margin-top: 2px; }
  .fx-pas-trait { position: relative; flex: 1; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
  .fx-pas-trait::before {
    content: ""; position: absolute; left: 0; right: 0; top: 18px; height: 4px; border-radius: 2px;
    background: var(--line); transition: background-color .2s var(--ease);
  }
  .fx-pas-trait.est-passe::before { background: #B9CEFF; }
  .fx-pas-trait[aria-current="true"]::before { background: var(--blue); }
  .fx-pas-aide { margin: -4px 0 6px; font-size: 0.75rem; color: var(--ink-faint); text-align: center; }
}
@media (max-width: 719px) and (prefers-reduced-motion: reduce) {
  .fx-pas-btn, .fx-pas-trait::before { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx--v1 .fx-t { transition: none; }
}
/* =====================================================================
   La dernière carte, « Et bien d'autres » (Théo, 18 octobre 2026), sur
   chaque page. Plus de liste depuis le même soir (« je m'adapte au client,
   il va penser que je sais faire que ce qu'il y a marqué sinon ») : la
   carte est blanche, bord en pointillés, un « + » pour image ; le grand
   cadre montre la même carte blanche, penchée comme dans la main, et une
   phrase : « la carte qui manque, c'est la vôtre ». Ce panneau n'est pas
   une toile réduite comme les scènes : son texte garde sa taille.
   ===================================================================== */
.fx--v1 .fx-t--autres { border-style: dashed; border-color: #AFC0E6; }
.fx--v1 .fx-vig--autres {
  display: grid; place-items: center;
  border: 1.5px dashed #C3D0EC; background: #F7F9FE; color: var(--blue);
}
.fx--v1 .fx-vig--autres svg { width: 30px; height: 30px; }

/* Le panneau prend toute la place du cadre (la cale), sans jamais la changer :
   il est posé par-dessus, hors du calcul de la hauteur. */
.fx-scenes { position: relative; }
.fx-sc--autres { position: absolute; inset: 0; }
.fx-sc--autres .fn-scene-boite { width: 100%; height: 100%; }
.fx-autres {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 34px;
  width: 100%; height: 100%; padding: 24px 34px;
  overflow: hidden;
}
.fx-autres-carte {
  position: relative; display: grid; place-items: center;
  width: 138px; height: 196px;
  border: 1.5px dashed #AFC0E6; border-radius: 14px; background: #F7F9FE;
  transform: rotate(-5deg);
  animation: fx-autre-carte .32s var(--ease) both;
}
/* La tranche de la carte, comme celles de la main, vide elle aussi. */
.fx-autres-carte::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 34px;
  border-radius: 9px; background: #EDF1FB;
}
.fx-autres-plus {
  position: relative; display: grid; place-items: center;
  width: 48px; height: 48px; margin-left: 30px;
  border: 1px solid #D3DCF0; border-radius: 12px; background: #fff; color: var(--blue);
}
.fx-autres-plus svg { width: 24px; height: 24px; display: block; }
.fx-autres-mots { display: flex; flex-direction: column; gap: 10px; min-width: 0; animation: fx-autre-mots .32s var(--ease) both; }
.fx-autres-tete { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
.fx-autres-titre { margin: 0; font-size: 1.625rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; color: var(--ink); text-wrap: balance; }
.fx-autres-pied { margin: 0; font-size: 0.9375rem; line-height: 1.5; color: var(--ink-mute); }
@keyframes fx-autre-carte { from { opacity: .4; transform: translateY(10px) rotate(-11deg); } }
@keyframes fx-autre-mots { from { opacity: .3; transform: translateY(6px); } }
@supports (container-type: inline-size) {
  /* Écran étroit : la carte au-dessus, la phrase dessous, centrées. */
  @container (max-width: 440px) {
    .fx-autres { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: 14px; padding: 14px 18px; text-align: center; }
    .fx-autres-carte { width: 82px; height: 114px; border-radius: 11px; }
    .fx-autres-carte::before { left: 4px; top: 4px; bottom: 4px; width: 20px; border-radius: 7px; }
    .fx-autres-plus { width: 34px; height: 34px; margin-left: 18px; border-radius: 9px; }
    .fx-autres-plus svg { width: 18px; height: 18px; }
    .fx-autres-mots { align-items: center; gap: 6px; }
    .fx-autres-titre { font-size: 1.25rem; }
    .fx-autres-pied { font-size: 0.875rem; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .fx-autres-carte, .fx-autres-mots { animation: none; }
}
