/* Header shell -------------------------------------------------------------- */

/*
 * `.site-header` is the template part's own <header>, given the class by every
 * template. Sticky has to live on that element: a sticky box only sticks
 * inside its parent, and anything inside the part has a parent no taller than
 * the header itself.
 */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--wp--preset--color--base);
	border-block-end: 1px solid var(--wp--preset--color--border);
	transition: box-shadow var(--fwf--transition);
}

.admin-bar .site-header {
	top: var(--wp-admin--admin-bar--height, 0px);
}

.site-header.is-scrolled {
	box-shadow: var(--wp--preset--shadow--md);
}

.site-header .site-header__inner {
	align-items: center;
	gap: var(--wp--preset--spacing--30);
	min-height: var(--fwf--header--height);
}

/* Branding ---------------------------------------------------------------- */
.site-header .site-logo,
.site-header .site-title {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
}

.site-header .site-logo__image {
	width: auto;
	height: var(--fwf--logo--height, 42px);
	max-width: 240px;
	object-fit: contain;
}

@media (max-width: 900px) {
	.site-header .site-logo__image {
		height: var(--fwf--logo--height-mobile, 34px);
	}
}

.site-title {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}

/* Primary navigation ------------------------------------------------------ */

/*
 * The menu is core/navigation. Its own list sits inside the responsive
 * container's content box; the overlay part renders into that same box when
 * the menu opens, so rules for the bar are anchored to the list's position
 * (`… -content > .wp-block-navigation__container`) and cannot reach into the
 * overlay's copy of the menu.
 *
 * Core copies the block's classes onto its <ul> as well as the <nav>, so a
 * rule meant for the block as a whole names the element: `nav.site-nav`. A
 * bare `.site-nav` margin lands twice, once on each.
 */
.site-header nav.site-nav {
	margin-inline-start: auto;
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--30);
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	display: block;
	padding-block: 1.75rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:hover,
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
}

/* Submenus ---------------------------------------------------------------- */

/*
 * Core shows and hides the panel (hover, focus-within, the click toggle); this
 * only dresses it, and only for the bar's own list — the overlay's submenus
 * open in place and are styled with the overlay. The entrance uses `translate`, not `transform`, so it
 * composes with anything else positioning the panel — see CLAUDE.md.
 */
/*
 * Dropdowns open from their parent's left edge. In a right-justified menu core
 * anchors them to the parent's right instead, at (0,5,0), so a wide panel
 * under the first item hung back over the logo. (0,6,0) here.
 */
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-container {
	top: calc(100% + 6px);
	left: -1.25rem;
	right: auto;
}

/*
 * The panel sits 6px below its parent so the parent's underline shows while it
 * is open; flush, the panel covered it. The bridge fills that gap, or the
 * pointer would leave the item on its way down and the menu would close.
 */
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-container::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 100%;
	height: 8px;
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container {
	gap: 0.75rem;
	min-width: 240px;
	padding: 1.25rem;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	box-shadow: var(--wp--preset--shadow--lg);
	translate: 0 -8px;
	transition: opacity var(--fwf--transition), translate var(--fwf--transition);
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container .has-child:hover > .wp-block-navigation__submenu-container,
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container .has-child:focus-within > .wp-block-navigation__submenu-container {
	translate: 0 0;
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0;
	color: var(--wp--preset--color--contrast);
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}

/* Menu button ------------------------------------------------------------- */
.site-header .wp-block-navigation__responsive-container-open {
	padding: 0.5rem;
	color: var(--wp--preset--color--contrast);
}

/*
 * Core's three-line icon draws 14px lines on a 24px box. Scaled up, its lines
 * come out at the width and weight of the bars the theme's own toggle had.
 */
.site-header .wp-block-navigation__responsive-container-open svg {
	width: 40px;
	max-width: none; /* base.css caps svg at its box, which is the icon. */
	height: 40px;
	margin: -8px;
}

/*
 * The drawer takes over at 900px, not core's 600px.
 *
 * core/navigation hardcodes its breakpoint. Between 600 and 900 it would show
 * the full menu inline, which does not fit beside a logo and a button. These
 * two rules extend the collapsed state up to 900px. Each is one class above
 * the core rule it overrides — (0,4,0) against (0,3,0) and (0,3,0) against
 * (0,2,0) — so the result does not depend on source order.
 */
@media (min-width: 600px) and (max-width: 900px) {
	.site-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.site-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
}

/* Overlay ----------------------------------------------------------------- */

/*
 * The open menu is the `navigation-overlay` template part, drawn inside core's
 * fixed, full-screen container. A custom overlay is responsible for its own
 * ground and spacing; core supplies neither.
 */
.site-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.admin-bar .site-header .wp-block-navigation__responsive-container.is-menu-open {
	top: var(--wp-admin--admin-bar--height, 0px);
}

.fwf-nav-overlay {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	min-height: 100%;
	padding: 0 var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
}

.fwf-nav-overlay .fwf-nav-overlay__bar {
	align-items: center;
	min-height: var(--fwf--header--height);
	border-block-end: 1px solid var(--wp--preset--color--border);
}

.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation__container {
	gap: 0;
	width: 100%;
}

.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation-item {
	flex-wrap: wrap;
	width: 100%;
}

.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation-item__content {
	display: block;
	width: 100%;
	padding-block: 0.85rem;
	border-block-end: 1px solid var(--wp--preset--color--border);
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.fwf-nav-overlay .fwf-nav-overlay__menu .current-menu-item > .wp-block-navigation-item__content,
.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--primary);
}

