/**
 * Mega Menu Styles
 * Premium SaaS aesthetic with glassmorphism
 */

/* ========================================
   1. CSS Variables
   ======================================== */
:root {
	--primary: var(--teal);
	--mega-menu-z-index: 10001;
	/* V4 dashboard standard — matches .acp-field-group / popup backgrounds. */
	--mega-menu-bg: rgba(30, 41, 59, 0.36);
	--mega-menu-width-max: 1200px;
	--mega-menu-column-gap: 2rem;
	--mega-menu-padding: 2rem;
	--mega-menu-border: var(--border-v3, rgba(47, 184, 160, 0.18));
	--mega-menu-shadow: var(--shadow-xl);
	--mega-menu-accent: var(--teal-dark);
}

/* ========================================
   1b. Lucide Icon Base Styles
   ======================================== */
svg.lucide-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	vertical-align: middle;
}

/* Fallback sizing for <i data-lucide> tags processed by Lucide JS (admin) */
i.lucide-icon,
.lucide {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--lucide-size, 20px);
	height: var(--lucide-size, 20px);
	flex-shrink: 0;
	vertical-align: middle;
}

/* Fallback: hide <i data-lucide> tags until Lucide JS processes them (admin only) */
i[data-lucide] {
	display: none;
}

/* ========================================
   2. Mega Menu Container
   ======================================== */
.has-mega-menu {
	position: relative;
}

.mega-menu {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: max-content;
	max-width: var(--mega-menu-width-max);
	min-width: 600px;
	margin-top: 0.5rem;

	background: var(--mega-menu-bg);
	backdrop-filter: blur(24px);
	-webkit-backdrop-filter: blur(24px);
	color: #F1F5F9;

	/* Border & Shadow */
	border: 1px solid var(--mega-menu-border);
	border-radius: 12px;
	box-shadow: var(--shadow-xl, 0 20px 50px rgba(0, 0, 0, 0.35));

	/* Layout */
	padding: var(--mega-menu-padding);

	/* Animation */
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%) translateY(-8px);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

	/* z-index */
	z-index: var(--mega-menu-z-index);
}

/* Show mega-menu on hover */
.has-mega-menu:hover>.mega-menu,
.has-mega-menu:focus-within>.mega-menu,
.mega-menu.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

/* Full Width Mega Menu — spans viewport regardless of parent position */
.mega-menu-full-width {
	width: 100vw !important;
	max-width: 100vw !important;
	left: 50% !important;
	right: auto !important;
	transform: translateX(-50vw) translateY(-8px) !important;
	border-radius: 0 !important;
	border-left: none;
	border-right: none;
	margin-top: 0;
}

.has-mega-menu:hover>.mega-menu-full-width,
.has-mega-menu:focus-within>.mega-menu-full-width,
.mega-menu-full-width.is-visible {
	transform: translateX(-50vw) translateY(0) !important;
}

/* Block Source Specifics */
.mega-menu-block-source {
	min-width: 400px;
	padding: 0;
	/* Clean slate for blocks */
	overflow: hidden;
}

.mega-menu-block-content {
	padding: 1.5rem;
}

/* Productive.io Inspired Grid/Sidebar */
.mega-menu-grid-content {
	display: flex;
	background: var(--mega-menu-bg);
}

/* Animation */
@keyframes megaMenuFadeIn {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-8px);
	}

	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* ========================================
   3. Grid Layouts
   ======================================== */
/* Grid layout model:
 *   - Default (no columns, no template): flex-wrap so cells size to content.
 *   - `columns=N` set: CSS grid with `repeat(N, minmax(240px, 320px))`
 *     so the grid has INTRINSIC width (sum of track widths). This is the
 *     key for the drawer to auto-size.
 *   - `column_template` set: inline style on the grid overrides tracks.
 *   - `mega-menu-full-width` (toggle on dropdown): overrides tracks to 1fr
 *     so the grid stretches to fill the full-width panel.
 * 1fr tracks have no intrinsic width — they only work when the grid is
 * stretched by an outer container (i.e. full-width mode). */
.mega-menu-grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mega-menu-column-gap);
	align-items: stretch;
}
.mega-menu-grid > .mega-menu-column {
	flex: 0 1 auto;
	min-width: 220px;
	max-width: 100%;
}

