/* =====================================================================
   FAFECA - HEADER STYLES
   ===================================================== */

.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	height: var(--header-height, 80px);
	transition: background .3s ease, box-shadow .3s ease;
}

/* Transparent header (front page) */
.header--transparent {
	background: transparent;
}

.header--transparent .nav-link,
.header--transparent .text-logo {
	color: rgba(255, 255, 255, .92);
}

.header--transparent .nav-link:hover {
	color: #fff;
}

.header--transparent .logo-white { display: block; }
.header--transparent .logo-default { display: none; }

/* Default: white header */
.site-header:not(.header--transparent),
.site-header.scrolled {
	background: #ffffff;
	box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
}

.site-header:not(.header--transparent) .logo-white { display: none; }
.site-header:not(.header--transparent) .logo-default { display: block; }
.header--transparent.scrolled .logo-white { display: none; }
.header--transparent.scrolled .logo-default { display: block; }

.header--dark {
	background: var(--color-primary);
}

/* Scrolled state */
.header--sticky.scrolled {
	background: var(--sticky-bg, #ffffff) !important;
	box-shadow: 0 2px 24px rgba(0, 0, 0, .1);
}

.header--sticky.scrolled .nav-link {
	color: var(--color-dark) !important;
}

.header--sticky.scrolled .logo-white { display: none !important; }
.header--sticky.scrolled .logo-default { display: block !important; }

/* =====================================================================
   HEADER INNER LAYOUT
   ===================================================== */
.header-inner {
	display: flex;
	align-items: center;
	height: 100%;
	gap: 2rem;
}

/* Logo */
.header-logo {
	flex-shrink: 0;
	line-height: 0;
}

.header-logo a {
	display: flex;
	align-items: center;
}

.header-logo img {
	height: 38px;
	width: auto;
	max-width: 180px;
	object-fit: contain;
	transition: opacity .2s;
}

.text-logo,
.footer-text-logo {
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: .08em;
	color: inherit;
}

/* Navigation */
.header-nav {
	flex: 1;
	display: flex;
	justify-content: center;
}

.nav-menu {
	display: flex;
	align-items: center;
	gap: .25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-menu li {
	position: relative;
}

.nav-link {
	display: flex;
	align-items: center;
	gap: .2rem;
	padding: .5rem .85rem;
	font-size: .92rem;
	font-weight: 500;
	color: var(--color-dark);
	border-radius: var(--radius-md);
	transition: color .2s, background .2s;
	white-space: nowrap;
}

.nav-link:hover,
.current-menu-item > .nav-link,
.current-menu-ancestor > .nav-link {
	color: var(--color-red);
}

.current-menu-item > .nav-link {
	font-weight: 600;
}

/* Wrapper lien-texte + bouton-flèche (items avec sous-menu) */
.nav-link-wrap {
	display: flex;
	align-items: center;
}
.nav-link-wrap .nav-link {
	flex: 1;
}

/* Flèche décorative desktop via pseudo-élément sur le lien */
.nav-link-wrap .nav-link::after {
	content: '\EA4E'; /* ri-arrow-down-s-line */
	font-family: 'remixicon';
	font-size: .9rem;
	margin-left: .2rem;
	transition: transform .2s;
	display: inline-block;
}
.menu-item-has-children:hover .nav-link-wrap .nav-link::after,
.menu-item-has-children:focus-within .nav-link-wrap .nav-link::after {
	transform: rotate(-180deg);
}

/* Bouton-flèche : uniquement sur mobile/tablette */
.submenu-toggle {
	display: none; /* caché sur desktop */
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	padding: .5rem .6rem;
	cursor: pointer;
	color: inherit;
	border-radius: var(--radius-sm);
	transition: color .2s, background .2s;
	flex-shrink: 0;
}
.submenu-toggle:hover { background: rgba(0,0,0,.06); }

.dropdown-arrow {
	font-size: .9rem;
	transition: transform .2s;
	display: block;
}

/* Desktop : rotation au survol du <li> parent */
.menu-item-has-children:hover .dropdown-arrow,
.menu-item-has-children:focus-within .dropdown-arrow {
	transform: rotate(-180deg);
}

/* Desktop : dropdown toujours en texte sombre (blanc sur header transparent sinon) */
.dropdown-menu .nav-link,
.header--transparent .dropdown-menu .nav-link {
	color: var(--color-dark) !important;
}
.dropdown-menu .nav-link:hover,
.header--transparent .dropdown-menu .nav-link:hover {
	color: var(--color-primary) !important;
}

/* Dropdown */
.dropdown-menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	background: #fff;
	border-radius: var(--radius-md);
	box-shadow: 0 8px 32px rgba(0,0,0,.12);
	min-width: 220px;
	padding: .5rem;
	list-style: none;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%) translateY(-8px);
	transition: opacity .2s, transform .2s, visibility .2s;
	z-index: 100;
}

