/* =====================================================================
   Scène « Animation 3D » (18 octobre 2026) : une cabane tchanquée qui se
   construit dans Blender, du fil de fer au rendu. Le récit est dans
   partials/fonctionnalites-demos/sc-animation-3d.php.

   LE MOTEUR. Cinq propriétés enregistrées, animées sur la vue et héritées
   par chaque face : combien de pièces sont posées (--a3d-p, de 0 à 5) et le
   poids de chaque mode d'affichage. Leur valeur de départ est l'état final
   (le rendu) : c'est ce que voit un visiteur qui demande moins de mouvement,
   et ce que montre un navigateur sans @property.
   ===================================================================== */

@property --a3d-p { syntax: '<number>'; inherits: true; initial-value: 5; }
@property --a3d-w { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --a3d-s { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --a3d-m { syntax: '<number>'; inherits: true; initial-value: 1; }
@property --a3d-r { syntax: '<number>'; inherits: true; initial-value: 1; }

/* ---- La place de la scène dans le haut de page (18 octobre, Théo :
   « centre bien la vidéo par rapport au hero ») : la fenêtre se centre en
   hauteur face au texte, et dans la largeur de sa colonne. Ce fichier n'est
   chargé que sur cette page : les autres pages gardent leur calage. La boîte
   laisse déborder l'ombre de la fenêtre, que son overflow coupait. ---- */
.fn-hero-grille:has(.fn-scene--animation-3d) { align-items: center; }
.fn-scene-boite:has(.fn-scene--animation-3d) {
  width: calc(520px * var(--sc-echelle, 1)); max-width: 100%;
  margin-inline: auto; overflow: visible;
}

/* ---- La fenêtre de Blender ---- */
.fn-scene--animation-3d .a3d-fen {
  position: absolute; top: 0; left: 0; width: 520px; height: 346px;
  overflow: hidden; border: 1px solid #161616; border-radius: 10px;
  background: #282828; color: #cfcfcf;
  font-size: 9.5px; line-height: 1.2; letter-spacing: 0;
  box-shadow: 0 14px 34px rgba(31, 36, 46, .14);
}
.fn-scene--animation-3d svg { display: block; }

.fn-scene--animation-3d .a3d-barre {
  display: flex; align-items: center; gap: 10px; height: 24px; padding: 0 8px;
  background: #232323; border-bottom: 1px solid #161616;
}
.fn-scene--animation-3d .a3d-logo svg { width: 14px; height: 14px; }
.fn-scene--animation-3d .a3d-menus,
.fn-scene--animation-3d .a3d-onglets,
.fn-scene--animation-3d .a3d-vmenus { display: flex; align-items: center; }
.fn-scene--animation-3d .a3d-menus { gap: 9px; color: #d6d6d6; }
.fn-scene--animation-3d .a3d-onglets { gap: 2px; margin-left: 4px; color: #a5a5a5; }
.fn-scene--animation-3d .a3d-onglets > * { padding: 3px 6px; border-radius: 4px; }
.fn-scene--animation-3d .a3d-onglets b { background: #3e3e3e; color: #fff; font-weight: 500; }

/* Les deux colonnes sont séparées par un trait d'un pixel : le fond de la
   zone, visible dans l'écart. */
.fn-scene--animation-3d .a3d-zone { display: flex; gap: 1px; height: 254px; background: #161616; }

/* ---- La vue 3D ---- */
.fn-scene--animation-3d .a3d-gauche { display: flex; flex-direction: column; width: 392px; }
.fn-scene--animation-3d .a3d-vtete {
  display: flex; align-items: center; gap: 9px; height: 22px; padding: 0 6px;
  background: #2f2f2f; border-bottom: 1px solid #1d1d1d;
}
.fn-scene--animation-3d .a3d-mode { padding: 2px 6px; border-radius: 4px; background: #474747; color: #ececec; }
.fn-scene--animation-3d .a3d-mode i { font-style: normal; font-size: 8px; color: #b5b5b5; }
.fn-scene--animation-3d .a3d-vmenus { gap: 9px; color: #d0d0d0; }
.fn-scene--animation-3d .a3d-modes { display: flex; gap: 2px; margin-left: auto; }
.fn-scene--animation-3d .a3d-modes > span {
  display: grid; place-items: center; width: 20px; height: 16px; border-radius: 3px;
  background: #4a4a4a; color: #dcdcdc;
}
.fn-scene--animation-3d .a3d-modes svg { width: 11px; height: 11px; }
/* Hors animation (moins de mouvement), le mode Rendu reste allumé. */
.fn-scene--animation-3d .a3d-modes > .sc-a3d-b4 { background: #4772b3; color: #fff; }

.fn-scene--animation-3d .sc-a3d-vue {
  --a3d-p: 5; --a3d-w: 0; --a3d-s: 0; --a3d-m: 1; --a3d-r: 1;
  position: relative; flex: 1 1 auto; overflow: hidden;
  background: linear-gradient(180deg, #414141 0%, #2c2c2c 100%);
  animation-name: sc-a3d-etapes; animation-timing-function: linear;
}
/* Le ciel du rendu, à la place du gris de travail. */
.fn-scene--animation-3d .a3d-ciel {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #a9c6dc 0%, #d6e4ec 56%, #edf1f3 100%);
  opacity: var(--a3d-r);
}
.fn-scene--animation-3d .a3d-perspective {
  position: absolute; inset: 0; perspective: 720px; perspective-origin: 50% 36%;
}
.fn-scene--animation-3d .sc-a3d-monde {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-35deg) scale(.92);
  animation-name: sc-a3d-tour; animation-timing-function: linear;
}
/* Le modèle est décalé pour tourner autour de son milieu, escalier compris. */
.fn-scene--animation-3d .a3d-modele {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  transform-style: preserve-3d; transform: translate3d(-35px, 8px, 0);
}
.fn-scene--animation-3d .a3d-piece,
.fn-scene--animation-3d .a3d-sol,
.fn-scene--animation-3d .a3d-ombre,
.fn-scene--animation-3d .a3d-face { position: absolute; left: 0; top: 0; }
/* Une pièce apparaît quand le compteur la dépasse, en tombant de 46 px. */
.fn-scene--animation-3d .a3d-piece {
  --a3d-v: clamp(0, calc(var(--a3d-p) - var(--i)), 1);
  width: 0; height: 0; transform-style: preserve-3d;
  transform: translate3d(0, calc((1 - var(--a3d-v)) * -46px), 0);
}
.fn-scene--animation-3d .a3d-face svg { overflow: visible; }
.fn-scene--animation-3d .a3d-l-w { opacity: calc(var(--a3d-v) * var(--a3d-w)); }
.fn-scene--animation-3d .a3d-l-s { opacity: calc(var(--a3d-v) * var(--a3d-s)); }
.fn-scene--animation-3d .a3d-l-m { opacity: calc(var(--a3d-v) * var(--a3d-m)); }
.fn-scene--animation-3d .a3d-l-r { opacity: calc(var(--a3d-v) * var(--a3d-r)); }

/* La grille du sol, avec l'axe X en rouge et l'axe Y en vert, comme dans
   Blender. Elle s'efface au rendu. */
.fn-scene--animation-3d .a3d-sol {
  width: 560px; height: 560px; margin: -280px 0 0 -280px;
  transform: translate3d(35px, 61px, 0) rotateX(90deg);
  background-image:
    linear-gradient(180deg, transparent calc(50% - .8px), rgba(196, 72, 62, .95) calc(50% - .8px), rgba(196, 72, 62, .95) calc(50% + .8px), transparent calc(50% + .8px)),
    linear-gradient(90deg, transparent calc(50% - .8px), rgba(112, 160, 62, .95) calc(50% - .8px), rgba(112, 160, 62, .95) calc(50% + .8px), transparent calc(50% + .8px)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .075) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .075) 0 1px, transparent 1px 28px);
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 68%);
  mask-image: radial-gradient(circle, #000 30%, transparent 68%);
  opacity: calc(1 - var(--a3d-r));
}
/* L'ombre de la cabane sur l'eau, au rendu seulement. Neutre. */
.fn-scene--animation-3d .a3d-ombre {
  width: 250px; height: 170px; margin: -85px 0 0 -125px;
  transform: translate3d(8px, 59.4px, -4px) rotateX(90deg);
  background: radial-gradient(closest-side, rgba(12, 22, 32, .42), rgba(12, 22, 32, 0));
  opacity: calc(var(--a3d-r) * .9);
}

/* Les textes de la vue : clairs sur le gris, sombres sur le ciel du rendu. */
.fn-scene--animation-3d .a3d-info {
  position: absolute; top: 6px; left: 8px; font-size: 9px; line-height: 1.4;
  color: rgb(calc(228 - 180 * var(--a3d-r)) calc(228 - 172 * var(--a3d-r)) calc(228 - 160 * var(--a3d-r)));
}
.fn-scene--animation-3d .a3d-ech { opacity: var(--a3d-r); }
.fn-scene--animation-3d .a3d-gizmo { position: absolute; top: 6px; right: 8px; width: 44px; height: 44px; }
.fn-scene--animation-3d .a3d-gizmo svg { width: 44px; height: 44px; stroke: #8d8d8d; }
.fn-scene--animation-3d .a3d-gz {
  position: absolute; z-index: 1; display: grid; place-items: center;
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  font-style: normal; font-size: 7.5px; font-weight: 700; color: #1c1c1c;
}
.fn-scene--animation-3d .a3d-gz-z { left: 22px; top: 6px; background: #3f7fd8; }
.fn-scene--animation-3d .a3d-gz-x { left: 35px; top: 30px; background: #df4f45; }
.fn-scene--animation-3d .a3d-gz-y { left: 9px; top: 30px; background: #73ab42; }

/* ---- L'outliner et les matériaux ---- */
.fn-scene--animation-3d .a3d-droite {
  width: 127px; background: #282828; font-size: 9px;
}
.fn-scene--animation-3d .a3d-ptete {
  height: 20px; padding: 0 7px; line-height: 20px;
  background: #303030; color: #dadada; font-weight: 600;
}
.fn-scene--animation-3d .a3d-ptete--mat { margin-top: 6px; border-top: 1px solid #1b1b1b; }
.fn-scene--animation-3d .a3d-arbre,
.fn-scene--animation-3d .a3d-mats { margin: 0; padding: 3px 0; list-style: none; }
.fn-scene--animation-3d .a3d-arbre li,
.fn-scene--animation-3d .a3d-mats li {
  display: flex; align-items: center; gap: 5px; height: 17px; padding: 0 7px; color: #cfcfcf;
}
.fn-scene--animation-3d .a3d-arbre svg { width: 11px; height: 11px; flex: 0 0 auto; }
.fn-scene--animation-3d .a3d-arbre .a3d-sous { padding-left: 17px; }
.fn-scene--animation-3d .a3d-arbre .a3d-choisi { background: #334d80; color: #fff; }
.fn-scene--animation-3d .a3d-mats i { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }

/* ---- La timeline et la barre d'état ---- */
.fn-scene--animation-3d .a3d-temps { height: 48px; background: #282828; border-top: 1px solid #161616; }
.fn-scene--animation-3d .a3d-ttete {
  display: flex; align-items: center; gap: 9px; height: 18px; padding: 0 8px;
  background: #2f2f2f; color: #cfcfcf;
}
.fn-scene--animation-3d .a3d-tdroite { margin-left: auto; color: #969696; }
.fn-scene--animation-3d .a3d-regle {
  position: relative; display: flex; justify-content: space-between;
  height: 29px; padding: 5px 14px 0; color: #8a8a8a; font-size: 8.5px;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 49.2px);
  background-position: 14px 0;
}
.fn-scene--animation-3d .sc-a3d-tete {
  position: absolute; top: 0; bottom: 0; left: 14px; width: 2px; background: #4772b3;
  transform: translateX(160px);
  animation-name: sc-a3d-lecture; animation-timing-function: linear;
}
.fn-scene--animation-3d .sc-a3d-tete::before {
  content: ""; position: absolute; top: 0; left: -6px; width: 14px; height: 9px;
  border-radius: 3px; background: #4772b3;
}
.fn-scene--animation-3d .a3d-statut {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 18px; padding: 0 8px; background: #232323; border-top: 1px solid #161616;
  color: #9a9a9a; font-size: 8.5px; white-space: nowrap;
}
.fn-scene--animation-3d .a3d-raccourcis { display: flex; align-items: center; gap: 3px; }
.fn-scene--animation-3d .a3d-raccourcis svg { width: 10px; height: 10px; margin-left: 4px; }

/* ---- Le curseur : il clique les trois derniers modes d'affichage ---- */
.fn-scene--animation-3d .sc-cur { animation-name: sc-cur-a3d; transform: translate(250px, 220px); }
.fn-scene--animation-3d .sc-cur-onde { top: -4px; left: -3px; animation-name: sc-a3d-onde; }

/* ---- Les animations ---- */
.fn-scene--animation-3d .sc-a3d-b1 { animation-name: sc-a3d-b1; }
.fn-scene--animation-3d .sc-a3d-b2 { animation-name: sc-a3d-b2; }
.fn-scene--animation-3d .sc-a3d-b3 { animation-name: sc-a3d-b3; }
.fn-scene--animation-3d .sc-a3d-b4 { animation-name: sc-a3d-b4; }

/* Pièces posées de 4 % à 26 % ; volumes à 31 % ; matières à 52 % ;
   rendu à 71 %. Chaque propriété ne s'interpole qu'entre ses propres pas. */
@keyframes sc-a3d-etapes {
  0%, 4%  { --a3d-p: 0; --a3d-w: 1; --a3d-s: 0; --a3d-m: 0; --a3d-r: 0; }
  26%     { --a3d-p: 5; }
  31.5%   { --a3d-w: 1; --a3d-s: 0; }
  34%     { --a3d-w: 0; --a3d-s: 1; }
  53%     { --a3d-s: 1; --a3d-m: 0; }
  55.5%   { --a3d-s: 0; --a3d-m: 1; }
  71%     { --a3d-r: 0; }
  75%     { --a3d-r: 1; }
  100%    { --a3d-p: 5; --a3d-w: 0; --a3d-s: 0; --a3d-m: 1; --a3d-r: 1; }
}
/* Un demi-tour en douze secondes : assez lent pour regarder les matières.
   Il finit de trois quarts face, côté escalier : le rendu final montre la
   façade et l'escalier qui descend dans l'eau, ce qui fait reconnaître une
   cabane tchanquée au premier coup d'œil. */
@keyframes sc-a3d-tour {
  0%   { transform: rotateX(-22deg) rotateY(-190deg) scale(.92); }
  100% { transform: rotateX(-22deg) rotateY(-10deg) scale(.92); }
}
@keyframes sc-a3d-lecture {
  0%   { transform: translateX(0); }
  100% { transform: translateX(492px); }
}
@keyframes sc-a3d-b1 {
  0%, 31.5%    { background: #4772b3; color: #fff; }
  32%, 100%    { background: #4a4a4a; color: #dcdcdc; }
}
@keyframes sc-a3d-b2 {
  0%, 31.5%    { background: #4a4a4a; color: #dcdcdc; }
  32%, 52.5%   { background: #4772b3; color: #fff; }
  53%, 100%    { background: #4a4a4a; color: #dcdcdc; }
}
@keyframes sc-a3d-b3 {
  0%, 52.5%    { background: #4a4a4a; color: #dcdcdc; }
  53%, 70.5%   { background: #4772b3; color: #fff; }
  71%, 100%    { background: #4a4a4a; color: #dcdcdc; }
}
@keyframes sc-a3d-b4 {
  0%, 70.5%    { background: #4a4a4a; color: #dcdcdc; }
  71%, 100%    { background: #4772b3; color: #fff; }
}
/* Le curseur va cliquer chaque mode, puis revient au milieu de la vue. */
@keyframes sc-cur-a3d {
  0%, 24%      { transform: translate(250px, 220px); }
  29.5%, 32%   { transform: translate(328px, 33px); }
  39%, 47%     { transform: translate(236px, 196px); }
  51%, 53.5%   { transform: translate(350px, 33px); }
  61%, 67%     { transform: translate(270px, 210px); }
  70%, 72.5%   { transform: translate(372px, 33px); }
  82%, 100%    { transform: translate(250px, 220px); }
}
@keyframes sc-a3d-onde {
  0%, 30.5%    { transform: scale(.4); opacity: 0; }
  31%          { transform: scale(.4); opacity: .9; }
  35%          { transform: scale(2.2); opacity: 0; }
  51.5%        { transform: scale(.4); opacity: 0; }
  52%          { transform: scale(.4); opacity: .9; }
  56%          { transform: scale(2.2); opacity: 0; }
  70%          { transform: scale(.4); opacity: 0; }
  70.5%        { transform: scale(.4); opacity: .9; }
  74.5%, 100%  { transform: scale(2.2); opacity: 0; }
}