/* Explicit columns count → CSS grid with intrinsic tracks. */
.mega-menu-columns-1 .mega-menu-grid,
.mega-menu-columns-2 .mega-menu-grid,
.mega-menu-columns-3 .mega-menu-grid,
.mega-menu-columns-4 .mega-menu-grid {
	display: grid;
	grid-template-columns: repeat(var(--mega-menu-cols, 1), minmax(240px, 320px));
}
.mega-menu-columns-1 .mega-menu-grid { --mega-menu-cols: 1; }
.mega-menu-columns-2 .mega-menu-grid { --mega-menu-cols: 2; }
.mega-menu-columns-3 .mega-menu-grid { --mega-menu-cols: 3; }
.mega-menu-columns-4 .mega-menu-grid { --mega-menu-cols: 4; }

/* Full Width Panel: expand tracks to 1fr so the grid fills the full viewport
 * width. Only applies when `full_width` is on (panel OR drawer pane) AND the
 * user hasn't supplied a custom `column_template` (inline style wins). */
.mega-menu-full-width .mega-menu-grid,
.nav-drawer-pane.mega-menu-full-width .mega-menu-grid {
	grid-template-columns: repeat(var(--mega-menu-cols, 1), 1fr);
}

/* `column_template` path — grid with user-provided tracks via inline style. */
.mega-menu-grid--custom {
	display: grid;
}

/* ========================================
   4. Column & Items
   ======================================== */
.mega-menu-column {
	min-width: 0;
	/* Prevent grid blowout */
}

/* Whole-column clickable card — rendered when a depth-1 item has a URL and no sub-links.
   Styled as an enhanced card matching the V4 dashboard box standard. */
