/**
 * Unified site header — SINGLE SOURCE for FSE and public routes.
 *
 * Markup is rendered by `Enel_Health_Core_Site_Header::render()`.
 * FM nav/footer visual styling lives in theme `site-chrome.css` (body.eh-joinenel-chrome).
 */

/* Legacy header rules — kept for fallback if theme chrome CSS is unavailable */
.eh-header {
	position: sticky;
	top: 0;
	z-index: 30;
	margin: 0;
	background: rgba(255, 255, 255, 0.88);
	color: #0a1f1e;
	border-bottom: 1px solid rgba(208, 213, 221, 0.75);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.admin-bar .eh-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .eh-header {
		top: 46px;
	}
}

.eh-header__inner {
	box-sizing: border-box;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 clamp(1rem, 4vw, 2rem);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem;
	min-height: 76px;
}

.eh-brand {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
	max-width: min(100%, 22rem);
}

.eh-site-logo {
	display: flex;
	flex-shrink: 0;
	text-decoration: none;
}

.eh-site-logo img {
	display: block;
	width: 44px;
	height: 44px;
	border-radius: 0.9rem;
	object-fit: cover;
}

.eh-brand__text {
	display: flex;
	flex-direction: column;
	gap: 0;
	min-width: 0;
}

.eh-site-title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.04em;
}

.eh-site-title a {
	color: #0a1f1e;
	text-decoration: none;
}

.eh-site-title a:hover {
	color: #0e6b5c;
}

.eh-site-tagline {
	margin: 0;
	font-size: 0.8125rem;
	color: #5c6b69;
	font-weight: 400;
	line-height: 1.35;
}

.eh-header__nav {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-end;
	gap: 1rem 1.25rem;
	flex: 1 1 auto;
	min-width: 0;
}

.eh-navigation {
	display: flex;
	min-width: 0;
	flex: 1 1 auto;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.eh-navigation::-webkit-scrollbar {
	display: none;
}

.eh-navigation__list {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
	align-items: center;
	gap: 0.25rem 1.15rem;
	list-style: none;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.eh-navigation__item {
	margin: 0;
}

.eh-navigation__link {
	display: inline-block;
	padding: 0.4rem 0.35rem;
	color: #0a1f1e;
	text-decoration: none;
	font-size: 0.9375rem;
	font-weight: 650;
	letter-spacing: -0.005em;
	white-space: nowrap;
	border-bottom: none;
}

.eh-navigation__link:hover,
.eh-navigation__link:focus-visible {
	color: #0a1f1e;
	text-decoration: none;
}

.eh-navigation__link[aria-current="page"] {
	font-weight: 800;
	text-decoration: underline;
	text-decoration-color: #0a1f1e;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.32rem;
}

.eh-header__cta {
	display: flex;
	flex-shrink: 0;
	align-items: center;
}

/* --- Safety overrides: when the FSE template's own wp:navigation slips through --- */
.eh-header .eh-navigation a,
.eh-header .eh-navigation .wp-block-navigation-item__content {
	color: #0a1f1e;
	text-decoration: none;
	font-size: 0.9375rem;
	font-weight: 650;
	letter-spacing: -0.005em;
}

.eh-header .eh-navigation a[aria-current="page"],
.eh-header .eh-navigation .current-menu-item > .wp-block-navigation-item__content {
	font-weight: 800;
	text-decoration: underline;
	text-decoration-color: #0a1f1e;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.32rem;
}

/* Mobile hamburger nav */
.eh-header__menu-btn {
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.35rem;
	height: 2.35rem;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(10, 31, 30, 0.12);
	border-radius: 999px;
	background: #fff;
	color: #0a1f1e;
	cursor: pointer;
	flex-shrink: 0;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eh-header__menu-btn:hover,
.eh-site-header.is-mobile-nav-open .eh-header__menu-btn {
	border-color: rgba(14, 107, 92, 0.45);
	box-shadow: 0 4px 14px rgba(14, 107, 92, 0.1);
}

.eh-header__menu-icon {
	display: block;
	flex-shrink: 0;
	color: #0a1f1e;
}

.eh-header__backdrop {
	display: none;
	pointer-events: none;
}

.eh-header__mobile-panel {
	display: none;
	pointer-events: none;
}

.eh-header__mobile-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.eh-header__mobile-item {
	margin: 0;
}

.eh-header__mobile-link {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0.7rem 0.85rem;
	font-size: 0.9375rem;
	font-weight: 650;
	color: #0a1f1e;
	text-decoration: none;
	border-radius: 10px;
	transition: background 0.15s ease, color 0.15s ease;
}

.eh-header__mobile-link:hover,
.eh-header__mobile-link:focus-visible {
	background: rgba(14, 107, 92, 0.08);
	color: #0e6b5c;
	outline: none;
}

.eh-header__mobile-link.is-active {
	background: rgba(14, 107, 92, 0.1);
	color: #0e6b5c;
	font-weight: 800;
}

@media (max-width: 782px) {
	.eh-header {
		overflow: visible;
	}

	.eh-header__inner {
		flex-wrap: nowrap;
		gap: 0.75rem;
		min-height: 64px;
		padding: 0 1rem;
	}

	.eh-brand {
		flex: 1 1 auto;
		min-width: 0;
		max-width: none;
	}

	.eh-site-tagline {
		font-size: 0.75rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.eh-header__menu-btn {
		display: inline-flex;
		order: 2;
	}

	.eh-header__nav {
		order: 3;
		flex: 0 0 auto;
		gap: 0.5rem;
	}

	.eh-navigation--desktop {
		display: none !important;
	}

	.eh-header__backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(8, 19, 40, 0.32);
		z-index: 29;
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.24s ease, visibility 0.24s ease;
	}

	.eh-site-header.is-mobile-nav-open .eh-header__backdrop {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.eh-header__mobile-panel {
		display: block;
		position: absolute;
		left: 12px;
		right: 12px;
		top: calc(100% + 6px);
		z-index: 31;
		overflow: hidden;
		max-height: 0;
		opacity: 0;
		transform: translateY(-10px);
		pointer-events: none;
		transition: max-height 0.34s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.24s ease, transform 0.24s ease, padding 0.34s ease;
		border-radius: 14px;
		border: 1px solid rgba(10, 31, 30, 0.08);
		background: #fff;
		box-shadow: 0 16px 40px rgba(8, 19, 40, 0.14);
		padding: 0;
	}

	.eh-site-header.is-mobile-nav-open .eh-header__mobile-panel {
		max-height: 24rem;
		opacity: 1;
		transform: translateY(0);
		padding: 8px;
		pointer-events: auto;
	}
}

/* FM chrome: mobile panel positioning under cream nav + wave */
body.eh-joinenel-chrome .eh-site-header .eh-header__mobile-panel {
	position: fixed;
	left: 12px;
	right: 12px;
	top: calc(env(safe-area-inset-top, 0px) + var(--fm-nav-bar-height, 54px) + var(--fm-nav-wave-height, 34px) + 6px);
}

@media (max-width: 782px) {
	body.eh-joinenel-chrome .eh-site-header .eh-header__backdrop {
		z-index: 71;
	}

	body.eh-joinenel-chrome .eh-site-header .eh-header__mobile-panel {
		z-index: 73;
	}
}