.menu-item-has-children:hover .dropdown-menu,
.menu-item-has-children:focus-within .dropdown-menu {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.dropdown-menu li a {
	display: block;
	padding: .6rem 1rem;
	font-size: .9rem;
	color: var(--color-dark);
	border-radius: var(--radius-sm);
	transition: background .15s, color .15s;
}

.dropdown-menu li a:hover {
	background: var(--color-light);
	color: var(--color-primary);
}

/* Arrow indicator for active dropdown items */
.dropdown-menu li.current-menu-item a {
	color: var(--color-red);
	font-weight: 600;
}

/* =====================================================
   HEADER ACTIONS
   ===================================================== */
.header-actions {
	display: flex;
	align-items: center;
	gap: .75rem;
	flex-shrink: 0;
}

.header-cta {
	padding: .6rem 1.4rem;
	font-size: .88rem;
}

/* Language Switcher */
.lang-switcher {
	position: relative;
}

.lang-switcher .language-switcher,
.lang-switcher ul {
	display: flex;
	gap: .4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lang-switcher a {
	display: flex;
	align-items: center;
	gap: .35rem;
	font-size: .82rem;
	font-weight: 600;
	padding: .35rem .6rem;
	border-radius: var(--radius-sm);
	border: 1.5px solid transparent;
	color: inherit;
	transition: all .2s;
}

.lang-switcher a:hover,
.lang-switcher li.active a {
	border-color: currentColor;
}

.lang-switcher img {
	width: 18px;
	height: 12px;
	object-fit: cover;
	border-radius: 2px;
}

.lang-switcher-fallback {
	font-size: .82rem;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: .4rem;
	opacity: .8;
}

/* Language switcher dropdown */
.lang-switcher {
	position: relative;
	display: inline-flex;
}
.lang-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	font-size: .78rem;
	font-weight: 700;
	padding: .3rem .6rem;
	border-radius: 7px;
	border: 1.5px solid transparent;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: all .2s;
	letter-spacing: .03em;
	white-space: nowrap;
}
.lang-switcher__toggle:hover,
.lang-switcher--open .lang-switcher__toggle {
	border-color: rgba(255,255,255,.4);
	background: rgba(255,255,255,.1);
}
.header--sticky:not(.header--transparent) .lang-switcher__toggle:hover,
.header--sticky:not(.header--transparent) .lang-switcher--open .lang-switcher__toggle {
	border-color: rgba(0,46,109,.2);
	background: rgba(0,46,109,.06);
}
.lang-switcher__flag { font-size: 1rem; line-height: 1; }
.lang-switcher__code { font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.lang-switcher__arrow {
	font-size: .9rem;
	transition: transform .2s;
	opacity: .7;
}
.lang-switcher--open .lang-switcher__arrow { transform: rotate(180deg); }

.lang-switcher__dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 140px;
	background: #fff;
	border: 1.5px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0,0,0,.12);
	list-style: none;
	margin: 0;
	padding: .35rem;
	z-index: 9999;
	overflow: hidden;
}
.lang-switcher--open .lang-switcher__dropdown { display: block; }

