/*
 * Mobile nav menu. Add the class `allstar-mobile-menu` to the Nav Menu widget.
 * The open dropdown becomes an absolute overlay (floats over the page, doesn't
 * grow the header); top rows are styled directly, sections/pills key off
 * `mnav-*` classes.
 *
 * The scope class is doubled (`.allstar-mobile-menu.allstar-mobile-menu`) to beat
 * Elementor's own item selectors — don't collapse it.
 * max-height / overflow on the dropdown are left to Elementor's open animation.
 */

/* ---- Open dropdown = fixed full-screen overlay panel ----
   `:not(.sub-menu)` limits this to the TOP-LEVEL dropdown (nested submenus also
   carry `elementor-nav-menu--dropdown`). Positioned against the viewport (not the
   widget) so it's the same on every layout regardless of where the toggle sits:
   13px gutters each side, top at the header's bottom edge (`--mnav-overlay-top`,
   set by mobile-menu.js; 90px fallback). */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown:not( .sub-menu ) {
	position: fixed;
	top: var(--mnav-overlay-top, 90px);
	left: 13px;
	right: 13px;
	z-index: 9999;
	width: auto;
	max-width: none;
	padding: 10px;
	background: #fbfbfb;
	border-radius: 10px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

/* Open state: fill from the top offset to a 13px bottom gutter and scroll
   internally. `:has()` keys off the toggle's aria state. The `!important` on
   max-height overrides Elementor's reveal variable (--menu-height); the closed
   state is still hidden by Elementor (this rule simply doesn't match when closed). */
.allstar-mobile-menu.allstar-mobile-menu:has( .elementor-menu-toggle[aria-expanded="true"] ) .elementor-nav-menu--dropdown:not( .sub-menu ) {
	min-height: calc(100dvh - var(--mnav-overlay-top, 90px) - 13px);
	max-height: calc(100dvh - var(--mnav-overlay-top, 90px) - 13px) !important;
	overflow-y: auto;
}

/* Dimmed backdrop behind the open menu. Starts at the header's bottom edge so the
   nav (logo + hamburger) stays visible and clickable — letting the user close the
   menu by tapping the hamburger again. `--mnav-overlay-top` is set from the header
   height by mobile-menu.js (per breakpoint); 90px is the fallback. */
.allstar-mobile-menu.allstar-mobile-menu:has( .elementor-menu-toggle[aria-expanded="true"] )::before {
	content: "";
	position: fixed;
	inset: var(--mnav-overlay-top, 90px) 0 0 0;
	z-index: 9998;
	background: rgba(174, 175, 182, 0.9);
}

/* Service Areas submenu inside the mobile menu: a collapsible accordion (collapsed
   by default, toggled by Elementor's sub-arrow), NOT the desktop floating panel.
   Scoped to .allstar-mobile-menu so the desktop dropdown is unaffected. */
.allstar-mobile-menu.allstar-mobile-menu .has-area-menu.has-area-menu > .sub-menu {
	position: static;
	width: 100%;
	max-width: none;
	display: none;
	box-shadow: none;
	border: 0;
}

/* ---- Nested submenus (Resources, future sections, …) ----
   Inline collapsible list of pills (per Figma), not a floating box. Collapsed by
   default; Elementor's sub-arrow toggles inline display. (Service Areas keeps its
   own has-area-menu styling, which wins on specificity.) */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown .sub-menu {
	display: none;
	position: static;
	width: 100%;
	max-width: none;
	padding: 5px 0 5px 6px;
	background: transparent;
	box-shadow: none;
	/* !important: the Nav Menu widget sets a dropdown border on .sub-menu. */
	border: 0 !important;
}

.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li {
	width: 100%;
	border: 0;
}

.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li > a {
	display: block;
	padding: 7px 15px;
	border-radius: 40px;
	border-bottom: 0;
	font-family: "azo-sans-web", sans-serif;
	font-size: 11.5px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: #000;
	background: transparent;
}

.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li > a:hover,
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.current-menu-item > a {
	background: #e8f1ff;
	color: #0067af;
}

/* spacing between top-level rows */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li {
	width: 100%;
	border: 0;
}

/* ---- Top-level rows (HOME / OUR SERVICES / …) ---- */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	border-bottom: 1px solid #e2e8f0;
	border-radius: 10px;
	font-family: "azo-sans-web", sans-serif;
	/* !important: beats the Nav Menu widget's typography control. */
	font-size: 15px !important;
	font-weight: 400;
	line-height: 1.3;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: #133e6b;
	background: transparent;
}

/* Top-level rows keep the highlight while their submenu is open (`.has-submenu
   .highlighted`); inner submenu rows do not. */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li > a:hover,
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li.menu-item-has-children.elementor-active > a,
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li > a.has-submenu.highlighted {
	background: #e8f1ff;
	color: #133e6b;
}

