/* ============================================================
   Site-wide header (Solar Air Energy) — clean /intro aesthetic.
   Rendered by template-parts/header/header-wrapper.php (child override),
   inside Flatsome's #header wrapper. Uses --ds-* tokens from
   dynamic-sections.css (loaded globally before this file).

   Desktop (>1024px): horizontal nav, Solar hover dropdown, no hamburger.
   Mobile  (<=1024px): nav collapses behind a hamburger (CSS checkbox toggle).
   ============================================================ */

/* Neutralise Flatsome's native header chrome so our markup controls the look. */
#header .header-wrapper { background: transparent; box-shadow: none; }
#header .header-bg-container { display: none; }
#header { background: transparent; }

.sae-header {
	font-family: "Roboto", sans-serif;
}

/* ---------- Announcement bar ---------- */
.sae-topbar {
	background: var(--ds-ink);
	color: #ffffff;
}
.sae-topbar__inner {
	max-width: var(--ds-container);
	margin-inline: auto;
	padding: 7px var(--ds-edge);
	display: flex;
	justify-content: flex-end;
	box-sizing: border-box;
}
.sae-topbar__menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 22px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.sae-topbar__menu li { margin: 0; }
.sae-topbar__menu a {
	color: rgba(255, 255, 255, 0.82);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	letter-spacing: 0.01em;
	transition: color 0.18s ease;
}
.sae-topbar__menu a:hover { color: var(--ds-gold); }

/* ---------- Main row ---------- */
.sae-main {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: #ffffff;
	box-shadow: 0 1px 0 rgba(21, 28, 36, 0.08), 0 6px 18px rgba(21, 28, 36, 0.06);
}
.sae-main__inner {
	max-width: var(--ds-container);
	margin-inline: auto;
	padding: 12px var(--ds-edge);
	display: flex;
	align-items: center;
	gap: 28px;
	box-sizing: border-box;
}

/* ---------- Logo ---------- */
.sae-logo { flex: 0 0 auto; display: flex; }
.sae-logo a { display: inline-flex; align-items: center; }
.sae-logo__img { display: block; height: 48px; width: auto; }
.sae-logo__img--mobile { display: none; }
.sae-logo__text { font-weight: 800; color: var(--ds-ink); font-size: 20px; }

/* ---------- Primary nav (desktop) ---------- */
.sae-nav { margin-inline-start: auto; }
.sae-nav__menu {
	display: flex;
	align-items: center;
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.sae-nav__menu > li { position: relative; }
.sae-nav__menu > li > a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--ds-ink);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	padding: 8px 0;
	transition: color 0.18s ease;
}
.sae-nav__menu > li > a:hover,
.sae-nav__menu > li.current-menu-item > a { color: var(--ds-orange); }

/* Caret on parent items */
.sae-nav__menu > li.menu-item-has-children > a::after {
	content: "";
	width: 7px; height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.18s ease;
	opacity: 0.7;
}
.sae-nav__menu > li.menu-item-has-children:hover > a::after { transform: rotate(225deg) translateY(2px); }

/* ---------- Solar dropdown (two-column text menu) ---------- */
.sae-nav__menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	margin: 0;
	padding: 18px 20px;
	list-style: none;
	display: flex;
	gap: 40px;
	background: #ffffff;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card), 0 18px 40px rgba(21, 28, 36, 0.16);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
}
/* Hover bridge so the cursor can travel from "Solar" to the panel */
.sae-nav__menu > li.menu-item-has-children::after {
	content: "";
	position: absolute;
	left: 0; right: 0; top: 100%;
	height: 12px;
}
.sae-nav__menu > li.menu-item-has-children:hover > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Each direct child of the panel is a column (group: "Solutions" / "Learn") */
.sae-nav__menu .sub-menu > li { margin: 0; min-width: 160px; }

/* Group heading (eyebrow) — ONLY the panel's direct children (Solutions/Learn),
   NOT the leaf links nested one level deeper. A descendant `.sub-menu` here would
   also match the inner link lists and wrongly disable their pointer events. */
.sae-nav__menu > li > .sub-menu > li > a {
	display: block;
	padding: 0 0 8px;
	font-size: var(--ds-fs-eyebrow);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ds-grey-light);
	pointer-events: none; /* "#" headers are non-clickable */
	border-bottom: 1px solid rgba(21, 28, 36, 0.08);
	margin-bottom: 8px;
}

