/* ==========================================================================
   Site header — shared by every page (markup: js/site-header.js)
   ========================================================================== */

/* <site-header> is only a mount point: it must not create a box, otherwise
   the sticky header would be confined to it */
site-header {
	display: contents;
}

:root {
	--header-h: 52px; /* pages that run a section under the header use this */
}

.header {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	height: var(--header-h);
	padding: 8px 56px;
	background: var(--white);
}
.header__inner {
	flex: 1;
	max-width: 1600px; /* Figma: wider screens keep the bar at 1600px, centred */
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 80px;
	padding: 0 8px;
}
.header__logo img {
	width: 115px;
	height: 22.033px;
}
.menu-toggle {
	display: none;
}

/* <site-header overlay>: floats over the first section (Figma: no fill) and
   turns white once the page scrolls or the mobile menu opens */
.header--overlay {
	background: transparent;
	transition: background-color 0.2s ease;
}
.header--overlay.is-scrolled,
.header--overlay.is-open {
	background: var(--white);
}
.nav {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	color: var(--black);
}

/* current page: Figma Navigation Item "active" — brand blue, medium weight,
   permanent [ ] brackets */
.nav__item--active {
	gap: 4px;
	padding-left: 12px;
	padding-right: 12px;
	font-weight: 500;
	color: var(--brand-blue);
}
.nav__item--active::before,
.nav__item--active::after {
	position: static;
	flex-shrink: 0;
	width: 2.671px;
	height: 15.67px;
	margin: 0;
	border: 0;
	opacity: 1;
	background: center / 100% 100% no-repeat;
}
.nav__item--active::before {
	order: -1;
	background-image: url("../assets/nav-bracket-l.svg");
}
.nav__item--active::after {
	order: 1;
	background-image: url("../assets/nav-bracket-r.svg");
}
@media (hover: hover) {
	.nav__item--active:hover {
		padding-left: 12px;
		padding-right: 12px;
	}
}
.nav__item--active:focus-visible {
	padding-left: 12px;
	padding-right: 12px;
}

@media (max-width: 1023px) {
	.header {
		padding: 8px calc(var(--gutter) - 8px);
	}
	.header__inner {
		gap: 8px;
	}
	.header__logo {
		margin: -12px auto -12px 0;
		padding: 12px 0; /* 44px tall tap target, same look */
	}
	.header__logo img {
		width: 104px;
		height: auto;
	}

	.menu-toggle {
		display: inline-flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 5px;
		width: 36px;
		height: 36px;
		flex-shrink: 0;
		border: 1px solid var(--black);
		border-radius: 50%;
		background: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
		position: relative;
	}
	/* invisible 44px hit areas around the 36px header controls */
	.menu-toggle::after,
	.header .btn-tertiary::after {
		content: "";
		position: absolute;
		inset: -4px;
	}
	.header .btn-tertiary {
		position: relative;
	}
	.menu-toggle span {
		display: block;
		width: 14px;
		height: 1.5px;
		background: var(--black);
		transition: transform 0.25s ease;
	}
	.header.is-open .menu-toggle span:first-child {
		transform: translateY(3.25px) rotate(45deg);
	}
	.header.is-open .menu-toggle span:last-child {
		transform: translateY(-3.25px) rotate(-45deg);
	}

	.nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 4px var(--gutter) 20px;
		background: var(--white);
		border-bottom: 1px solid var(--blue-36);
		box-shadow: 0 24px 40px -24px rgba(2, 35, 125, 0.25);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-8px);
		transition:
			opacity 0.2s ease,
			transform 0.2s ease,
			visibility 0s linear 0.2s;
	}
	.header.is-open .nav {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition:
			opacity 0.2s ease,
			transform 0.2s ease,
			visibility 0s;
	}
	.header .nav__item {
		justify-content: flex-start;
		height: 52px;
		padding: 0 8px;
		font-size: 14px;
		border-bottom: 1px solid var(--blue-36);
	}
	.header .nav__item:last-child {
		border-bottom: 0;
	}

	.header .nav__item--active {
		justify-content: flex-start;
	}
}

@media (max-width: 599px) {
	.header .btn-tertiary {
		padding: 0 14px;
		gap: 8px;
	}
}

@media (max-width: 374px) {
	.header .btn-tertiary {
		display: none;
	}
}
