/**
 * Site header — front end + editor.
 *
 * Rebuilt to match Figma desktop (37:15717) and mobile (41:12535).
 *
 * Structure is intentionally FLAT: logo, nav, phone icon, phone number and the
 * Contact button are all direct children of the .site-header flex row. Nested
 * `core/group` (`.wp-block-group.is-layout-flex`) wrappers were avoided because
 * Chromium collapses such a group to width:0 when it is itself a flex item,
 * which made the phone overlap the button. Spacing between the flat items is
 * tuned with the row gap + targeted margins.
 *
 * Desktop: logo · centered nav · gray phone pill · red "Contact Us" pill.
 * Mobile (<=1023px): logo · gray phone circle · red hamburger. The core
 * Navigation overlay (overlayMenu="mobile") holds the links + a "Contact Us"
 * pill. Core only collapses at 600px, so the breakpoint is shifted to 1023px
 * with a small set of !important toggles.
 */

/* ---------- Bar ---------- */
.site-header.wp-block-group {
	width: 100%;
	min-height: 79px;
	gap: 24px;
	box-shadow: 0 4px 12px rgba(37, 36, 36, 0.08);
	/* Full-bleed white bar, content centered at the theme content width. */
	padding-inline: max(20px, (100% - 1240px) / 2);
	position: relative;
	z-index: 100;
}

.site-header .header-logo {
	flex: 0 0 auto;
	margin: 0;
}

.site-header .wp-block-site-logo img {
	max-height: 64px;
	width: auto;
	display: block;
}

/* ---------- Desktop navigation ---------- */
.site-header .header-nav {
	/* Center the menu in the space between the logo and the actions. */
	margin-inline: auto;
}

.site-header .header-nav .wp-block-navigation__container {
	gap: 8px;
}

.site-header .header-nav .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--dm-sans);
	font-size: var(--wp--preset--font-size--font-16px);
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: -0.08px;
	color: var(--wp--preset--color--text-form);
	padding: 9px 14px;
	border-radius: 8px;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.site-header .header-nav .wp-block-navigation-item__content:hover,
.site-header .header-nav .wp-block-navigation-item__content:focus-visible {
	background-color: var(--wp--preset--color--surface-light);
	color: var(--wp--preset--color--primary-red);
}

/* ---------- PPC-18: desktop sub-menu dropdown ----------
 * Core rendered the submenu with no panel: transparent background floating
 * over the page (links looked "transparent" before hover). Give it a white
 * card with a hairline border + shadow, and solid link colors that turn red
 * on hover. The parent item opens on click (openSubmenusOnClick on the
 * navigation block), so the toggle is a <button>, not a link. */
.site-header .header-nav .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--white) !important;
	border: 1px solid var(--wp--preset--color--border-light);
	border-radius: 8px;
	box-shadow: 0 12px 24px rgba(31, 30, 34, 0.12);
	padding: 8px;
	min-width: 190px !important;
	gap: 2px;
}

.site-header .header-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	display: block;
	width: 100%;
	color: var(--wp--preset--color--text-form);
	opacity: 1;
	padding: 9px 14px;
}

.site-header .header-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
.site-header .header-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus-visible {
	background-color: var(--wp--preset--color--surface-light);
	color: var(--wp--preset--color--primary-red);
}

/* The click toggle is a button — normalize it to match the other items. */
.site-header .header-nav button.wp-block-navigation-submenu__toggle {
	background: none;
	border: none;
	cursor: pointer;
}

.site-header .header-nav .wp-block-navigation__submenu-icon {
	color: var(--wp--preset--color--text-form);
}

/* The overlay-only "Contact Us" CTA is hidden everywhere by default
 * (desktop inline menu + closed state); it is revealed inside the open
 * mobile overlay only. */
.site-header .header-nav .header-menu-cta {
	display: none;
}

/* ---------- Phone (icon circle + number) ---------- */
.site-header .header-phone__icon.wp-block-image {
	margin: 0;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background-color: var(--wp--preset--color--surface-light);
	display: flex;
	align-items: center;
	justify-content: center;
}

.site-header .header-phone__icon.wp-block-image a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.site-header .header-phone__icon img {
	width: 16px;
	height: 16px;
}

.site-header .header-phone__number {
	flex: 0 0 auto;
	margin: 0;
	/* Tighten the gap to the icon (row gap is 24px, design wants 8px). */
	margin-left: -16px;
	font-family: var(--wp--preset--font-family--dm-sans);
	font-size: var(--wp--preset--font-size--font-14px);
	font-weight: 600;
	line-height: 1.55;
	letter-spacing: -0.08px;
	white-space: nowrap;
}

