/**
 * Divi Mobile Menu Collapse
 *
 * Collapses Divi mobile sub-menus into accordions toggled by a .mobile-toggle
 * button (added by divi-mobile-menu.js). Toggle background + icon colours come
 * from the module settings as CSS variables, with sensible fallbacks.
 */

ul.et_mobile_menu li.menu-item-has-children,
ul.et_mobile_menu li.page_item_has_children {
	position: relative;
}

/* Collapsed by default; revealed when the JS adds .visible on click. */
ul.et_mobile_menu li.menu-item-has-children > ul.sub-menu,
ul.et_mobile_menu li.menu-item-has-children > ul.children,
ul.et_mobile_menu li.page_item_has_children > ul.sub-menu,
ul.et_mobile_menu li.page_item_has_children > ul.children {
	display: none;
}

ul.et_mobile_menu ul.sub-menu.visible,
ul.et_mobile_menu ul.children.visible {
	display: block;
}

/* Toggle button (top-right of each parent item). */
ul.et_mobile_menu .mobile-toggle {
	position: absolute;
	top: 0;
	right: 0;
	display: block;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	background: var(--dmm-toggle-bg, #2ea3f2);
	cursor: pointer;
	z-index: 1;
}

/* Plus icon drawn from two bars — no icon font needed. */
ul.et_mobile_menu .mobile-toggle::before,
ul.et_mobile_menu .mobile-toggle::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--dmm-icon-color, #ffffff);
	transform: translate( -50%, -50% );
	transition: opacity 0.15s ease;
}

ul.et_mobile_menu .mobile-toggle::before { width: 14px; height: 2px; } /* horizontal bar */
ul.et_mobile_menu .mobile-toggle::after  { width: 2px;  height: 14px; } /* vertical bar   */

/* Open state: hide the vertical bar so the plus becomes a minus. */
ul.et_mobile_menu li.dt-open > .mobile-toggle::after {
	opacity: 0;
}
