/**
 * Homestead site header.
 */

.homestead-header {
	--homestead-olive: var(--wp--preset--color--olive, #a8b89a);
	--homestead-olive-dark: var(--wp--preset--color--olive-dark, #6f7566);
	--homestead-olive-cta: var(--homestead-cta-bg);
	--homestead-olive-cta-hover: var(--homestead-cta-bg-hover);
	--homestead-content-width: 1440px;

	padding-block: 0;
	border-bottom: 0;
	background-color: var(--wp--preset--color--light-sage, #c7d3c0);
}

.homestead-header__bar {
	width: 100%;
	max-width: var(--homestead-content-width);
	margin-inline: auto;
	padding-block: 0.85rem 0.75rem;
	padding-inline: clamp(1rem, 2.5vw, 2rem);
	box-sizing: border-box;
}

.homestead-header__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	grid-template-areas:
		"brand nav cta"
		"brand nav location";
	align-items: center;
	column-gap: 2rem;
	row-gap: 0.35rem;
	width: 100%;
	min-height: 4.25rem;
}

.homestead-header__brand {
	grid-area: brand;
	justify-self: start;
	align-self: center;
}

.homestead-header__nav {
	grid-area: nav;
	justify-self: center;
}

.homestead-header__cta {
	grid-area: cta;
	/* Stretch to the shared end-column width (set by address), then center the button. */
	justify-self: stretch;
	align-self: end;
	display: flex;
	justify-content: center;
}

.homestead-header__location {
	grid-area: location;
	justify-self: stretch;
}

/* Wrapper is transparent on tablet/desktop so nav + CTA stay parent-grid children. */
.homestead-header__actions {
	display: contents;
}

.homestead-header__logo.wp-block-site-logo {
	line-height: 0;
}

.homestead-header__logo .custom-logo-link,
.homestead-header__logo-mobile {
	display: block;
	line-height: 0;
}

.homestead-header__logo-mobile {
	display: none;
}

.homestead-header__logo img,
.homestead-header__logo .custom-logo,
.homestead-header__logo-mobile img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
}

/*
 * Tablet + desktop: logo badge overlaps header and the section below.
 * Phone keeps the standard in-flow header (see max-width: 600px rules).
 */
@media (min-width: 601px) {
	:root {
		--homestead-logo-badge-width: clamp(15.66rem, 22.68vw, 21.06rem);
		--homestead-logo-badge-height: calc(var(--homestead-logo-badge-width) * 0.75);
		--homestead-logo-badge-pad: 1.05rem;
		/* Bottom half of the badge sits in the hero; divider aligns to vertical center. */
		--homestead-logo-badge-overhang: calc(var(--homestead-logo-badge-height) * 0.5);
		--homestead-header-bar-height: calc(var(--homestead-logo-badge-height) * 0.5);
	}

	.homestead-header {
		position: relative;
		z-index: 30;
		overflow: visible;
	}

	.homestead-header__bar {
		position: relative;
		box-sizing: border-box;
		min-height: var(--homestead-header-bar-height);
		padding-block: 0;
		padding-inline: clamp(1rem, 2.5vw, 2rem);
		overflow: visible;
	}

	.homestead-header__inner {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"nav cta"
			"nav location";
		column-gap: clamp(1rem, 2vw, 1.5rem);
		row-gap: 0.2rem;
		align-items: center;
		min-height: var(--homestead-header-bar-height);
		padding-inline-start: calc(var(--homestead-logo-badge-width) + 1.35rem);
	}

	.homestead-header__brand {
		position: absolute;
		top: 0;
		left: clamp(1rem, 2.5vw, 2rem);
		z-index: 40;
		grid-area: auto;
		width: var(--homestead-logo-badge-width);
		margin: 0;
	}

	.homestead-header__logo-badge {
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: center;
		width: var(--homestead-logo-badge-width);
		min-height: var(--homestead-logo-badge-height);
		aspect-ratio: 4 / 3;
		padding: var(--homestead-logo-badge-pad);
		border: 2px solid var(--homestead-stone, #8e9188);
		background-color: var(--homestead-cream, #f5f1e8);
		box-shadow: 0 10px 28px rgb(26 26 26 / 14%);
	}

	.homestead-header__divider {
		position: relative;
		z-index: 35;
	}

	.homestead-header__logo-desktop {
		display: block;
		width: 100%;
	}

	.homestead-header__logo-mobile {
		display: none;
	}

	.homestead-header__logo .custom-logo,
	.homestead-header__logo img {
		width: 100%;
		height: auto;
		max-width: 100%;
	}

	.homestead-header__nav {
		grid-area: nav;
		justify-self: center;
		width: 100%;
	}

	.homestead-header__cta {
		grid-area: cta;
	}

	.homestead-header__location {
		grid-area: location;
		justify-self: end;
	}
}

@media (min-width: 901px) {
	.homestead-header__inner {
		column-gap: 2rem;
	}

	.homestead-header__nav .wp-block-navigation-item__content {
		font-size: 1.4rem;
	}
}

.homestead-header__nav .wp-block-navigation__container {
	gap: clamp(1rem, 2.2vw, 2.25rem);
}

.homestead-header__nav .wp-block-navigation-item__content {
	color: var(--wp--preset--color--heading, #000000);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.4rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	text-decoration: none;
	padding-block: 0.35rem;
}

.homestead-header__nav .wp-block-navigation-item__content:hover,
.homestead-header__nav .wp-block-navigation-item__content:focus-visible {
	color: var(--homestead-olive-dark);
	text-decoration: none;
}

.homestead-header__nav .current-menu-item > .wp-block-navigation-item__content,
.homestead-header__nav .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content {
	box-shadow: inset 0 -0.2rem 0 var(--homestead-olive);
}

.homestead-header__cta-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0.55rem 1.25rem;
	border-radius: var(--homestead-radius);
	background-color: var(--homestead-olive-cta);
	color: #ffffff;
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.homestead-header__cta-button:hover,
.homestead-header__cta-button:focus-visible {
	background-color: var(--homestead-olive-cta-hover);
	color: #ffffff;
	text-decoration: none;
}

.homestead-header__cta-button:focus-visible {
	outline: 2px solid var(--homestead-olive-cta-hover);
	outline-offset: 3px;
}

.homestead-header__location {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	margin: 0;
	color: var(--wp--preset--color--body, #313131);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.02em;
	text-align: center;
}

.homestead-header__address {
	display: block;
}

.homestead-header__phone-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.homestead-header__phone-link:hover,
.homestead-header__phone-link:focus-visible {
	color: var(--homestead-olive-dark);
	text-decoration: underline;
}

/* Only show drawer-only chrome when the mobile overlay is open (not in desktop nav). */
.homestead-header__nav-overlay-logo,
.homestead-header__nav-overlay-cta {
	display: none;
}

/* Shared compact type under 900px (tablet + phone). */
@media (max-width: 900px) {
	.homestead-header__nav .wp-block-navigation__container {
		gap: clamp(0.65rem, 1.5vw, 1.1rem);
	}

	.homestead-header__nav .wp-block-navigation-item__content {
		font-size: 0.9375rem;
		padding-block: 0.25rem;
	}

	.homestead-header__cta-button {
		padding-inline: 1rem;
		font-size: 0.9375rem;
	}
}

/*
 * Tablet (601–900px): badge layout above; horizontal nav until phone breakpoint.
 * Nav + address/phone stack as one column; CTA alone, centered in the right column.
 */
@media (min-width: 601px) and (max-width: 900px) {
	.homestead-header__inner {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"nav cta"
			"location cta";
		column-gap: clamp(0.85rem, 1.5vw, 1.25rem);
		row-gap: 0.15rem;
		align-items: center;
	}

	.homestead-header__nav {
		grid-area: nav;
		justify-self: center;
		align-self: end;
		width: auto;
		max-width: 100%;
	}

	.homestead-header__nav .wp-block-navigation__container {
		justify-content: center;
	}

	.homestead-header__location {
		grid-area: location;
		justify-self: center;
		align-self: start;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 0.25rem 0.65rem;
		text-align: center;
		font-size: 0.75rem;
	}

	.homestead-header__address,
	.homestead-header__phone-link {
		display: inline;
		white-space: nowrap;
	}

	.homestead-header__address::after {
		content: "·";
		margin-inline: 0.5rem 0;
		color: var(--homestead-stone, #8e9188);
	}

	.homestead-header__cta {
		grid-area: cta;
		justify-self: center;
		align-self: center;
		display: flex;
		align-items: center;
		justify-content: center;
		width: auto;
		min-height: 100%;
		padding-inline: 0.25rem;
	}
}

/*
 * Phone (≤600px): 2fr | 1fr — logo | hamburger+CTA; address/phone on a full-width row below.
 */
@media (max-width: 600px) {
	.homestead-header__bar {
		padding-block: 0.75rem 0.65rem;
		padding-inline: 1rem;
	}

	.homestead-header__inner {
		grid-template-columns: 2fr auto;
		grid-template-areas:
			"brand actions"
			"location location";
		column-gap: 0.75rem;
		row-gap: 0.75rem;
		align-items: center;
		min-height: 0;
	}

	.homestead-header__brand {
		position: static;
		grid-area: brand;
		justify-self: stretch;
		align-self: center;
		width: auto;
		min-width: 0;
		padding-inline: 0;
	}

	.homestead-header__logo-badge {
		display: contents;
	}

	.homestead-header__logo-desktop {
		display: none;
	}

	.homestead-header__logo-mobile {
		display: block;
		width: 100%;
	}

	.homestead-header__logo-mobile img {
		width: 100%;
		height: auto;
		max-height: none;
		object-fit: contain;
		object-position: left center;
	}

	.homestead-header__actions {
		display: flex;
		grid-area: actions;
		flex-direction: column;
		align-items: flex-end;
		justify-content: center;
		gap: 0;
		justify-self: end;
		min-width: 0;
	}

	.homestead-header__actions > * {
		margin: 0;
	}

	/* CTA lives in the slide-out drawer on phone. */
	.homestead-header__cta {
		display: none;
	}

	.homestead-header__nav {
		grid-area: auto;
		justify-self: auto;
		align-self: auto;
		width: auto;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container-open {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 2.75rem;
		height: 2.75rem;
		padding: 0.45rem;
		border-radius: 0;
		color: var(--wp--preset--color--heading, #000000);
		background-color: transparent;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container-open:focus-visible {
		outline: 2px solid var(--homestead-olive-cta);
		outline-offset: 2px;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container-open svg {
		width: 1.75rem;
		height: 1.75rem;
	}

	.homestead-header__location {
		grid-area: location;
		justify-self: stretch;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-start;
		gap: 0.25rem 0.65rem;
		text-align: left;
		font-size: 0.75rem;
		min-width: 0;
	}

	.homestead-header__address,
	.homestead-header__phone-link {
		display: inline;
		white-space: nowrap;
	}

	.homestead-header__address::after {
		content: "·";
		margin-inline: 0.5rem 0;
		color: var(--homestead-stone, #8e9188);
	}

	/*
	 * Mobile drawer: slide in from the left (~70% width) over a dimmed page.
	 * Close via the X button or a tap on the dark backdrop.
	 *
	 * WP copies has-base-background-color onto the overlay container with
	 * !important white; keep the container transparent and paint the dim on
	 * ::before so the page shows through at ~55% black.
	 */
	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: stretch;
		padding: 0;
		background: transparent !important;
		background-color: transparent !important;
		z-index: 50;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 0;
		background-color: rgb(0 0 0 / 55%);
		pointer-events: none;
		animation: homestead-nav-backdrop-in 0.25s ease-out both;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
		position: relative;
		z-index: 1;
		width: 70%;
		max-width: 70%;
		height: 100%;
		margin: 0;
		margin-left: 0;
		margin-right: auto;
		background-color: var(--wp--preset--color--base, #f5f1e8);
		box-shadow: 8px 0 28px rgb(0 0 0 / 22%);
		animation: homestead-nav-drawer-in 0.28s ease-out both;
	}

	.has-modal-open .homestead-header__nav .wp-block-navigation__responsive-close {
		margin-left: 0;
		margin-right: auto;
		max-width: 70%;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		height: 100%;
		padding: 1rem 1.25rem 1.5rem;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
		top: 0.85rem;
		right: 0.85rem;
		width: 2.5rem;
		height: 2.5rem;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border-radius: 0;
		color: var(--wp--preset--color--heading, #000000);
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close:focus-visible {
		outline: 2px solid var(--homestead-olive-cta);
		outline-offset: 2px;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-height: 0;
		padding-top: 0.5rem;
	}

	.homestead-header__nav-overlay-logo {
		display: block;
		order: 1;
		margin: 0 2.75rem 1.25rem 0;
		line-height: 0;
	}

	.homestead-header__nav-overlay-logo-link {
		display: inline-block;
		line-height: 0;
		text-decoration: none;
	}

	.homestead-header__nav-overlay-logo-link:focus-visible {
		outline: 2px solid var(--homestead-olive-cta);
		outline-offset: 3px;
	}

	.homestead-header__nav-overlay-logo-img {
		display: block;
		width: auto;
		height: auto;
		max-width: min(100%, 12rem);
		max-height: 8.5rem;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		order: 2;
		gap: 0.35rem;
		width: 100%;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: block;
		width: 100%;
		padding: 0.7rem 0.25rem;
		font-size: 1.125rem;
		font-weight: 600;
		box-shadow: none;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .current-menu-item > .wp-block-navigation-item__content {
		box-shadow: inset 0.25rem 0 0 var(--homestead-olive);
		padding-left: 0.75rem;
	}

	.homestead-header__nav-overlay-cta {
		display: block;
		order: 3;
		margin-top: 0.75rem;
		padding-top: 0;
	}

	.homestead-header__nav-overlay-cta-button {
		display: flex;
		width: 100%;
		min-height: 2.75rem;
		padding: 0.65rem 1rem;
		border-radius: 0;
		box-sizing: border-box;
		text-align: center;
	}
}

@keyframes homestead-nav-backdrop-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes homestead-nav-drawer-in {
	from {
		transform: translateX(-100%);
	}

	to {
		transform: translateX(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.homestead-header__cta-button {
		transition: none;
	}

	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open::before,
	.homestead-header__nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
		animation: none;
	}
}
