/* =========================================================================
   IWL – En-tête du site
   ========================================================================= */

/* L'en-tête IWL remplace celui du thème / de Header Footer Elementor */
body.iwl-has-header #masthead,
body.iwl-has-header #site-header,
body.iwl-has-header header.site-header,
body.iwl-has-header .elementor-location-header {
	display: none !important;
}

.iwl-hd {
	--hd-navy: var(--iwl-navy, #172D7B);
	--hd-coral: var(--iwl-coral, #FA7066);
	--hd-cream: var(--iwl-cream, #FCF7EE);
	--hd-yellow: var(--iwl-yellow, #FBC66A);
	--hd-ink: #2B2F3A;
	--hd-muted: #5A5F6E;
	--hd-line: #ECE6DA;
	position: sticky;
	top: 0;
	z-index: 999;
	font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-size: 16px;
	line-height: 1.4;
	color: var(--hd-ink);
}
body.admin-bar .iwl-hd { top: 32px; }
@media (max-width: 782px) { body.admin-bar .iwl-hd { top: 0; } }

.iwl-hd *, .iwl-hd *::before, .iwl-hd *::after { box-sizing: border-box; }
.iwl-hd a { text-decoration: none; }
.iwl-hd ul { list-style: none; margin: 0; padding: 0; }
.iwl-hd ul li::before { content: none; }
.iwl-hd .iwl-hd__svg { display: block; flex: none; }
.iwl-hd .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.iwl-hd a:focus-visible,
.iwl-hd button:focus-visible {
	outline: 3px solid var(--hd-yellow);
	outline-offset: 2px;
	border-radius: 8px;
}
.iwl-hd__wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---- Bandeau du haut ---- */
.iwl-hd__top { background: var(--hd-navy); color: #fff; font-size: 14px; }
.iwl-hd__top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.iwl-hd__promo { margin: 0; font-weight: 700; }
.iwl-hd__promo a { color: #fff; }
.iwl-hd__promo a:hover { color: var(--hd-yellow); }
.iwl-hd__socials { display: flex; gap: 6px; margin-left: auto; }
.iwl-hd__social {
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; border-radius: 50%;
	color: #fff; background: rgba(255, 255, 255, .1);
	transition: background .2s, color .2s;
}
.iwl-hd__social .iwl-hd__svg { width: 16px; height: 16px; }
.iwl-hd__social:hover { background: var(--hd-coral); color: #fff; }

/* ---- Barre principale ---- */
.iwl-hd__bar {
	background: rgba(255, 255, 255, .97);
	border-bottom: 1px solid var(--hd-line);
	box-shadow: 0 6px 24px rgba(23, 45, 123, .06);
	backdrop-filter: saturate(1.2) blur(6px);
}
.iwl-hd__bar-inner { display: flex; align-items: center; gap: 28px; min-height: 80px; }
.iwl-hd__logo { flex: none; display: block; }
.iwl-hd__logo img { display: block; height: 52px; width: auto; max-width: none; }
.iwl-hd__panel { flex: 1; display: flex; align-items: center; gap: 20px; }
.iwl-hd__nav { flex: 1; display: flex; justify-content: center; }
.iwl-hd__menu { display: flex; align-items: center; gap: 4px; }
.iwl-hd__item, .iwl-hd__menu > li { position: relative; }

.iwl-hd__link,
.iwl-hd__menu--wp > li > a {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 10px 12px; border-radius: 10px;
	background: none; border: 0; cursor: pointer;
	font: inherit; font-weight: 800; font-size: 15.5px; color: var(--hd-navy);
	transition: color .2s, background .2s;
}
.iwl-hd__link:hover,
.iwl-hd__menu--wp > li > a:hover,
.iwl-hd__toggle[aria-expanded="true"] { color: var(--hd-coral); background: var(--hd-cream); }
.iwl-hd__link[aria-current="page"],
.iwl-hd__menu--wp > li.current-menu-item > a {
	color: var(--hd-coral);
	box-shadow: inset 0 -3px 0 var(--hd-coral);
	border-radius: 10px 10px 0 0;
}
.iwl-hd__toggle .iwl-hd__svg { width: 18px; height: 18px; transition: transform .2s; }
.iwl-hd__toggle[aria-expanded="true"] .iwl-hd__svg { transform: rotate(180deg); }

/* ---- Méga-menu « Formations » ---- */
.iwl-hd__mega {
	position: absolute; left: 50%; top: calc(100% + 12px);
	width: 560px; transform: translateX(-50%);
	background: #fff; border: 1px solid var(--hd-line); border-radius: 18px;
	box-shadow: 0 24px 60px rgba(23, 45, 123, .16);
	padding: 14px; display: none;
}
.iwl-hd__mega::before {
	content: ""; position: absolute; top: -7px; left: 50%; width: 14px; height: 14px;
	background: #fff; border-left: 1px solid var(--hd-line); border-top: 1px solid var(--hd-line);
	transform: translateX(-50%) rotate(45deg);
}
.iwl-hd__item--has-sub.is-open > .iwl-hd__mega { display: block; }
@media (hover: hover) and (min-width: 1101px) {
	.iwl-hd__item--has-sub:hover > .iwl-hd__mega { display: block; }
	.iwl-hd__item--has-sub:hover > .iwl-hd__mega::after {
		content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px;
	}
}
.iwl-hd__mega-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.iwl-hd__mega-link {
	display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
	color: var(--hd-ink); transition: background .2s;
}
.iwl-hd__mega-link:hover { background: var(--hd-cream); }
.iwl-hd__mega-link img { width: 48px; height: 48px; flex: none; }
.iwl-hd__mega-link strong { display: block; font-family: 'Montserrat', system-ui, sans-serif; font-weight: 900; color: var(--hd-navy); font-size: 15.5px; }
.iwl-hd__mega-link small { display: block; color: var(--hd-muted); font-size: 13px; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.iwl-hd__mega-footer {
	display: flex; justify-content: space-between; gap: 12px;
	margin-top: 10px; padding: 12px 10px 4px; border-top: 1px dashed var(--hd-line);
}
.iwl-hd__mega-footer a { font-weight: 800; color: var(--hd-coral); font-size: 14.5px; }
.iwl-hd__mega-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Sous-menus d'un menu WordPress (Apparence > Menus) */
.iwl-hd__menu--wp .sub-menu {
	position: absolute; left: 0; top: 100%; min-width: 220px; padding: 8px;
	background: #fff; border: 1px solid var(--hd-line); border-radius: 14px;
	box-shadow: 0 18px 40px rgba(23, 45, 123, .14); display: none;
}
.iwl-hd__menu--wp li:hover > .sub-menu,
.iwl-hd__menu--wp li:focus-within > .sub-menu { display: block; }
.iwl-hd__menu--wp .sub-menu a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--hd-navy); font-weight: 700; }
.iwl-hd__menu--wp .sub-menu a:hover { background: var(--hd-cream); color: var(--hd-coral); }

/* ---- Boutons de connexion ---- */
.iwl-hd__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.iwl-hd__btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 11px 18px; border-radius: 999px; border: 2px solid transparent;
	font-weight: 800; font-size: 15px; line-height: 1.1; white-space: nowrap;
	transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.iwl-hd__btn:hover { transform: translateY(-1px); }
.iwl-hd__btn .iwl-hd__svg { width: 18px; height: 18px; }
.iwl-hd__btn--student { background: var(--hd-coral); color: #fff; }
.iwl-hd__btn--student:hover { background: var(--accent-hover, #E85A50); color: #fff; }
.iwl-hd__btn--teacher { border-color: var(--hd-navy); color: var(--hd-navy); background: #fff; }
.iwl-hd__btn--teacher:hover { background: var(--hd-navy); color: #fff; }

/* Utilisateur connecté */
.iwl-hd__user {
	display: inline-flex; align-items: center; gap: 10px;
	padding: 5px 14px 5px 5px; border-radius: 999px;
	background: var(--hd-cream); color: var(--hd-navy);
}
.iwl-hd__user:hover { background: #F6EEDF; }
.iwl-hd__avatar { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--hd-yellow); }
.iwl-hd__user small { display: block; font-size: 12px; color: var(--hd-muted); font-weight: 700; }
.iwl-hd__user strong { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.2; }
.iwl-hd__logout { font-size: 14px; font-weight: 700; color: var(--hd-muted); }
.iwl-hd__logout:hover { color: var(--hd-coral); }

/* ---- Bouton menu (mobile) ---- */
.iwl-hd__burger {
	display: none; margin-left: auto;
	width: 46px; height: 46px; border-radius: 12px; border: 0; cursor: pointer;
	background: var(--hd-cream); color: var(--hd-navy);
	align-items: center; justify-content: center; padding: 0;
}
.iwl-hd__burger .iwl-hd__svg { width: 24px; height: 24px; }
.iwl-hd__burger-close { display: none; }
.iwl-hd__burger[aria-expanded="true"] .iwl-hd__burger-open { display: none; }
.iwl-hd__burger[aria-expanded="true"] .iwl-hd__burger-close { display: block; }
.iwl-hd__panel-socials { display: none; }

/* ---- Écrans intermédiaires ---- */
@media (max-width: 1240px) {
	.iwl-hd__bar-inner { gap: 18px; }
	.iwl-hd__link, .iwl-hd__menu--wp > li > a { padding: 10px 9px; font-size: 15px; }
	.iwl-hd__btn { padding: 10px 14px; }
}

/* ---- Mobile et tablette ---- */
@media (max-width: 1100px) {
	.iwl-hd__top-inner { justify-content: center; }
	.iwl-hd__top .iwl-hd__socials { display: none; }
	.iwl-hd__bar-inner { min-height: 68px; }
	.iwl-hd__logo img { height: 42px; }
	.iwl-hd__burger { display: inline-flex; }
	.iwl-hd__panel {
		display: none; position: absolute; left: 0; right: 0; top: 100%;
		flex-direction: column; align-items: stretch; gap: 16px;
		background: #fff; border-bottom: 1px solid var(--hd-line);
		box-shadow: 0 24px 40px rgba(23, 45, 123, .14);
		padding: 12px 24px 24px; max-height: calc(100vh - 110px); overflow-y: auto;
	}
	.iwl-hd.is-open .iwl-hd__panel { display: flex; }
	.iwl-hd__bar { position: relative; }
	.iwl-hd__nav { display: block; }
	.iwl-hd__menu { flex-direction: column; align-items: stretch; gap: 0; }
	.iwl-hd__menu > li { border-bottom: 1px solid var(--hd-line); }
	.iwl-hd__link, .iwl-hd__menu--wp > li > a {
		width: 100%; justify-content: space-between; padding: 14px 4px; font-size: 17px; border-radius: 0;
	}
	.iwl-hd__link:hover, .iwl-hd__toggle[aria-expanded="true"] { background: none; }
	.iwl-hd__link[aria-current="page"] { box-shadow: none; }
	.iwl-hd__mega, .iwl-hd__menu--wp .sub-menu {
		position: static; width: auto; transform: none; box-shadow: none;
		border: 0; border-radius: 0; padding: 0 0 12px;
	}
	.iwl-hd__mega::before { display: none; }
	.iwl-hd__menu--wp li:focus-within > .sub-menu,
	.iwl-hd__menu--wp li:hover > .sub-menu { display: block; }
	.iwl-hd__mega-grid { grid-template-columns: 1fr; }
	.iwl-hd__mega-link img { width: 40px; height: 40px; }
	.iwl-hd__actions { flex-direction: column; align-items: stretch; }
	.iwl-hd__btn { justify-content: center; padding: 14px 18px; font-size: 16px; }
	.iwl-hd__user { justify-content: flex-start; }
	.iwl-hd__logout { text-align: center; padding: 6px; }
	.iwl-hd__panel-socials { display: block; }
	.iwl-hd__panel-socials .iwl-hd__socials { justify-content: center; margin: 0; }
	.iwl-hd__panel-socials .iwl-hd__social { width: 40px; height: 40px; background: var(--hd-cream); color: var(--hd-navy); }
	.iwl-hd__panel-socials .iwl-hd__social .iwl-hd__svg { width: 18px; height: 18px; }
}
@media (max-width: 480px) {
	.iwl-hd__wrap { padding: 0 16px; }
	.iwl-hd__promo { font-size: 13px; text-align: center; }
	.iwl-hd__logo img { height: 38px; }
	.iwl-hd__panel { padding: 8px 16px 20px; }
}
@media (prefers-reduced-motion: reduce) {
	.iwl-hd * { transition: none !important; }
}

/* Couleurs des boutons protégées contre les styles de liens globaux (thème, option « tout le site ») */
body .iwl-hd a.iwl-hd__btn--student,
body .iwl-hd a.iwl-hd__btn--student:hover,
body .iwl-hd a.iwl-hd__btn--student:focus { color: #fff; }
body .iwl-hd a.iwl-hd__btn--teacher { color: var(--hd-navy); }
body .iwl-hd a.iwl-hd__btn--teacher:hover,
body .iwl-hd a.iwl-hd__btn--teacher:focus { color: #fff; }
