/* =====================================================================
   Header du site (partials/home/header-04.php) - version 2, 2 nov. 2026
   - collant : la barre d'annonce défile, la barre de navigation reste (sticky, sans saut de mise en page)
   - se resserre après défilement ; fine barre de progression de lecture
   - repère glissant sous le lien survolé, posé par défaut sur la page active
   - sous-menus en carte, avec une icône par entrée
   Script : assets/js/csb-header.js (fixe --csb-topbar-h et les classes is-condensed / is-ready)
   ===================================================================== */

/* --- Collant --- */
.header-section-4 { position: sticky; top: calc(-1 * var(--csb-topbar-h, 0px)); z-index: 60; }
.header-section-4 .header-bottom {
	position: relative; background: rgba(255, 255, 255, .97);
	padding-top: 18px; padding-bottom: 18px;
	transition: padding .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, background-color .35s ease;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	.header-section-4 .header-bottom { background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: saturate(1.5) blur(12px); backdrop-filter: saturate(1.5) blur(12px); }
}
.header-section-4.is-condensed .header-bottom {
	padding-top: 10px; padding-bottom: 10px;
	box-shadow: 0 1px 0 rgba(0, 69, 64, .08), 0 18px 32px -24px rgba(0, 45, 40, .45);
}
@media (max-width: 1199px) {
	.header-section-4 .header-bottom { padding-top: 12px; padding-bottom: 12px; }
	.header-section-4.is-condensed .header-bottom { padding-top: 8px; padding-bottom: 8px; }
}

/* --- Logo : symbole + nom --- */
.csb-logo-lockup { display: inline-flex; align-items: center; gap: 12px; }
body .csb-logo-lockup .csb-logo-mark { width: 50px; height: 50px; max-width: none; flex: none; object-fit: contain; transition: width .35s ease, height .35s ease; }
body .header-section-4.is-condensed .csb-logo-lockup .csb-logo-mark { width: 40px; height: 40px; }
body .header-section-4 .csb-logo-lockup .csb-logo-text,
body .off-canvas-menubar .csb-logo-lockup .csb-logo-text { font-family: var(--csb-font-titre); font-weight: 600; font-size: 17px; line-height: 1.12; letter-spacing: -.005em; color: var(--theme-color-3); }
@media (max-width: 575px) {
	body .csb-logo-lockup .csb-logo-mark { width: 42px; height: 42px; }
	body .header-section-4 .csb-logo-lockup .csb-logo-text { font-size: 15px; }
}

/* --- Menu principal : repère glissant --- */
.header-section-4 .main-menu { position: relative; }
.header-section-4 .main-menu > ul { position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; }
body .header-section-4 .main-menu > ul > li > a,
body .header-section-4 .main-menu > ul > li:hover > a,
body .header-section-4 .main-menu > ul > li.csb-active > a { background: transparent; }
body .header-section-4 .main-menu > ul > li > a { font-size: 16px; font-weight: 500; padding: 8px 15px; color: var(--theme-color-3); transition: color .2s ease; }
body .header-section-4 .main-menu > ul > li.csb-active > a { font-weight: 600; }
@media (min-width: 1200px) and (max-width: 1399px) { body .header-section-4 .main-menu > ul > li > a { padding: 7px 11px; font-size: 15px; } }
.csb-nav-indicator {
	position: absolute; z-index: 0; top: 50%; left: 0; height: 40px; width: 0; border-radius: 999px;
	background: rgba(0, 69, 64, .08); opacity: 0; pointer-events: none;
	transform: translate3d(var(--x, 0px), -50%, 0); width: var(--w, 0px);
}
.header-section-4.is-ready .csb-nav-indicator { transition: transform .38s cubic-bezier(.2, .8, .2, 1), width .38s cubic-bezier(.2, .8, .2, 1), opacity .2s ease, background-color .2s ease; }
.csb-nav-indicator.is-visible { opacity: 1; }
.csb-nav-indicator.is-actif::after { /* petite marque jaune sous la page active */
	content: ""; position: absolute; left: 50%; bottom: -7px; width: 18px; height: 3px; margin-left: -9px; border-radius: 3px; background: var(--theme-color-2);
}
.csb-nav-indicator.is-survol { background: rgba(0, 69, 64, .1); }
.csb-nav-indicator.is-survol::after { opacity: 0; }
/* Sans script : retour à un fond simple sur la page active */
.header-section-4:not(.is-ready) .main-menu > ul > li.csb-active > a { background: rgba(0, 69, 64, .08); }

