/* ============================================================
   Header — "teal" single-row design (h.JPG).
   Logo · nav · search toggle (popup panel) · Get Quote CTA.
   Loaded after main.css.
   ============================================================ */

/* ---------- Bar ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--header-bg);
	border-bottom: 1px solid var(--line);
}
body.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) {
	body.admin-bar .site-header { top: 46px; }
}

.header-inner {
	display: grid;
	grid-template-columns: auto auto auto minmax(0, 1fr);
	align-items: center;
	gap: 24px;
	height: 72px;
}

/* ---------- Brand ---------- */
/* The 24px grid gap alone leaves the logo only 36px from the first menu word. */
.site-branding { flex-shrink: 0; justify-self: start; margin-right: 28px; }
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}
.brand-mark { display: inline-flex; }
.brand-mark svg { display: block; }
.brand-word {
	font-family: var(--font-title);
	font-size: 27px;
	font-weight: 800;
	letter-spacing: -.5px;
	color: var(--ink);
	line-height: 1;
}
.brand-dot { font-style: normal; color: var(--accent); }
.custom-logo-link img { max-height: 62px; width: auto; display: block; }

/* ---------- Navigation ---------- */
.main-navigation { display: flex; justify-self: start; }
.main-navigation > ul {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.main-navigation li { position: relative; }
.main-navigation > ul > li > a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	font-family: var(--font-title);
	font-size: 15px;
	font-weight: 600;
	color: var(--nav);
	border-radius: 8px;
	transition: color .18s ease, background .18s ease;
}
.main-navigation > ul > li > a:hover,
.main-navigation > ul > li.current-menu-item > a { color: var(--nav-hover); }
.nav-caret { opacity: .55; transition: transform .18s ease; }
.main-navigation li:hover > a > .nav-caret { transform: translateY(1px); }

/* Dropdown */
.main-navigation .sub-menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 220px;
	list-style: none;
	margin: 0;
	padding: 8px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 12px;
	box-shadow: var(--shadow-md);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: all .18s ease;
	z-index: 90;
}
.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.main-navigation .sub-menu a {
	display: block;
	padding: 9px 12px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 500;
	color: var(--nav);
	border-radius: 8px;
	transition: background .15s ease, color .15s ease;
}
.main-navigation .sub-menu a:hover { background: var(--link-wash); color: var(--nav-hover); }

/* Mega menu (Products): compact panel under the trigger, one column per second-level item. */
.main-navigation { align-self: stretch; }
.main-navigation > ul { height: 100%; }
.main-navigation .menu-item-mega {
	position: relative;
	align-self: stretch;
	display: flex;
	align-items: center;
}
.mega-menu {
	position: absolute;
	top: 100%;
	left: 0;
	right: auto;
	transform: translateY(6px);
	width: max-content;
	max-width: min(calc(100vw - 32px), 680px);
	background: #fff;
	border: 1px solid var(--line);
	border-top: 0;
	border-radius: 0 0 12px 12px;
	box-shadow: 0 14px 26px rgba(26, 21, 18, .07);
	opacity: 0;
	visibility: hidden;
	transition: opacity .16s ease, transform .16s ease, visibility .16s;
	z-index: 90;
}
.main-navigation li:hover > .mega-menu,
.main-navigation li:focus-within > .mega-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.mega-inner {
	display: grid;
	grid-template-columns: repeat(var(--mega-cols, 3), minmax(0, 1fr));
	gap: 12px 22px;
	padding: 14px 16px 12px;
}
.mega-col { min-width: 0; }
.mega-col-title {
	display: block;
	padding-bottom: 6px;
	margin-bottom: 6px;
	border-bottom: 1px solid var(--line);
	font-family: var(--font-title);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	line-height: 1.4;
	color: var(--nav);
}
a.mega-col-title:hover { color: var(--nav-hover); }
.mega-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega-list a {
	display: block;
	padding: 6px 8px;
	font-family: var(--font-body);
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.6;
	color: var(--body);
	border-radius: 6px;
	transition: background .15s ease, color .15s ease;
}
.mega-list a:hover { background: var(--link-wash); color: var(--nav-hover); }

.mega-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px 18px;
	padding: 10px 16px;
	border-top: 1px solid var(--line);
}
.mega-count {
	font-family: var(--font-body);
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--body);
}
.mega-quote {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: var(--font-title);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.4;
	color: var(--nav);
	white-space: nowrap;
}
.mega-quote:hover { color: var(--nav-hover); }
.mega-quote-arrow { transition: transform .15s ease; }
.mega-quote:hover .mega-quote-arrow { transform: translateX(3px); }

/* ---------- Actions: search + CTA + hamburger ---------- */
.header-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	justify-self: end;
	flex-shrink: 0;
}

/* Magnifier toggle — the search field itself lives in the popup panel below. */
.header-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	background: var(--surface);
	border: 0;
	border-radius: var(--radius);
	color: var(--nav);
	cursor: pointer;
	transition: background .18s ease, color .18s ease;
}
.header-search-toggle:hover { background: var(--link-wash); color: var(--nav-hover); }
.header-search-toggle svg { display: block; }

