/**
 * v2 header. Sits over the hero on the Home page (--overlay).
 * Markup: header-v2.php
 *
 * Default / scrolled: white bar + color logo.
 * Home at scroll top: transparent bar + light logo (site.js adds is-at-top).
 * Mobile open menu (Header ALT) styles live only under max-width — do not leak to desktop.
 */
@layer sections {
	.lb-v2-header {
		position: sticky;
		top: 0;
		z-index: 20;
		color: var(--lb-v2-color-ink);
		background: var(--lb-v2-color-white);
		transition:
			background-color var(--lb-v2-duration) var(--lb-v2-ease),
			color var(--lb-v2-duration) var(--lb-v2-ease);
	}

	/*
	 * Home: pull the hero up under the bar. White by default so no-JS still reads;
	 * site.js adds is-at-top at scrollY === 0 for the transparent-over-hero state.
	 */
	.lb-v2-header--overlay {
		margin-bottom: calc(-1 * var(--lb-v2-header-height));
	}

	.lb-v2-header--overlay.is-at-top:not(.is-menu-open) {
		color: var(--lb-v2-color-white);
		background: transparent;
	}

	.lb-v2-header__inner {
		position: relative; /* mobile panel anchors to the container, not the full viewport */
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--lb-v2-space-5);
		padding: var(--lb-v2-space-4) 0.6875rem; /* Figma: 16px top and bottom, 31px from the edge with the gutter */
	}

	.lb-v2-header__logo {
		position: relative;
		display: block;
		flex-shrink: 0;
	}

	.lb-v2-header__logo-img {
		display: block;
		width: 7.1875rem; /* 115px */
		height: auto;
	}

	/* Color logo on white bar; light logo only while transparent over the hero. */
	.lb-v2-header__logo-img--light {
		display: none;
	}

	.lb-v2-header--overlay.is-at-top:not(.is-menu-open) .lb-v2-header__logo-img--light {
		display: block;
	}

	.lb-v2-header--overlay.is-at-top:not(.is-menu-open) .lb-v2-header__logo-img--color {
		display: none;
	}

	.lb-v2-header__tools {
		display: flex;
		align-items: center;
		gap: var(--lb-v2-space-3);
		margin-inline-start: auto;
	}

	.lb-v2-header__toggle {
		display: inline-grid;
		place-items: center;
		width: 2.75rem;
		height: 2.75rem;
		padding: 0;
		border: 0;
		background: transparent;
		color: inherit;
		cursor: pointer;
	}

	.lb-v2-header__toggle svg {
		width: 1.75rem;
		height: 1.75rem;
	}

	.lb-v2-header__toggle .lb-v2-header__icon-close,
	.lb-v2-header__toggle[aria-expanded="true"] .lb-v2-header__icon-open {
		display: none;
	}

	.lb-v2-header__toggle[aria-expanded="true"] .lb-v2-header__icon-close {
		display: block;
	}

	/* Shared panel shell — desktop overrides below; mobile open look is max-width only. */
	.lb-v2-header__panel {
		display: none;
	}

	.lb-v2-header__panel.is-open {
		display: flex;
	}

	.lb-v2-header__nav ul {
		display: grid;
		gap: var(--lb-v2-space-5);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.lb-v2-header__nav a {
		font-size: var(--lb-v2-text-body-size);
		font-weight: 500;
	}

	.lb-v2-header__nav a:hover,
	.lb-v2-header__nav a[aria-current="page"] {
		color: var(--lb-v2-color-accent);
	}

	/* WordPress menu markup: li.menu-item-has-children > a + button + ul.sub-menu */
	.lb-v2-header__nav li {
		position: relative;
	}

	.lb-v2-header__nav > ul > li {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.lb-v2-header__subtoggle {
		display: inline-grid;
		place-items: center;
		flex-shrink: 0;
		width: 1.25rem;
		height: 1.25rem;
		margin-inline-start: var(--lb-v2-space-1);
		padding: 0;
		border: 0;
		background: transparent;
		color: inherit;
		cursor: pointer;
	}

	.lb-v2-header__subtoggle svg {
		width: 0.75rem;
		transition: transform var(--lb-v2-duration) var(--lb-v2-ease);
	}

	.lb-v2-header__subtoggle[aria-expanded="true"] svg {
		transform: rotate(180deg);
	}

	.lb-v2-header__nav .sub-menu {
		display: none;
		flex-basis: 100%;
		gap: var(--lb-v2-space-3);
		margin: var(--lb-v2-space-3) 0 0;
		padding: 0 0 0 var(--lb-v2-space-4);
		list-style: none;
	}

	.lb-v2-header__nav .sub-menu a {
		font-size: var(--lb-v2-text-label-size);
		font-weight: 400;
	}

	.lb-v2-header__nav li.is-open > .sub-menu {
		display: grid;
	}

	/* Contact Us / utility: desktop only (Figma Header ALT — hidden on mobile). */
	.lb-v2-header__utility {
		display: none;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--lb-v2-space-5);
		font-size: var(--lb-v2-text-label-size); /* 16px */
		font-weight: 400;
		line-height: var(--lb-v2-text-small-leading);
		text-transform: uppercase;
	}

	.lb-v2-header__utility ul {
		display: flex;
		flex-wrap: wrap;
		gap: var(--lb-v2-space-5);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.lb-v2-header__utility a:hover {
		color: var(--lb-v2-color-accent);
	}

	.lb-v2-header__search {
		display: inline-grid;
		place-items: center;
		width: 1.5rem;
		height: 1.5rem;
		padding: 0;
		border: 0;
		background: transparent;
		color: inherit;
		cursor: pointer;
	}

	.lb-v2-header__search svg {
		width: 1.125rem;
		height: 1.125rem;
	}

	.lb-v2-header__search--utility {
		display: none;
	}

	/* —— Mobile only: closed tools + open Header ALT panel —— */
	@media (max-width: 79.9375rem) {
		/* Open: close only — hide bar search while the panel is up. */
		.lb-v2-header.is-menu-open .lb-v2-header__search--bar {
			display: none;
		}

		/*
		 * __inner is also .lb-v2-container (guttered). Drop its positioning so the
		 * panel anchors to the sticky header and goes edge-to-edge (Figma Header ALT).
		 */
		.lb-v2-header__inner {
			position: static;
		}

		.lb-v2-header__panel {
			position: absolute;
			top: 100%;
			right: 0;
			left: 0;
			flex-direction: column;
			gap: 0;
			max-height: calc(100dvh - var(--lb-v2-header-height));
			padding: 0;
			overflow-y: auto;
			background: var(--lb-v2-color-white);
			color: var(--lb-v2-color-ink);
			border-top: 1px solid var(--lb-v2-color-grey-400); /* Astute Grey */
		}

		.lb-v2-header__nav ul {
			gap: 0;
		}

		.lb-v2-header__nav a {
			font-family: var(--lb-v2-font-sans); /* Figma Nav Header: Roboto */
			font-size: 1.125rem; /* 18px */
			font-weight: 600;
			line-height: 1;
			color: #000;
			white-space: nowrap;
		}

		/* 16px rows; horizontal inset = gutter + inner pad so text lines up with the logo. */
		.lb-v2-header__nav > ul > li {
			width: 100%;
			box-sizing: border-box;
			padding: var(--lb-v2-space-4) calc(var(--lb-v2-gutter) + 0.6875rem);
			border-bottom: 1px solid var(--lb-v2-color-grey-400); /* #ADB6C5 */
		}
	}

	@media (min-width: 80rem) {
		/* Figma: 32px top, 24px bottom, logo on the bottom edge of the 92px menu block (148px total). */
		.lb-v2-header__inner {
			position: relative;
			align-items: flex-end;
			padding: var(--lb-v2-space-6) 0 var(--lb-v2-space-5);
		}

		.lb-v2-header__logo {
			padding-bottom: var(--lb-v2-space-2);
		}

		.lb-v2-header__logo-img {
			width: 9.125rem; /* 146px */
		}

		.lb-v2-header__tools {
			display: none;
		}

		.lb-v2-header__panel {
			position: static;
			display: flex;
			flex-direction: column;
			align-items: flex-end;
			gap: var(--lb-v2-space-2); /* 8px */
			max-height: none;
			padding: 0;
			overflow: visible;
			background: transparent;
			color: inherit;
			border-top: 0;
		}

		.lb-v2-header__utility {
			display: flex;
		}

		.lb-v2-header__search--utility {
			display: inline-grid;
		}

		.lb-v2-header__nav > ul {
			display: flex;
			align-items: center;
			flex-wrap: nowrap;
			gap: 1.25rem; /* 20px */
			min-height: 3.75rem; /* 60px row */
			width: auto;
		}

		.lb-v2-header__utility,
		.lb-v2-header__utility ul {
			gap: var(--lb-v2-space-4); /* 16px */
		}

		.lb-v2-header__nav > ul > li {
			flex: 0 0 auto;
			flex-wrap: nowrap;
			width: auto;
			padding: 0;
			border-bottom: 0;
		}

		.lb-v2-header__nav a {
			white-space: nowrap;
		}

		/* Desktop submenus drop down on hover, focus or tap. */
		.lb-v2-header__nav .sub-menu {
			position: absolute;
			top: 100%;
			left: calc(-1 * var(--lb-v2-space-4));
			min-width: 15rem;
			margin: 0;
			padding: var(--lb-v2-space-4);
			border-radius: var(--lb-v2-radius-sm);
			background: var(--lb-v2-color-white);
			color: var(--lb-v2-color-ink);
			box-shadow: 0 0.5rem 1.5rem rgb(22 32 43 / 0.15);
		}

		.lb-v2-header__nav li:hover > .sub-menu,
		.lb-v2-header__nav li:focus-within > .sub-menu {
			display: grid;
		}
	}
}
