/**
 * UX Motion — micro-interactions, reveal au scroll, accordéons.
 * Classes utilitaires Gutenberg : .ux-hover-lift | .ux-fade-up | .ux-link-accent
 * Préfixe body.lelac-nav-nouvelle pour rester aligné sur la maquette.
 */

/* --------------------------------------------------------------------------
   1. Feedback — lift au survol (boutons / cartes d’action)
   -------------------------------------------------------------------------- */

.ux-hover-lift {
	transition:
		transform 0.22s ease,
		box-shadow 0.22s ease,
		border-color 0.22s ease,
		background-color 0.22s ease;
	will-change: transform;
}

.ux-hover-lift:hover,
.ux-hover-lift:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(16, 24, 40, 0.12);
}

/* Design system : CTAs & boutons d’action (sans toucher au markup) */
body.lelac-nav-nouvelle a[class*="__cta"],
body.lelac-nav-nouvelle a[class*="__btn"],
body.lelac-nav-nouvelle a[class*="__action"],
body.lelac-nav-nouvelle a[class*="__fichier"],
body.lelac-nav-nouvelle .wp-block-button__link,
body.lelac-nav-nouvelle .lelac-manif__btn,
body.lelac-nav-nouvelle .lelac-ta__btn-primaire .wp-block-button__link,
body.lelac-nav-nouvelle .lelac-ta__btn-outline .wp-block-button__link {
	transition:
		transform 0.22s ease,
		box-shadow 0.22s ease,
		border-color 0.22s ease,
		background-color 0.22s ease,
		color 0.22s ease;
}