/*
 * Submenus are listed under their parents, always open, as core's own overlay
 * shows them. They cannot be left to core's toggle here: a menu nested in the
 * overlay reads the overlay's "open" state as its own, so every submenu came
 * up expanded as a dropdown panel over the items below it. Stating the open
 * state outright makes the result the same whatever the script decides.
 */
.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation__submenu-container {
	position: static;
	visibility: visible;
	opacity: 1;
	width: 100%;
	height: auto;
	min-width: 0;
	overflow: visible;
	padding: 0 0 0 1rem;
	border: 0;
	background: transparent;
	box-shadow: none;
	translate: none;
}

.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--small);
}

.fwf-nav-overlay .fwf-nav-overlay__audience-label {
	margin: 0 0 0.5rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--muted);
}

/* Utility variant ----------------------------------------------------------- */
.site-header--utility .site-title,
.site-header--utility .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
}

.site-header--utility .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:hover,
.site-header--utility .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
}

.site-header--utility nav.site-nav {
	margin-inline: auto;
}

.site-header .site-header__actions {
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	flex-shrink: 0;
}

.site-header .site-header__phone {
	align-items: center;
	gap: 0.4em;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	white-space: nowrap;
}

.site-header .site-header__phone p {
	margin: 0;
}

.site-header .site-header__phone a {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
	padding-block: 0.25rem;
	color: inherit;
	text-decoration: none;
}

.site-header .site-header__cta .wp-block-button__link {
	display: inline-block;
	padding: 0.65rem 1.25rem;
	border-radius: var(--fwf--button--radius);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--fwf--transition), color var(--fwf--transition);
}

.site-header .site-header__cta .wp-block-button__link:hover,
.site-header .site-header__cta .wp-block-button__link:focus-visible {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
}

.site-header__utility {
	display: grid;
	grid-template-rows: 1fr;
	background: var(--wp--preset--color--primary);
	transition:
		grid-template-rows 320ms var(--fwf--transition-ease, ease),
		opacity 220ms ease;
}

.site-header__utility > * {
	overflow: hidden;
}

.site-header.is-scrolled .site-header__utility {
	grid-template-rows: 0fr;
	opacity: 0;
}

.site-header .site-utility-nav .wp-block-navigation__container {
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--wp--preset--spacing--50);
}

.site-header .site-utility-nav .wp-block-navigation-item__content {
	display: inline-block;
	padding-block: var(--wp--preset--spacing--20);
	color: #fff;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	text-decoration: none;
}

.site-header .site-utility-nav .wp-block-navigation-item__content::before {
	content: "\00BB";
	margin-inline-end: 0.55em;
	opacity: 0.7;
}

.site-header .site-utility-nav .wp-block-navigation-item__content:hover,
.site-header .site-utility-nav .wp-block-navigation-item__content:focus-visible {
	color: #fff;
}

@media (max-width: 900px) {
	.site-header .site-header__cta,
	.site-header .site-header__phone {
		display: none;
	}

	.site-header__utility {
		display: none;
	}
}
