/* ==========================================================================
   Aver Logistics — Mega-menu navigation
   Replaces Enfold's primary menu output with a modern, responsive nav.
   ========================================================================== */

.aver-nav,
.aver-nav * { box-sizing: border-box; }

.aver-nav {
	font-family: var(--aver-font);
	position: relative;
	z-index: 50;
	height: 100%;
}

/* --------------------------------------------------------------------------
   Nav list (desktop horizontal)
   -------------------------------------------------------------------------- */

.aver-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: stretch;
	gap: 0;
	height: 100%;
}

.aver-nav__item {
	position: relative;
	display: flex;
	align-items: center;
}

/* Tab indicator pinned to the bottom edge of the header bar */
.aver-nav__item::after {
	content: "";
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 0;
	height: 2px;
	background: var(--aver-red);
	transform: scaleX(0);
	transform-origin: center;
	transition: transform 0.25s var(--aver-ease);
}

.aver-nav__item:hover::after,
.aver-nav__item.is-open::after,
.aver-nav__item.is-active::after {
	transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   Triggers & links
   -------------------------------------------------------------------------- */

.aver-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 16px;
	font-family: var(--aver-font);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1;
	color: var(--aver-ink);
	background: transparent;
	border: 0;
	cursor: pointer;
	text-decoration: none !important;
	transition: color 0.2s var(--aver-ease);
}

.aver-nav__link:hover,
.aver-nav__link:focus-visible {
	color: var(--aver-red) !important;
	outline: 0;
}

.aver-nav__link--active {
	color: var(--aver-red) !important;
}

.aver-nav__caret {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform 0.25s var(--aver-ease);
	opacity: 0.7;
}

.aver-nav__item--has-mega:hover .aver-nav__caret,
.aver-nav__item--has-mega.is-open .aver-nav__caret {
	transform: rotate(-135deg) translate(-2px, -2px);
}

/* --------------------------------------------------------------------------
   Mega panel
   -------------------------------------------------------------------------- */

.aver-nav__mega {
	position: absolute;
	top: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	width: min(720px, calc(100vw - 32px));
	background: #fff;
	border-radius: 14px;
	box-shadow:
		0 24px 60px -20px rgba(20, 23, 26, 0.35),
		0 4px 12px -8px rgba(20, 23, 26, 0.15);
	padding: 22px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.22s var(--aver-ease), transform 0.22s var(--aver-ease), visibility 0.22s;
	z-index: 100;
}

.aver-nav__mega--narrow { width: min(520px, calc(100vw - 32px)); }
.aver-nav__mega--wide   { width: min(960px, calc(100vw - 32px)); }

/* Invisible hover bridge covering the gap between the section name and the
   panel below it. Without this, moving the mouse down off the trigger crosses
   a dead zone, :hover drops, and the panel closes before you reach it. */
.aver-nav__mega::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}

.aver-nav__item--has-mega:hover .aver-nav__mega,
.aver-nav__item--has-mega.is-open .aver-nav__mega {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

.aver-nav__mega-grid {
	display: grid;
	gap: 10px;
}

.aver-nav__mega-grid--2 { grid-template-columns: repeat(2, 1fr); }
.aver-nav__mega-grid--3 { grid-template-columns: repeat(3, 1fr); gap: 18px; }

.aver-nav__mega-col {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.aver-nav__mega-heading {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--aver-muted);
	margin: 4px 12px 6px;
}

/* --------------------------------------------------------------------------
   Mega cell
   -------------------------------------------------------------------------- */

.aver-nav__cell {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 10px;
	text-decoration: none !important;
	transition: background-color 0.18s var(--aver-ease);
}

.aver-nav__cell:hover { background: var(--aver-red-soft); }

.aver-nav__cell-icon {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--aver-red-soft);
	color: var(--aver-red);
	font-size: 20px;
	transition: background-color 0.18s var(--aver-ease), color 0.18s var(--aver-ease);
}

.aver-nav__cell:hover .aver-nav__cell-icon {
	background: var(--aver-red);
	color: #fff;
}

.aver-nav__cell-body { display: flex; flex-direction: column; min-width: 0; }

.aver-nav__cell-title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--aver-ink);
}

.aver-nav__cell-text {
	font-size: 12px;
	line-height: 1.4;
	color: var(--aver-body);
	margin-top: 3px;
}

.aver-nav__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 8px 12px 0;
	font-size: 13px;
	font-weight: 700;
	color: var(--aver-red) !important;
	text-decoration: none !important;
	transition: gap 0.2s var(--aver-ease);
}

.aver-nav__more:hover { gap: 10px; }
.aver-nav__more .aver-icon { font-size: 15px; }

/* --------------------------------------------------------------------------
   Feature column (e.g. Services → CTA card)
   -------------------------------------------------------------------------- */

.aver-nav__mega-col--feature {
	background: var(--aver-red-soft);
	color: var(--aver-body);
	border: 1px solid rgba(219, 0, 17, 0.16);
	border-radius: 12px;
	padding: 22px;
	justify-content: center;
}

.aver-nav__feature-eyebrow {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--aver-red);
	margin-bottom: 8px;
}

