/* =====================================================================
 * Mobile menu (< 1200px) - display + effects like thepinnacleone.com
 * Loaded after main.css / theme-main.css (inc/mobile-menu.php).
 *
 * - Full-screen white panel under the header (instead of the floating card
 *   on a dark overlay), fade + slide in, items appear one after another.
 * - Page behind is locked; the X stays where the menu icon is.
 * - Menu design unchanged: Poppins items, chevron buttons, grey submenu box.
 * - "Contact Us" button right after the last menu item.
 * - Header always stuck to the top on phones/tablets.
 * ================================================================== */

@media (max-width: 1199px) {

	/* ---- Header: always stuck to the top (no hide on scroll) ---------- */
	/* "sticky" cannot work here (html/body have overflow:auto), so the header
	   is fixed and the page is pushed down by its height (--wr-header-h,
	   measured by mobile-menu.js). */
	#header,
	#header.fixed-top {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
	}

	body {
		padding-top: var(--wr-header-h, 82px);
	}

	#header.hide-header {
		transform: none;
		opacity: 1;
	}

	/* Logged-in: keep the header under the WordPress admin bar. */
	body.admin-bar #header {
		top: var(--wp-admin--admin-bar--height, 0px);
	}

	.mobile-nav-toggle.hide-toggle {
		transform: none;
		opacity: 1;
		pointer-events: auto;
	}

	/* ---- Panel ---------------------------------------------------------- */
	/* No dark overlay: the panel itself covers the screen under the header. */
	.mobile-nav-active #navmenu {
		position: static;
		inset: auto;
		background: none;
		overflow: visible;
	}

	#navmenu > ul {
		display: flex;
		flex-direction: column;
		position: fixed;
		inset: var(--wr-mnav-top, 82px) 0 0 0;
		margin: 0;
		padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px));
		border: 0;
		border-top: 1px solid #e5e7eb;
		border-radius: 0;
		box-shadow: none;
		background: var(--nav-mobile-background-color, #fff);
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-12px);
		transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
		z-index: 9998;
	}

	.mobile-nav-active #navmenu > ul {
		display: flex;
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity .3s ease, transform .3s ease, visibility 0s;
	}

	/* Lock the page behind (iOS needs it on <html> too). */
	html:has(body.mobile-nav-active) {
		overflow: hidden;
	}

	/* ---- Items: thin dividers, appear one after another ----------------- */
	#navmenu > ul > li {
		border-bottom: 1px solid #e5e7eb;
		opacity: 0;
		transform: translateY(10px);
		transition: opacity .35s ease, transform .35s ease;
	}

	.mobile-nav-active #navmenu > ul > li {
		opacity: 1;
		transform: none;
		transition-delay: calc(var(--wr-i, 0) * 50ms + 100ms);
	}

	#navmenu > ul > li > a,
	#navmenu > ul > li > a:focus {
		padding: 14px 0;
	}

	/* Submenu: same grey box, full width, smooth reveal. */
	#navmenu .dropdown ul {
		margin: 0 0 14px;
	}

	#navmenu .dropdown > ul.dropdown-active {
		animation: wr-mnav-drop .25s ease both;
	}

	@keyframes wr-mnav-drop {
		from { opacity: 0; transform: translateY(-6px); }
		to   { opacity: 1; transform: none; }
	}

	/* ---- Close (X): stays where the menu icon is, dark on white ---------- */
	.mobile-nav-active .header .mobile-nav-toggle {
		position: fixed;
		top: 25px;
		right: 5px;
		margin-right: 10px;
		font-size: 28px;
		color: #374151;
		z-index: 9999;
	}

	.mobile-nav-toggle:focus-visible {
		outline: 2px solid #1e88e5;
		outline-offset: 4px;
		border-radius: 4px;
	}

	/* Floating call / WhatsApp / back-to-top buttons step aside while open. */
	.wr-float-cta,
	#scroll-top {
		transition: opacity .25s ease, visibility .25s ease;
	}

	body.mobile-nav-active .wr-float-cta,
	body.mobile-nav-active #scroll-top {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}

	/* ---- "Contact Us" button at the bottom ------------------------------ */
	/* Right under the last menu item (not pinned to the bottom). */
	#navmenu > ul > li.wr-mnav-cta {
		margin-top: 0;
		padding-top: 24px;
		border-bottom: 0;
	}

	#navmenu .wr-mnav-cta__btn,
	#navmenu .wr-mnav-cta__btn:focus {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		padding: 12px 28px;
		border-radius: 0;
		background: #0f4c81;
		color: #fff;
		font-family: var(--nav-font, "Poppins", sans-serif);
		font-size: 16px;
		font-weight: 500;
		line-height: 24px;
		text-transform: uppercase;
		text-decoration: none;
		transition: background-color .3s;
	}

	#navmenu .wr-mnav-cta__btn:hover,
	#navmenu .wr-mnav-cta__btn:active {
		background: #1e88e5;
		color: #fff;
	}
}

/* WordPress admin bar scrolls away on small phones. */
@media (max-width: 600px) {
	body.admin-bar #header {
		top: 0;
	}
}

@media (max-width: 1199px) and (prefers-reduced-motion: reduce) {
	#navmenu > ul,
	#navmenu > ul > li {
		transform: none;
		transition-duration: .01s;
		transition-delay: 0s;
	}

	#navmenu .dropdown > ul.dropdown-active {
		animation: none;
	}
}
