/*
 * Mega menu — matches the existing header nav (Aileron 600, #2C3E50, primary for the
 * current page) and the site's card language (white, 16px radius, soft shadow).
 */
.bf-mm {
	--mm-primary: var(--e-global-color-primary, #2660A4);
	--mm-text: var(--e-global-color-text, #2C3E50);
	--mm-muted: #5A6C7D;
	--mm-tint: #E8F0FA;
	--mm-hover: #F4F7FB;
	--mm-border: #EEF0F2;
	--mm-nav-font: "Aileron", var(--e-global-typography-text-font-family, "Inter"), sans-serif;
	--mm-heading-font: var(--e-global-typography-primary-font-family, "Poppins"), sans-serif;
	--mm-body-font: var(--e-global-typography-text-font-family, "Inter"), sans-serif;
	position: relative;
	font-family: var(--mm-body-font);
}
.bf-mm *, .bf-mm *::before, .bf-mm *::after { box-sizing: border-box; }
.bf-mm ul { list-style: none; margin: 0; padding: 0; }
.bf-mm li { margin: 0; }
.bf-mm .bf-icon { width: 18px; height: 18px; flex: none; }
.bf-mm button { border: 0; background: transparent; box-shadow: none; padding: 0; margin: 0; color: inherit; cursor: pointer; text-transform: none; letter-spacing: normal; }
.bf-mm button:hover, .bf-mm button:focus { background: transparent; color: inherit; }
.bf-mm a:focus-visible, .bf-mm button:focus-visible { outline: 2px solid var(--mm-primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Top level (desktop) ---------- */
.bf-mm .bf-mm__burger { display: none; }
/* Menu items with the CSS class "mobile-only-link" / "desktop-only-link" (Appearance → Menus → CSS Classes) */
@media (min-width: 1025px) { .bf-mm .mobile-only-link { display: none; } }
@media (max-width: 1024px) { .bf-mm .desktop-only-link { display: none; } }
.bf-mm__list { display: flex; align-items: center; flex-wrap: nowrap; }
.bf-mm__item { position: relative; display: flex; align-items: center; }
.bf-mm .bf-mm__link {
	display: block;
	padding: 4px 6px 4px 18px;
	font: 600 0.92rem/1.5 var(--mm-nav-font);
	color: var(--mm-text);
	text-decoration: none;
	white-space: nowrap;
	transition: color .2s;
}
.bf-mm__item:not(.has-children) > .bf-mm__link { padding-right: 18px; }
.bf-mm .bf-mm__link:hover,
.bf-mm__item.is-open > .bf-mm__link,
.bf-mm__item.is-current > .bf-mm__link { color: var(--mm-primary); }
.bf-mm .bf-mm__toggle { display: inline-flex; align-items: center; padding: 4px; color: var(--mm-muted); }
.bf-mm .bf-mm__toggle .bf-icon { width: 15px; height: 15px; transition: transform .2s; }
.bf-mm__item.is-open > .bf-mm__toggle { color: var(--mm-primary); }
.bf-mm__item.is-open > .bf-mm__toggle .bf-icon { transform: rotate(180deg); }

/* ---------- Dropdown panel ---------- */
.bf-mm__panel {
	position: absolute;
	top: calc(100% + 14px);
	left: 0;
	z-index: 1000;
	width: 380px;
	padding: 10px;
	border: 1px solid var(--mm-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 18px 48px rgba(44, 62, 80, .14);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .18s, transform .18s, visibility .18s;
}
.bf-mm__panel::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; } /* hover bridge */
.bf-mm__panel.is-flipped { left: auto; right: 0; }
.bf-mm__item.is-open > .bf-mm__panel { opacity: 1; visibility: visible; transform: none; }

.bf-mm__subitem { position: relative; }
.bf-mm .bf-mm__card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 11px 12px;
	border-radius: 12px;
	color: var(--mm-text);
	text-decoration: none;
	transition: background .15s;
}
.bf-mm .bf-mm__card:hover,
.bf-mm__subitem.is-open > .bf-mm__card { background: var(--mm-hover); }
.bf-mm__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex: none;
	border-radius: 10px;
	background: var(--mm-tint);
	color: var(--mm-primary);
}
.bf-mm__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bf-mm__title { font: 600 15px/1.35 var(--mm-heading-font); color: var(--mm-text); }
.bf-mm__desc { font-size: 13px; line-height: 1.45; color: var(--mm-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bf-mm .bf-mm__card:hover .bf-mm__title,
.bf-mm .bf-mm__card.is-current .bf-mm__title,
.bf-mm__subitem.is-open > .bf-mm__card .bf-mm__title { color: var(--mm-primary); }
.bf-mm__chev { align-self: center; color: var(--mm-muted); }
.bf-mm__chev .bf-icon { width: 16px; height: 16px; transform: rotate(-90deg); }
.bf-mm .bf-mm__subtoggle { display: none; }

/* ---------- Flyout (3rd level) ---------- */
.bf-mm__flyout {
	position: absolute;
	top: -10px;
	left: calc(100% + 18px);
	z-index: 1001;
	width: 360px;
	padding: 10px;
	border: 1px solid var(--mm-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 18px 48px rgba(44, 62, 80, .14);
	opacity: 0;
	visibility: hidden;
	transform: translateX(-6px);
	transition: opacity .16s, transform .16s, visibility .16s;
}
.bf-mm__flyout::before { content: ""; position: absolute; top: 0; bottom: 0; left: -20px; width: 20px; } /* hover bridge */
.bf-mm__flyout.is-flipped { left: auto; right: calc(100% + 18px); transform: translateX(6px); }
.bf-mm__flyout.is-flipped::before { left: auto; right: -20px; }
.bf-mm__subitem.is-open > .bf-mm__flyout { opacity: 1; visibility: visible; transform: none; }
.bf-mm__flyout .bf-mm__card { padding: 9px 12px; }
.bf-mm__flyout .bf-mm__icon { width: 30px; height: 30px; border-radius: 8px; }
.bf-mm__flyout .bf-mm__icon .bf-icon { width: 16px; height: 16px; }
.bf-mm__flyout .bf-mm__title { font-size: 14.5px; }
.bf-mm__flyout .bf-mm__desc { font-size: 12.5px; -webkit-line-clamp: 1; }

/* A closed panel/flyout is invisible but still counts for scrolling: park it towards the LEFT
   (which never creates a sideways scrollbar). The delay keeps it in place while it fades out,
   so "left" must stay a LENGTH: a delayed change to/from "auto" happens at once and the box
   jumps over the menu while it is still visible. */
@media (min-width: 1025px) {
	.bf-mm__item:not(.is-open) > .bf-mm__panel:not(.is-flipped) {
		left: calc(100% - 380px); /* 380px = panel width: same place as right: 0 */
		transition: opacity .18s, transform .18s, visibility .18s, left 0s .18s;
	}
	.bf-mm__subitem:not(.is-open) > .bf-mm__flyout:not(.is-flipped) {
		left: 0;
		transition: opacity .16s, transform .16s, visibility .16s, left 0s .18s;
	}
	/* Moving to a sibling: drop the old flyout at once so the two never show through each other. */
	.bf-mm :has(> .bf-mm__subitem.is-open) > .bf-mm__subitem:not(.is-open) > .bf-mm__flyout { transition: none; }
}

/* ---------- Tablet & mobile: burger + accordion ---------- */
@media (max-width: 1024px) {
	.bf-mm .bf-mm__burger {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		border-radius: 10px;
		color: var(--mm-text);
	}
	.bf-mm__burger-lines { position: relative; width: 22px; height: 16px; }
	.bf-mm__burger-lines span { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s, top .2s; }
	.bf-mm__burger-lines span:nth-child(1) { top: 0; }
	.bf-mm__burger-lines span:nth-child(2) { top: 7px; }
	.bf-mm__burger-lines span:nth-child(3) { top: 14px; }
	.bf-mm.is-open .bf-mm__burger-lines span:nth-child(1) { top: 7px; transform: rotate(45deg); }
	.bf-mm.is-open .bf-mm__burger-lines span:nth-child(2) { opacity: 0; }
	.bf-mm.is-open .bf-mm__burger-lines span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

	/* .bf-mm prefix: the generic `.bf-mm ul { padding: 0 }` reset outranked `.bf-mm__list` and
	   removed the drawer's side padding (menu text touched the screen edge) - fixed 1.12.1 */
	.bf-mm .bf-mm__list {
		position: fixed;
		top: var(--bf-mm-top, 80px);
		left: 0;
		right: 0;
		z-index: 9999;
		display: none;
		flex-direction: column;
		align-items: stretch;
		max-height: calc(100vh - var(--bf-mm-top, 80px));
		overflow-y: auto;
		padding: 12px 16px 24px;
		background: #fff;
		border-top: 1px solid var(--mm-border);
		box-shadow: 0 18px 40px rgba(44, 62, 80, .14);
	}
	.bf-mm.is-open .bf-mm__list { display: flex; }
	.bf-mm__item { flex-wrap: wrap; border-bottom: 1px solid var(--mm-border); }
	.bf-mm .bf-mm__link { flex: 1; padding: 14px 4px; font-size: 1rem; }
	.bf-mm .bf-mm__toggle { width: 44px; height: 44px; justify-content: center; }
	.bf-mm__panel,
	.bf-mm__flyout {
		position: static;
		width: 100%;
		display: none;
		padding: 0 0 10px;
		border: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: none;
	}
	.bf-mm__panel::before, .bf-mm__flyout::before { display: none; }
	.bf-mm__item.is-open > .bf-mm__panel { display: block; }
	.bf-mm__subitem { display: flex; flex-wrap: wrap; align-items: center; }
	.bf-mm__subitem > .bf-mm__card { flex: 1; }
	.bf-mm__chev { display: none; }
	.bf-mm .bf-mm__subtoggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--mm-muted); }
	.bf-mm .bf-mm__subtoggle .bf-icon { width: 15px; height: 15px; transition: transform .2s; }
	.bf-mm__subitem.is-open > .bf-mm__subtoggle .bf-icon { transform: rotate(180deg); }
	.bf-mm__subitem.is-open > .bf-mm__flyout { display: block; padding-left: 18px; border-left: 2px solid var(--mm-tint); margin-left: 28px; width: calc(100% - 28px); }
	.bf-mm__flyout .bf-mm__desc { -webkit-line-clamp: 2; }
}
@media (prefers-reduced-motion: reduce) {
	.bf-mm__panel, .bf-mm__flyout, .bf-mm__toggle .bf-icon { transition: none; }
}
@media (max-width: 1024px) {
	html.bf-mm-lock, html.bf-mm-lock body { overflow: hidden; }
}

/* Mobile-first pass (1.12.0): on phones/tablets the fixed header slides away while scrolling
   down and comes back on scroll up (menu.js), so content gets the screen. */
[data-elementor-type="header"] .bf-hdr-anim { transition: transform .25s ease; }
[data-elementor-type="header"] .bf-hdr-hide { transform: translateY(-110%) !important; }
@media (prefers-reduced-motion: reduce) { [data-elementor-type="header"] .bf-hdr-anim { transition: none; } }

/* Phones/tablets: the shortcode widget kept the old Elementor nav's fixed mobile width, and the
   burger sat at the LEFT of that box (~78px from the screen edge). Push it to the right edge. */
@media (max-width: 1024px) {
	.elementor-shortcode > .bf-mm { display: flex; justify-content: flex-end; align-items: center; }
}

/* Phones/tablets: the header row aligned its children to the top and the menu box to the bottom
   (+10px top padding), so the burger sat lower than the logo. Centre both in the white bar. */
@media (max-width: 1024px) {
	[data-elementor-type="header"] .e-con.e-parent > .e-con-inner { align-items: center; }
	[data-elementor-type="header"] .e-con.e-parent > .e-con-inner > .e-con { align-self: center; padding-top: 0; padding-bottom: 0; }
}