a.mega-menu-card {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 1rem 1.1rem;
	border-radius: 12px;
	border: 1px solid transparent;
	background: transparent;
	color: inherit;
	text-decoration: none;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

a.mega-menu-card:hover,
a.mega-menu-card:focus-visible {
	background: rgba(47, 184, 160, 0.08);
	border-color: rgba(47, 184, 160, 0.3);
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* Cards remove the heading underline — the whole card is the surface. */
a.mega-menu-card .mega-menu-section-heading {
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 0.25rem;
}

a.mega-menu-card .mega-menu-section-heading span {
	color: #F1F5F9;
}

a.mega-menu-card:hover .mega-menu-section-heading span {
	color: var(--teal, #2FB8A0);
}

/* Per-card accent color — drives icon tint + hover border. Brand slugs map to V4 mood palette. */
.mega-menu-card--accent-teal   { --mega-card-accent: #2FB8A0; }
.mega-menu-card--accent-orange { --mega-card-accent: #EC8B4C; }
.mega-menu-card--accent-sage   { --mega-card-accent: #8AA686; }
.mega-menu-card--accent-coral  { --mega-card-accent: #B85A35; }
.mega-menu-card--accent-blue   { --mega-card-accent: #4A6B9A; }
.mega-menu-card--accent-cream  { --mega-card-accent: #F5F1E8; }

.mega-menu-card[class*="mega-menu-card--accent-"] .mega-menu-icon {
	color: var(--mega-card-accent);
}

.mega-menu-card[class*="mega-menu-card--accent-"]:hover {
	border-color: var(--mega-card-accent);
	background: color-mix(in srgb, var(--mega-card-accent) 10%, transparent);
}

.mega-menu-card[class*="mega-menu-card--accent-"]:hover .mega-menu-section-heading span {
	color: var(--mega-card-accent);
}

/* Section heading — depth-1 items rendered as column titles */
.mega-menu-section-heading {
	padding: 0 0 0.5rem 0;
	margin-bottom: 0.75rem;
	border-bottom: 1px solid var(--mega-menu-border);
}

.mega-menu-section-heading a,
.mega-menu-section-heading span {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 1.2rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-muted, #94a3b8);
	text-decoration: none;
}

.mega-menu-section-heading a:hover {
	color: var(--teal);
}

.mega-menu-section-heading .mega-menu-icon {
	width: 22px;
	height: 22px;
	color: var(--teal);
}

.mega-menu-section-heading .mega-menu-heading-title {
	flex: 1;
	min-width: 0;
}

/* Description rendered under the section heading when configured in the mega-menu admin */
.mega-menu-heading-description {
	margin: 0.35rem 0 0.75rem;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--text-muted, #94a3b8);
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

.mega-menu-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

/* depth-2 navigation link items */
.mega-menu-items>li {
	margin-bottom: 0.25rem;
}

.mega-menu-items>li:last-child {
	margin-bottom: 0;
}

.mega-menu-items>li>a {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.625rem 0.75rem;
	border-radius: var(--radius-sm, 8px);
	text-decoration: none;
	color: #F1F5F9;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mega-menu-items>li>a:hover {
	background: rgba(47, 184, 160, 0.12);
	color: var(--teal, #2FB8A0);
	transform: translateX(4px);
}

[data-theme="light"] .mega-menu-items>li>a {
	color: var(--text-dark, #1a202c);
}

.mega-menu-item-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.mega-menu-item-label {
	font-size: 0.95em;
	font-weight: 500;
	line-height: 1.35;
}

.mega-menu-item-description {
	font-size: 0.8em;
	line-height: 1.4;
	color: rgba(241, 245, 249, 0.56);
	font-weight: 400;
}

.mega-menu-items>li>a:hover .mega-menu-item-description {
	color: rgba(47, 184, 160, 0.72);
}

[data-theme="light"] .mega-menu-item-description {
	color: rgba(26, 32, 44, 0.6);
}

/* ========================================
   5. Icons
   ======================================== */
.mega-menu-icon {
	line-height: 1;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.mega-menu-icon.lucide-icon {
	width: var(--lucide-size, 20px);
	height: var(--lucide-size, 20px);
}

.mega-menu-icon-image {
	width: 24px;
	height: 24px;
	object-fit: contain;
}

/* ========================================
   6. Link Content & Badge
   ======================================== */
.mega-menu-link-content {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1;
}

.mega-menu-link-content strong {
	font-weight: 600;
	font-size: 0.95rem;
	line-height: 1.4;
}

.mega-menu-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: var(--radius-full, 9999px);
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	margin-left: 0.5rem;
}

/* Badge colors */
.mega-menu-badge.badge-primary {
	background: var(--teal);
	color: var(--white, #fff);
}

.mega-menu-badge.badge-success {
	background: var(--success, #10b981);
	color: var(--white, #fff);
}

.mega-menu-badge.badge-warning {
	background: var(--warning, #f59e0b);
	color: var(--white, #fff);
}

.mega-menu-badge.badge-new {
	background: var(--teal);
	color: var(--white, #fff);
}

.mega-menu-badge.badge-popular {
	background: var(--success, #10b981);
	color: var(--white, #fff);
}

.mega-menu-badge.badge-beta {
	background: var(--warning, #f59e0b);
	color: var(--white, #fff);
}

/* ========================================
   7. Description
   ======================================== */
.mega-menu-description {
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--text, #64748b);
	margin: 0;
	padding-left: 0.9rem;
	/* Align with icon */
}

/* ========================================
   8. Promotional Cards
   ======================================== */
.mega-menu-promo-card {
	background: var(--primary-lighter);
	border: 1px solid var(--primary-20);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	transition: var(--transition-base);
}

.mega-menu-promo-card:hover {
	border-color: var(--teal);
	box-shadow: var(--shadow-md);
	transform: translateY(-2px);
}

.mega-menu-promo-image {
	width: 100%;
	height: auto;
	border-radius: var(--radius-sm, 8px);
	margin-bottom: 1rem;
}

.mega-menu-promo-card h4 {
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0 0 0.5rem 0;
	color: var(--text-dark, #1a202c);
}

.mega-menu-promo-card p {
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--text, #64748b);
	margin: 0 0 1rem 0;
}

.mega-menu-promo-card .btn {
	width: 100%;
	justify-content: center;
}

/* ========================================
   9. Accessibility
   ======================================== */
.has-mega-menu>a:focus {
	outline: 2px solid var(--teal);
	outline-offset: 2px;
}

.mega-menu-items>li>a:focus {
	outline: 2px solid var(--teal);
	outline-offset: -2px;
}

/* Skip to main content for screen readers */
.mega-menu-skip-link {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.mega-menu-skip-link:focus {
	left: 0;
	width: auto;
	height: auto;
	overflow: visible;
	padding: 1rem;
	background: var(--teal);
	color: var(--white, #fff);
	z-index: 10000;
}

/* ========================================
   10. Responsive - Tablet
   ======================================== */
@media (max-width: 1024px) {
	.mega-menu {
		max-width: 90vw;
		min-width: 500px;
	}

	.mega-menu-columns-4 .mega-menu-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.mega-menu-template-asymmetric.mega-menu-columns-4 .mega-menu-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ========================================
   11. Responsive - Mobile
   ======================================== */
@media (max-width: 768px) {

	/* Hide mega-menu dropdown on mobile */
	.has-mega-menu>.mega-menu {
		display: none;
	}

	/* Mobile navigation will be handled by theme's mobile menu */
	/* Mega-menu items will appear as accordion within mobile nav */

	/* Strip non-essential objects on mobile */
	.mega-menu-block-source *:not(.menu-item):not(a):not(span):not(.mega-menu-icon):not(i):not(svg):not(li):not(ul):not(.sub-menu) {
		display: none !important;
	}

	.mega-menu-promo,
	.mega-menu-block-content>*:not(ul):not(li) {
		display: none !important;
	}

	/* Mobile accordion styles (when integrated with theme's mobile nav) */
	.main-navigation.open .mega-menu {
		position: static;
		transform: none;
		width: 100%;
		min-width: 0;
		max-width: none;
		margin-top: 0;
		background: transparent;
		backdrop-filter: none;
		border: none;
		box-shadow: none;
		padding: 0;
		opacity: 1;
		visibility: visible;
	}

	.main-navigation.open .mega-menu-grid {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.main-navigation.open .mega-menu-column {
		border-top: 1px solid var(--border-light, rgba(11, 48, 82, 0.1));
		padding-top: 1rem;
		margin-top: 1rem;
	}

	.main-navigation.open .mega-menu-column:first-child {
		border-top: none;
		padding-top: 0;
		margin-top: 0;
	}

	.main-navigation.open .mega-menu-item a {
		padding: 0.5rem 0;
	}

	.main-navigation.open .mega-menu-description {
		padding-left: 2.25rem;
		font-size: 0.8rem;
	}

	.main-navigation.open .mega-menu-promo-card {
		margin-top: 1rem;
	}
}

/* ========================================
   12. Dark Mode Support
   Covers both OS preference and JS-toggle (data-theme attribute).
   ======================================== */

/* Dark Mode Support handled via :root variables above and theme.css */

/* ========================================
   13. Top-Level Menu Icons
   ======================================== */
.menu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin-right: 8px;
	vertical-align: middle;
	transition: transform 0.2s ease;
}

.menu-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

/* Icon hover effect */
.menu-item>a:hover .menu-icon {
	transform: translateY(-1px);
}

/* ========================================
   14. Top-Level Chevron Indicator
   ======================================== */
.nav-chevron {
	margin-left: 4px;
	flex-shrink: 0;
	opacity: 0.6;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.has-mega-menu:hover>a .nav-chevron,
.has-mega-menu:focus-within>a .nav-chevron,
.menu-item-has-children:hover>a .nav-chevron,
.menu-item-has-children:focus-within>a .nav-chevron {
	transform: rotate(180deg);
	opacity: 1;
}

/* ========================================
   15. Print Styles
   ======================================== */
@media print {
	.mega-menu {
		display: none !important;
	}
}

/* ========================================
   16. HAMBURGER NAV DRAWER
   Always-visible hamburger → full-screen
   overlay with left teal tab column +
   right white content pane.
   JS in mega-menu.js builds the overlay
   from the hidden .main-navigation DOM.
   ======================================== */

/* ── Mega nav wrapper ──────────────────────── */
.adamiro-mega-nav-wrapper {
	display: inline-flex;
	align-items: center;
	flex-wrap: nowrap;
	flex-shrink: 0;
}

/* Hide the horizontal nav links — drawer replaces them on all screen sizes */
.main-navigation {
	display: none !important;
}

/* ── Hamburger button ────────────────────── */
.nav-hamburger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	padding: 8px 12px;
	cursor: pointer;
	color: inherit;
	/* inherits from .adamiro-mega-nav-wrapper so block editor color setting works */
	font-family: var(--wp--preset--font-family--outfit);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	position: relative;
	z-index: 1002;
	flex-shrink: 0;
	white-space: nowrap;
	border-radius: var(--radius-sm, 8px);
	transition: background 0.15s ease, color 0.15s ease;
}

.nav-hamburger:hover {
	color: var(--teal));
	background: var(--primary-10, rgba(24, 91, 110, 0.1));
}

.nav-hamburger svg {
	flex-shrink: 0;
	transition: opacity 0.15s ease;
	width: var(--hamburger-icon-size, 22px);
	height: var(--hamburger-icon-size, 22px);
}

.nav-hamburger .hamburger-label {
	display: inline-block;
}

/* ── Overlay wrapper ──────────────────────── */
/* Intentionally NO `right: 0`. With right:0 the overlay fills viewport width
 * (100vw) regardless of children, which forced a full-screen drawer even when
 * the panel inside was narrow. Without right:0 + with explicit max-content
 * width, the fixed overlay wraps to the inner panel's width. The full-width
 * modifier below restores right:0 + a dimmed backdrop for the expanded mode. */
.nav-drawer {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	height: 100vh;
	width: max-content;
	max-width: min(100vw, 1100px);
	z-index: 10001;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	pointer-events: none;
}

.nav-drawer.is-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

body.nav-drawer-open {
	overflow: hidden;
}

body.nav-drawer-open .wp-site-blocks > .wp-block-template-part:first-child {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 10002;
}

/* Ensure header container maintains full width when drawer is open */
body.nav-drawer-open .header-container {
	max-width: var(--max-width, 1200px);
	width: 100%;
	margin: 0;
}

/* ── Header spacer to push content below fixed header ──────── */
.nav-drawer::before {
	content: "";
	display: block;
	height: var(--header-height, 90px);
	flex-shrink: 0;
	pointer-events: none;
	background: transparent;
}

/* No default backdrop: the narrow drawer only covers its own width. The
 * dimmed overlay + full-viewport cover are applied only in full-width mode. */

/* ── Inner split ──────────────────────────── */
.nav-drawer-inner {
	display: flex;
	/* Vertical: fill remaining drawer height below the header spacer.
	 * Do NOT use align-self:stretch — in a column-flex parent that stretches
	 * the CROSS axis (horizontal) and would force the drawer to 100vw. Height
	 * is already handled by `flex: 1 1 auto`. */
	flex: 1 1 auto;
	/* Horizontal: shrink to the combined width of left rail + right pane.
	 * The overlay's `align-items: flex-start` keeps this from stretching.
	 *
	 * Hard cap of `min(100vw, 1100px)` matters because the CSS shrink-to-fit
	 * algorithm falls back to *available-width* (100vw) when a child's
	 * max-content exceeds it. Without this cap, a flex-wrap grid whose cells
	 * sum to > 100vw would blow the drawer open to full viewport width even
	 * though `align-items: flex-start` is set. The `min()` lets the drawer
	 * still obey narrow viewports on mobile. */
	width: auto;
	max-width: min(100vw, 1100px);
	min-width: 420px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	pointer-events: auto;
	opacity: 0.98;
	background: var(--bg, #0b1a1c);
}

/* Full Width — set by mega-menu.js when the active pane has
 * .mega-menu-full-width. Drawer fills the viewport side-to-side and paints a
 * dimmed backdrop. */
.nav-drawer.nav-drawer--full-width {
	right: 0;
	width: auto;
	max-width: none;
}
.nav-drawer.nav-drawer--full-width.is-open {
	background: rgba(0, 0, 0, 0.45);
}
.nav-drawer.nav-drawer--full-width .nav-drawer-inner {
	width: 100vw;
	max-width: none;
}
.nav-drawer.nav-drawer--full-width .nav-drawer-right {
	flex: 1 1 auto;
}

/* ── Left teal column ─────────────────────── */
.nav-drawer-left {
	width: 260px;
	flex-shrink: 0;
	background: var(--teal-dark);
	border-right: 1px solid var(--border-light, hsl(210, 20%, 94%));
	overflow-y: auto;
	padding: 2rem 0;
	display: flex;
	flex-direction: column;
}

/* Left tab items */
.nav-drawer-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0.875rem 1.5rem;
	background: none;
	border: none;
	border-left: 3px solid transparent;
	color: var(--off-white);
	font-family: var(--wp--preset--font-family--outfit);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	line-height: 1.4;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-drawer-item .drawer-arrow {
	font-size: 1rem;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.nav-drawer-item:hover,
.nav-drawer-item.active {
	background: rgba(255, 255, 255, 0.08);
	border-left-color: var(--teal, #2FB8A0);
	color: #fff;
}

.nav-drawer-item:hover .drawer-arrow,
.nav-drawer-item.active .drawer-arrow {
	opacity: 1;
}

/* ── Right pane ───────────────────────────── */
/* Default: size to the active pane's content (grid width + padding).
 * Full-width state (set by JS) overrides this to flex:1 1 auto in the
 * dedicated rule above. */
.nav-drawer-right {
	flex: 0 1 auto;
	width: auto;
	max-width: 100vw;
	background: var(--navy);
	overflow-y: auto;
	padding: 2.5rem 3rem;
}

/* Individual content panes */
.nav-drawer-pane {
	display: none;
}

.nav-drawer-pane.active {
	display: block;
}

/* Drawer panes inherit the frontend grid rules. The drawer container
 * auto-sizes to the sum of the cells (see .nav-drawer-inner above). Column
 * counts carry via .mega-menu-columns-N; custom templates carry via the
 * inline style on .mega-menu-grid--custom. */
.nav-drawer-pane.mega-menu-columns-1 .mega-menu-grid,
.nav-drawer-pane.mega-menu-columns-2 .mega-menu-grid,
.nav-drawer-pane.mega-menu-columns-3 .mega-menu-grid,
.nav-drawer-pane.mega-menu-columns-4 .mega-menu-grid {
	display: grid;
	grid-template-columns: repeat(var(--mega-menu-cols, 1), minmax(240px, 320px));
}
.nav-drawer-pane.mega-menu-columns-1 .mega-menu-grid { --mega-menu-cols: 1; }
.nav-drawer-pane.mega-menu-columns-2 .mega-menu-grid { --mega-menu-cols: 2; }
.nav-drawer-pane.mega-menu-columns-3 .mega-menu-grid { --mega-menu-cols: 3; }
.nav-drawer-pane.mega-menu-columns-4 .mega-menu-grid { --mega-menu-cols: 4; }

/* Responsive breakpoints — fixed column counts collapse gracefully. */
@media (max-width: 1024px) {
	.mega-menu-columns-4 .mega-menu-grid,
	.nav-drawer-pane.mega-menu-columns-4 .mega-menu-grid {
		grid-template-columns: repeat(2, minmax(240px, 320px));
	}
}
@media (max-width: 900px) {
	.mega-menu-columns-3 .mega-menu-grid,
	.nav-drawer-pane.mega-menu-columns-3 .mega-menu-grid {
		grid-template-columns: repeat(2, minmax(240px, 320px));
	}
}
@media (max-width: 640px) {
	.mega-menu-columns-2 .mega-menu-grid,
	.mega-menu-columns-3 .mega-menu-grid,
	.mega-menu-columns-4 .mega-menu-grid,
	.nav-drawer-pane.mega-menu-columns-2 .mega-menu-grid,
	.nav-drawer-pane.mega-menu-columns-3 .mega-menu-grid,
	.nav-drawer-pane.mega-menu-columns-4 .mega-menu-grid {
		grid-template-columns: 1fr;
	}
	/* Flex-wrap cells also collapse to full width. */
	.mega-menu-grid > .mega-menu-column {
		flex: 0 0 100%;
		min-width: 0;
	}
}

/* Section headings inside drawer */
.nav-drawer-pane .mega-menu-section-heading {
	margin-bottom: 1rem;
}

/* No translateX lift on links inside drawer */
.nav-drawer-pane .mega-menu-items>li>a:hover {
	transform: none;
	background: var(--primary-10, hsla(194, 69%, 22%, 0.08));
	color: var(--teal));
}

/* Promo card separator inside drawer */
.nav-drawer-pane>.mega-menu-promo,
.nav-drawer-pane>.mega-menu-column.mega-menu-promo {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid var(--border-light, hsl(210, 20%, 94%));
}

/* ── Theme-reactive wrapper colors ───────────── */
/* !important needed to beat WordPress's .has-light-color { color: ... !important } block utility */
html[data-theme="dark"] .adamiro-mega-nav-wrapper {
	color: hsl(194, 12%, 80%) !important;
}

html[data-theme="light"] .adamiro-mega-nav-wrapper {
	color: hsl(222, 35%, 18%) !important;
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) .adamiro-mega-nav-wrapper {
		color: hsl(194, 12%, 80%) !important;
	}
}

/* Nav drawer dark mode */
html[data-theme="dark"] .nav-drawer-left {
	background: var(--teal-dark);
	border-right-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .nav-drawer-item {
	color: rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .nav-drawer-pane>.mega-menu-promo,
html[data-theme="dark"] .nav-drawer-pane>.mega-menu-column.mega-menu-promo {
	border-top-color: rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) .nav-drawer-left {
		background: var(--teal-dark);
		border-right-color: rgba(255, 255, 255, 0.08);
	}

	html:not([data-theme="light"]) .nav-drawer-item {
		color: rgba(255, 255, 255, 0.65);
	}
}

/* ── Mobile ONLY: Icon-only buttons ──────────── */
@media (max-width: 768px) {
	.header-cta .wp-block-button {
		margin: 0;
	}

	.header-cta .wp-block-button__link {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 10px;
		min-width: 44px;
		min-height: 44px;
		border-radius: 50%;
		font-size: 0;
		gap: 0;
		white-space: nowrap;
		position: relative;
	}

	/* SVG icon for user/login buttons */
	.header-cta .btn:has([href*="sign-in"]) .wp-block-button__link::before,
	.header-cta .btn:has([href*="login"]) .wp-block-button__link::before,
	.header-cta .btn:has([href*="account"]) .wp-block-button__link::before {
		content: "";
		display: block;
		width: 20px;
		height: 20px;
		flex-shrink: 0;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
		background-size: contain;
		background-repeat: no-repeat;
		background-position: center;
	}

	/* SVG icon for dashboard/console/get-started buttons */
	.header-cta .btn:has([href*="dashboard"]) .wp-block-button__link::before,
	.header-cta .btn:has([href*="console"]) .wp-block-button__link::before,
	.header-cta .btn:has([href*="get-started"]) .wp-block-button__link::before,
	.header-cta .btn:has([href*="start"]) .wp-block-button__link::before {
		content: "";
		display: block;
		width: 20px;
		height: 20px;
		flex-shrink: 0;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M9 3v18'/%3E%3C/svg%3E");
		background-size: contain;
		background-repeat: no-repeat;
		background-position: center;
	}

	/* Search icon if present */
	.header-cta .btn:has([href*="search"]) .wp-block-button__link::before {
		content: "";
		display: block;
		width: 20px;
		height: 20px;
		flex-shrink: 0;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
		background-size: contain;
		background-repeat: no-repeat;
		background-position: center;
	}

	/* Hide hamburger label on mobile */
	.nav-hamburger {
		padding: 8px;
	}

	.nav-hamburger .hamburger-label {
		display: none;
	}
}

/* ── Mobile: horizontal strip ─────────────── */
@media (max-width: 768px) {
	.nav-drawer::before {
		height: var(--header-height, 90px);
		pointer-events: none;
	}

	.nav-drawer-inner {
		flex-direction: column;
	}

	.nav-drawer-left {
		width: 100%;
		flex-direction: row;
		flex-wrap: wrap;
		padding: 0.5rem;
		overflow-y: visible;
		overflow-x: auto;
	}

	.nav-drawer-item {
		width: auto;
		flex: none;
		padding: 0.625rem 1rem;
		font-size: 0.75rem;
		border-left: none;
		border-bottom: 2px solid transparent;
	}

	.nav-drawer-item:hover,
	.nav-drawer-item.active {
		border-left: none;
		border-bottom-color: rgba(255, 255, 255, 0.6);
	}

	.nav-drawer-item .drawer-arrow {
		display: none;
	}

	.nav-drawer-right {
		padding: 1.5rem;
	}

	.nav-drawer-pane .mega-menu-grid {
		grid-template-columns: 1fr;
	}

	/* Enhanced mobile drawer scroll for tall navigation */
	.nav-drawer-left {
		max-height: 120px;
		overflow-x: auto;
		scrollbar-width: thin;
		-webkit-overflow-scrolling: touch;
	}
}