body.lelac-nav-nouvelle a[class*="__cta"]:hover,
body.lelac-nav-nouvelle a[class*="__cta"]:focus-visible,
body.lelac-nav-nouvelle a[class*="__btn"]:hover,
body.lelac-nav-nouvelle a[class*="__btn"]:focus-visible,
body.lelac-nav-nouvelle a[class*="__action"]:hover,
body.lelac-nav-nouvelle a[class*="__action"]:focus-visible,
body.lelac-nav-nouvelle a[class*="__fichier"]:hover,
body.lelac-nav-nouvelle a[class*="__fichier"]:focus-visible,
body.lelac-nav-nouvelle .wp-block-button__link:hover,
body.lelac-nav-nouvelle .wp-block-button__link:focus-visible,
body.lelac-nav-nouvelle .lelac-manif__btn:hover,
body.lelac-nav-nouvelle .lelac-manif__btn:focus-visible {
	transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   2. Liens — barre d’accent verte L→R
   -------------------------------------------------------------------------- */

.ux-link-accent {
	position: relative;
	display: inline;
	color: inherit;
	text-decoration: none !important;
	background-image: linear-gradient(currentColor, currentColor);
	background-position: 0 100%;
	background-repeat: no-repeat;
	background-size: 0% 2px;
	transition: background-size 0.28s ease, color 0.2s ease;
}

.ux-link-accent:hover,
.ux-link-accent:focus-visible {
	color: var(--lelac-nv-accent, #009247);
	background-size: 100% 2px;
}

/* Liens texte dans les sections maquette (ignore liens-image / CTAs) */
body.lelac-nav-nouvelle .lelac-section a:not(:has(img)):not([class*="__cta"]):not([class*="__btn"]):not([class*="__action"]):not(.wp-block-button__link):not([class*="__fichier"]) {
	background-image: linear-gradient(var(--lelac-nv-accent, #009247), var(--lelac-nv-accent, #009247));
	background-position: 0 100%;
	background-repeat: no-repeat;
	background-size: 0% 2px;
	transition: background-size 0.28s ease, color 0.2s ease;
	text-decoration: none;
}

body.lelac-nav-nouvelle .lelac-section a:not(:has(img)):not([class*="__cta"]):not([class*="__btn"]):not([class*="__action"]):not(.wp-block-button__link):not([class*="__fichier"]):hover,
body.lelac-nav-nouvelle .lelac-section a:not(:has(img)):not([class*="__cta"]):not([class*="__btn"]):not([class*="__action"]):not(.wp-block-button__link):not([class*="__fichier"]):focus-visible {
	color: var(--lelac-nv-accent, #009247);
	background-size: 100% 2px;
}

/* --------------------------------------------------------------------------
   3. Reveal au scroll
   -------------------------------------------------------------------------- */

.ux-fade-up {
	opacity: 0;
	transform: translateY(14px);
	transition:
		opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: var(--ux-delay, 0ms);
}

.ux-fade-up.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Stagger optionnel via data-ux-delay ou enfants */
.ux-stagger > .ux-fade-up:nth-child(1) { --ux-delay: 0ms; }
.ux-stagger > .ux-fade-up:nth-child(2) { --ux-delay: 60ms; }
.ux-stagger > .ux-fade-up:nth-child(3) { --ux-delay: 120ms; }
.ux-stagger > .ux-fade-up:nth-child(4) { --ux-delay: 180ms; }
.ux-stagger > .ux-fade-up:nth-child(5) { --ux-delay: 240ms; }
.ux-stagger > .ux-fade-up:nth-child(6) { --ux-delay: 300ms; }

/* --------------------------------------------------------------------------
   3b. KPIs — carte (fade-up + scale) + compteur
   Classes Gutenberg : .kpi-card (carte) | .kpi-counter (chiffre)
   -------------------------------------------------------------------------- */

.kpi-card,
.ux-kpi-card {
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	transition:
		opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: var(--ux-delay, 0ms);
	will-change: transform, opacity;
}

.kpi-card.is-visible,
.ux-kpi-card.is-visible,
.kpi-card.ux-fade-up.is-visible,
.ux-kpi-card.ux-fade-up.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.kpi-counter {
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
}

/* --------------------------------------------------------------------------
   4. Accordéons <details> — transitions fluides
   -------------------------------------------------------------------------- */

.ux-details-panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.32s ease, opacity 0.28s ease;
	opacity: 0;
}

.ux-details-panel > .ux-details-panel__inner {
	overflow: hidden;
	min-height: 0;
}

details.ux-details-open > .ux-details-panel,
details[open].ux-details-animated > .ux-details-panel {
	grid-template-rows: 1fr;
	opacity: 1;
}

/* Chevrons déjà animés dans comites/consultations — renforce summary */
body.lelac-nav-nouvelle details summary {
	transition: background-color 0.2s ease;
}

body.lelac-nav-nouvelle details summary:hover {
	background-color: rgba(248, 250, 252, 0.85);
}

/* --------------------------------------------------------------------------
   5. Accueil — Hero Ken Burns + fade texte
   -------------------------------------------------------------------------- */

@keyframes ux-hero-kenburns {
	from {
		transform: scale(1.12);
		opacity: 0.88;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes ux-hero-fade-up {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

body.home.lelac-nav-nouvelle .lelac-nv-hero__image,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__image {
	transform-origin: center center;
	animation: ux-hero-kenburns 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.home.lelac-nav-nouvelle .lelac-nv-hero__sur,
body.home.lelac-nav-nouvelle .lelac-nv-hero__titre,
body.home.lelac-nav-nouvelle .lelac-nv-hero__actions,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__sur,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__titre,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__actions {
	opacity: 0;
	animation: ux-hero-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.home.lelac-nav-nouvelle .lelac-nv-hero__sur,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__sur {
	animation-delay: 0.2s;
}

body.home.lelac-nav-nouvelle .lelac-nv-hero__titre,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__titre {
	animation-delay: 0.4s;
}

body.home.lelac-nav-nouvelle .lelac-nv-hero__actions,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__actions {
	animation-delay: 0.6s;
}

/* --------------------------------------------------------------------------
   6. Accueil — hover lift cartes & boutons
   -------------------------------------------------------------------------- */

body.home.lelac-nav-nouvelle .lelac-carte,
body.home.lelac-nav-nouvelle a.lelac-carte,
body.home.lelac-nav-nouvelle .lelac-terrain__carte,
body.home.lelac-nav-nouvelle .lelac-chiffres .lelac-chiffre,
body.home.lelac-nav-nouvelle .lelac-nv-hero__btn,
body.front-page.lelac-nav-nouvelle .lelac-carte,
body.front-page.lelac-nav-nouvelle a.lelac-carte,
body.front-page.lelac-nav-nouvelle .lelac-terrain__carte,
body.front-page.lelac-nav-nouvelle .lelac-chiffres .lelac-chiffre,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__btn {
	transition:
		transform 0.22s ease,
		box-shadow 0.22s ease,
		border-color 0.22s ease,
		background-color 0.22s ease,
		color 0.22s ease;
}

body.home.lelac-nav-nouvelle .lelac-carte:hover,
body.home.lelac-nav-nouvelle a.lelac-carte:hover,
body.home.lelac-nav-nouvelle a.lelac-carte:focus-visible,
body.home.lelac-nav-nouvelle .lelac-terrain__carte:hover,
body.home.lelac-nav-nouvelle .lelac-terrain__carte:focus-visible,
body.home.lelac-nav-nouvelle .lelac-nv-hero__btn:hover,
body.home.lelac-nav-nouvelle .lelac-nv-hero__btn:focus-visible,
body.front-page.lelac-nav-nouvelle .lelac-carte:hover,
body.front-page.lelac-nav-nouvelle a.lelac-carte:hover,
body.front-page.lelac-nav-nouvelle a.lelac-carte:focus-visible,
body.front-page.lelac-nav-nouvelle .lelac-terrain__carte:hover,
body.front-page.lelac-nav-nouvelle .lelac-terrain__carte:focus-visible,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__btn:hover,
body.front-page.lelac-nav-nouvelle .lelac-nv-hero__btn:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}

/* --------------------------------------------------------------------------
   7. Accessibilité — prefers-reduced-motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.ux-hover-lift,
	.ux-hover-lift:hover,
	.ux-hover-lift:focus-visible,
	.ux-fade-up,
	.ux-fade-up.is-visible,
	.kpi-card,
	.ux-kpi-card,
	.kpi-card.is-visible,
	.ux-kpi-card.is-visible,
	.ux-link-accent,
	.ux-details-panel,
	body.lelac-nav-nouvelle a[class*="__cta"],
	body.lelac-nav-nouvelle a[class*="__btn"],
	body.lelac-nav-nouvelle a[class*="__action"],
	body.lelac-nav-nouvelle a[class*="__fichier"],
	body.lelac-nav-nouvelle .wp-block-button__link,
	body.lelac-nav-nouvelle .lelac-manif__btn,
	body.lelac-nav-nouvelle .lelac-section a,
	body.home.lelac-nav-nouvelle .lelac-carte,
	body.home.lelac-nav-nouvelle .lelac-terrain__carte,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__btn,
	body.front-page.lelac-nav-nouvelle .lelac-carte,
	body.front-page.lelac-nav-nouvelle .lelac-terrain__carte,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__btn,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__image,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__image,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__sur,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__titre,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__actions,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__sur,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__titre,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__actions {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}

	.ux-fade-up,
	.kpi-card,
	.ux-kpi-card,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__sur,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__titre,
	body.home.lelac-nav-nouvelle .lelac-nv-hero__actions,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__sur,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__titre,
	body.front-page.lelac-nav-nouvelle .lelac-nv-hero__actions {
		opacity: 1 !important;
	}

	.ux-details-panel {
		display: block;
		opacity: 1;
	}

	details:not([open]) > .ux-details-panel {
		display: none;
	}
}
