/* ==========================================================================
   Mobile nav — burger icon + off-canvas panel

   Note: which markup renders (desktop vs mobile) is decided server-side by
   MobileDetect in header.php, not by viewport width — a large tablet can
   still get the mobile branch. So these mobile styles are scoped to the
   actual mobile container classes (.menu-burger, .menu-mobile,
   .mega-menu--mobile), not hidden behind a max-width media query. The
   media query at the very end is just a convenience for testing via
   browser dev tools' responsive mode on a desktop-rendered page.
   ========================================================================== */

.menu-burger {
	display: flex !important;
	align-items: center;
	left: unset !important;
	max-width: 100vw;
    text-align: right;
    justify-content: flex-end !important;
    padding-right: 1.5rem;
}

.nav-toggle {
	position: relative;
	width: 32px;
	height: 24px;
	cursor: pointer;
	z-index: 1001;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
	content: '';
	position: absolute;
	left: 0;
	width: 100%;
	height: 3px;
	background: var(--mega-nav-burger-color, #222);
	transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease, background 0.2s ease;
}

.nav-toggle-bar {
	top: 50%;
	transform: translateY(-50%);
}

.nav-toggle-bar::before { top: -9px; }
.nav-toggle-bar::after  { top: 9px; }

/* JS toggles .is-active on .nav-toggle when the panel opens. */
.nav-toggle.is-active .nav-toggle-bar {
	background: transparent;
}

.nav-toggle.is-active .nav-toggle-bar::before {
	top: 0;
	transform: rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar::after {
	top: 0;
	transform: rotate(-45deg);
}

/* Dimmed backdrop behind the panel, click/tap to close. */
.mobile-menu-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
	z-index: 999;
}

.mobile-menu-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* The slide-in panel itself. */
.menu-mobile {
	position: fixed;
	top: 0;
	right: -100%;
	width: 60%;
	max-width: 300px;
	height: 100vh !important;
	height: 100dvh;
	overflow-y: auto;
	background: #111111;
	z-index: 1000;
	padding: 90px 1.5em 2.5em;
	transition: right 0.3s ease;
	box-shadow: -12px 0 24px rgba(0, 0, 0, 0.25);
}

.menu-mobile.is-open {
	right: 0;
}

body.mobile-menu-open {
	overflow: hidden;
}

/* ---- Mobile nav list styling (inside the slide-in panel) ---- */
.mega-menu--mobile .mega-menu__list {
	display: block;
}

.mega-menu--mobile .mega-menu__list > li {
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mega-menu--mobile .mega-menu__list > li > a {
	display: block;
	padding: 0.9em 0.25em !important; /* overrides the desktop 30px rule, which doesn't apply here anyway since it's scoped to .desktopmenu, but kept explicit for clarity */
	color: #ffffff;
	font-weight: 600;
}

.mega-menu--mobile .mega-menu__list > li:hover > a,
.mega-menu--mobile .mega-menu__list > li.is-open > a {
	background: transparent; /* no white hover box on touch — reserve that for desktop */
	color: #ffffff;
}

.mega-menu--mobile .mega-menu__list > li > a::after {
	display: none; /* skip the red underline sweep on mobile, not a hover-driven UI here */
}

/* Plain dropdowns (About Us, Why Us?, etc.) — stack inline as an accordion
   instead of the desktop absolutely-positioned panel. */
.mega-menu--mobile .sub-menu {
	position: static;
	display: none;
	box-shadow: none;
	background: transparent;
	padding: 0 0 0.5em 1em;
	min-width: 0;
}

.mega-menu--mobile .mega-menu__list > li.is-open > .sub-menu {
	display: block;
}

.mega-menu--mobile .sub-menu a {
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.9rem;
}

.mega-menu--mobile .sub-menu .sub-menu {
	left: 0;
	padding-left: 1em;
}

/* Products mega panel — becomes a stacked accordion, same colours as
   desktop but full width and no absolute positioning. */
.mega-menu--mobile .mega-menu__panel-group {
	position: static;
	display: none;
	min-width: 0;
	min-height: 0;
	box-shadow: none;
	background: transparent;
}

.mega-menu--mobile .mega-menu__list > li.is-open > .mega-menu__panel-group {
	display: flex;
}

.mega-menu--mobile .mega-menu__brand { width: 100%; }

.mega-menu--mobile .mega-menu__tab {
	height: auto;
	text-align: left;
	padding: 0.9em 0.25em;
}

.mega-menu--mobile .mega-menu__panel {
	position: static;
	flex-direction: column;
	gap: 0;
}

.mega-menu--mobile .mega-menu__panel:not(.is-active) { display: none; }

.mega-menu--mobile .mega-menu__about,
.mega-menu--mobile .mega-menu__columns {
	padding: 1.25em;
}

.mega-menu--mobile .mega-menu__columns { flex-direction: column; gap: 1em; }

.mega-menu--mobile .mega-menu__list > li:not(.is-open) > .sub-menu,
.mega-menu--mobile .mega-menu__list > li:not(.is-open) > .mega-menu__panel-group {
	display: none !important;
}

/* ==========================================================================
   Mobile submenu toggle arrow
   Add this into your existing mega-menu.css / mega-menu-mobile.css.

   Note: this REPLACES the existing padding on
   .mega-menu--mobile .mega-menu__list > li > a — it was:
       padding: 0.9em 0.25em !important;
   and needs to become the version below (extra right-padding clears the
   new arrow button so the label text doesn't run under it).
   ========================================================================== */

.mega-menu--mobile .mega-menu__list > li > a {
	display: block;
	padding: 0.9em 52px 0.9em 0.25em !important;
	color: #ffffff;
	font-weight: 600;
}


/* ---- Expand/collapse arrow (mobile only) ----
   The <a> itself still navigates normally (or does nothing, for items with
   no real href) — this button is the ONLY thing that toggles a submenu. */
.mega-menu__toggle {
	display: none; /* shown only inside .mega-menu--mobile, below */
}


button.mobile-menu-close {
    font-size: 2rem;
    padding: 0 !important;
    margin: 0 !important;
    color: white;
    position: absolute;
    top: 1rem;
    right: 2.5rem;
}

.mega-menu--mobile .mega-menu__toggle {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	position: absolute;
	top: 0;
	right: 0;
	width: 52px;
	height: 100%;
	min-height: 44px; /* comfortable tap target */
	border: 0;
	background: transparent;
	cursor: pointer;
	padding: 0;
	z-index: 100;
	padding-top: 1.1rem;
	margin-right: 0;
}

.mega-menu--mobile .mega-menu__toggle-arrow {
	width: 10px;
	height: 10px;
	border-right: 2px solid rgba(255, 255, 255, 0.7);
	border-bottom: 2px solid rgba(255, 255, 255, 0.7);
	transform: rotate(45deg); /* chevron pointing down */
	transition: transform 0.2s ease;
}

.mega-menu--mobile .mega-menu__toggle[aria-expanded="true"] .mega-menu__toggle-arrow {
	transform: rotate(225deg); /* chevron pointing up when expanded */
}

/* ==========================================================================
   Convenience only — lets you preview the mobile accordion styling above by
   shrinking a desktop-rendered browser window, since MobileDetect won't
   have switched the markup in that case. Not required for real devices.
   ========================================================================== */
@media (max-width: 768px) {

	.mega-menu__list {
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
	}

	.mega-menu__panel-group {
		display: none;
		position: static;
		min-width: 0;
		min-height: 0;
		box-shadow: none;
	}

	.mega-menu__list > li.mega-menu.is-open > .mega-menu__panel-group {
		display: flex;
	}

	.mega-menu__brand { width: 100%; }

	.mega-menu__panel {
		position: static;
		flex-direction: column;
		gap: 0;
	}

	.mega-menu__panel:not(.is-active) { display: none; }

	.mega-menu__about,
	.mega-menu__columns {
		padding: 1.5em;
	}

	.mega-menu__columns { flex-direction: column; gap: 1.25em; }
}
