/* ------------------------------------------------------------------------------------------------------------------
 * Passe 32 (16/11/2026) : motion design, les 14 propositions de docs/propositions/motion-design.md
 * (demande du client du 15/11/2026 : « je voudrais que tu les appliques toutes »). Script : assets/js/motion.js.
 *
 * Une seule grammaire pour tout le site :
 * - une courbe, --legato-mvt-courbe : départ franc, arrivée très douce ; rien ne rebondit, rien ne clignote ;
 * - quatre durées : 350 ms (gestes : menu, coche, changement de page), 450 ms (tiroir, cartes, fonctions,
 *   arrivée d'une photo), 700 ms (surtitre, compteur du panier), 900 ms (titres, photos, anneau, chiffres) ;
 * - deux décalages : 120 ms entre deux éléments voisins (celui des apparitions de interactions.js), 40 ms dans une
 *   liste ; une montée de 0,875 rem pour les textes ;
 * - opacité, transformations et découpage seulement : aucune mise en page ne bouge (CLS nul) ;
 * - ce qui est visible au chargement ne bouge pas ; une apparition se joue une fois ;
 * - mouvement réduit demandé, ou animations en pause (classe animations-en-pause, bouton du pied de page) : rien ne
 *   bouge, l'état final s'affiche. Les décors en boucle des bandeaux gardent leurs courbes lentes, symétriques, faites
 *   pour une boucle (passe 28) ; tout ce qui entre, sort ou répond à un geste suit la courbe commune.
 * Périmètres des autres passes (cartes de la passe 29, accueil de la passe 30) : seulement des sélecteurs précis, sur
 * des propriétés de mouvement, jamais la mise en page.
 * ------------------------------------------------------------------------------------------------------------------ */

:root {
	--legato-mvt-courbe: cubic-bezier(0.22, 1, 0.36, 1);
	--legato-mvt-court: 350ms;
	--legato-mvt-moyen: 450ms;
	--legato-mvt-long: 700ms;
	--legato-mvt-ample: 900ms;
	--legato-mvt-decalage: 120ms;
	--legato-mvt-cascade: 40ms;
	--legato-mvt-montee: 0.875rem;
}