/* ---- Top-row icon chips (Figma) ----
   A light-blue 24px chip on the right of each top-level row. Plain links and
   `.is-home` use the row's `::after`; items with children reuse Elementor's
   `.sub-arrow` (kept clickable so it still toggles the submenu). */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li > a::after,
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li > a .sub-arrow {
	/* `position: static` overrides Elementor's `a::after` underline rule (which is
	   absolutely positioned) so the chip is a normal flex item, not overlapping
	   the label. `inset:auto` clears any inherited offsets. */
	position: static;
	inset: auto;
	flex: 0 0 24px;
	width: 24px;
	min-width: 24px;
	height: 24px;
	margin: 0;
	border-radius: 2px;
	background-color: #eef5ff;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 16px 16px;
	/* Elementor's pointer animation fades `::after` to opacity:0 until hover/active;
	   force it visible since mobile has no hover. !important because Elementor's
	   selector is a high-specificity `:not()` stack. */
	opacity: 1 !important;
	color: transparent;
	font-size: 0;
}

/* house — items tagged .is-home */
.allstar-mobile-menu.allstar-mobile-menu .is-home > a::after {
	content: "";
	background-image: url(/wp-content/mu-plugins/allstar/assets/icons/home.svg);
}

/* arrow-right — plain link rows (no submenu, not home) */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li:not(.is-home):not(.menu-item-has-children) > a::after {
	content: "";
	background-image: url(/wp-content/mu-plugins/allstar/assets/icons/arrow-right.svg);
}

/* plus / minus — TOP-LEVEL rows with a submenu (plus collapsed, minus expanded).
   Scoped to `> ul > li` so section carets (deeper) are not affected.
   Elementor sets the submenu's inline `display:block` when open. */
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li.menu-item-has-children > a .sub-arrow {
	background-image: url(/wp-content/mu-plugins/allstar/assets/icons/plus.svg);
}
.allstar-mobile-menu.allstar-mobile-menu .elementor-nav-menu--dropdown > ul > li.menu-item-has-children:has( > .sub-menu[style*="display: block"] ) > a .sub-arrow {
	background-image: url(/wp-content/mu-plugins/allstar/assets/icons/minus.svg);
}

/* Our Services mega-menu — injected nested items:
   is-services > ul > li.mnav-section > ul > li.mnav-pill. Selectors carry
   `.sub-menu` + the item class to beat the generic pill rules above. */

/* Sections list (level 2) — the white cards stack with a 20px gap */
.allstar-mobile-menu.allstar-mobile-menu .is-services > .sub-menu {
	padding: 15px 0 0;
}

/* Section card (Roofing / Gutters / …) */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-section {
	margin: 0 0 20px;
	padding: 10px;
	background: #fff;
	border-radius: 10px;
}
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-section:last-child {
	margin-bottom: 0;
}

/* Section header */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-section > a {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	padding: 0 0 10px;
	border-bottom: 0;
	border-radius: 0;
	background: transparent;
	font-family: "azo-sans-web", sans-serif;
	/* !important: beats the Nav Menu widget's typography control. */
	font-size: 10px !important;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: #0067af;
}

/* Section caret (▼ collapsed, ▲ when the header is `.highlighted` = open).
   Built as a CSS triangle so no extra asset is needed. */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-section > a .sub-arrow {
	flex: 0 0 auto;
	width: 0;
	min-width: 0;
	height: 0;
	margin: 0;
	padding: 0;
	border-radius: 0;
	background: none;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 7px solid #0067af;
}
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-section > a.highlighted .sub-arrow {
	border-top: 0;
	border-bottom: 7px solid #0067af;
}

/* Pills list (level 3) */
.allstar-mobile-menu.allstar-mobile-menu .mnav-section > .sub-menu {
	gap: 5px;
	padding: 0;
}

/* Pills (children of a section) */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-pill > a {
	display: block;
	padding: 7px 15px;
	/* !important: beats the Nav Menu widget's border-radius + typography controls. */
	border-radius: 40px !important;
	border-bottom: 0;
	font-family: "azo-sans-web", sans-serif;
	font-size: 11.5px !important;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: #000;
	background: transparent;
}

.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-pill > a:hover {
	background: #e8f1ff;
	color: #0067af;
}

/* Current page pill — solid blue (active only, e.g. the section's Hub you're on) */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-pill.current-menu-item > a {
	background: #0067af;
	color: #fff;
}

/* "Overview" / highlighted pill — light blue */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-overview > a {
	background: #e8f1ff;
	color: #0067af;
}

/* Indented sub-item under an Overview pill */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-sub > a {
	padding-left: 30px;
}

/* SOLAR "Partner" green sub-label */
.allstar-mobile-menu.allstar-mobile-menu .sub-menu > li.mnav-partner > a::after {
	content: "Partner";
	display: block;
	margin-top: 2px;
	font-size: 9px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: #009c31;
}
