/* =========================================================
   MIDDLE LAND — header (template home2). Dépend de mlt-tokens.
   Logo (max 270 px) | menu principal + mega-menu (même menu et même
   walker que le header ITF, préfixe mlt) | bouton « Demander un devis ».
   Posé en absolu sur le hero clair. Mobile-first : sous 1280 px,
   burger + panneau avec mega-menu en accordéon.
   ========================================================= */

.mlt-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 10000;
	padding: var(--mlt-space-16) var(--mlt-space-24);
	background: var(--mlt-color-olive);
	color: var(--mlt-color-blanc);
	font-weight: 700;
	text-decoration: none;
}

.mlt-skip-link:focus {
	left: var(--mlt-space-16);
	top: var(--mlt-space-16);
	outline: none;
	box-shadow: var(--mlt-focus-ring);
}

/* Pages internes : header en flux, sur le crème de la bannière de page qui le suit */
.mlt-header {
	position: relative;
	z-index: 50;
	color: var(--mlt-color-texte);
	background: var(--mlt-color-fond);
}

/* Pages vitrines (accueil) : header transparent posé en absolu sur le hero */
.mlt-vitrine .mlt-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	background: transparent;
}

.admin-bar.mlt-vitrine .mlt-header {
	top: 46px;
}

.mlt-header__inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--mlt-space-16);
	max-width: 1440px;
	margin: 0 auto;
	padding: var(--mlt-space-16) var(--mlt-gutter);
}

/* -------------------- Logo : largeur max 270 px, hauteur automatique -------------------- */
.mlt-header__logo {
	display: block;
	flex: 0 1 270px;
	max-width: 270px;
	min-width: 0;
	border-radius: var(--mlt-space-4);
}

.mlt-header__logo .mlt-logo {
	display: block;
	width: 100%;
	max-width: 270px;
	height: auto;
}

/* -------------------- Actions (devis | burger) -------------------- */
.mlt-header__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: var(--mlt-space-16);
}

.mlt-header__devis {
	display: none;
	min-height: 44px;
	padding: 0 var(--mlt-space-24);
	font-size: var(--mlt-fs-small);
	white-space: nowrap;
}

.mlt-header__burger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--mlt-radius-pill);
	background: transparent;
	color: var(--mlt-color-texte);
	cursor: pointer;
}

/* Icône « justify » de la maquette : 4 traits fins de 16 px */
.mlt-header__burger-lines {
	display: grid;
	gap: 2.3px;
	width: 16px;
}

.mlt-header__burger-lines span {
	display: block;
	height: 1.4px;
	background: currentColor;
	transition: transform var(--mlt-duration) var(--mlt-ease), opacity var(--mlt-duration) var(--mlt-ease);
}

.mlt-header__burger[aria-expanded="true"] .mlt-header__burger-lines span:nth-child(2),
.mlt-header__burger[aria-expanded="true"] .mlt-header__burger-lines span:nth-child(3) {
	opacity: 0;
}

.mlt-header__burger[aria-expanded="true"] .mlt-header__burger-lines span:nth-child(1) {
	transform: translateY(3.7px) rotate(45deg);
}

.mlt-header__burger[aria-expanded="true"] .mlt-header__burger-lines span:nth-child(4) {
	transform: translateY(-3.7px) rotate(-45deg);
}

.mlt-header__logo:focus-visible,
.mlt-header__devis:focus-visible,
.mlt-header__burger:focus-visible,
.mlt-header a:focus-visible {
	outline: none;
	box-shadow: var(--mlt-focus-ring);
}

/* -------------------- Boutique (home3) : recherche + panier -------------------- */
.mlt-header__icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--mlt-radius-pill);
	background: transparent;
	color: var(--mlt-color-texte);
	cursor: pointer;
	transition: color var(--mlt-duration) var(--mlt-ease), background-color var(--mlt-duration) var(--mlt-ease);
}

.mlt-header__icon:hover {
	color: var(--mlt-color-botanique);
	background: var(--mlt-color-ligne);
}

.mlt-header__icon:active {
	color: var(--mlt-color-olive);
}

.mlt-header__icon:focus-visible {
	outline: none;
	box-shadow: var(--mlt-focus-ring);
}

