/* =========================================================
   Yceo Mega Menu — styles front-end
   Les couleurs, tailles et polices sont pilotées par des
   variables CSS injectées depuis la page de réglages
   (voir build_css_variables() dans includes/class-ymm-render.php).
   ========================================================= */

.ymm-nav {
	position: relative;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: linear-gradient(135deg, var(--ymm-bg-start, #0b2e3a) 0%, var(--ymm-bg-end, #0e6e8c) 100%);
	color: var(--ymm-text, #fff);
	width: 100%;
	max-width: 100%;
	flex: 1 1 100%;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	padding: 0 16px;
	flex-wrap: wrap;
}

.ymm-nav *,
.ymm-nav *::before,
.ymm-nav *::after {
	box-sizing: border-box;
}

/* --- Bouton hamburger (mobile) --- */
.ymm-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 5px;
	width: 44px;
	height: 44px;
	margin-left: auto !important;
	margin-right: 0 !important;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 0;
}
.ymm-toggle-bar {
	display: block;
	width: 24px;
	height: 2px;
	background: var(--ymm-text, #fff);
	border-radius: 2px;
	transition: transform .25s ease, opacity .25s ease;
}
.ymm-nav.is-open .ymm-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ymm-nav.is-open .ymm-toggle-bar:nth-child(2) { opacity: 0; }
.ymm-nav.is-open .ymm-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Barre de menu --- */
.ymm-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: stretch;
	flex-wrap: wrap;
}

.ymm-item {
	position: relative;
}

.ymm-item-head {
	display: flex;
	align-items: center;
}

/* Niveau 1 : libellés de la barre */
.ymm-link,
.ymm-link--nolink {
	position: relative;
	display: inline-block;
	padding: 18px 20px;
	color: var(--ymm-text, #fff);
	text-decoration: none;
	font-weight: var(--ymm-l1-weight, 600);
	font-size: var(--ymm-l1-size, 15px);
	letter-spacing: .2px;
	white-space: nowrap;
	transition: color .2s ease;
}
.ymm-link::after,
.ymm-link--nolink::after {
	content: "";
	position: absolute;
	left: 20px;
	right: 20px;
	bottom: 10px;
	height: 3px;
	border-radius: 2px;
	background: var(--ymm-l1-hover-bar, #00a7b5);
	transform: scaleX(0);
	transform-origin: center;
	transition: transform .25s ease;
}
.ymm-link:hover,
.ymm-link:focus-visible {
	color: var(--ymm-accent, #b7d334);
}
.ymm-link:hover::after,
.ymm-link:focus-visible::after,
.ymm-link--nolink:hover::after,
.ymm-item.is-open .ymm-link::after,
.ymm-item.is-active > .ymm-item-head .ymm-link::after {
	transform: scaleX(1);
}

.ymm-item.has-panel > .ymm-item-head .ymm-link {
	padding-right: 6px;
}

.ymm-item-toggle {
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 0 16px 0 4px;
	display: flex;
	align-items: center;
	height: 100%;
}
.ymm-chevron {
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--ymm-text, #fff);
	border-bottom: 2px solid var(--ymm-text, #fff);
	transform: rotate(45deg);
	transition: transform .25s ease;
	margin-top: -4px;
}
.ymm-item.is-open .ymm-chevron {
	transform: rotate(225deg);
	margin-top: 4px;
}

.ymm-item.is-active > .ymm-item-head .ymm-link,
.ymm-item.is-active .ymm-chevron {
	color: var(--ymm-accent, #b7d334);
}

/* --- Panneau déroulant --- */
.ymm-panel {
	display: none;
	position: fixed;
	z-index: 2147483647;
	background: var(--ymm-panel-bg, #fff);
	color: var(--ymm-panel-text, #0b2e3a);
	min-width: var(--ymm-panel-width, 900px);
	max-width: 95vw;
	box-shadow: 0 18px 40px rgba(0,0,0,.18);
	border-radius: 0 0 10px 10px;
	padding: 28px;
}
.ymm-panel.is-open {
	display: block;
}

.ymm-grid {
	display: flex !important;
	align-items: stretch;
	flex-wrap: nowrap;
	gap: 28px;
	width: 100%;
}

/* Chaque colonne occupe une largeur égale et empile ses blocs verticalement.
   En flexbox (plutôt qu'en grille), la colonne reçoit une hauteur définie
   dès l'étirement (align-items: stretch), ce qui permet ensuite à ses
   enfants de s'étirer à leur tour de façon fiable, sans le bug de
   pourcentages imbriqués propre à CSS Grid.
   Les propriétés ci-dessous sont en !important : certains thèmes/plugins
   appliquent des styles globaux sur des balises génériques (nav, ul, li,
   div) qui peuvent sinon écraser cette mise en page. */
.ymm-column {
	display: flex !important;
	flex-direction: column !important;
	flex: 1 1 0;
	gap: 14px;
	min-width: 0;
}

/* Colonne composée uniquement de blocs "image" : ils se partagent la
   hauteur disponible à parts égales, pour que la colonne s'aligne avec
   la hauteur des colonnes voisines (pas de grand vide en dessous). */
.ymm-column--fill .ymm-col--fill {
	display: flex;
	flex: 1 1 0;
	min-height: 0;
}
.ymm-column--fill .ymm-col--fill .ymm-tile {
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-height: var(--ymm-tile-height, 200px) !important;
}

/* Niveau 2 : titres de colonne */
.ymm-col-heading {
	margin: 0 0 6px;
	font-size: var(--ymm-l2-size, 16px);
	font-weight: var(--ymm-l2-weight, 700);
	color: var(--ymm-panel-text, #0b2e3a);
}

.ymm-col-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}
/* Niveau 3 : liens de liste */
.ymm-col-list a {
	display: inline-block;
	color: var(--ymm-panel-text, #0b2e3a);
	text-decoration: none;
	font-size: var(--ymm-l3-size, 14px);
	font-weight: var(--ymm-l3-weight, 400);
	line-height: 1.1;
	opacity: .85;
	transition: opacity .2s ease, color .2s ease, padding-left .2s ease;
}
.ymm-col-list a:hover,
.ymm-col-list a:focus-visible {
	opacity: 1;
	color: var(--ymm-l3-hover, #0e6e8c);
	padding-left: 3px;
}

/* --- Tuiles image --- */
.ymm-tile {
	position: relative;
	display: flex !important;
	align-items: center;
	justify-content: center;
	text-align: center;
	width: var(--ymm-tile-width, 100%);
	max-width: 100%;
	margin: 0 auto;
	min-height: var(--ymm-tile-height, 200px) !important;
	border-radius: 8px;
	background-color: var(--ymm-tile-bg, #cdeaf0);
	background-size: cover;
	background-position: center;
	overflow: hidden;
	text-decoration: none;
}
.ymm-tile::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 8px;
	background: linear-gradient(180deg, rgba(10,20,25,.15) 0%, rgba(5,10,15,.55) 55%, rgba(0,0,0,.78) 100%);
	transition: background .3s ease;
}
.ymm-tile:hover::after,
.ymm-tile:focus-visible::after {
	background: linear-gradient(180deg, rgba(var(--ymm-l1-hover-rgb, 0,167,181), .35) 0%, rgba(var(--ymm-l1-hover-rgb, 0,167,181), .6) 45%, rgba(0,0,0,.85) 100%);
}
/* Niveau 3 : texte affiché sur les vignettes image */
.ymm-tile-overlay {
	position: relative;
	z-index: 1;
	padding: 16px;
	color: #fff;
	font-weight: 700;
	font-size: calc(var(--ymm-l3-size, 14px) + 3px);
	line-height: 1.25;
	text-shadow: 0 2px 6px rgba(0,0,0,.85), 0 1px 2px rgba(0,0,0,.9);
}

.ymm-empty-notice {
	padding: 14px 18px;
	background: #fff3cd;
	color: #664d03;
	font-size: 14px;
}

/*
 * Remarque : le point de bascule mobile (largeur en px) est réglable dans
 * "Mega Menu Ycéo > Réglages". Pour que la structure (colonne unique,
 * accordéon...) et l'affichage du bouton hamburger changent exactement au
 * même seuil, TOUTES les règles ci-dessous sont dupliquées et injectées
 * dynamiquement au bon seuil par build_css_variables() dans
 * includes/class-ymm-render.php. Les règles statiques ci-dessous ne servent
 * que de filet de sécurité si, pour une raison quelconque, le style inline
 * ne se charge pas (elles utilisent le seuil par défaut : 992px).
 */
@media (max-width: 991px) {
	.ymm-nav {
		position: relative !important;
		padding-right: 60px !important;
	}
	.ymm-toggle {
		display: inline-flex !important;
		position: absolute !important;
		top: 50% !important;
		right: 16px !important;
		left: auto !important;
		margin: 0 !important;
		transform: translateY(-50%) !important;
	}
	.ymm-list {
		flex-direction: column;
		width: 100%;
		flex-basis: 100%;
	}
	.ymm-nav.ymm-no-toggle .ymm-list {
		display: flex !important;
	}
	.ymm-item {
		width: 100%;
		border-top: 1px solid rgba(255,255,255,.12);
	}
	.ymm-item-head {
		justify-content: space-between;
	}
	.ymm-link,
	.ymm-link--nolink {
		width: 100%;
		padding: 15px 4px;
	}
	.ymm-item-toggle {
		height: auto;
		padding: 15px 10px;
	}
	.ymm-panel {
		position: static;
		width: 100%;
		max-width: none;
		min-width: 0;
		box-shadow: none;
		border-radius: 0;
		padding: 18px 4px 22px;
	}
	.ymm-grid {
		flex-direction: column;
		gap: 18px;
	}
	.ymm-column {
		flex: 1 1 auto;
	}
	.ymm-column--fill .ymm-col--fill .ymm-tile {
		flex: none;
	}
	.ymm-tile {
		min-height: 140px;
	}
}