/* Annonce aux lecteurs d'écran (ajout au panier) : hors de l'écran, toujours lue. */
.mvt-annonce {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---- Harmonisation des apparitions existantes (interactions.js, classes a-reveler puis est-revele) ----
 * Leurs durées validées ne changent pas ; leur courbe devient la courbe commune. */
@media (prefers-reduced-motion: no-preference) {
	.a-reveler.est-revele {
		transition-timing-function: var(--legato-mvt-courbe) !important;
	}
}

/* En pause, les apparitions au défilement ne jouent pas : tout est affiché. */
:root.animations-en-pause .a-reveler {
	opacity: 1 !important;
	transform: none !important;
	transition: none !important;
}

/* ==================================================================================================================
 * 1. Titres et filet à losange : le surtitre puis le titre montent en fondu (décalage de 120 ms) ; le losange or
 *    paraît, puis les deux traits du filet se tracent depuis lui. Titres de section centrés, titres des collections
 *    de produits, titres des chapitres des pages éditoriales ; seulement ceux qui arrivent du bas de l'écran.
 * ================================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
	.a-reveler:is(h2, h3, h4, .surtitre) {
		transform: translateY(var(--legato-mvt-montee));
	}

	.a-reveler.est-revele:is(h2, h3, h4, .surtitre) {
		transition:
			opacity var(--legato-mvt-ample) var(--legato-mvt-courbe),
			transform var(--legato-mvt-ample) var(--legato-mvt-courbe);
		transition-delay: var(--delai, 0s);
	}

	.a-reveler.est-revele.surtitre {
		transition-duration: var(--legato-mvt-long);
	}

	.a-reveler:not(.est-revele):is(h2.wp-block-heading.has-text-align-center, .wp-block-woocommerce-product-collection > h2.wp-block-heading, .section-alternee > h2.wp-block-heading:first-child)::after {
		opacity: 0;
		transform: none;
		clip-path: inset(0 50%);
	}

	.a-reveler.est-revele:is(h2.wp-block-heading.has-text-align-center, .wp-block-woocommerce-product-collection > h2.wp-block-heading, .section-alternee > h2.wp-block-heading:first-child)::after {
		transform: none;
		transition: none;
		animation: legato-mvt-filet 1.25s var(--legato-mvt-courbe) calc(var(--delai, 0s) + 520ms) backwards;
	}
}

:root.animations-en-pause .a-reveler:is(h2.wp-block-heading.has-text-align-center, .wp-block-woocommerce-product-collection > h2.wp-block-heading, .section-alternee > h2.wp-block-heading:first-child)::after {
	opacity: 1 !important;
	transform: none !important;
	clip-path: none !important;
	animation: none !important;
}

/* Losange : 350 ms (28 %), puis les traits : 900 ms. */
@keyframes legato-mvt-filet {
	0% {
		opacity: 0;
		clip-path: inset(0 50%);
	}

	28% {
		opacity: 1;
		clip-path: inset(0 calc(50% - 0.5rem));
	}

	100% {
		opacity: 1;
		clip-path: inset(0 0);
	}
}

/* ==================================================================================================================
 * 4. Photos du contenu au rideau : la photo se découvre de bas en haut et passe de 104 % à 100 % (900 ms), au lieu
 *    du fondu montant. L'Entreprise, Notre technologie, systèmes, articles ; ni logos, ni portrait de l'accueil.
 * ================================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
	:is(.wp-block-post-content > .wp-block-image, .wp-block-post-content > .section-alternee > .wp-block-image):not(.logo-recompense, .logo-revendeur, .portrait-fondateurs).a-reveler {
		opacity: 1;
		transform: none;
	}

	:is(.wp-block-post-content > .wp-block-image, .wp-block-post-content > .section-alternee > .wp-block-image):not(.logo-recompense, .logo-revendeur, .portrait-fondateurs).a-reveler:not(.est-revele) img {
		clip-path: inset(100% 0 0 0);
		transform: scale(1.04);
	}

	:is(.wp-block-post-content > .wp-block-image, .wp-block-post-content > .section-alternee > .wp-block-image):not(.logo-recompense, .logo-revendeur, .portrait-fondateurs).a-reveler.est-revele img {
		animation: legato-mvt-rideau var(--legato-mvt-ample) var(--legato-mvt-courbe) var(--delai, 0s) backwards;
	}
}

:root.animations-en-pause .a-reveler img {
	clip-path: none !important;
	transform: none !important;
	animation: none !important;
}

@keyframes legato-mvt-rideau {
	from {
		clip-path: inset(100% 0 0 0);
		transform: scale(1.04);
	}

	to {
		clip-path: inset(0 0 0 0);
		transform: none;
	}
}

/* ==================================================================================================================
 * 2. Ajout au panier : pendant l'envoi, le libellé s'efface et un anneau se ferme comme un bouton de volume (900 ms,
 *    encre du bouton : noir sur l'or, or sur le contour) ; sur le panier, la coche du message se trace (350 ms), le
 *    compteur respire une fois (700 ms) ; le message rappelle l'essai de 10 jours (inc/motion.php).
 *    Sans mouvement : l'anneau est fermé d'emblée, la coche et le compteur sont posés.
 * ================================================================================================================== */
.mvt-ajout {
	position: relative;
	color: transparent !important;
}

.mvt-ajout::after {
	opacity: 0 !important;
}

.mvt-anneau {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 1.75em;
	height: 1.75em;
	margin: -0.875em 0 0 -0.875em;
	overflow: visible;
	opacity: 0;
	pointer-events: none;
}

.mvt-anneau circle {
	fill: none;
	stroke: var(--mvt-encre, currentColor);
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-dasharray: 100;
	stroke-dashoffset: 0;
	transform: rotate(-90deg);
	transform-origin: 50% 50%;
}

.mvt-ajout .mvt-anneau {
	opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
	:root:not(.animations-en-pause) .mvt-ajout {
		transition: color var(--legato-mvt-court) var(--legato-mvt-courbe) !important;
	}

	:root:not(.animations-en-pause) .mvt-ajout .mvt-anneau circle {
		animation: legato-mvt-anneau var(--legato-mvt-ample) var(--legato-mvt-courbe) both;
	}

	:root:not(.animations-en-pause) .mvt-ajoute > svg {
		animation: legato-mvt-coche var(--legato-mvt-court) var(--legato-mvt-courbe) 150ms backwards;
	}

	:root:not(.animations-en-pause) .mvt-respire {
		animation: legato-mvt-respire var(--legato-mvt-long) var(--legato-mvt-courbe) 550ms;
	}
}

@keyframes legato-mvt-anneau {
	from {
		stroke-dashoffset: 100;
	}

	to {
		stroke-dashoffset: 0;
	}
}

@keyframes legato-mvt-coche {
	from {
		clip-path: inset(0 100% 0 0);
	}

	to {
		clip-path: inset(0 0 0 0);
	}
}

@keyframes legato-mvt-respire {
	40% {
		scale: 1.35;
		box-shadow: 0 0 0 6px rgb(230 177 12 / 0.18);
	}

	100% {
		scale: 1;
		box-shadow: 0 0 0 0 rgb(230 177 12 / 0);
	}
}

/* Rappel de l'essai sous le message d'ajout (texte et lien des engagements de la fiche). */
.wc-block-components-notice-banner .rappel-essai,
.woocommerce-message .rappel-essai {
	display: block;
	margin-top: 0.35em;
	font-size: 0.9375em;
}

/* ==================================================================================================================
 * 3. et 14. Grande photo des fiches : aucune loupe ni aucun zoom au survol (décision du client du 16/11/2026 : « on
 *    clique sur la photo et toutes les photos apparaissent ») ; la loupe de la proposition 3 est retirée et le zoom
 *    de WooCommerce coupé (hoverZoom à false dans les deux gabarits de fiche). Restent le curseur loupe du navigateur,
 *    la pastille « agrandir » et la fenêtre plein écran au clic (passe 26). Aucun curseur personnalisé ailleurs.
 *    Garde-fou si un gabarit enregistré dans l'éditeur gardait le zoom : la photo ne grossit pas.
 * ================================================================================================================== */
.fiche__galerie .wc-block-woocommerce-product-gallery-large-image__image--hoverZoom {
	transform: none !important;
}

/* Pastille « agrandir » de la passe 26 (loupe or sur fond sombre), rétablie : la lumière adoucie de la passe 28 vise
   le même pseudo-élément et lui retirait son pictogramme et son fond. */
.fiche__galerie .wc-block-product-gallery-large-image::after {
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6B10C' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='M15 15l5 5M10.5 8v5M8 10.5h5'/%3E%3C/svg%3E") center / 22px no-repeat,
		rgb(11 11 11 / 0.55) !important;
}

/* ==================================================================================================================
 * 5. Transitions de page : fondu enchaîné de 350 ms entre deux pages du site ; la photo d'une carte produit devient
 *    la grande photo de la fiche (motion.js nomme la carte suivie au départ). Navigateurs sans View Transitions :
 *    navigation ordinaire. Mouvement réduit : aucune transition ; pause : sautée au départ (motion.js).
 * ================================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
	@view-transition {
		navigation: auto;
	}

	::view-transition-old(root),
	::view-transition-new(root) {
		animation-duration: var(--legato-mvt-court);
		animation-timing-function: var(--legato-mvt-courbe);
	}

	::view-transition-group(legato-photo-produit) {
		animation-duration: var(--legato-mvt-moyen);
		animation-timing-function: var(--legato-mvt-courbe);
	}

	::view-transition-old(legato-photo-produit),
	::view-transition-new(legato-photo-produit) {
		animation-duration: var(--legato-mvt-moyen);
	}

	body.single-product .fiche__galerie .wc-block-product-gallery-large-image__wrapper:first-child .wc-block-woocommerce-product-gallery-large-image__image {
		view-transition-name: legato-photo-produit;
	}
}

/* ==================================================================================================================
 * 6. Fil de lecture : un fil or très fin en haut de l'écran avance avec la lecture, comme le bras sur le disque
 *    (animation liée au défilement, sans durée propre). Articles et pages de lecture longues (motion.js). Absent sans
 *    animation liée au défilement, en mouvement réduit et en pause.
 * ================================================================================================================== */
.fil-lecture {
	display: none;
}

@supports (animation-timeline: scroll()) {
	@media (prefers-reduced-motion: no-preference) {
		:root:not(.animations-en-pause) .fil-lecture {
			display: block;
			position: fixed;
			inset: 0 0 auto;
			z-index: 100001;
			height: 2px;
			background: linear-gradient(90deg, rgb(230 177 12 / 0.3), var(--wp--preset--color--or, #E6B10C));
			box-shadow: 0 0 6px rgb(230 177 12 / 0.35);
			transform-origin: 0 50%;
			pointer-events: none;
			animation: legato-mvt-fil linear both;
			animation-timeline: scroll(root block);
		}
	}
}

@keyframes legato-mvt-fil {
	from {
		transform: scaleX(0);
	}

	to {
		transform: scaleX(1);
	}
}

/* ==================================================================================================================
 * 7. Tiroir du panier : il glisse depuis la droite sur un voile sombre en 450 ms, puis les articles apparaissent l'un
 *    après l'autre (40 ms d'écart). Fermeture inchangée (WooCommerce, 300 ms).
 * ================================================================================================================== */
/* Voile sombre de la charte (WooCommerce : noir à 35 %), à toutes les préférences. */
body .wc-block-components-drawer__screen-overlay {
	background-color: rgb(11 11 12 / 0.62);
}

@media (prefers-reduced-motion: no-preference) {
	:root:not(.animations-en-pause) body .wc-block-components-drawer__screen-overlay {
		animation-duration: var(--legato-mvt-moyen);
		animation-timing-function: var(--legato-mvt-courbe);
	}

	:root:not(.animations-en-pause) body .wc-block-components-drawer__screen-overlay--with-slide-in .wc-block-components-drawer {
		animation-duration: var(--legato-mvt-moyen);
		animation-timing-function: var(--legato-mvt-courbe);
	}

	:root:not(.animations-en-pause) body .wc-block-components-drawer__screen-overlay:not(.wc-block-components-drawer__screen-overlay--is-hidden) .wc-block-mini-cart__drawer .wc-block-cart-items__row {
		animation: legato-mvt-ligne var(--legato-mvt-moyen) var(--legato-mvt-courbe) backwards;
		animation-delay: calc(200ms + var(--mvt-i, 0) * var(--legato-mvt-cascade));
	}

	body .wc-block-mini-cart__drawer .wc-block-cart-items__row:nth-child(2) { --mvt-i: 1; }
	body .wc-block-mini-cart__drawer .wc-block-cart-items__row:nth-child(3) { --mvt-i: 2; }
	body .wc-block-mini-cart__drawer .wc-block-cart-items__row:nth-child(4) { --mvt-i: 3; }
	body .wc-block-mini-cart__drawer .wc-block-cart-items__row:nth-child(5) { --mvt-i: 4; }
	body .wc-block-mini-cart__drawer .wc-block-cart-items__row:nth-child(n + 6) { --mvt-i: 5; }
}

:root.animations-en-pause body :is(.wc-block-components-drawer__screen-overlay, .wc-block-components-drawer) {
	animation-duration: 0.01ms !important;
}

@keyframes legato-mvt-ligne {
	from {
		opacity: 0;
		transform: translateX(var(--legato-mvt-montee));
	}
}

/* ==================================================================================================================
 * 8. Cartes produits (boutique, catégories, accueil, produits similaires) : au survol, la vue de détail remplace la
 *    vue d'ensemble en fondu (450 ms), le nom monte de 3 px et le prix passe en or. Souris seulement ; rien au toucher.
 *    Mise en page des cartes inchangée (passe 29).
 * ================================================================================================================== */
@media (hover: hover) and (pointer: fine) {
	.wc-block-product .wc-block-components-product-image .image-survol {
		transition: opacity var(--legato-mvt-moyen) var(--legato-mvt-courbe), transform 0.7s var(--legato-mvt-courbe);
	}

	.wc-block-product :is(.wp-block-post-title, .wc-block-components-product-name),
	.wc-block-product .wc-block-components-product-price,
	.wc-block-product .wc-block-components-product-price .woocommerce-Price-amount {
		transition: color var(--legato-mvt-moyen) var(--legato-mvt-courbe), translate var(--legato-mvt-moyen) var(--legato-mvt-courbe);
	}

	.wc-block-product:hover .wc-block-components-product-price,
	.wc-block-product:hover .wc-block-components-product-price ins,
	.wc-block-product:hover .wc-block-components-product-price :not(del) > .woocommerce-Price-amount {
		color: var(--wp--preset--color--or, #E6B10C);
	}
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	:root:not(.animations-en-pause) .wc-block-product:hover :is(.wp-block-post-title, .wc-block-components-product-name) {
		translate: 0 -3px;
	}
}

/* ==================================================================================================================
 * 9. Trait du menu : un seul trait or glisse d'un intitulé à l'autre (350 ms) et revient sous la page en cours ; il
 *    remplace le soulignement propre à chaque intitulé quand motion.js l'a posé (menu en ligne, 600 px et plus).
 * ================================================================================================================== */
.avec-trait-menu {
	position: relative;
}

.en-tete .avec-trait-menu .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	background-size: 0 1px !important;
}

.trait-menu {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 1;
	width: 100px;
	height: 1px;
	background: var(--wp--preset--color--or, #E6B10C);
	transform-origin: 0 0;
	opacity: 0;
	pointer-events: none;
	transition: transform var(--legato-mvt-court) var(--legato-mvt-courbe), opacity var(--legato-mvt-court) var(--legato-mvt-courbe);
}

.trait-menu.est-visible {
	opacity: 1;
}

.trait-menu.sans-glisser,
:root.animations-en-pause .trait-menu {
	transition: none;
}

.wp-block-navigation__responsive-container.is-menu-open .trait-menu {
	display: none;
}

@media (max-width: 599.98px) {
	.trait-menu {
		display: none;
	}
}

/* ==================================================================================================================
 * 10. Gamme électronique (Notre technologie) : sur chaque modèle, trois losanges, autant d'allumés que de fonctions
 *     (Finezza 2, Rubato et Ubiquita 3, d'après le texte des cartes) ; ils s'allument un à un, 450 ms par fonction,
 *     d'un modèle à l'autre, à l'arrivée de la gamme et au survol d'un modèle. Décor : le texte le dit déjà.
 * ================================================================================================================== */
.techno-gamme > .techno-produit > .wp-block-image {
	position: relative;
}

.mvt-fonctions {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 2;
	display: flex;
	gap: 0.45rem;
	padding: 0.45rem 0.6rem;
	border: 1px solid rgb(230 177 12 / 0.35);
	border-radius: var(--legato-rayon, 2px);
	background: rgb(17 18 20 / 0.8);
	pointer-events: none;
}

.mvt-fonctions i {
	display: block;
	width: 0.4375rem;
	height: 0.4375rem;
	border: 1px solid rgb(230 177 12 / 0.55);
	rotate: 45deg;
}

.mvt-fonctions i.est-allume {
	border-color: var(--wp--preset--color--or, #E6B10C);
	background: var(--wp--preset--color--or, #E6B10C);
	box-shadow: 0 0 6px rgb(230 177 12 / 0.55);
}

.mvt-fonctions i:nth-child(2) { --mvt-i: 1; }
.mvt-fonctions i:nth-child(3) { --mvt-i: 2; }

@media (prefers-reduced-motion: no-preference) {
	:root:not(.animations-en-pause) .mvt-fonctions i {
		transition:
			background-color var(--legato-mvt-moyen) var(--legato-mvt-courbe),
			border-color var(--legato-mvt-moyen) var(--legato-mvt-courbe),
			box-shadow var(--legato-mvt-moyen) var(--legato-mvt-courbe);
		transition-delay: calc((var(--rang, 0) + var(--mvt-i, 0)) * var(--legato-mvt-moyen));
	}

	:root:not(.animations-en-pause) .mvt-fonctions.est-eteint i.est-allume {
		border-color: rgb(230 177 12 / 0.55);
		background-color: transparent;
		box-shadow: none;
		transition: none;
	}
}

/* ==================================================================================================================
 * 11. Photos d'ambiance : le carrousel de l'accueil laisse place à la vidéo ; restent les photos de systèmes du
 *     carrousel du bandeau des Systèmes clients. Chaque photo affichée se rapproche très lentement (100 % à 105 % en
 *     12 s, linéaire, une fois par affichage). Arrêt au survol et au focus, pendant une vidéo, en pause (figée sur
 *     place) ; rien sur une batterie faible ni en mouvement réduit. Propriété scale : elle s'ajoute au zoom du survol.
 * ================================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
	:root:not(.mvt-economie) .bandeau-systemes__photo {
		animation: legato-mvt-ambiance 12s linear forwards;
	}

	:root:is(.animations-en-pause, .mvt-video) .bandeau-systemes__photo,
	.bandeau-systemes__vignette:is(:hover, :focus-visible) .bandeau-systemes__photo {
		animation-play-state: paused;
	}
}

@keyframes legato-mvt-ambiance {
	from {
		scale: 1;
	}

	to {
		scale: 1.05;
	}
}

/* ==================================================================================================================
 * 12. Chargement des images : une photo différée qui arrive à l'écran apparaît en fondu (450 ms) sur la couleur
 *     d'attente de son cadre (tuile claire des produits, passe-partout des photos, fond des cartes).
 * ================================================================================================================== */
@media (prefers-reduced-motion: no-preference) {
	:root:not(.animations-en-pause) img.mvt-arrivee {
		animation: legato-mvt-arrivee var(--legato-mvt-moyen) var(--legato-mvt-courbe);
	}
}

@keyframes legato-mvt-arrivee {
	from {
		opacity: 0;
	}
}

/* ==================================================================================================================
 * 13. Chiffres clés (Notre technologie) : une année ou un nombre monte une fois jusqu'à sa valeur (900 ms), 120 ms
 *     d'un chiffre à l'autre. Le texte réel reste dans la page ; le compteur est peint par-dessus le temps de
 *     l'animation (motion.js), lu comme vide par les lecteurs d'écran.
 * ================================================================================================================== */
@property --mvt-n {
	syntax: "<integer>";
	inherits: false;
	initial-value: 0;
}

.mvt-compte {
	position: relative;
	color: transparent !important;
}

.mvt-compte::after {
	content: attr(data-mvt-avant) counter(mvt-n) attr(data-mvt-apres);
	content: attr(data-mvt-avant) counter(mvt-n) attr(data-mvt-apres) / "";
	position: absolute;
	inset: 0;
	counter-reset: mvt-n var(--mvt-n);
	color: var(--mvt-couleur, currentColor);
	animation: legato-mvt-compte var(--legato-mvt-ample) var(--legato-mvt-courbe) var(--mvt-retard, 0s) both;
	pointer-events: none;
}

@keyframes legato-mvt-compte {
	from {
		--mvt-n: var(--mvt-de);
	}

	to {
		--mvt-n: var(--mvt-a);
	}
}
