/**
 * Menu mobile v2 — test prod.
 * Actif seulement si body.whp-mobile-nav-v2 (constante WHP_MOBILE_NAV_V2).
 * Couper : WHP_MOBILE_NAV_V2 = false dans functions.php → ce fichier n’est plus chargé.
 *
 * Important : on ne force PAS display:none (Divi gère l’ouverture/fermeture).
 */

@media (max-width: 1200px) {
	/*
	 * Burger CSS (3 traits) → croix animée.
	 */
	body.whp-mobile-nav-v2 #header-section .mobile_menu_bar {
		position: relative;
		width: 32px;
		height: 32px;
		overflow: visible !important;
		background: transparent !important;
	}

	body.whp-mobile-nav-v2 #header-section .mobile_menu_bar:before,
	body.whp-mobile-nav-v2 #header-section .mobile_menu_bar:after {
		content: "" !important;
		font-size: 0 !important;
		font-family: none !important;
		position: absolute;
		left: 50%;
		top: 50%;
		width: 20px;
		height: 2px;
		margin: 0 !important;
		border-radius: 1px;
		background-color: #121212;
		pointer-events: none;
		transition:
			transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
			box-shadow 0.25s ease,
			opacity 0.25s ease;
	}

	body.whp-mobile-nav-v2 #header-section .mobile_menu_bar:before {
		transform: translate(-50%, -50%) translateY(-7px);
		box-shadow: 0 7px 0 #121212;
		opacity: 1;
	}

	body.whp-mobile-nav-v2 #header-section .mobile_menu_bar:after {
		transform: translate(-50%, -50%) translateY(7px);
		opacity: 1;
	}

	body.whp-mobile-nav-v2 #header-section .mobile_nav.opened .mobile_menu_bar:before {
		transform: translate(-50%, -50%) rotate(45deg);
		box-shadow: 0 0 0 transparent;
	}

	body.whp-mobile-nav-v2 #header-section .mobile_nav.opened .mobile_menu_bar:after {
		transform: translate(-50%, -50%) rotate(-45deg);
	}

	/*
	 * Panneau ouvert — :has() couvre menu frère OU descendant de .mobile_nav
	 * display:flex seulement quand ouvert (sinon on laisse Divi en display:none)
	 */
	body.whp-mobile-nav-v2 .mobile_nav.opened #mobile_menu1,
	body.whp-mobile-nav-v2 .et_mobile_nav_menu:has(.mobile_nav.opened) #mobile_menu1 {
		display: flex !important;
		flex-direction: column;
		left: 16px;
		right: 16px;
		/* svh = viewport avec barre Chrome visible (100vh la cache derrière) */
		bottom: max(16px, env(safe-area-inset-bottom, 0px));
		min-height: calc(100vh - var(--whp-header-bar) - var(--whp-menu-gap) - 26px);
		min-height: calc(100svh - var(--whp-header-bar) - var(--whp-menu-gap) - 26px);
		max-height: calc(100vh - var(--whp-header-bar) - var(--whp-menu-gap) - 16px) !important;
		max-height: calc(100dvh - var(--whp-header-bar) - var(--whp-menu-gap) - 16px) !important;
		max-height: calc(100svh - var(--whp-header-bar) - var(--whp-menu-gap) - 16px) !important;
		padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		border-radius: 20px;
		background-color: rgba(255, 255, 255, 0.92);
		box-shadow: 0 16px 40px rgba(11, 27, 58, 0.12);
		-webkit-backdrop-filter: blur(16px);
		backdrop-filter: blur(16px);
		border: 1px solid rgba(255, 255, 255, 0.65);
		overflow-x: hidden;
		overflow-y: auto;
		transform-origin: top center;
		animation: whp-mobile-nav-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
	}

	@keyframes whp-mobile-nav-in {
		from {
			opacity: 0;
			transform: translateY(-12px) scale(0.98);
		}
		to {
			opacity: 1;
			transform: translateY(0) scale(1);
		}
	}

	@media (prefers-reduced-motion: reduce) {
		body.whp-mobile-nav-v2 .mobile_nav.opened #mobile_menu1,
		body.whp-mobile-nav-v2 .et_mobile_nav_menu:has(.mobile_nav.opened) #mobile_menu1 {
			animation: none;
		}
	}

	body.whp-mobile-nav-v2 #header-section.scrolled .mobile_nav.opened #mobile_menu1,
	body.whp-mobile-nav-v2 #header-section.scrolled .et_mobile_nav_menu:has(.mobile_nav.opened) #mobile_menu1 {
		min-height: calc(100vh - (var(--whp-header-bar) - var(--whp-header-pad-top)) - var(--whp-menu-gap) - 26px);
		min-height: calc(100svh - (var(--whp-header-bar) - var(--whp-header-pad-top)) - var(--whp-menu-gap) - 26px);
		max-height: calc(100vh - (var(--whp-header-bar) - var(--whp-header-pad-top)) - var(--whp-menu-gap) - 16px) !important;
		max-height: calc(100dvh - (var(--whp-header-bar) - var(--whp-header-pad-top)) - var(--whp-menu-gap) - 16px) !important;
		max-height: calc(100svh - (var(--whp-header-bar) - var(--whp-header-pad-top)) - var(--whp-menu-gap) - 16px) !important;
	}

	/* Liste */
	body.whp-mobile-nav-v2 #mobile_menu1 > li {
		border-bottom: 0 !important;
		margin: 0;
		position: relative;
		min-height: 0;
		flex-shrink: 0;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li:not(.open):not(.whp-mobile-nav-cta) {
		overflow: hidden;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li:not(.whp-mobile-nav-cta) + li:not(.whp-mobile-nav-cta) {
		border-top: 1px solid rgba(18, 18, 18, 0.06);
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li > a,
	body.whp-mobile-nav-v2 #mobile_menu1 > li > span.submenu-toggle {
		font-weight: 600;
		font-size: 16px;
		letter-spacing: 0;
		line-height: 16px;
		padding: 15px 48px 15px 5px;
		margin: 10px 0;
		color: #121212;
		position: relative;
		display: block;
		border-bottom: 0 !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.menu-item-has-children:after {
		content: none !important;
		display: none !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.menu-item-has-children > .submenu-toggle:after,
	body.whp-mobile-nav-v2 #mobile_menu1 > li.menu-item-has-children > a:after {
		content: "\33";
		font-family: ETmodules;
		speak: none;
		position: absolute;
		right: 4px;
		top: 50%;
		transform: translateY(-50%);
		width: 32px;
		height: 32px;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 18px;
		font-weight: 400;
		color: #121212;
		background: transparent;
		pointer-events: none;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.menu-item-has-children.open > .submenu-toggle:after,
	body.whp-mobile-nav-v2 #mobile_menu1 > li.menu-item-has-children.open > a:after {
		content: "\32";
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li > ul.sub-menu {
		max-height: 0 !important;
		overflow: hidden !important;
		padding: 0 !important;
		margin: 0 !important;
		border: 0 !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.open > ul.sub-menu {
		max-height: 1000px !important;
		overflow: hidden;
		padding: 0 8px 8px !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li > ul.sub-menu > .menu-item-has-children:not(.img-container) > ul.sub-menu > li.menu-item > a {
		margin: 0 0 8px;
		padding: 12px 8px;
		font-size: 15px;
		font-weight: 500;
		line-height: 1.35;
		border-radius: 12px;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.whp-mobile-nav-cta {
		margin-top: auto;
		padding-top: 16px;
		border-top: 1px solid rgba(18, 18, 18, 0.08) !important;
		border-bottom: 0 !important;
		position: sticky;
		bottom: 0;
		background: #fff;
		z-index: 2;
		list-style: none;
		flex-shrink: 0;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.whp-mobile-nav-cta .whp-mobile-nav-cta__inner {
		display: flex;
		flex-direction: column;
		gap: 10px;
		padding: 8px 0 4px;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.whp-mobile-nav-cta a.et_pb_button {
		display: flex !important;
		align-items: center;
		justify-content: center;
		width: 100%;
		box-sizing: border-box;
		margin: 0 !important;
		text-align: center;
		font-weight: 600 !important;
		font-size: 15px !important;
		line-height: 1.2 !important;
		border-radius: 15px;
		border-bottom: 0 !important;
		padding-top: 14px !important;
		padding-bottom: 14px !important;
		padding-left: 20px !important;
		padding-right: 20px !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 > li.whp-mobile-nav-cta a.et_pb_button_1_tb_header {
		color: #ffffff !important;
		background-color: #121212 !important;
		border: 2px solid #121212 !important;
	}

	body.whp-mobile-nav-v2 #mobile_menu1 .img-container .btn-formation a {
		border-bottom: 2px solid #d5d5d5 !important;
	}
}

@media (max-width: 980px) {
	body.whp-mobile-nav-v2 .mobile_nav.opened #mobile_menu1,
	body.whp-mobile-nav-v2 .et_mobile_nav_menu:has(.mobile_nav.opened) #mobile_menu1 {
		left: 12px;
		right: 12px;
	}
}

@media (max-width: 767px) {
	body.whp-mobile-nav-v2 .mobile_nav.opened #mobile_menu1,
	body.whp-mobile-nav-v2 .et_mobile_nav_menu:has(.mobile_nav.opened) #mobile_menu1 {
		left: 10px;
		right: 10px;
		bottom: max(12px, env(safe-area-inset-bottom, 0px));
		padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
	}
}
