/**
 * HAI Mobile Menu: drill-down off-canvas navigation.
 * All theming flows through CSS custom properties on .hai-mm so each site
 * only overrides a handful of variables (set via the Elementor Style tab).
 */

.hai-mm {
	--hai-mm-bg: #ffffff;
	--hai-mm-text: #1a1a1a;
	--hai-mm-accent: #1f1f1f;
	--hai-mm-muted: rgba(0, 0, 0, 0.55);
	--hai-mm-divider: rgba(0, 0, 0, 0.08);
	--hai-mm-header-bg: transparent;
	--hai-mm-overlay: rgba(0, 0, 0, 0.5);
	--hai-mm-width: 360px;
	--hai-mm-toggle-color: #1a1a1a;
	--hai-mm-toggle-size: 26px;
	--hai-mm-toggle-bar-h: 2px;
	--hai-mm-z: 99990;

	display: inline-flex;
	line-height: 1;
}

/* Hamburger toggle */
.hai-mm-toggle {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: calc(var(--hai-mm-toggle-size) + 12px);
	height: calc(var(--hai-mm-toggle-size) + 12px);
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}
.hai-mm-toggle span {
	display: block;
	flex: 0 0 auto;
	width: var(--hai-mm-toggle-size);
	height: var(--hai-mm-toggle-bar-h);
	background: var(--hai-mm-toggle-color);
	border-radius: 2px;
	transition: transform 0.25s ease, opacity 0.2s ease;
}
/* 3-bar open animation (gap is 5px) */
.hai-mm-bars-3.is-open .hai-mm-toggle span:nth-child(1) { transform: translateY(calc(var(--hai-mm-toggle-bar-h) + 5px)) rotate(45deg); }
.hai-mm-bars-3.is-open .hai-mm-toggle span:nth-child(2) { opacity: 0; }
.hai-mm-bars-3.is-open .hai-mm-toggle span:nth-child(3) { transform: translateY(calc((var(--hai-mm-toggle-bar-h) + 5px) * -1)) rotate(-45deg); }
/* 2-bar open animation */
.hai-mm-bars-2.is-open .hai-mm-toggle span:nth-child(1) { transform: translateY(calc((var(--hai-mm-toggle-bar-h) + 5px) * 0.5)) rotate(45deg); }
.hai-mm-bars-2.is-open .hai-mm-toggle span:nth-child(2) { transform: translateY(calc((var(--hai-mm-toggle-bar-h) + 5px) * -0.5)) rotate(-45deg); }

/*
 * Overlay + panel carry popover="manual" so the JS can lift them into the
 * browser's top layer, escaping any ancestor that established a containing
 * block for position:fixed (backdrop-filter, filter, transform, perspective).
 *
 * That means the UA popover defaults apply here: inset:0, width/height:
 * fit-content, margin:auto, border:solid, padding:.25em, overflow:auto,
 * background:Canvas and display:none while closed. Author declarations always
 * beat the UA sheet, but ONLY for properties actually declared. So every one
 * of those is set explicitly below. Drop `height: auto` and the panel collapses
 * to its content height; drop `left/right: auto` and it snaps to the wrong
 * edge, because UA `inset: 0` sets the side we did not declare.
 */
.hai-mm-overlay {
	position: fixed;
	inset: 0;
	width: auto;
	height: auto;
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--hai-mm-overlay);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	z-index: calc(var(--hai-mm-z) - 1);
}
.hai-mm.is-open .hai-mm-overlay { opacity: 1; visibility: visible; }

/* Off-canvas panel */
.hai-mm-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	height: auto;
	width: min(var(--hai-mm-width), 100vw);
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: visible;
	background: var(--hai-mm-bg);
	color: var(--hai-mm-text);
	display: flex;
	flex-direction: column;
	z-index: var(--hai-mm-z);
	transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
}
.hai-mm--right .hai-mm-panel { right: 0; left: auto;  transform: translateX(100%); }
.hai-mm--left  .hai-mm-panel { left: 0;  right: auto; transform: translateX(-100%); }
.hai-mm.is-open .hai-mm-panel { transform: translateX(0); }

/*
 * Fallback for browsers without the Popover API (iOS 16 and older): while the
 * menu is open, strip the filter off the ancestor that traps the panel. It is
 * invisible, because the overlay covers that area anyway. Transforms are
 * deliberately left alone (see the JS).
 */
.hai-mm-unclamp {
	filter: none !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}