.site-header .header-phone__number a {
	color: var(--wp--preset--color--text-body);
	text-decoration: none;
}

/* ---------- Contact Us pill (reuse is-style-primary-red-pill) ---------- */
.site-header .header-contact {
	flex: 0 0 auto;
	margin: 0;
}

.site-header .header-contact .wp-block-button__link {
	font-size: var(--wp--preset--font-size--font-16px);
	letter-spacing: -0.075px;
	padding: 13px 22px;
}

/* ---------- Mobile hamburger (open button) ---------- */
.site-header .wp-block-navigation__responsive-container-open {
	width: 42px;
	height: 42px;
	padding: 0;
	border-radius: 50%;
	background-color: var(--wp--preset--color--primary-red);
	color: var(--wp--preset--color--white);
	align-items: center;
	justify-content: center;
}

.site-header .wp-block-navigation__responsive-container-open svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* ---------- Mobile overlay (open menu) ----------
 * PPC-18: the core overlay covered the whole viewport with the links
 * centered mid-screen. Render it instead as a traditional dropdown panel
 * pinned under the header bar: full-width white sheet, auto height,
 * left-aligned links. */
.site-header .wp-block-navigation__responsive-container.is-menu-open {
	position: absolute;
	inset: 100% 0 auto 0;
	height: auto;
	min-height: 0;
	background-color: var(--wp--preset--color--white);
	padding: 12px 20px 24px;
	border-top: 1px solid var(--wp--preset--color--border-light);
	box-shadow: 0 16px 24px rgba(31, 30, 34, 0.12);
	overflow: visible;
	z-index: 99;
}

/* The close (X) replaces the hamburger in the bar while the panel is open. */
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	position: static;
}

.site-header .header-nav:has(.is-menu-open) .wp-block-navigation__responsive-container-open {
	visibility: hidden;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	display: flex;
	position: absolute;
	top: -61px;
	right: 20px;
	width: 42px;
	height: 42px;
	padding: 0;
	border-radius: 50%;
	background-color: var(--wp--preset--color--primary-red);
	color: var(--wp--preset--color--white);
	align-items: center;
	justify-content: center;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg {
	width: 18px;
	height: 18px;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	width: 100%;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 4px;
	width: 100%;
	align-items: stretch;
	text-align: left;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	justify-content: flex-start;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	display: block;
	width: 100%;
	text-align: left;
	font-size: var(--wp--preset--font-size--font-18px);
	padding: 12px 8px;
	color: var(--wp--preset--color--text-form);
}

/* Sub-menu items inside the open panel: plain indented list below the
 * toggle (the li is flex-row by default, putting the submenu beside the
 * button — stack it instead). */
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	position: static;
	background: none;
	border: none;
	box-shadow: none;
	padding: 0 0 0 16px !important;
	margin: 0;
	width: 100%;
	min-width: 0 !important;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item {
	width: 100%;
	margin: 0;
	justify-content: flex-start;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle {
	width: 100%;
	text-align: left;
	justify-content: flex-start;
}

/* Reveal the CTA inside the open overlay, styled as a red pill. */
.site-header .wp-block-navigation__responsive-container.is-menu-open .header-menu-cta {
	display: block;
	margin-top: 12px;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .header-menu-cta .wp-block-navigation-item__content {
	background-color: var(--wp--preset--color--primary-red);
	color: var(--wp--preset--color--white);
	border-radius: var(--wp--custom--borders--radius--pill, 100px);
	text-align: center;
	font-weight: 600;
	padding: 14px 22px;
}

/* ---------- Breakpoint: collapse to the hamburger below 1024px ---------- */
@media (max-width: 1023px) {
	/* Slightly tighter row gap so the phone + hamburger sit ~20px apart. */
	.site-header.wp-block-group {
		gap: 20px;
	}

	/* Show the hamburger (core hides it at >=600px). */
	.site-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex !important;
	}

	/* Hide the inline menu until it is opened as the overlay. */
	.site-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none !important;
	}

	/* Cluster the phone + hamburger at the right; hamburger sits last.
	 * position:static so the open panel (absolute) anchors to the full-width
	 * .site-header bar instead of this 42px flex item. */
	.site-header .header-nav {
		order: 10;
		margin-inline: 0;
		position: static;
	}

	.site-header .header-phone__icon.wp-block-image {
		order: 5;
		margin-left: auto;
		width: 42px;
		height: 42px;
		background-color: var(--wp--preset--color--border-light);
	}

	/* Number + desktop Contact pill live in the overlay on mobile, not the bar. */
	.site-header .header-phone__number,
	.site-header .header-contact {
		display: none;
	}
}