.aver-nav__feature-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--aver-ink);
	margin: 0 0 8px;
	line-height: 1.25;
	display: block;
	font-family: var(--aver-font);
	letter-spacing: normal;
	text-transform: none;
}

.aver-nav__feature-text {
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--aver-body);
	margin: 0 0 16px;
}

.aver-nav__mega-col--feature .aver-btn {
	font-size: 13px;
	padding: 11px 18px;
	align-self: flex-start;
}

/* --------------------------------------------------------------------------
   Hamburger (mobile only)
   -------------------------------------------------------------------------- */

.aver-nav__burger {
	display: none;
	width: 42px;
	height: 42px;
	background: transparent;
	border: 0;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 5px;
	padding: 0;
}

.aver-nav__burger span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--aver-ink);
	border-radius: 2px;
	transition: transform 0.25s var(--aver-ease), opacity 0.2s var(--aver-ease);
}

.aver-nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.aver-nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.aver-nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   Hide any leftover Enfold mobile menu artifacts so only ours shows
   -------------------------------------------------------------------------- */

#top .av-burger-menu-main { display: none !important; }
#top #avia-menu { display: none !important; }

/* Hide the "Track Shipments" portal button injected by the WPCode header
   snippet — kept out of the revamped nav. */
.logi-track-menu-item { display: none !important; }

/* --------------------------------------------------------------------------
   Responsive — mobile drawer
   -------------------------------------------------------------------------- */

@media (max-width: 989px) {
	/* Hamburger sits above everything when drawer is open so it doubles as a close button */
	.aver-nav__burger {
		display: flex;
		position: relative;
		z-index: 1001;
	}
	.aver-nav__burger[aria-expanded="true"] {
		position: fixed;
		top: 22px;
		right: 18px;
	}

	/* Backdrop — appears when the drawer opens. Uses :has() so no extra markup needed. */
	.aver-nav::before {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(20, 23, 26, 0.55);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.25s var(--aver-ease), visibility 0.25s;
		z-index: 998;
	}
	.aver-nav:has([data-open="true"])::before {
		opacity: 1;
		visibility: visible;
	}

	/* Drawer */
	.aver-nav__list {
		position: fixed;
		top: 0;
		right: 0;
		height: 100vh;
		height: 100dvh;
		width: min(86vw, 380px);
		background: #fff;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 78px 0 32px;
		transform: translateX(100%);
		transition: transform 0.3s var(--aver-ease);
		box-shadow: -10px 0 40px -16px rgba(0, 0, 0, 0.35);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		z-index: 999;
	}

	.aver-nav__list[data-open="true"] { transform: translateX(0); }

	/* Reset desktop flex on the LI so it stacks as a clean list with dividers */
	.aver-nav__item {
		display: block;
		border-bottom: 1px solid var(--aver-line);
	}
	.aver-nav__item:last-child { border-bottom: 0; }

	/* No underline indicator on mobile */
	.aver-nav__item::after { display: none; }

	/* Top-level links / triggers — full-width row tappable */
	.aver-nav__link {
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 8px;
		padding: 16px 22px;
		font-size: 16px;
		font-weight: 600;
		letter-spacing: 0;
		border-radius: 0;
		box-shadow: none;
	}

	/* Active page stays red, no bar */
	.aver-nav__link--active { color: var(--aver-red) !important; }

	/* Caret a touch bigger for thumbs */
	.aver-nav__caret {
		width: 8px;
		height: 8px;
		opacity: 0.8;
	}

	/* Accordion mega panel — tinted background to set it apart from the top level */
	.aver-nav__mega {
		position: static;
		width: auto;
		transform: none !important;
		box-shadow: none;
		border-radius: 0;
		padding: 0;
		background: var(--aver-bg-alt);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s var(--aver-ease), opacity 0.2s var(--aver-ease);
	}

	.aver-nav__item--has-mega:hover .aver-nav__mega {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		max-height: 0;
	}

	.aver-nav__item--has-mega.is-open .aver-nav__mega {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		max-height: 1500px;
		padding: 4px 0 10px;
	}

	/* Each column becomes a flat section with a small heading */
	.aver-nav__mega-grid--2,
	.aver-nav__mega-grid--3 {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.aver-nav__mega-col { gap: 0; }

	.aver-nav__mega-heading {
		padding: 12px 22px 4px;
		margin: 0;
		font-size: 10.5px;
		color: var(--aver-muted);
	}

	/* Cells: TITLE-ONLY on mobile — no icon, no description, no card padding.
	   Drop the icon block and description copy that just crowd a narrow drawer. */
	.aver-nav__cell {
		padding: 11px 22px;
		gap: 0;
		border-radius: 0;
	}
	.aver-nav__cell:hover { background: var(--aver-red-soft); }

	.aver-nav__cell-icon,
	.aver-nav__cell-text { display: none; }

	.aver-nav__cell-title {
		font-size: 14.5px;
		font-weight: 600;
	}

	/* "All shipping routes →" link */
	.aver-nav__more {
		display: flex;
		margin: 4px 0 0;
		padding: 12px 22px;
		font-size: 14px;
	}

	/* No promo card in mobile */
	.aver-nav__mega-col--feature { display: none; }
}
