/* =========================================================================
   HNZ Constructions — site header

   Utility bar, header, primary navigation and the mobile nav panel.

   Enqueued by hnz_enqueue_assets() in inc/enqueue.php, which fixes the load
   order. Design tokens live in tokens.css.
   ========================================================================= */

.utility-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 101;
	background: var(--c-ink);
	font-family: var(--font-display);
	color: #fff;
	font-size: 12px; /* 12px */
	font-weight: var(--fw-display);
	letter-spacing: 0;
}

.utility-bar__wrapper {
	position: relative;
	z-index: 2;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.utility-bar__inner {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: var(--sp-2) var(--sp-3);
	padding: var(--sp-1) var(--sp-5);
	background: var(--c-ink);
	justify-content: center;

	.utility-bar__item {
		white-space: nowrap;
	}
}

/* Separator pipes between the items, as in the design. */
.utility-bar__item + .utility-bar__item::before {
	content: "|";
	margin-right: var(--sp-3);
	opacity: 0.45;
}

.utility-bar__email {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.site-header {
	position: sticky;
	width: 100%;
	top: 27px;
	z-index: 100;
	background: var(--c-surface);
	
	@media (min-width: 1300px) {
		position: fixed;
	}
}

/* Contact details move into the full-screen mobile navigation panel, and
   with no utility bar left above it, the header sits flush with the top.
   This must come after the base .site-header rule above — same
   specificity, so source order decides the winner, not the media query. */
@media (max-width: 1299px) {
	.utility-bar {
		display: none;
	}

	.site-header {
		top: 0;
	}
}

@media (min-width: 1300px) {
	/* Hero pages use a transparent header until it becomes sticky. */
	body:has(.site-main > .section--hero:first-child .hero__image) .site-header,
	body:has(.site-main > .section--page-hero:first-child .page-hero__image) .site-header,
	body.single-project .site-header {
		background: transparent;
	}

	body:has(.site-main > .section--hero:first-child .hero__image) .site-header:not(.is-stuck) .site-nav__list a,
	body:has(.site-main > .section--page-hero:first-child .page-hero__image) .site-header:not(.is-stuck) .site-nav__list a,
	body.single-project .site-header:not(.is-stuck) .site-nav__list a {
		color: #e6e7e8;
	}

	body:has(.site-main > .section--hero:first-child .hero__image) .site-header:not(.is-stuck) .logo__image,
	body:has(.site-main > .section--page-hero:first-child .page-hero__image) .site-header:not(.is-stuck) .logo__image,
	body.single-project .site-header:not(.is-stuck) .logo__image {
		filter: brightness(0) invert(1);
	}

	body:has(.site-main > .section--hero:first-child .hero__image) .site-header.is-stuck,
	body:has(.site-main > .section--page-hero:first-child .page-hero__image) .site-header.is-stuck,
	body.single-project .site-header.is-stuck {
		background: var(--c-surface);
	}
}

.site-header__inner {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: stretch;
	justify-content: space-between;
	min-height: 64px;
	height: 100%;
	padding-inline: var(--gutter);
	padding-block: var(--sp-6);
	max-width: var(--container);
	margin-inline: auto;

	@media (min-width: 1300px) {
		padding-block: 0;
	}
}

@media (min-width: 1300px) {
	.site-header__inner .logo {
		margin-top: 45px;
		margin-bottom: 45px;
	}
}

.logo {
	display: inline-flex;
	align-items: center;
	flex: none;
}

.logo__image {
	max-height: 56px; /* The lockup's own height in the design. */
	width: auto;
}

.logo__text {
	font-family: var(--font-display);
	font-weight: var(--fw-bold);
	font-size: var(--fs-400); /* 18px */
	letter-spacing: 0.02em;
}

.site-nav {
	position: relative;
	margin-left: auto;
	display: flex;
	align-items: center;
	justify-content: end;
}

.site-nav__list {
	display: none;
	/* Measured ~72-73px edge-to-edge between items across every export
	   (Home/About/Services/Projects); no spacing token matches, so it's
	   hard-coded rather than borrowed from a nearby one. */
	gap: 4.5rem;
}

@media (min-width: 1300px) {
	.site-nav__list {
		display: flex;
	}
}

.site-nav__list a {
	position: relative;
	display: block;
	font-size: 12px; /* 12px */
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	padding-block: var(--sp-2);
	font-family: var(--font-display);
	cursor: pointer;
}

.site-nav__list a::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background: currentcolor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.site-nav__list a:hover::before,
.site-nav__list .current-menu-item > a::before,
.site-nav__list .current_page_parent > a::before,
.site-nav__list .current-menu-ancestor > a::before {
	transform: scaleX(1);
	transform-origin: left;
}

.site-header__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--sp-3);
	width: 100%;
	max-width: 177px;
}

@media (min-width: 1300px) {
	.site-header__actions {
		display: none;
	}
}

.nav-toggle {
	display: grid;
	gap: 6px;
	width: 52px;
	height: 52px;
	place-content: center;
}

.nav-toggle__bar {
	display: block;
	width: 28px;
	height: 2px;
	background: currentcolor;
	transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
	transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
	opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(4) {
	transform: translateY(-8px) rotate(-45deg);
}

.mobile-nav {
	position: fixed;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	padding: calc(4rem + var(--sp-7)) var(--gutter) var(--sp-5);
	background: var(--c-surface);
	color: var(--c-ink);
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 1300px) {
	.mobile-nav {
		display: none !important;
	}
}

.mobile-nav.is-open {
	transform: translateX(0);
}

.mobile-nav__list {
	border-top: 1px solid var(--c-rule);
}

.mobile-nav__list a {
	position: relative;
	display: block;
	padding: 0.42em 0;
	font-family: var(--font-display);
	font-size: clamp(2.25rem, 11vw, 3.75rem); /* 36px–60px */
	font-weight: var(--fw-display);
	line-height: 1;
	border-bottom: 1px solid var(--c-rule);
	transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-nav__list a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background: currentcolor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-nav__list a:hover,
.mobile-nav__list a:focus-visible,
.mobile-nav__list a:active {
	transform: translateX(0.5rem);
}

.mobile-nav__list a:hover::after,
.mobile-nav__list a:focus-visible::after,
.mobile-nav__list a:active::after {
	transform: scaleX(1);
	transform-origin: left;
}

.mobile-nav__contact {
	margin-top: auto;
	padding-top: var(--sp-4);
	border-top: 1px solid var(--c-rule);
	font-size: var(--fs-100); /* 12px */
	line-height: 1.5;
}

.mobile-nav__contact-item + .mobile-nav__contact-item {
	margin-top: var(--sp-3);
}

.mobile-nav__contact-label,
.mobile-nav__contact-value {
	display: block;
}

.mobile-nav__contact-label {
	font-weight: var(--fw-bold);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.mobile-nav__contact-email {
	display: inline-block;
	margin-top: var(--sp-4);
	text-decoration: underline;
	text-underline-offset: 0.22em;
}

body.nav-is-open .site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: transparent;
	color: var(--c-ink);
}

body.nav-is-open .nav-toggle {
	color: var(--c-ink);
}

@media (prefers-reduced-motion: reduce) {
	.mobile-nav {
		transition: none;
	}
}