/* Links within a column */
.sae-nav__menu .sub-menu .sub-menu {
	position: static;
	display: block;
	opacity: 1;
	visibility: visible;
	transform: none;
	padding: 0;
	margin: 0;
	box-shadow: none;
	border-radius: 0;
	background: none;
}
.sae-nav__menu .sub-menu .sub-menu a {
	display: block;
	padding: 8px 0;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--ds-ink);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s ease, padding-left 0.15s ease;
}
.sae-nav__menu .sub-menu .sub-menu a:hover {
	color: var(--ds-orange);
	padding-left: 4px;
}

/* Hide the legacy menu-images in the text dropdown (markup stays for the mobile/full views) */
.sae-nav__menu .sub-menu .menu-image,
.sae-nav__menu .sub-menu a.menu-image-title-below > .menu-image { display: none !important; }
.sae-nav__menu .sub-menu .menu-image-title { padding: 0; font-weight: 600; }

/* ---------- Right actions (phone + Free Quote) ---------- */
.sae-actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 18px;
}
.sae-phone {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--ds-ink);
}
.sae-phone__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px; height: 38px;
	border-radius: 50%;
	background: rgba(239, 130, 0, 0.12);
	color: var(--ds-orange);
	flex: none;
}
.sae-phone__text { display: flex; flex-direction: column; line-height: 1.1; }
.sae-phone__label { font-size: 11.5px; font-weight: 500; color: var(--ds-grey-light); }
.sae-phone__number { font-size: 17px; font-weight: 800; color: var(--ds-ink); letter-spacing: 0.2px; }
.sae-phone:hover .sae-phone__number { color: var(--ds-orange); }

.sae-quote { font-size: 14px; }

/* ---------- Hamburger (mobile only) ---------- */
.sae-burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px; height: 44px;
	padding: 10px;
	box-sizing: border-box;
	cursor: pointer;
	border-radius: 10px;
}
.sae-burger span {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--ds-ink);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Focus visibility */
.sae-phone:focus-visible,
.sae-nav__menu a:focus-visible,
.sae-topbar__menu a:focus-visible,
.sae-quote:focus-visible,
.sae-burger:focus-visible {
	outline: var(--ds-focus);
	outline-offset: 2px;
	border-radius: 8px;
}

/* ============================================================
   Responsive — collapse to hamburger at <=1024px
   ============================================================ */
@media screen and (max-width: 1024px) {
	.sae-burger { display: flex; }

	/* Hide inline nav; reveal as a dropdown panel when toggled */
	.sae-nav {
		position: absolute;
		left: 0; right: 0;
		top: 100%;
		margin: 0;
		background: #ffffff;
		box-shadow: 0 14px 30px rgba(21, 28, 36, 0.12);
		border-top: 1px solid rgba(21, 28, 36, 0.06);
		display: none;
	}
	.sae-main { position: sticky; }
	.sae-main__inner { position: relative; }

	#sae-nav-toggle:checked ~ .sae-main .sae-nav { display: block; }

	.sae-nav__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		max-width: var(--ds-container);
		margin-inline: auto;
		padding: 8px var(--ds-edge) 16px;
	}
	.sae-nav__menu > li { border-bottom: 1px solid rgba(21, 28, 36, 0.06); }
	.sae-nav__menu > li > a { padding: 14px 0; justify-content: space-between; }

	/* Sub-menu: always visible, indented (no hover on touch) */
	.sae-nav__menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		padding: 0 0 8px 14px;
		min-width: 0;
	}
	.sae-nav__menu > li.menu-item-has-children > a::after { display: none; }

	/* Burger -> X when open */
	#sae-nav-toggle:checked ~ .sae-main .sae-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	#sae-nav-toggle:checked ~ .sae-main .sae-burger span:nth-child(2) { opacity: 0; }
	#sae-nav-toggle:checked ~ .sae-main .sae-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

	.sae-main__inner { gap: 14px; }
	.sae-nav { order: 3; }
}

@media screen and (max-width: 600px) {
	.sae-logo__img--desktop { display: none; }
	.sae-logo__img--mobile { display: block; height: 40px; }
	.sae-phone__label { display: none; }
	.sae-phone__text { display: none; }
	.sae-topbar { display: none; }
	.sae-quote { padding: 10px 16px; }
}
