/**
 * Empilement mobile cohérent — nav / Tempo / FAB / overlays.
 * Ne supprime pas les fonctions : aligne bottoms + z-index + safe-area.
 *
 * Stack z (bas contenu → chrome) :
 * 10015 sticky fiche (sous Tempo / FAB / nav)
 * 10025 Live FAB lane
 * 10040–10050 Tempo
 * 10060 nav Simple
 * 10010 back-to-top (sous Tempo si conflit spatial)
 *
 * Hauteur chrome : --cd-mobile-ui-stack-h (Tempo syncStack).
 */

:root {
	--cd-ui-nav-z: 10060;
	--cd-ui-tempo-z: 10040;
	--cd-ui-fab-z: 10025;
	--cd-ui-backtop-z: 10010;
	--cd-ui-sticky-event-z: 10015;
}

@media (max-width: 959px) {
	body.cdsn-simple-mode {
		--cd-bottom-nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
	}

	.cdsn-bottom-nav {
		z-index: var(--cd-ui-nav-z) !important;
	}

	.cd-tempo,
	.cd-tempo-bar,
	[class*="cd-tempo"][style*="fixed"] {
		z-index: var(--cd-ui-tempo-z);
	}

	.cdl-global-live-fab,
	.cdl-sound-meter-fab,
	#cdl-global-live-fab {
		z-index: var(--cd-ui-fab-z);
		bottom: calc(var(--cd-bottom-nav-h, 68px) + var(--cd-tempo-mobile-gap, 4px) + env(safe-area-inset-bottom, 0px));
	}

	/* Retour haut : ne pas concurrencer Tempo / FAB */
	#ast-scroll-top,
	.ast-scroll-top-icon,
	a.ast-scroll-to-top,
	.cd-back-to-top,
	#scroll-top {
		z-index: var(--cd-ui-backtop-z) !important;
		bottom: calc(var(--cd-bottom-nav-h, 68px) + 4.5rem + env(safe-area-inset-bottom, 0px)) !important;
		right: 0.75rem !important;
		opacity: 0.72;
	}

	body.single-mec-events .cd-event-actions--sticky-ready {
		z-index: var(--cd-ui-sticky-event-z);
		bottom: max(
			var(--cd-mobile-ui-stack-h, 0px),
			var(--cd-bottom-nav-h, var(--csn-bottom-h, 0px))
		);
	}

	/* Micro : hors page d’accueil / hors contexte live, ne pas empiler en permanence */
	body.home .cdl-sound-meter-fab,
	body.cd-home-v3 .cdl-sound-meter-fab,
	body.page .cdl-sound-meter-fab:not([data-cdl-sound-relevant="1"]) {
		display: none !important;
	}
}
