/*
 * Site header, mobile menu panel. Values from docs/specs/home-header-footer.md 1.1 to 1.6.
 * Mobile applies at max-width 781px (D7). The sticky bar itself is styled in components.css.
 * The classes live on the header pattern's own markup, so templates reference the part bare ({"slug":"header"}).
 */
.di-header {
	position: relative;
	border-bottom: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--paper);
}
/* Header row: 1120px including its 40px gutters (1040px content), unlike the 1120px-content .di-container (R11). */
.di-header__row {
	box-sizing: border-box;
	max-width: 1120px;
	margin-inline: auto;
	padding-inline: var(--wp--custom--layout--gutter);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	min-height: 76px;
	padding-block: 12px;
}
.di-wordmark {
	/* 44px tall hit area (WCAG 2.5.8 / client 44px rule) without changing the row height: the nav sets it. */
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--control--min-tap-target);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--serif);
	font-size: 26px;
	font-weight: 500;
	letter-spacing: -0.01em;
	text-decoration: none;
	white-space: nowrap;
}
.di-wordmark span {
	color: var(--wp--preset--color--accent);
}
.di-wordmark:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--accent);
	outline-offset: 4px;
}

/* Desktop navigation: wraps to its own row when the row does not fit, never overflows. */
.di-nav {
	display: flex;
	flex: 1 0 auto;
	justify-content: center;
}
/*
 * Below 1120px the single row no longer fits: the wordmark and "Get a quote" share row 1 and the nav takes
 * row 2 (spec 1.3). Visual order only; the DOM (and keyboard) order stays wordmark, nav, quote, as on desktop.
 */
@media (min-width: 782px) and (max-width: 1119px) {
	.di-nav {
		order: 3;
		flex-basis: 100%;
	}
}
.di-nav ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.di-nav a {
	/*
	 * 4px of side padding cancelled by -4px margins: every link's hit area is at least 44px wide ("Tools" 37px of
	 * text becomes 45px) while the text positions, the 20px visual spacing and the row width stay as designed.
	 * The current-page underline is drawn by ::after at the text width, not by the padded box.
	 */
	position: relative;
	display: inline-block;
	box-sizing: border-box;
	min-width: var(--wp--custom--control--min-tap-target);
	margin-inline: -4px;
	padding: 12px 4px;
	border-bottom: 2px solid transparent;
	text-align: center;
	color: var(--wp--preset--color--ink);
	font-size: 16px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}
.di-nav a:hover {
	color: var(--wp--preset--color--accent);
}
.di-nav a[aria-current="page"]::after {
	content: "";
	position: absolute;
	right: 4px;
	bottom: -2px;
	left: 4px;
	height: 2px;
	background: var(--wp--preset--color--accent);
}

.di-header__actions {
	display: flex;
	align-items: center;
	gap: 10px;
}
.di-header__quote {
	padding: 0 20px;
	font-size: 17px;
	white-space: nowrap;
}

/* Menu toggle: <summary> without JavaScript, <button> with it. Same look. */
.di-menu-toggle {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	box-sizing: border-box;
	width: 48px;
	height: 48px;
	padding: 0;
	border: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--control);
	background: transparent;
	list-style: none;
	cursor: pointer;
}
.di-menu-toggle::-webkit-details-marker {
	display: none;
}
.di-menu-toggle__bar {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--wp--preset--color--ink);
}
.di-menu,
.di-header--js .di-menu-toggle {
	display: none;
}

/* Mobile panel. */
.di-mobile-menu {
	display: none;
}
.di-mobile-menu[hidden] {
	display: none;
}
.di-mobile-menu nav {
	box-sizing: border-box;
	padding: 8px var(--wp--custom--layout--gutter-mobile) 16px;
	border-top: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--card);
}
.di-mobile-menu ul {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}
.di-mobile-menu li {
	border-bottom: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
}
.di-mobile-menu li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 52px;
	color: var(--wp--preset--color--ink);
	font-size: 18px;
	font-weight: 500;
	text-decoration: none;
}
.di-mobile-menu li a[aria-current="page"] {
	font-weight: 600;
}
.di-mobile-menu li a span {
	color: var(--wp--preset--color--slate);
}
.di-mobile-menu li a:focus-visible {
	outline-offset: -2px;
}
.di-mobile-menu__call {
	display: flex;
	margin-top: 16px;
}

@media (max-width: 781px) {
	.di-header__row {
		padding-inline: var(--wp--custom--layout--gutter-mobile);
		gap: 12px 10px;
		min-height: 64px;
		padding-block: 8px;
	}
	.di-wordmark {
		font-size: 21px;
	}
	.di-nav {
		display: none;
	}
	.di-header__quote {
		padding: 0 12px;
	}
	.di-menu {
		display: block;
	}
	/* Without JavaScript the open <details> shows the panel as an overlay under the header row. */
	.di-menu[open] .di-mobile-menu {
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		z-index: 40;
		display: block;
	}
	/* With JavaScript the button replaces the <details>; the panel sits in flow below the row. */
	.di-header--js .di-mobile-menu:not([hidden]) {
		display: block;
	}
	.di-header--js .di-menu-toggle {
		display: flex;
	}
}
