/*
 * Site header — Figma "Global Header" (CRH file CPO8VrN83OFQrdnEQ6hRGX,
 * 8103:36711: desktop 8103:36712, mobile 8107:1167) and "Global / Message
 * Bar" (28408:5436).
 *
 * Served directly, like block CSS; bin/add-fallbacks.mjs generates the var()
 * fallbacks. Type metrics come from the composite classes in the markup
 * (.text-label-sm, .text-label-lg); this file is color and layout only.
 */

.site-header {
	background: var(--background, #ffffff);
}

/* Announcement bar ---------------------------------------------------------- */

.site-announcement {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: var(--spacing-2, 8px) var(--section-hr-padding, 64px);
	background: var(--primary, #263954);
	color: var(--primary-foreground, #ffffff);
}

.site-announcement[hidden] {
	display: none;
}

.site-announcement__text {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
	text-align: center;
}

/* Desktop: pinned 16px from the right edge at 20px, so the copy stays centred
   on the full bar. Mobile moves it into the flow at 16px (below). */
.site-announcement__close {
	--icon-size: 20px;
	position: absolute;
	top: 50%;
	right: var(--spacing-4, 16px);
	display: inline-flex;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transform: translateY(-50%);
}

.site-announcement__close:focus-visible {
	outline: 2px solid var(--primary-foreground, #ffffff);
	outline-offset: 2px;
	border-radius: var(--radius-sm, 2px);
}

/* Main row ------------------------------------------------------------------ */

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--spacing-8, 32px);
	max-width: var(--container-max-width, 1440px);
	margin-inline: auto;
	padding: var(--spacing-6, 24px) var(--section-hr-padding, 64px);
}

/* The global a:not(.btn) hover underline doesn't belong on the logo. */
.site-header__logo,
.site-header__logo:hover {
	display: flex;
	flex: none;
	align-items: center;
	border-bottom-color: transparent;
}

.site-header__logo img {
	display: block;
	width: auto;
	max-width: 200px;
	height: 60px;
	object-fit: contain;
}

.site-header__site-name {
	color: var(--foreground, #666666);
}

.site-header__nav {
	flex: 1 1 0;
	min-width: 0;
}

.site-header__menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	/* 24px between links, per Figma. A menu longer than the comp's three links
	   can wrap at tablet widths; the 8px row gap keeps it compact when it does. */
	gap: var(--spacing-2, 8px) var(--spacing-6, 24px);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Menu links are Figma Button Type=Link in foreground: the hover underline
   comes from the global link rule, in the link's own color. */
.site-header__link {
	color: var(--foreground, #666666);
}

.site-header__actions {
	display: flex;
	flex: none;
	align-items: center;
	gap: var(--spacing-2, 8px);
	margin-left: auto;
}

/* The header's pills are full-round in Figma whatever the brand's
   --radius-button is (the Button component uses border-radius/full here). */
.site-header__pill {
	border-radius: var(--radius-full, 9999px);
}

.site-header__toggle {
	display: none;
}

/* Mobile -------------------------------------------------------------------- */

@media (max-width: 767px) {
	.site-announcement__close {
		--icon-size: 16px;
		position: static;
		flex: none;
		transform: none;
	}

	.site-header__inner {
		flex-wrap: wrap;
		justify-content: space-between;
		gap: 0 var(--spacing-2, 8px);
		padding-block: var(--spacing-4, 16px);
	}

	.site-header__logo img {
		height: 40px;
	}

	/* The menu becomes a panel under the row, opened by the toggle. Without JS
	   (no .has-js) it stays visible and the toggle stays hidden, so the menu is
	   always reachable. The open panel isn't in the Figma comp — this is the
	   simplest treatment on existing tokens; replace it when design adds one. */
	.site-header__nav {
		flex-basis: 100%;
		order: 3;
	}

	.site-header.has-js .site-header__nav {
		display: none;
	}

	.site-header.has-js.is-open .site-header__nav {
		display: block;
	}

	.site-header.has-js .site-header__toggle {
		display: inline-flex;
	}

	.site-header__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin-top: var(--spacing-4, 16px);
		border-top: var(--border-width-1, 1px) solid var(--border, #d6d3d1);
	}

	.site-header__menu > li {
		border-bottom: var(--border-width-1, 1px) solid var(--border, #d6d3d1);
	}

	.site-header__link {
		display: block;
		padding-block: var(--spacing-3, 12px);
	}
}

/* Monarch -------------------------------------------------------------------
   Live Divi header (monarchhomestn.com, 1440px): white bar ~120px tall, the
   animated Monarch logo centred (240px), Montserrat 500 16px uppercase black
   links split either side, and "Call Us" as an orange #f3a31a button.
   Sticky, as on the other rebuilds. */

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.admin-bar .site-header { top: 32px; }

@media (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}

.site-header__link {
	font-family: var(--font-label, "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif);
	font-weight: 500;
	font-size: 16px;
	line-height: 1;
	text-transform: uppercase;
	color: #000000;
	border-bottom: 0;
}

.site-header__link:hover { color: #000000; opacity: 0.7; border-bottom: 0; }
.site-header__menu .current-menu-item > .site-header__link { color: #000000; border-bottom: 0; }

.site-header__menu .menu-cta > .site-header__link {
	padding: 14px 16px;
	background: var(--mh-accent, #f3a31a);
	color: #ffffff;
	font-weight: 600;
}

.site-header__menu .menu-cta > .site-header__link:hover { opacity: 0.85; }

@media (min-width: 981px) {
	.site-header__inner {
		display: grid;
		grid-template-columns: 1fr auto 1fr;
		gap: 0 32px;
		width: 90%;
		max-width: 1200px;
		min-height: 120px;
		padding: 10px 0;
	}

	.site-header__nav { display: contents; }
	.site-header__menu { gap: 0 22px; flex-wrap: nowrap; }
	.site-header__menu--first { grid-column: 1; grid-row: 1; justify-content: flex-end; }
	.site-header__logo { grid-column: 2; grid-row: 1; }
	.site-header__menu--second { grid-column: 3; grid-row: 1; justify-content: flex-start; }
	.site-header__actions { display: none; }

	.site-header__logo img { width: 220px; max-width: none; height: auto; }
}

@media (max-width: 1200px) and (min-width: 981px) {
	.site-header__menu { gap: 0 14px; }
	.site-header__link { font-size: 14px; }
	.site-header__logo img { width: 170px; }
}

/* Below 981px: logo left, menu behind the toggle (both halves stacked). */
@media (max-width: 980px) {
	.site-header__inner {
		flex-wrap: wrap;
		justify-content: space-between;
		gap: 0 8px;
		width: 90%;
		padding: 12px 0;
	}

	.site-header__logo img { width: 150px; max-width: none; height: auto; }

	.site-header__nav {
		flex-basis: 100%;
		order: 3;
		max-height: calc(100vh - 100px);
		overflow-y: auto;
	}

	.site-header.has-js .site-header__nav { display: none; }
	.site-header.has-js.is-open .site-header__nav { display: block; }
	.site-header.has-js .site-header__toggle { display: inline-flex; color: #000000; }

	.site-header__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin: 0;
		border-top: 0;
	}

	.site-header__menu--first { margin-top: 12px; border-top: 1px solid rgba(0, 0, 0, 0.1); }
	.site-header__menu > li { border-bottom: 1px solid rgba(0, 0, 0, 0.1); }
	.site-header__link { display: block; padding: 14px 0; }
	.site-header__menu .menu-cta { border-bottom: 0; padding: 16px 0 8px; }
	.site-header__menu .menu-cta > .site-header__link { display: inline-block; padding: 14px 20px; }
}
