/**
 * Zinavo-style multi-column mega menu
 * Per-item: Full Width | Fit Width, Row | Column
 * Accent: #1fa9e1 — titles: black
 */

:root {
	--zmh-accent: #1fa9e1;
	--zmh-title-color: #000000;
	--zmh-link-color: #222222;
	--zmh-link-hover: #1fa9e1;
	--zmh-link-hover-bg: #f2f2f2;
	--zmh-chevron: #888888;
}

.zmh-header-wrap {
	position: relative;
	width: 100%;
	overflow: visible !important;
}

.zmh-header.tf-header {
	position: relative;
	z-index: 100;
	background: #fff;
	overflow: visible !important;
}

/* Elementor / HFE often clip dropdowns */
.ehf-header #masthead,
.ehf-header .elementor,
.ehf-header .elementor-section,
.ehf-header .elementor-container,
.ehf-header .elementor-element,
.ehf-header .elementor-widget-wrap,
.ehf-header .elementor-widget,
.ehf-header .elementor-widget-container,
.elementor-element:has(.zmh-header-wrap),
.elementor-widget:has(.zmh-header-wrap),
.elementor-widget-wrap:has(.zmh-header-wrap),
.elementor-container:has(.zmh-header-wrap),
.elementor-section:has(.zmh-header-wrap) {
	overflow: visible !important;
}

.zmh-header-wrap .zmh-header .tf-container,
.zmh-header-wrap .zmh-header .header-inner,
.zmh-header-wrap .zmh-header .header-left,
.zmh-header-wrap .zmh-header .main-nav,
.zmh-header-wrap .zmh-header .nav-list,
.zmh-header-wrap .zmh-header .nav-item.has-mega {
	position: static;
}

