/**
 * Mobile header menu — full-screen panel below header (overrides main.css drawer rules).
 */

@media (min-width: 769px) {
	.b2bmg-header {
		position: relative;
	}

	.b2bmg-header__nav {
		position: absolute;
		top: 50%;
		left: 50%;
		right: auto;
		bottom: auto;
		width: auto;
		max-width: none;
		flex: none;
		display: flex;
		justify-content: center;
		padding: 0;
		margin: 0;
		background: transparent;
		border: none;
		box-shadow: none;
		transform: translate(-50%, -50%);
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		overflow: visible;
		z-index: 2;
	}

	body.b2bmg-menu-open::before {
		display: none;
	}
}

@media (max-width: 768px) {
	body.b2bmg-menu-open {
		overflow: hidden;
	}

	.b2bmg-sticky-header .b2bmg-header,
	.b2bmg-header {
		overflow: visible;
	}

	body.b2bmg-menu-open .b2bmg-header {
		/* position: relative; */
		z-index: 1102;
	}

	.b2bmg-header__inner {
		position: relative;
		z-index: 1103;
	}

	.b2bmg-header__logo {
		flex: 1;
		min-width: 0;
	}

	.b2bmg-header__toggle {
		flex-shrink: 0;
		margin-left: 12px;
		border: none;
		background: transparent;
		cursor: pointer;
	}

	.b2bmg-header__nav {
		height: 100vh;
		position: fixed;
		top: var(--b2bmg-header-height);
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		flex: none;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		padding: 20px var(--b2bmg-gutter) 40px;
		margin: 0;
		background-color: var(--b2bmg-white);
		border-top: 1px solid var(--b2bmg-border);
		box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
		transform: none !important;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		z-index: 1101;
		transition:
			opacity 0.28s ease,
			visibility 0.28s ease;
	}

	.b2bmg-header__nav.is-open {
		transform: none !important;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.b2bmg-nav {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 10px;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.b2bmg-nav li {
		width: 100%;
		margin: 0;
		padding: 0;
	}

	.b2bmg-nav li a {
		display: flex;
		align-items: center;
		width: 100%;
		padding: 15px;
		font-size: 14px;
		font-weight: 600;
		line-height: 1.3;
		color: var(--b2bmg-text);
		background-color: var(--b2bmg-bg-subtle);
		border: 1px solid var(--b2bmg-border);
		border-radius: 12px;
		text-decoration: none;
		transition:
			color var(--b2bmg-transition),
			background-color var(--b2bmg-transition),
			border-color var(--b2bmg-transition);
	}

	.b2bmg-nav li a:hover,
	.b2bmg-nav li a:focus-visible {
		color: var(--b2bmg-primary);
		background-color: rgba(37, 99, 235, 0.06);
		border-color: rgba(37, 99, 235, 0.2);
	}

	.b2bmg-nav .current-menu-item > a,
	.b2bmg-nav .current_page_item > a {
		color: var(--b2bmg-primary);
		background-color: rgba(37, 99, 235, 0.1);
		border-color: rgba(37, 99, 235, 0.28);
		box-shadow: inset 4px 0 0 var(--b2bmg-primary);
	}

	/* Logged-in WP admin bar offset */
	body.admin-bar .b2bmg-header__nav {
		top: 75px;
		height: 100vh;
	}

	body.admin-bar.b2bmg-menu-open::before {
		top: calc(var(--b2bmg-header-height) + 46px);
	}
}

body.b2bmg-menu-open::before {
	content: "";
	position: fixed;
	top: var(--b2bmg-header-height);
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(15, 23, 42, 0.5);
	z-index: 1100;
	pointer-events: none;
}

@media (max-width: 768px) {
	body.b2bmg-menu-open::before {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.b2bmg-header__nav {
		transition: none;
	}
}