/* Signe +/- des entrées à sous-menu : chevron discret */
body .header-section-4 .main-menu ul .has-dropdown > a::after,
body .header-section-4 .main-menu ul .has-dropdown:hover > a::after,
body .header-section-4 .main-menu ul .has-dropdown:focus-within > a::after {
	content: "\f107"; font-family: var(--icon-font); font-weight: 400; font-size: 12px; margin-left: 2px; transform: none; transition: transform .25s ease;
}
body .header-section-4 .main-menu ul .has-dropdown:hover > a::after,
body .header-section-4 .main-menu ul .has-dropdown:focus-within > a::after { transform: rotate(180deg); }

/* --- Sous-menus en carte --- */
body .header-section-4 .main-menu ul .has-dropdown .sub-menu {
	top: calc(100% + 14px); left: 50%; min-width: 280px; width: max-content; max-width: 340px; padding: 10px;
	border-radius: 16px; border: 1px solid rgba(0, 69, 64, .08); background: #fff;
	box-shadow: 0 24px 48px -20px rgba(0, 40, 36, .35), 0 2px 6px rgba(0, 40, 36, .06);
	transform: translate(-50%, 8px); transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility .22s;
}
body .header-section-4 .main-menu ul .has-dropdown .sub-menu::before { /* zone de passage de la souris */
	content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px;
}
body .header-section-4 .main-menu ul .has-dropdown:hover .sub-menu,
body .header-section-4 .main-menu ul .has-dropdown:focus-within .sub-menu { top: calc(100% + 14px); transform: translate(-50%, 0); }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li { display: block; text-align: left; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a {
	width: 100%; justify-content: flex-start; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px;
	font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--theme-color-3); background: none; white-space: nowrap;
	transition: background-color .2s ease;
}
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a:hover,
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a:focus-visible { background: #F4F1E6; color: var(--theme-color-3); }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a[aria-current="page"] { background: rgba(0, 69, 64, .07); font-weight: 600; }
/* Sous-menus sans pictogramme (6 nov. 2026, retour du propriétaire) : petite ligne d'accent jaune au survol, verte sur la page active */
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a { position: relative; padding: 9px 12px 9px 18px; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a::before { content: ""; position: absolute; left: 6px; top: 50%; width: 3px; height: 0; border-radius: 2px; background: var(--theme-color-2); transform: translateY(-50%); transition: height .2s ease; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a:hover::before, body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a:focus-visible::before { height: 16px; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a[aria-current="page"]::before { height: 16px; background: var(--theme-color-3); }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li:first-child a { font-weight: 600; }
.main-menu .sub-menu li:first-child:not(:only-child) { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(0, 69, 64, .08); }

/* --- Boutons du header --- */
.header-section-4 .csb-header-btns .csb-btn-outline { min-height: 46px; font-weight: 600; font-size: 15px; }
.header-section-4.is-condensed .csb-header-btns .csb-btn-outline { min-height: 42px; }

/* --- Barre de progression de lecture --- */
.csb-header-progress {
	position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--theme-color-2);
	transform-origin: 0 50%; transform: scaleX(var(--csb-progress, 0)); opacity: 0; transition: opacity .3s ease;
}
.header-section-4.is-condensed .csb-header-progress { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
	.header-section-4 .header-bottom, .csb-logo-mark, .csb-nav-indicator, .header-section-4.is-ready .csb-nav-indicator, body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a::before,
	body .header-section-4 .main-menu ul .has-dropdown .sub-menu, .csb-header-progress { transition: none !important; }
}

/* --- Écrans 1200-1399 px : tout tient sur une ligne --- */
body .header-section-4 .main-menu > ul > li > a { white-space: nowrap; }
@media (min-width: 1200px) and (max-width: 1399px) {
	.header-section-4 .header-bottom-layout { column-gap: 16px; }
	body .header-section-4 .csb-logo-lockup .csb-logo-mark { width: 42px; height: 42px; }
	body .header-section-4 .csb-logo-lockup { gap: 10px; }
	body .header-section-4 .csb-logo-lockup .csb-logo-text { font-size: 15px; }
	body .header-section-4 .main-menu > ul > li > a { padding: 7px 9px; font-size: 15px; }
	.header-section-4 .csb-header-btns .csb-btn-outline { display: none; } /* « Se former » reste dans le menu (Formations) et dans le hero */
}

/* --- Icône panier --- */
.header-section-4 .csb-cart-link { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-right: 8px; border-radius: 50%; color: #004540; font-size: 20px; transition: background-color .2s; }
.header-section-4 .csb-cart-link:hover, .header-section-4 .csb-cart-link:focus-visible { background: rgba(0, 69, 64, .08); }
.header-section-4 .csb-cart-badge { position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #004540; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.header-section-4 .csb-cart-badge[hidden] { display: none; }
.header-right { display: flex; align-items: center; }
/* Très petits écrans (320 à 374 px) : logo + panier + menu tiennent sur une ligne (débordement de 34 px corrigé le 5 nov. 2026) */
@media (max-width: 374px) {
	.header-section-4 .csb-logo { height: 50px; }
	.header-section-4 .csb-cart-link { width: 42px; height: 42px; margin-right: 0; font-size: 19px; }
}

/* --- Entrée « Événements » ajoutée (6 nov. 2026) : 8 entrées tiennent sur une ligne de 1200 à 1699 px --- */
@media (min-width: 1400px) and (max-width: 1699px) {
	body .header-section-4 .main-menu > ul > li > a { padding: 8px 10px; font-size: 15.5px; }
	.header-section-4 .header-bottom-layout { column-gap: 20px; }
}
@media (min-width: 1200px) and (max-width: 1399px) {
	body .header-section-4 .main-menu > ul > li > a { padding: 7px 7px; font-size: 14.5px; }
	.header-section-4 .main-menu > ul { gap: 0; }
}

/* --- Sélecteur de langue (6 nov. 2026) : menu déroulant avec drapeaux, visible à toutes les largeurs ---
   <details> natif : s'ouvre au clic ou au clavier sans JavaScript ; csb-header.js le ferme au clic extérieur, avec Échap et au choix. */
.csb-langue { position: relative; margin-right: 12px; }
.csb-langue-btn {
	display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 10px 0 9px; border: 1px solid rgba(0, 69, 64, .18); border-radius: 999px;
	background: #fff; font-family: var(--csb-font-texte); font-size: 14px; font-weight: 700; letter-spacing: .03em; color: var(--theme-color-3);
	cursor: pointer; list-style: none; user-select: none; transition: border-color .2s ease, background-color .2s ease;
}
.csb-langue-btn::-webkit-details-marker { display: none; }
.csb-langue-btn::marker { content: ""; }
.csb-langue-btn:hover, .csb-langue[open] .csb-langue-btn { border-color: rgba(0, 69, 64, .45); background: #F7F6EF; }
.csb-langue-btn:focus-visible { outline: 2px solid var(--theme-color-3); outline-offset: 2px; }
.csb-drapeau { flex: none; width: 20px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.csb-langue-chevron { width: 12px; height: 12px; transition: transform .2s ease; }
.csb-langue[open] .csb-langue-chevron { transform: rotate(180deg); }
.csb-langue-liste {
	position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 176px; margin: 0; padding: 6px; list-style: none;
	border: 1px solid rgba(0, 69, 64, .1); border-radius: 12px; background: #fff; box-shadow: 0 18px 36px -18px rgba(0, 40, 36, .4), 0 2px 6px rgba(0, 40, 36, .06);
}
.csb-langue-liste a {
	display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-family: var(--csb-font-texte); font-size: 15px; font-weight: 500;
	color: var(--theme-color-3); text-decoration: none; transition: background-color .15s ease;
}
.csb-langue-liste a:hover, .csb-langue-liste a:focus-visible { background: #F4F1E6; outline: none; }
.csb-langue-liste a[aria-current="true"] { font-weight: 700; background: rgba(0, 69, 64, .06); }
.csb-langue-liste a[aria-current="true"]::after { content: ""; width: 7px; height: 7px; margin-left: 2px; border-radius: 50%; background: var(--theme-color-2); box-shadow: 0 0 0 2px rgba(0, 69, 64, .2); }
.csb-langue-liste .csb-langue-nom { flex: 1; }
.csb-langue-liste .csb-langue-code { font-size: 12px; font-weight: 600; letter-spacing: .05em; color: rgba(0, 69, 64, .55); }
@media (max-width: 1199px) { .csb-langue { margin-right: 0; } }
@media (max-width: 374px) { .csb-langue-btn { gap: 5px; padding: 0 7px; min-height: 36px; } .csb-langue-btn .csb-langue-code { display: none; } }
@media (prefers-reduced-motion: reduce) { .csb-langue-btn, .csb-langue-chevron, .csb-langue-liste a { transition: none; } }

/* Mobile : logo un peu plus petit pour loger le sélecteur de langue à côté du panier et du menu (aucun débordement jusqu'à 320 px) */
@media (max-width: 575px) {
	.header-section-4 .csb-logo { height: 42px; width: auto; }
	.header-section-4 .csb-cart-link { width: 40px; height: 40px; margin-right: 2px; }
}
@media (max-width: 374px) {
	.header-section-4 .csb-logo { height: 34px; }
	.header-section-4 .csb-cart-link { width: 36px; height: 36px; font-size: 18px; }
}
@media (max-width: 1199px) {
	.header-section-4 .header-right { gap: 8px; }
	.header-section-4 .header-bottom-layout { column-gap: 12px; }
	.csb-langue { margin-right: 0; }
}
@media (max-width: 374px) { .header-section-4 .header-right { gap: 4px; } }

/* --- Sélecteur de langue minimaliste (6 nov. 2026) : drapeaux seuls ---
   Bouton = drapeau de la langue en cours ; menu = deux drapeaux. Les noms « Français » / « English » restent lisibles
   par les lecteurs d'écran (texte masqué visuellement) et le libellé du bouton annonce la langue actuelle. */
.csb-langue-btn { gap: 0; min-width: 40px; min-height: 40px; padding: 0; justify-content: center; border: 0; border-radius: 8px; background: transparent; }
.csb-langue-btn:hover, .csb-langue[open] .csb-langue-btn { background: rgba(0, 69, 64, .06); }
.csb-langue-btn .csb-langue-code, .csb-langue-btn .csb-langue-chevron { display: none; }
.csb-drapeau { width: 22px; height: 15px; }
.csb-langue-liste { left: 50%; right: auto; min-width: 0; padding: 4px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 2px; border-radius: 10px; }
.csb-langue-liste a { justify-content: center; gap: 0; width: 40px; height: 34px; padding: 0; }
.csb-langue-liste a[aria-current="true"] { background: rgba(0, 69, 64, .08); }
.csb-langue-liste a[aria-current="true"]::after { display: none; }
.csb-langue-liste .csb-langue-nom, .csb-langue-liste .csb-langue-code {
	position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.csb-langue-liste a { position: relative; }

/* Chevron des entrées à sous-menu : boîte propre (inline-block) pour que la rotation à l'ouverture soit rendue de façon identique sur toutes les entrées */
body .header-section-4 .main-menu ul .has-dropdown > a::after { display: inline-block; line-height: 1; vertical-align: middle; transform-origin: 50% 50%; }

/* Panier : dans le menu hamburger sur mobile et tablette (< 1200 px), icône dans l'en-tête sur ordinateur (6 nov. 2026) */
.csb-offcanvas-cart { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; color: #004540; }
.csb-offcanvas-cart i { font-size: 20px; }
.csb-offcanvas-cart .csb-cart-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #004540; color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
.csb-offcanvas-cart .csb-cart-badge[hidden] { display: none; }

/* Menu principal : éléments plus espacés (6 nov. 2026) */
.header-section-4 .main-menu > ul { gap: 10px; }
body .header-section-4 .main-menu > ul > li > a { padding: 8px 17px; }
@media (min-width: 1200px) and (max-width: 1399px) { .header-section-4 .main-menu > ul { gap: 4px; } body .header-section-4 .main-menu > ul > li > a { padding: 7px 12px; } }

/* Sous-menus minimalistes, alignés sur l'élément de menu (6 nov. 2026) : plus étroits, bord gauche et texte alignés sur le lien parent */
body .header-section-4 .main-menu ul .has-dropdown .sub-menu {
	left: 0; min-width: 0; width: max-content; max-width: 260px; padding: 6px;
	border-radius: 12px; border: 1px solid rgba(0, 69, 64, .08);
	box-shadow: 0 14px 30px -18px rgba(0, 40, 36, .3);
	transform: translate(0, 6px);
}
body .header-section-4 .main-menu ul .has-dropdown:hover .sub-menu,
body .header-section-4 .main-menu ul .has-dropdown:focus-within .sub-menu { top: calc(100% + 10px); transform: translate(0, 0); }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a { padding: 8px 11px; font-size: 14.5px; font-weight: 500; border-radius: 8px; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li a::before { left: 2px; }
body .header-section-4 .main-menu ul .has-dropdown .sub-menu li:first-child a { font-weight: 600; }
.main-menu .sub-menu li:first-child:not(:only-child) { margin-bottom: 3px; padding-bottom: 3px; }