/* Popup search panel — drops under the sticky bar, full bleed. */
.header-search-panel {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	padding: 18px 0 20px;
	background: #fff;
	border-bottom: 1px solid var(--line);
	box-shadow: var(--shadow-md);
	z-index: 95;
}
.header-search-panel[hidden] { display: none; }
.header-search-inner {
	display: flex;
	align-items: center;
	gap: 12px;
	width: min(560px, calc(100% - 48px));
	margin: 0 auto;
}
.header-search-form {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 0;
	height: 52px;
	padding: 0 6px 0 14px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.header-search-form:focus-within {
	background: #fff;
	border-color: var(--nav-hover);
	box-shadow: 0 0 0 3px rgba(201, 114, 34, .14);
}
.header-search-form .search-icon { color: var(--muted); flex-shrink: 0; }
.header-search-form .search-field {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 0;
	font-family: var(--font-body);
	font-size: 16px;
	color: var(--nav);
	outline: none;
}
.header-search-form .search-field::placeholder { color: var(--muted); }
.search-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	background: var(--nav-hover);
	border: 0;
	border-radius: var(--radius);
	color: #fff;
	cursor: pointer;
	transition: background .18s ease;
}
.search-submit:hover { background: var(--nav); color: #fff; }
.search-close { width: 44px; height: 44px; }

/* CTA */
.header-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	padding: 0 22px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-title);
	font-size: 15px;
	font-weight: 700;
	border-radius: 999px;
	box-shadow: 0 4px 12px rgba(201, 114, 34, .28);
	transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
	white-space: nowrap;
}
.header-cta:hover {
	color: #fff;
	background: var(--accent-dark);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(201, 114, 34, .36);
}

/* The CTA is an in-page jump to the quote form every footer prints, so the
   sticky 72px header must not cover it on arrival. */
#quote-form {
	scroll-margin-top: 88px;
}

/* Hamburger (hidden on desktop) */
.menu-toggle {
	display: none;
	background: none;
	border: 0;
	cursor: pointer;
	padding: 8px;
	flex-direction: column;
	gap: 5px;
}
.menu-toggle span { display: block; width: 24px; height: 2px; background: var(--nav); border-radius: 2px; transition: all .25s ease; }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer-only extras (hidden on desktop) */
.nav-cta-mobile { display: none; }
.nav-tools-mobile { display: none; }

/* ---------- Responsive ---------- */
/* Narrow desktop: keep logo + 6 nav items + search toggle + CTA on one row. */
@media (max-width: 1280px) {
	.header-inner { gap: 18px; }
	.main-navigation > ul > li > a { padding: 8px 9px; }
}

@media (max-width: 1024px) {
	/* Nav becomes an out-of-flow drawer, so drop to a two-column row. */
	.header-inner { height: 66px; gap: 16px; grid-template-columns: 1fr auto; }
	.header-actions { grid-column: 2; }
	.custom-logo-link img { max-height: 52px; }
	/* Search lives in the drawer instead of the bar. */
	.header-search-toggle,
	.header-search-panel { display: none; }
	.header-actions .header-cta { display: none; }
	.menu-toggle { display: flex; }

	.main-navigation {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		flex-direction: column;
		background: var(--header-bg);
		border-top: 1px solid var(--line);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow-md);
		max-height: calc(100vh - 66px);
		overflow-y: auto;
	}
	.main-navigation.open { display: flex; }
	.main-navigation > ul { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 20px; }
	.main-navigation > ul > li > a { padding: 12px 8px; font-size: 16px; }
	.main-navigation .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: 0;
		border-left: 3px solid var(--nav-hover);
		border-radius: 0;
		margin: 0 0 8px 12px;
		padding: 0 0 0 10px;
		display: none;
		min-width: 0;
	}
	.main-navigation li.open > .sub-menu { display: block; }

	/* Mega panel becomes a stacked accordion section inside the drawer. */
	.main-navigation > ul { height: auto; }
	.main-navigation .menu-item-mega { position: relative; display: block; align-self: auto; }
	.mega-menu {
		position: static;
		width: auto;
		max-width: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: 0;
		border-radius: 0;
		display: none;
	}
	.main-navigation li.open > .mega-menu { display: block; }
	.mega-inner { grid-template-columns: 1fr; gap: 12px; padding: 0 0 10px; }
	.mega-footer { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 0 2px; }

	.nav-tools-mobile { display: block; padding: 12px 20px; border-top: 1px solid var(--line); }
	.drawer-search { display: flex; gap: 8px; }
	.drawer-search input {
		flex: 1;
		height: 42px;
		padding: 0 12px;
		background: var(--surface);
		border: 1px solid transparent;
		border-radius: var(--radius);
		font-size: 14px;
	}
	.drawer-search button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 42px;
		height: 42px;
		background: var(--nav-hover);
		color: #fff;
		border: 0;
		border-radius: var(--radius);
		cursor: pointer;
	}
	.nav-cta-mobile { display: flex; margin: 12px 20px 20px; }
}

@media (max-width: 560px) {
	.header-inner { gap: 10px; }
	.brand-word { font-size: 23px; }
	.header-cta { height: 40px; padding: 0 18px; font-size: 14px; }
}
