/**
 * GVA — site header, primary navigation and scroll progress. Ported from the
 * prototype's block 00 (docs/REFERENCE.md §2) as the *effective cascade
 * result* of its two competing style blocks, not source order.
 *
 * Enqueued as `gva-site-header` from inc/enqueue.php.
 */

:root {
	/* The prototype's fixed header height. Also the anchor-scroll offset. */
	--header-height: 68px;
}

/* The width at which the horizontal bar can no longer hold the navigation and
   the mobile toggle takes over lives in exactly one place: the
   `@media (max-width: 767px)` block in section 7. navigation.js reads the
   toggle's rendered visibility rather than restating that number. */

/* The header is fixed, so in-page anchors must clear it when scrolled to. */
html {
	scroll-padding-top: var(--header-height);
}

/* Every current template renders flowing content directly under the fixed
   header. A full-bleed section that deliberately runs under it (the front-page
   hero) sets its own padding and opts out. */
.site-main {
	padding-top: var(--header-height);
}

/* ==========================================================================
   1. The bar
   ========================================================================== */

.site-header {
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 50;
	background: rgba(250, 248, 248, 0.92);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--line);
}

/* Logged-in: clear the WordPress admin bar so the fixed header is never hidden
   underneath it. The admin bar is 32px on desktop and 46px at and below its own
   782px breakpoint — the same breakpoint WordPress core uses. Logged-out layout
   is untouched (no `.admin-bar` class, no rule applies). The mobile panel is
   `position: absolute; top: 100%` on the header, so it follows this offset. */
body.admin-bar .site-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .site-header {
		top: 46px;
	}
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 28px;
	height: var(--header-height);
}

/* ==========================================================================
   2. Brand lockup
   ========================================================================== */

.gva-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.gva-brand__mark {
	display: block;
	width: auto;
}

.site-header__brand .gva-brand__mark {
	height: 24px;
}

.gva-brand__sub {
	font-family: var(--font-sans);
	font-weight: 500;
	font-size: 10px;
	letter-spacing: 0.01em;
	line-height: 1;
	color: var(--red);
}

/* ==========================================================================
   3. Primary navigation — desktop bar
   ========================================================================== */

.main-nav {
	margin-left: 14px;
	min-width: 0;
}

.main-nav__list {
	display: flex;
	align-items: center;
	gap: 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.main-nav a {
	position: relative;
	display: block;
	padding: 5px 0;
	font-family: var(--font-sans);
	font-weight: 500;
	font-size: 12.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #242424;
	white-space: nowrap;
}

.main-nav a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 1.5px;
	background: var(--red);
	transition: width 0.25s ease;
}

.main-nav a:hover,
.main-nav a.is-active {
	color: var(--red);
}

.main-nav a:hover::after,
.main-nav a.is-active::after {
	width: 100%;
}

/* ==========================================================================
   4. Header right — language presentation and call to action
   ========================================================================== */

.site-header__right {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 20px;
}

/* Shared base for both language presentations; the footer variant overrides
   the sizing in assets/css/site-footer.css. */
.lang-badges {
	display: flex;
	margin: 0;
	font-family: var(--font-mono);
}

.lang-badges--header {
	gap: 5px;
	font-size: 12px;
	letter-spacing: 0.06em;
	color: #4A4A4A;
}

/* The current language keeps the <b> element's own weight — the prototype
   renders it bold against the lighter unavailable one. */
.lang-badges--header .lang-badges__lang.is-current {
	color: var(--black);
}

/* ==========================================================================
   5. Scroll progress
   A 1px hairline pinned to the header's bottom edge; width is set by
   assets/js/navigation.js.
   ========================================================================== */

.site-header__progress {
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 0;
	height: 1px;
	background: var(--red);
	transition: width 0.12s linear;
}

/* ==========================================================================
   6. Mobile navigation
   The prototype has none: below roughly 710px its header bar simply overflows
   and the last links, the language badges and the CTA become unreachable. That
   is a defect, not a pattern to reproduce, so a toggle takes over exactly
   where the bar stops fitting (768px, the last width the reference still
   renders correctly). Above that width the header is byte-for-byte the
   reference layout.
   ========================================================================== */

.nav-toggle {
	display: none;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	/* Pull the 44px hit area out so the icon itself lines up with the
	   container's 32px gutter. */
	margin-right: -11px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--black);
	cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 22px;
	height: 1.5px;
	background: currentColor;
	transition:
		transform 0.2s var(--ease),
		opacity 0.2s var(--ease);
}

.nav-toggle__bars {
	position: relative;
	margin: 0 auto;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: "";
	position: absolute;
	left: 0;
}

.nav-toggle__bars::before {
	top: -7px;
}

.nav-toggle__bars::after {
	top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
	background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
	transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
	transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	/* Fallback first: `dvh` accounts for mobile browser chrome, `vh` does not,
	   but every engine understands `vh`. */
	max-height: calc(100vh - var(--header-height));
	max-height: calc(100dvh - var(--header-height));
	overflow-y: auto;
	background: var(--bone);
	border-bottom: 1px solid var(--line);
}

.mobile-nav__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mobile-nav__list > li + li {
	border-top: 1px solid var(--line);
}

.mobile-nav__list a {
	display: block;
	padding: 16px var(--container-pad);
	font-family: var(--font-sans);
	font-weight: 500;
	font-size: 12.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #242424;
}

.mobile-nav__list a:hover,
.mobile-nav__list a.is-active {
	color: var(--red);
}

/* Repeated call to action inside the panel. Only ever displayed when the copy
   in the bar is not — see section 7. */
.mobile-nav__foot {
	display: none;
	align-items: center;
	gap: 20px;
	padding: 18px var(--container-pad) 22px;
	border-top: 1px solid var(--line);
}

.mobile-nav__foot .lang-badges {
	margin: 0;
}

/* ==========================================================================
   7. Responsive
   The 1360 / 1280 / 1140 / 980 ladder is the prototype's own progressive
   collapse, reproduced exactly. 768 is the added mobile-navigation step.
   ========================================================================== */

@media (max-width: 1360px) {
	.main-nav__list {
		gap: 22px;
	}

	.main-nav a {
		font-size: 12px;
		letter-spacing: 0.04em;
	}
}

@media (max-width: 1280px) {
	.main-nav .nav-lo {
		display: none;
	}
}

@media (max-width: 1140px) {
	.main-nav .nav-mid {
		display: none;
	}

	.site-header__right .lang-badges {
		display: none;
	}
}

@media (max-width: 980px) {
	.site-header__cta {
		min-height: 44px;
		padding: 12px 18px;
		font-size: 14px;
	}
}

@media (max-width: 767px) {
	.site-header__inner {
		gap: 16px;
	}

	.main-nav {
		display: none;
	}

	.nav-toggle {
		display: block;
	}

	.mobile-nav {
		display: block;
	}

	.mobile-nav[hidden] {
		display: none;
	}
}

/* Smallest phones: a longer (translated) call-to-action label would push the
   bar past the viewport, so the call to action moves into the panel with the
   rest of the navigation instead of being clipped off-screen as it is in the
   prototype. */
@media (max-width: 479px) {
	.site-header__right {
		display: none;
	}

	.mobile-nav__foot {
		display: flex;
	}

	/* With the call to action out of the bar, the toggle takes over as the
	   element that holds the right edge. */
	.nav-toggle {
		margin-left: auto;
	}
}