/* Base mega panel — always below header via JS fixed top */
.zmh-header .main-nav .nav-item .zmh-mega.sub-menu.mega-menu,
.zmh-header .zmh-mega.sub-menu.mega-menu,
body > .zmh-mega.sub-menu.mega-menu {
	display: block !important;
	flex-direction: unset !important;
	justify-content: unset !important;
	gap: 0 !important;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	position: fixed !important;
	top: 0;
	left: 0;
	right: auto;
	z-index: 100000 !important;
	margin: 0;
	padding: 0 !important;
	border: none;
	border-radius: 0;
	border-bottom: 3px solid var(--zmh-accent, #1fa9e1);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
	background: #fff;
	transition: opacity 0.15s ease, visibility 0.15s ease;
	transform: none !important;
	width: 100%;
	max-width: none;
	min-width: 0;
}

/*
 * Fit width — American Eagle style compact dropdown:
 * content-sized, under parent item, top accent line, soft shadow
 */
.zmh-mega.zmh-mega--fit,
body > .zmh-mega.zmh-mega--fit {
	width: max-content !important;
	min-width: 220px;
	max-width: min(420px, calc(100vw - 24px));
	border-bottom: none !important;
	border-top: 2px solid var(--zmh-accent, #1fa9e1) !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.zmh-mega--fit .zmh-mega__inner {
	padding: 18px 8px 18px !important;
	width: auto;
	max-width: 100%;
}

.zmh-mega--fit .zmh-mega__grid {
	display: flex !important;
	flex-direction: column !important;
	gap: 0 !important;
	width: max-content;
	min-width: 200px;
}

.zmh-mega--fit.zmh-mega--dir-row .zmh-mega__grid {
	flex-direction: row !important;
	flex-wrap: wrap;
	gap: 8px 28px !important;
}

.zmh-mega--fit .zmh-mega__col {
	width: auto;
	min-width: 0;
}

/* Fit: hide heavy column headers look when it's a simple list; keep title if children exist */
.zmh-mega--fit .zmh-mega__col-title {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--zmh-title-color, #000000);
	margin: 8px 12px 6px;
	padding: 0 0 6px;
	border-bottom: 1px solid rgba(31, 169, 225, 0.35);
}

.zmh-mega--fit .zmh-mega__col:first-child .zmh-mega__col-title {
	margin-top: 0;
}

/* Flat list feel — no chevrons, clean padded links */
.zmh-mega--fit .zmh-mega__link {
	padding: 10px 20px 10px 16px !important;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	color: var(--zmh-link-color, #222222);
	white-space: nowrap;
	background: transparent;
}

.zmh-mega--fit .zmh-mega__link::before {
	display: none !important;
	content: none !important;
}

.zmh-mega--fit .zmh-mega__link:hover {
	color: var(--zmh-link-hover, #1fa9e1);
	background-color: rgba(31, 169, 225, 0.08);
}

/* When fit column has NO child links, the title itself is the clickable row */
.zmh-mega--fit .zmh-mega__col:not(:has(.zmh-mega__list)) .zmh-mega__col-title {
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
	border-bottom: none;
	margin: 0;
	padding: 10px 20px 10px 16px;
	white-space: nowrap;
}

.zmh-mega--fit .zmh-mega__col:not(:has(.zmh-mega__list)) .zmh-mega__col-title:hover {
	color: var(--zmh-link-hover, #1fa9e1);
	background-color: rgba(31, 169, 225, 0.08);
}

.zmh-mega.is-open,
body > .zmh-mega.is-open {
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	display: block !important;
	transform: none !important;
}

.zmh-header .nav-item.has-mega:hover > .zmh-mega,
.zmh-header .nav-item.has-mega:focus-within > .zmh-mega,
.zmh-header .nav-item.has-mega.is-mega-open > .zmh-mega {
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	transform: none !important;
}

.zmh-mega__inner {
	padding: 28px 20px 32px;
	width: 100%;
	box-sizing: border-box;
}

/* Row = side-by-side columns (default Zinavo look) */
.zmh-mega--dir-row .zmh-mega__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	column-gap: 32px;
	row-gap: 12px;
	width: 100%;
	align-items: start;
}

/* Subgrid: all column titles share one row → underlines lock to the same line */
@supports (grid-template-rows: subgrid) {
	.zmh-mega--dir-row .zmh-mega__grid {
		grid-template-rows: auto auto;
	}

	.zmh-mega--dir-row .zmh-mega__col {
		display: grid;
		grid-template-rows: subgrid;
		grid-row: span 2;
		row-gap: 12px;
		align-items: start;
	}

	.zmh-mega--dir-row .zmh-mega__col-title {
		grid-row: 1;
		align-self: stretch;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
	}

	.zmh-mega--dir-row .zmh-mega__list {
		grid-row: 2;
	}
}

/* Column = stacked sections */
.zmh-mega--dir-column .zmh-mega__grid {
	display: flex;
	flex-direction: column;
	gap: 28px;
	width: 100%;
	align-items: stretch;
}

.zmh-mega--dir-column .zmh-mega__col {
	width: 100%;
}

.zmh-mega__col {
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.zmh-mega__col-title {
	display: flex;
	align-items: flex-end;
	box-sizing: border-box;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--zmh-title-color, #000000);
	margin: 0 0 12px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--zmh-accent, #1fa9e1);
	text-decoration: none;
	line-height: 1.35;
	width: 100%;
}

/*
 * Fallback (no subgrid): fixed title box + underline pinned to bottom
 * so every accent line sits on the same horizontal line.
 */
@supports not (grid-template-rows: subgrid) {
	.zmh-mega--dir-row .zmh-mega__col-title {
		position: relative;
		height: 56px !important;
		min-height: 56px !important;
		margin-bottom: 12px;
		padding-bottom: 10px;
		border-bottom: none !important;
		overflow: hidden;
	}

	.zmh-mega--dir-row .zmh-mega__col-title::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		height: 1px;
		background-color: var(--zmh-accent, #1fa9e1);
	}
}

/* Also pin underline with ::after in row mode always — bulletproof alignment */
.zmh-mega--dir-row .zmh-mega__col-title {
	position: relative;
	border-bottom-color: transparent !important;
}

.zmh-mega--dir-row .zmh-mega__col-title::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background-color: var(--zmh-accent, #1fa9e1);
	pointer-events: none;
}

a.zmh-mega__col-title:hover {
	color: var(--zmh-link-hover, #1fa9e1);
}

.zmh-mega__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.zmh-mega--dir-row .zmh-mega__list {
	display: block;
}

/* In column direction, links can still stack; optional horizontal links inside a section */
.zmh-mega--dir-column .zmh-mega__list {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.zmh-mega__list li {
	margin: 0;
	padding: 0;
}

.zmh-mega__link {
	display: block;
	position: relative;
	padding: 8px 12px 8px 22px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	color: var(--zmh-link-color, #222222);
	text-decoration: none;
	border-radius: 0;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.zmh-mega__link::before {
	content: "›";
	position: absolute;
	left: 6px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 16px;
	line-height: 1;
	color: var(--zmh-chevron, #888888);
	font-weight: 400;
}

.zmh-mega__link:hover {
	color: var(--zmh-link-hover, #1fa9e1);
	background-color: var(--zmh-link-hover-bg, #f2f2f2);
	text-decoration: none;
}

.zmh-mega__link:hover::before {
	color: var(--zmh-link-hover, #1fa9e1);
}

.zmh-header .nav-item.has-mega > .item-link i.icon-polygon {
	display: inline-block;
	margin-left: 4px;
	font-size: 8px;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Keep multi-word labels (e.g. "Case Studies") on one line */
.zmh-header .main-nav .nav-list {
	flex-wrap: nowrap;
}

.zmh-header .main-nav .nav-item {
	flex-shrink: 0;
}

.zmh-header .main-nav .item-link {
	white-space: nowrap;
	flex-wrap: nowrap;
}

.zmh-header .main-nav .item-link span {
	white-space: nowrap;
}

.zmh-mb-mega .sub-nav-link {
	font-weight: 600;
}

@media (max-width: 1199px) {
	.zmh-header .main-nav {
		display: none;
	}

	.zmh-header .zmh-mega,
	body > .zmh-mega {
		display: none !important;
	}
}

@media (max-width: 991px) {
	.zmh-mega--dir-row .zmh-mega__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575px) {
	.zmh-mega--dir-row .zmh-mega__grid {
		grid-template-columns: 1fr;
	}
}