/* Panel header */
.hai-mm-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	background: var(--hai-mm-header-bg);
	border-bottom: 1px solid var(--hai-mm-divider);
	flex: 0 0 auto;
}
.hai-mm-head-title { font-size: 16px; font-weight: 600; letter-spacing: 0.02em; }
.hai-mm-head-logo {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	min-width: 0;
	line-height: 0;
}
/* width + max-height box the logo; contain keeps it from ever distorting */
.hai-mm-head-logo img {
	display: block;
	width: var(--hai-mm-logo-w, 120px);
	max-width: 100%;
	height: auto;
	max-height: var(--hai-mm-logo-maxh, 40px);
	object-fit: contain;
	object-position: left center;
}
.hai-mm-close {
	background: none;
	border: 0;
	cursor: pointer;
	width: 34px;
	height: 34px;
	color: var(--hai-mm-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
	appearance: none;
}
.hai-mm-close::before { content: "\00d7"; font-size: 30px; line-height: 1; }

/* Levels viewport */
.hai-mm-levels { position: relative; flex: 1 1 auto; overflow: hidden; }
.hai-mm-level {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--hai-mm-bg);
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hai-mm-level--root { transform: translateX(0); }
.hai-mm-level.is-open { transform: translateX(0); }

/* Back bar (sublevels) */
.hai-mm-back {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 14px 20px;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--hai-mm-divider);
	color: var(--hai-mm-muted);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	cursor: pointer;
	flex: 0 0 auto;
}
.hai-mm-back svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* Item list */
.hai-mm-list { list-style: none; margin: 0; padding: 4px 0; }
.hai-mm-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--hai-mm-divider); }
.hai-mm-link {
	flex: 1 1 auto;
	padding: 15px 20px;
	text-decoration: none;
	font-size: 16px;
	display: flex;
	align-items: center;
}
.hai-mm-link--all { color: var(--hai-mm-accent); font-weight: 600; }

/*
 * Item states: normal / hover / active (current page + its parents).
 * Each state falls back through state -> normal -> panel text, so leaving the
 * Style-tab colors empty keeps the original "everything follows --hai-mm-text"
 * behaviour. The "view all" link is excluded on purpose: it stays on the
 * accent color.
 */
.hai-mm-link:not(.hai-mm-link--all) {
	color: var(--hai-mm-item-color, var(--hai-mm-text));
	background-color: var(--hai-mm-item-bg, transparent);
	transition: color var(--hai-mm-item-transition, 0.2s) ease,
	            background-color var(--hai-mm-item-transition, 0.2s) ease;
}
.hai-mm-item.is-current > .hai-mm-link:not(.hai-mm-link--all),
.hai-mm-item.is-ancestor > .hai-mm-link:not(.hai-mm-link--all) {
	color: var(--hai-mm-item-color-active, var(--hai-mm-item-color, var(--hai-mm-text)));
	background-color: var(--hai-mm-item-bg-active, var(--hai-mm-item-bg, transparent));
}
/* Hover comes after active (same specificity) so it wins while pointing. */
.hai-mm-item > .hai-mm-link:not(.hai-mm-link--all):hover,
.hai-mm-item > .hai-mm-link:not(.hai-mm-link--all):focus-visible {
	color: var(--hai-mm-item-color-hover, var(--hai-mm-item-color, var(--hai-mm-text)));
	background-color: var(--hai-mm-item-bg-hover, var(--hai-mm-item-bg, transparent));
}
/* Hovering the current item falls back to the active color, not the normal one. */
.hai-mm-item.is-current > .hai-mm-link:not(.hai-mm-link--all):hover,
.hai-mm-item.is-current > .hai-mm-link:not(.hai-mm-link--all):focus-visible,
.hai-mm-item.is-ancestor > .hai-mm-link:not(.hai-mm-link--all):hover,
.hai-mm-item.is-ancestor > .hai-mm-link:not(.hai-mm-link--all):focus-visible {
	color: var(--hai-mm-item-color-hover, var(--hai-mm-item-color-active, var(--hai-mm-item-color, var(--hai-mm-text))));
	background-color: var(--hai-mm-item-bg-hover, var(--hai-mm-item-bg-active, var(--hai-mm-item-bg, transparent)));
}
.hai-mm-drill {
	flex: 0 0 auto;
	width: 56px;
	background: none;
	border: 0;
	border-left: 1px solid var(--hai-mm-divider);
	cursor: pointer;
	color: var(--hai-mm-muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
	appearance: none;
}
.hai-mm-drill svg { width: 16px; height: 16px; }

/* CTA footer */
.hai-mm-cta-wrap { flex: 0 0 auto; padding: 18px 20px; border-top: 1px solid var(--hai-mm-divider); }
.hai-mm-cta {
	display: block;
	text-align: center;
	padding: 14px 20px;
	background: var(--hai-mm-accent);
	color: #ffffff;
	text-decoration: none;
	font-weight: 600;
	transition: background-color 0.25s ease, background-image 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Harden against theme/kit global button styles leaking in */
.hai-mm-toggle,
.hai-mm-close,
.hai-mm-drill,
.hai-mm-back {
	background: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	min-width: 0 !important;
	min-height: 0 !important;
}
.hai-mm-toggle,
.hai-mm-close,
.hai-mm-back { border: 0 !important; }
.hai-mm-drill { border: 0 !important; border-left: 1px solid var(--hai-mm-divider) !important; }
/* Force icon/text colors (header themes often paint buttons a single color) */
.hai-mm-close { color: var(--hai-mm-text) !important; }
.hai-mm-back,
.hai-mm-drill { color: var(--hai-mm-muted) !important; }

/* Body scroll lock */
body.hai-mm-lock { overflow: hidden; }

/* Editor convenience: keep the panel reachable while editing */
.elementor-editor-active .hai-mm-panel,
.elementor-editor-active .hai-mm-overlay { transition: none; }