.mlt-header__cart-count {
	position: absolute;
	top: 4px;
	right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 var(--mlt-space-4);
	border-radius: var(--mlt-radius-pill);
	background: var(--mlt-color-ocre);
	color: var(--mlt-color-blanc);
	font-size: var(--mlt-fs-xsmall);
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.mlt-header__cart-count[data-count="0"] {
	background: var(--mlt-color-texte-doux);
}

.mlt-search {
	position: absolute;
	top: 100%;
	left: var(--mlt-gutter);
	right: var(--mlt-gutter);
	z-index: 55;
	padding: var(--mlt-space-16);
	border-radius: var(--mlt-radius-card);
	background: var(--mlt-color-blanc);
	box-shadow: 0 24px 48px -24px var(--mlt-color-ombre);
}

.mlt-search[hidden] {
	display: none;
}

.mlt-search__form {
	display: flex;
	gap: var(--mlt-space-8);
	max-width: 1440px;
	margin: 0 auto;
}

.mlt-search__input {
	flex: 1;
	min-width: 0;
	min-height: 48px;
	padding: 0 var(--mlt-space-16);
	border: 1px solid var(--mlt-color-ligne);
	border-radius: var(--mlt-radius-pill);
	color: var(--mlt-color-texte);
	font-family: inherit;
	font-size: var(--mlt-fs-body);
}

.mlt-search__input:focus-visible {
	outline: none;
	border-color: var(--mlt-color-botanique);
	box-shadow: var(--mlt-focus-ring);
}

/* =========================================================
   Menu — mobile / tablette : panneau sous le header, mega-menu en accordéon
   ========================================================= */
.mlt-header__nav {
	display: none;
	position: absolute;
	top: 100%;
	left: var(--mlt-gutter);
	right: var(--mlt-gutter);
	max-height: calc(100vh - 96px);
	overflow-y: auto;
	padding: var(--mlt-space-8) var(--mlt-space-24) var(--mlt-space-24);
	border-radius: var(--mlt-radius-card);
	background: var(--mlt-color-blanc);
	box-shadow: 0 24px 48px -24px var(--mlt-color-ombre);
}

.mlt-header.is-open .mlt-header__nav {
	display: block;
}

.mlt-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mlt-menu > .menu-item + .menu-item {
	border-top: 1px solid var(--mlt-color-ligne);
}

.mlt-menu__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--mlt-space-8);
	padding: var(--mlt-space-16) 0;
	border-radius: var(--mlt-space-4);
	color: var(--mlt-color-texte);
	font-weight: 500;
	text-decoration: none;
	transition: color var(--mlt-duration) var(--mlt-ease);
}

.mlt-menu__link:hover,
.mlt-menu .current-menu-item > .mlt-menu__link {
	color: var(--mlt-color-botanique);
}

.mlt-menu__link:active {
	color: var(--mlt-color-olive);
}

.mlt-menu__chevron {
	width: 8px;
	height: 8px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--mlt-duration) var(--mlt-ease);
}

.mlt-menu .has-mega.is-open > .mlt-menu__link .mlt-menu__chevron {
	margin-top: 3px;
	transform: rotate(-135deg);
}

/* Panneau mega-menu : replié par défaut en mobile */
.mlt-mega {
	display: none;
	padding: 0 0 var(--mlt-space-16);
}

.mlt-menu .has-mega.is-open > .mlt-mega {
	display: block;
}

.mlt-mega__inner {
	display: grid;
	gap: var(--mlt-space-24);
	padding: 0;
}

.mlt-mega__columns {
	display: grid;
	gap: var(--mlt-space-16);
}

.mlt-mega__col {
	display: grid;
	align-content: start; /* colonnes de hauteurs égales (flex) : les rangées ne s'étirent pas */
	gap: var(--mlt-space-4);
}

.mlt-mega__col-title {
	padding: var(--mlt-space-4) 0;
	color: var(--mlt-color-olive);
	font-size: var(--mlt-fs-small);
	font-weight: 700;
	text-decoration: none;
}

a.mlt-mega__col-title:hover {
	color: var(--mlt-color-botanique);
}

/* Titre / entrée sans destination (lien « # » en base) : affiché comme un intitulé, non cliquable */
span.mlt-mega__col-title {
	display: block;
}

.mlt-mega__texte {
	display: block;
	padding: var(--mlt-space-8) 0;
	color: var(--mlt-color-texte-doux);
	font-size: var(--mlt-fs-small);
}

.mlt-mega__col-list {
	display: grid;
	gap: 0;
	margin: 0;
	padding: 0 0 0 var(--mlt-space-16);
	list-style: none;
	border-left: 2px solid var(--mlt-color-ligne);
}

.mlt-mega__col-list a {
	display: block;
	padding: var(--mlt-space-8) 0;
	color: var(--mlt-color-texte-doux);
	font-size: var(--mlt-fs-small);
	text-decoration: none;
	transition: color var(--mlt-duration) var(--mlt-ease);
}

.mlt-mega__col-list a:hover {
	color: var(--mlt-color-botanique);
}

.mlt-mega__col-list a:active {
	color: var(--mlt-color-olive);
}

/* Vignettes avec photo (hook mlt_mega_menu_extra) */
.mlt-mega__tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--mlt-space-16);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mlt-mega__tile a {
	display: block;
	border-radius: var(--mlt-radius-card);
	color: var(--mlt-color-texte);
	text-decoration: none;
}

.mlt-header .mlt-mega__tile-img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	margin-bottom: var(--mlt-space-8);
	border-radius: var(--mlt-radius-card);
	object-fit: cover;
	background: var(--mlt-color-fond);
	transition: opacity var(--mlt-duration) var(--mlt-ease);
}

.mlt-mega__tile a:hover .mlt-mega__tile-img {
	opacity: 0.88;
}

.mlt-mega__tile-title {
	display: block;
	color: var(--mlt-color-olive);
	font-size: var(--mlt-fs-small);
	font-weight: 700;
}

