/*
 * Micro-interactions d'apparition au défilement.
 * Les états cachés ne s'appliquent que sous .bc-motion-ready, ajoutée par
 * inc/animation/animation.php
 */

/* ── Réglages ───────────────────────────────────────────── */

:root {
	--bc-motion-distance: 24px;
	--bc-motion-duration: 700ms;
	--bc-motion-easing: cubic-bezier(0.22, 1, 0.36, 1);
}

:is(.bc-fade-in, .bc-fade-up, .bc-fade-down, .bc-fade-left, .bc-fade-right) {
	--bc-motion-x: 0px;
	--bc-motion-y: 0px;
	--bc-motion-delay: 0ms;
}

.bc-fade-up    { --bc-motion-y: var(--bc-motion-distance); }
.bc-fade-down  { --bc-motion-y: calc(-1 * var(--bc-motion-distance)); }
.bc-fade-left  { --bc-motion-x: var(--bc-motion-distance); }
.bc-fade-right { --bc-motion-x: calc(-1 * var(--bc-motion-distance)); }

.bc-delay-100 { --bc-motion-delay: 100ms; }
.bc-delay-200 { --bc-motion-delay: 200ms; }
.bc-delay-300 { --bc-motion-delay: 300ms; }
.bc-delay-500 { --bc-motion-delay: 500ms; }

.bc-slow { --bc-motion-duration: 1100ms; }

.bc-motion-ready main { overflow-x: clip; }


/* ── Éléments seuls ─────────────────────────────────────── */

.bc-motion-ready :is(.bc-fade-in, .bc-fade-up, .bc-fade-down, .bc-fade-left, .bc-fade-right) {
	transition:
		opacity var(--bc-motion-duration) var(--bc-motion-easing) var(--bc-motion-delay),
		transform var(--bc-motion-duration) var(--bc-motion-easing) var(--bc-motion-delay);
}

.bc-motion-ready :is(.bc-fade-in, .bc-fade-up, .bc-fade-down, .bc-fade-left, .bc-fade-right):not(.bc-visible) {
	opacity: 0;
	transform: translate(var(--bc-motion-x), var(--bc-motion-y));
}


/* ── Cascade (enfants d'un groupe) ──────────────────────── */

/* --bc-stagger-index est posé sur chaque enfant par assets/js/animations.js. */
.bc-stagger {
	--bc-stagger-delay: 100ms;
	--bc-stagger-x: 0px;
	--bc-stagger-y: var(--bc-motion-distance);
}

.bc-stagger-150  { --bc-stagger-delay: 150ms; }
.bc-stagger-200  { --bc-stagger-delay: 200ms; }
.bc-stagger-fade { --bc-stagger-y: 0px; }

.bc-motion-ready .bc-stagger > :not(.bc-stagger-skip) {
	--bc-stagger-wait: calc(var(--bc-stagger-index, 0) * var(--bc-stagger-delay));
	transition:
		opacity var(--bc-motion-duration) var(--bc-motion-easing) var(--bc-stagger-wait),
		transform var(--bc-motion-duration) var(--bc-motion-easing) var(--bc-stagger-wait);
}

.bc-motion-ready .bc-stagger:not(.bc-stagger-visible) > :not(.bc-stagger-skip) {
	opacity: 0;
	transform: translate(var(--bc-stagger-x), var(--bc-stagger-y));
}


/* ── Mouvement réduit ───────────────────────────────────── */

/* Filet de sécurité si la préférence change après le chargement de la page. */
@media (prefers-reduced-motion: reduce) {
	.bc-motion-ready :is(.bc-fade-in, .bc-fade-up, .bc-fade-down, .bc-fade-left, .bc-fade-right),
	.bc-motion-ready .bc-stagger > :not(.bc-stagger-skip) {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}