.lang-item {
	display: flex;
	align-items: center;
	gap: .55rem;
	padding: .55rem .75rem;
	border-radius: 7px;
	font-size: .85rem;
	font-weight: 600;
	color: #374151;
	text-decoration: none;
	transition: background .15s, color .15s;
}
.lang-item:hover { background: #f3f4f6; color: #002E6D; }
.lang-item--active { background: rgba(0,46,109,.07); color: #002E6D; font-weight: 700; }
.lang-item__flag { font-size: 1.15rem; line-height: 1; }
.lang-item__label { flex: 1; }

/* Mobile Menu Toggle */
.mobile-menu-toggle {
	display: none;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-sm);
	border: 1.5px solid var(--color-border);
	background: transparent;
	align-items: center;
	justify-content: center;
	font-size: 1.25rem;
	color: var(--color-dark);
	cursor: pointer;
	transition: all .2s;
}

.header--transparent .mobile-menu-toggle {
	color: #fff;
	border-color: rgba(255,255,255,.3);
}

.mobile-menu-toggle:hover {
	background: var(--color-light);
}

/* Body padding to compensate fixed header */
body {
	padding-top: 0; /* set by JS based on header height */
}

body:not(.has-transparent-header) .site-main {
	padding-top: var(--header-height, 80px);
}

/* =====================================================
   BACK TO TOP
   ===================================================== */
#back-to-top {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	z-index: 999;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--color-red);
	color: #fff;
	font-size: 1.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(215,25,32,.4);
	transition: all .25s;
	cursor: pointer;
	border: none;
	opacity: 0;
	transform: translateY(10px);
}

#back-to-top.visible {
	opacity: 1;
	transform: translateY(0);
	display: flex !important;
}

#back-to-top:hover {
	background: var(--color-primary);
	transform: translateY(-3px);
}

/* =====================================================
   MOBILE OVERLAY
   ===================================================== */
.mobile-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.5);
	z-index: 998;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s, visibility .3s;
}

.mobile-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Logo dans le panneau mobile (caché sur desktop) */
.nav-logo {
	display: none;
}

/* =====================================================
   RESPONSIVE HEADER  ≤1024px
   ===================================================== */