.mlt-mega__tile-text {
	display: block;
	color: var(--mlt-color-texte-doux);
	font-size: var(--mlt-fs-small);
	line-height: 1.4;
}

.mlt-mega__tile a:hover .mlt-mega__tile-title {
	color: var(--mlt-color-botanique);
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* Bouton devis dans le panneau (mobile) */
.mlt-header__nav-cta {
	margin-top: var(--mlt-space-16);
}

@media (min-width: 768px) {
	.mlt-header__devis {
		display: inline-flex;
	}

	.mlt-header__actions {
		gap: var(--mlt-space-24);
	}

	.mlt-header__nav-cta {
		display: none;
	}

	.mlt-header__nav {
		left: auto;
		width: 420px;
	}
}

@media (min-width: 783px) {
	.admin-bar.mlt-vitrine .mlt-header {
		top: 32px;
	}
}

/* =========================================================
   Desktop (≥ 1280) : menu horizontal, mega-menu pleine largeur au survol / focus
   ========================================================= */
@media (min-width: 1280px) {
	.mlt-header__inner {
		padding: calc(49 * var(--mlt-u)) calc(73 * var(--mlt-u)) 0 calc(49 * var(--mlt-u));
		gap: var(--mlt-space-32);
	}

	.mlt-header__burger {
		display: none;
	}

	.mlt-header__actions {
		gap: var(--mlt-space-8);
	}

	.mlt-header__devis {
		margin-left: var(--mlt-space-16);
	}

	.mlt-search {
		left: calc(49 * var(--mlt-u));
		right: calc(73 * var(--mlt-u));
		margin-top: var(--mlt-space-16);
	}

	.mlt-header__nav,
	.mlt-header.is-open .mlt-header__nav {
		position: static;
		display: flex;
		flex: 1;
		justify-content: center;
		width: auto;
		max-height: none;
		overflow: visible;
		padding: 0;
		border-radius: 0;
		background: transparent;
		box-shadow: none;
	}

	.mlt-menu {
		display: flex;
		align-items: center;
		gap: var(--mlt-space-4);
	}

	.mlt-menu > .menu-item {
		position: static; /* le mega-menu s'étend sur la largeur du header */
	}

	.mlt-menu > .menu-item + .menu-item {
		border-top: 0;
	}

	.mlt-menu__link {
		justify-content: flex-start;
		padding: var(--mlt-space-8) var(--mlt-space-16);
		font-size: var(--mlt-fs-small);
		white-space: nowrap;
	}

	.mlt-menu .has-mega:hover > .mlt-menu__link .mlt-menu__chevron,
	.mlt-menu .has-mega:focus-within > .mlt-menu__link .mlt-menu__chevron {
		margin-top: 3px;
		transform: rotate(-135deg);
	}

	/* Mega-menu : panneau blanc sous le header */
	.mlt-mega,
	.mlt-menu .has-mega.is-open > .mlt-mega {
		display: block;
		position: absolute;
		top: 100%;
		left: calc(49 * var(--mlt-u));
		right: calc(73 * var(--mlt-u));
		z-index: 60;
		margin-top: var(--mlt-space-16);
		padding: 0;
		border-radius: var(--mlt-radius-panel);
		background: var(--mlt-color-blanc);
		box-shadow: 0 32px 64px -32px var(--mlt-color-ombre);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-8px);
		transition: opacity var(--mlt-duration) var(--mlt-ease), transform var(--mlt-duration) var(--mlt-ease), visibility 0s linear var(--mlt-duration);
	}

	/* Zone tampon : le survol ne se perd pas entre le lien et le panneau */
	.mlt-mega::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 100%;
		height: var(--mlt-space-16);
	}

	.mlt-menu .has-mega:hover > .mlt-mega,
	.mlt-menu .has-mega:focus-within > .mlt-mega {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity var(--mlt-duration) var(--mlt-ease), transform var(--mlt-duration) var(--mlt-ease), visibility 0s;
	}

	/* Échap au clavier : mega-menu masqué même si le focus reste sur le déclencheur */
	.mlt-menu .has-mega.is-dismissed > .mlt-mega {
		opacity: 0;
		visibility: hidden;
		transform: translateY(-8px);
	}

	.mlt-mega__inner {
		display: flex;
		align-items: flex-start;
		gap: var(--mlt-space-64);
		padding: var(--mlt-space-48);
	}

	.mlt-mega__columns {
		display: flex;
		flex-wrap: wrap;
		gap: var(--mlt-space-48);
	}

	.mlt-mega__col {
		min-width: 180px;
		gap: var(--mlt-space-8);
	}

	.mlt-mega__col-title {
		padding-bottom: var(--mlt-space-8);
		border-bottom: 1px solid var(--mlt-color-ligne);
	}

	.mlt-mega__col-list {
		padding-left: 0;
		border-left: 0;
	}

	.mlt-mega__tiles {
		flex: 1;
		max-width: 520px;
		margin-left: auto;
		gap: var(--mlt-space-24);
	}

	.mlt-header__nav-cta {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mlt-mega,
	.mlt-menu__chevron,
	.mlt-header__burger-lines span {
		transition: none;
	}
}