@media (max-width: 1024px) {

	/* ── 1. CTA masqués ── */
	.header-cta,
	.header-donation-btn { display: none !important; }

	/* ── 2. Hamburger visible ET poussé à droite ──
	   Quand .header-nav passe en position:fixed il sort du flux,
	   il ne reste que logo + actions → margin-left:auto colle
	   actions à droite. */
	.header-inner { gap: .75rem; }
	.header-actions { margin-left: auto; }
	.mobile-menu-toggle { display: flex; }

	/* ── 3. Panneau de navigation (glisse depuis la gauche) ── */
	.header-nav {
		position: fixed;
		top: 0;
		left: -100%;
		right: auto;
		height: 100vh;
		width: min(300px, 85vw);
		background: #fff;
		z-index: 999;
		flex-direction: column;
		justify-content: flex-start;
		padding: 0 0 2rem;
		overflow-y: auto;
		overflow-x: hidden;
		transition: left .3s cubic-bezier(.4,0,.2,1);
		box-shadow: 4px 0 24px rgba(0,0,0,.12);
	}
	.header-nav.mobile-open { left: 0; }

	/* ── 4. Logo interne au panneau ── */
	.nav-logo {
		display: flex;
		align-items: center;
		flex-shrink: 0;
		padding: 1.25rem 1.5rem;
		border-bottom: 1px solid var(--color-border, #E5E7EB);
		margin-bottom: .5rem;
		position: sticky;
		top: 0;
		background: #fff;
		z-index: 1;
	}
	.nav-logo img {
		height: 36px;
		width: auto;
		max-width: 160px;
		object-fit: contain;
	}

	/* ── 5. Liste des liens ── */
	.nav-menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		width: 100%;
		padding: .5rem .75rem;
		box-sizing: border-box;
	}
	.nav-menu > li { position: static; }

	/* ── 6. Liens — texte toujours sombre dans le panneau blanc ── */
	/* nav-link-wrap : lien texte + bouton flèche côte à côte */
	.nav-link-wrap {
		align-items: stretch;
		border-radius: var(--radius-md);
		overflow: hidden;
	}
	.nav-link-wrap .nav-link {
		flex: 1;
		border-radius: 0;
		padding: .85rem 1rem;
	}
	/* Masquer la flèche pseudo-élément dans le panneau mobile */
	.nav-link-wrap .nav-link::after { display: none; }

	/* Bouton-flèche visible uniquement sur mobile/tablette */
	.submenu-toggle {
		display: flex;
		padding: .5rem .85rem;
		border-radius: 0;
		border-left: 1px solid var(--color-border, #E5E7EB);
		color: var(--color-dark);
	}
	.submenu-toggle:hover { background: var(--color-light); }

	.header-nav .nav-link {
		display: flex;
		align-items: center;
		padding: .85rem 1rem;
		border-radius: var(--radius-md);
		font-size: 1rem;
		font-weight: 500;
		color: var(--color-dark) !important;
		white-space: normal;
		width: 100%;
		box-sizing: border-box;
	}
	.header-nav .nav-link:hover { background: var(--color-light); }
	.header-nav .current-menu-item > .nav-link,
	.header-nav .current-menu-ancestor > .nav-link {
		color: var(--color-red) !important;
		font-weight: 600;
	}

	/* ── 7. Sous-menus : reset total des styles desktop ──
	   La règle desktop .menu-item-has-children:hover .dropdown-menu
	   a une spécificité 0,3,0 → elle écrase transform:none (0,1,0).
	   On la neutralise avec !important sur position, transform, etc. */
	.dropdown-menu {
		position: static !important;
		left: auto !important;
		transform: none !important;
		box-shadow: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		transition: none !important;
		background: var(--color-light, #F8F9FA);
		border-radius: var(--radius-md);
		margin: .25rem 0 .5rem;
		padding: .25rem;
		min-width: 0;
		width: 100%;
		box-sizing: border-box;
		display: none;
		z-index: auto;
	}
	/* :hover/:focus-within desktop → annuler transform qui décentre */
	.menu-item-has-children:hover .dropdown-menu,
	.menu-item-has-children:focus-within .dropdown-menu {
		transform: none !important;
		/* laisser display contrôlé par .open ci-dessous */
	}
	.dropdown-menu.open { display: block !important; }

	.dropdown-menu > li {
		width: 100%;
		position: static;
	}
	.dropdown-menu > li > a {
		display: block !important;
		width: 100%;
		padding: .65rem 1rem !important;
		font-size: .92rem !important;
		color: var(--color-dark) !important;
		border-radius: var(--radius-sm);
		white-space: normal !important;
		box-sizing: border-box;
		font-weight: 400;
	}
	.dropdown-menu > li > a:hover {
		background: rgba(0,46,109,.08);
		color: var(--color-primary) !important;
	}

	/* ── 8. Sélecteur de langue : masqué dans la barre header, visible dans le footer du panneau ── */
	.header-actions .lang-switcher { display: none; }

	/* ── 9. Footer du panneau mobile ── */
	.nav-mobile-footer {
		padding: 1rem 1rem .75rem;
		border-top: 1px solid var(--color-border, #E5E7EB);
		margin-top: .5rem;
	}
	.nav-mobile-footer .lang-switcher {
		display: flex !important;
		width: 100%;
	}
	.nav-mobile-footer .lang-switcher__toggle {
		width: 100%;
		justify-content: flex-start;
		background: var(--color-light, #F8F9FA);
		border-radius: var(--radius-md, 8px);
		color: var(--color-dark, #1E293B) !important;
		padding: .75rem 1rem;
		font-size: .95rem;
		gap: .5rem;
	}
	.nav-mobile-footer .lang-switcher__dropdown {
		position: static;
		display: none;
		box-shadow: none;
		border: 1px solid var(--color-border, #E5E7EB);
		border-radius: var(--radius-md, 8px);
		margin-top: .375rem;
		width: 100%;
	}
	.nav-mobile-footer .lang-switcher--open .lang-switcher__dropdown { display: block; }
}

/* ── Donation button — blue base, green sweep (same animation as primary) ── */
.header-donation-btn {
    background: var(--color-primary, #002E6D) !important;
    padding: .6rem 1.4rem !important;
    font-size: .88rem !important;
    line-height: inherit !important;
    font-family: inherit !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.header-donation-btn::before { background: #009739 !important; }
.header-donation-btn:hover, .header-donation-btn:focus-visible { box-shadow: 0 6px 22px rgba(0,151,57,.32) !important; }
