/* Mega menu — Branford theme (#2a055d, #e8f2f5, #22acac accents) */
/* Loaded after Bootstrap: light navbar + dark text (navbar-dark + light bg hid all labels). */

header.my-nav nav.navbar.bg-custom.navbar-light .navbar-nav .nav-link {
	color: #2a2633 !important;
	font-size: 1rem;
	font-weight: 500;
}

header.my-nav nav.navbar.bg-custom.navbar-light .navbar-nav .nav-link:hover,
header.my-nav nav.navbar.bg-custom.navbar-light .navbar-nav .nav-link:focus-visible {
	color: #22acac !important;
}

header.my-nav nav.navbar.bg-custom.navbar-light .navbar-nav .nav-link.active {
	color: #2a055d !important;
	font-weight: 700;
}

header.my-nav nav.navbar.bg-custom.navbar-light .navbar-toggler {
	border-color: rgba(42, 5, 93, 0.35);
}

header.my-nav nav.navbar,
header.my-nav nav.navbar .container {
	overflow: visible !important;
}

/* Do not set position:relative here — it would shrink the mega menu’s positioning
   context to this narrow <ul>; panel is centered against the full-width <nav> instead. */
.mega-menu-nav {
	position: static;
}

.mega-menu__trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	background: transparent;
	border: 0;
	cursor: pointer;
	font-family: "Josefin Sans", serif;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	padding: 0.5rem 0;
	color: #2a055d !important;
	transition: color 0.25s ease, transform 0.2s ease;
}

.mega-menu__trigger:hover,
.mega-menu__trigger:focus-visible {
	color: #22acac;
	outline: none;
}

.mega-menu__chevron {
	flex-shrink: 0;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 0.75;
}

@media (min-width: 992px) {
	.nav-mega:hover .mega-menu__chevron,
	.nav-mega:focus-within .mega-menu__chevron {
		transform: rotate(180deg);
	}
}

.nav-mega.is-open .mega-menu__chevron {
	transform: rotate(180deg);
}

.mega-menu__panel {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 1080;
	padding-top: 0.5rem;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition:
		opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1),
		visibility 0.32s,
		transform 0.38s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Wider than Bootstrap .container (~1320px) — align with site max-width feel */
@media (min-width: 992px) {
	.nav-mega.position-static .mega-menu__panel {
		left: 50%;
		right: auto;
		width: min(1720px, calc(100vw - 2.5rem));
		transform: translateX(-50%) translateY(12px);
	}

	.nav-mega:hover .mega-menu__panel,
	.nav-mega:focus-within .mega-menu__panel {
		opacity: 1;
		visibility: visible;
		transform: translateX(-50%) translateY(0);
		pointer-events: auto;
	}
}

.nav-mega.is-open .mega-menu__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

@media (min-width: 992px) {
	.nav-mega.is-open .mega-menu__panel {
		transform: translateX(-50%) translateY(0);
	}
}

.mega-menu__inner {
	background: linear-gradient(145deg, #ffffff 0%, #f4f9fb 48%, #eef6f8 100%);
	border-radius: 20px;
	box-shadow:
		0 24px 48px rgba(42, 5, 93, 0.12),
		0 0 0 1px rgba(42, 5, 93, 0.06);
	overflow: hidden;
	border: 1px solid rgba(42, 5, 93, 0.08);
	animation: mega-panel-in 0.45s cubic-bezier(0.34, 1.15, 0.64, 1) both;
}

@media (min-width: 992px) {
	.mega-menu__inner--scroll {
		max-height: min(78vh, 820px);
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-gutter: stable;
	}

	.mega-menu__inner--scroll::-webkit-scrollbar {
		width: 8px;
	}

	.mega-menu__inner--scroll::-webkit-scrollbar-thumb {
		background: rgba(42, 5, 93, 0.18);
		border-radius: 8px;
	}

	.mega-menu__inner--scroll::-webkit-scrollbar-track {
		background: rgba(42, 5, 93, 0.04);
	}
}

@keyframes mega-panel-in {
	from {
		opacity: 0;
		transform: translateY(6px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mega-menu__panel,
	.mega-menu__inner,
	.mega-menu__link,
	.mega-menu__featured-card,
	.mega-menu__chevron,
	.mega-menu__link-item {
		animation: none !important;
	}
}

.mega-menu__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(220px, 280px);
	gap: 0;
	min-height: 280px;
}

/* Segregated category megas: 3 link columns + featured (uses wide panel) */
.mega-menu__grid--category {
	grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(280px, 340px);
	min-height: 300px;
	align-items: stretch;
}

.mega-menu__grid--category .mega-menu__col {
	padding: 1.65rem 1.35rem 1.75rem 1.5rem;
}

.mega-menu__grid--category .mega-menu__links {
	gap: 0.2rem;
}

.mega-menu__grid--category .mega-menu__link {
	font-size: 0.875rem;
	line-height: 1.45;
	padding-top: 0.35rem;
	padding-bottom: 0.35rem;
	color: #3d3a45;
}

@media (max-width: 1199.98px) and (min-width: 992px) {
	.mega-menu__grid--category {
		grid-template-columns: 1fr;
	}

	.mega-menu__grid--category .mega-menu__col {
		border-inline-end: none;
		border-bottom: 1px solid rgba(42, 5, 93, 0.07);
	}

	.mega-menu__grid--category .mega-menu__featured {
		border-inline-start: none;
		border-top: 1px solid rgba(42, 5, 93, 0.09);
	}
}

.mega-menu__col {
	padding: 1.75rem 1.5rem 1.75rem 1.75rem;
	border-inline-end: 1px solid rgba(42, 5, 93, 0.07);
}

.mega-menu__col:last-of-type {
	border-inline-end: none;
}

.mega-menu__featured {
	padding: 1.25rem;
	display: flex;
	align-items: stretch;
	align-self: stretch;
	background: linear-gradient(160deg, rgba(42, 5, 93, 0.05) 0%, rgba(34, 172, 172, 0.08) 100%);
	border-inline-start: 1px solid rgba(42, 5, 93, 0.09);
}

.mega-menu__grid--category .mega-menu__featured {
	padding: 1.5rem 1.35rem 1.5rem 1.5rem;
}

.mega-menu__col-title {
	font-family: "Josefin Sans", serif;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #22acac;
	margin: 0 0 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid rgba(34, 172, 172, 0.35);
}

.mega-menu__links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.mega-menu__link {
	display: block;
	padding: 0.4rem 0.35rem 0.4rem 0;
	font-size: 0.9rem;
	line-height: 1.35;
	color: #4a4a55;
	text-decoration: none;
	border-radius: 8px;
	position: relative;
	transition:
		color 0.2s ease,
		padding-inline-start 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
		background 0.2s ease;
}

.mega-menu__link::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	width: 0;
	height: 2px;
	background: linear-gradient(90deg, #22acac, #2a055d);
	border-radius: 2px;
	transform: translateY(-50%);
	transition: width 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
	opacity: 0.9;
}

.mega-menu__link:hover,
.mega-menu__link:focus-visible {
	color: #2a055d;
	padding-inline-start: 0.65rem;
	background: rgba(42, 5, 93, 0.04);
	outline: none;
}

.mega-menu__link:hover::before,
.mega-menu__link:focus-visible::before {
	width: 14px;
}

.mega-menu__link-item {
	animation: mega-link-in 0.4s cubic-bezier(0.34, 1.1, 0.64, 1) backwards;
	animation-delay: calc(var(--mega-i, 0) * 0.028s);
}

@keyframes mega-link-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.mega-menu__featured-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	text-decoration: none;
	color: inherit;
	border-radius: 16px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 12px 32px rgba(42, 5, 93, 0.1);
	transition:
		transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
		box-shadow 0.35s ease;
}

.mega-menu__featured-card:hover,
.mega-menu__featured-card:focus-visible {
	transform: translateY(-4px) scale(1.01);
	box-shadow: 0 20px 44px rgba(42, 5, 93, 0.16);
	outline: none;
}

.mega-menu__featured-visual {
	position: relative;
	aspect-ratio: 4/3;
	overflow: hidden;
	background: linear-gradient(135deg, #2a055d 0%, #4a1a7a 50%, #22acac 100%);
}

.mega-menu__featured-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.55s cubic-bezier(0.34, 1, 0.64, 1);
}

.mega-menu__featured-card:hover .mega-menu__featured-img,
.mega-menu__featured-card:focus-visible .mega-menu__featured-img {
	transform: scale(1.06);
}

.mega-menu__featured-shine {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		120deg,
		transparent 0%,
		rgba(255, 255, 255, 0.15) 45%,
		transparent 55%
	);
	transform: translateX(-100%);
	transition: transform 0.7s ease;
	pointer-events: none;
}

.mega-menu__featured-card:hover .mega-menu__featured-shine,
.mega-menu__featured-card:focus-visible .mega-menu__featured-shine {
	transform: translateX(100%);
}

.mega-menu__featured-body {
	padding: 1.1rem 1.15rem 1.25rem;
}

.mega-menu__featured-title {
	font-family: "Josefin Sans", serif;
	font-size: 1.05rem;
	font-weight: 700;
	color: #2a055d;
	margin: 0 0 0.4rem;
	line-height: 1.25;
}

.mega-menu__featured-text {
	font-size: 0.82rem;
	line-height: 1.45;
	color: #6d6d6d;
	margin: 0 0 0.85rem;
}

.mega-menu__featured-cta {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #22acac;
	transition: gap 0.25s ease, color 0.2s ease;
}

.mega-menu__featured-card:hover .mega-menu__featured-cta,
.mega-menu__featured-card:focus-visible .mega-menu__featured-cta {
	gap: 0.55rem;
	color: #2a055d;
}

/* Mobile / tablet collapse */
@media (max-width: 991.98px) {
	.nav-mega .mega-menu__panel {
		left: auto !important;
		right: auto !important;
		width: auto !important;
	}

	.mega-menu__panel {
		position: static;
		padding-top: 0;
		transform: none !important;
		max-height: 0;
		opacity: 1;
		visibility: visible;
		overflow: hidden;
		pointer-events: none;
		transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
	}

	.nav-mega.is-open .mega-menu__panel {
		max-height: 5600px;
		pointer-events: auto;
	}

	.mega-menu__inner {
		margin-top: 0.5rem;
		border-radius: 14px;
		animation: none;
	}

	.mega-menu__grid {
		grid-template-columns: 1fr;
		min-height: 0;
	}

	.mega-menu__grid--category {
		grid-template-columns: 1fr;
	}

	.mega-menu__col {
		border-inline-end: none;
		border-bottom: 1px solid rgba(42, 5, 93, 0.07);
		padding: 1.25rem 1.25rem 1rem;
	}

	.mega-menu__featured {
		border-inline-start: none;
		border-top: 1px solid rgba(42, 5, 93, 0.08);
		padding: 1rem;
	}

	.mega-menu__link-item {
		animation: none;
	}

}

@media (max-width: 991.98px) {
	.my-nav .navbar li.nav-item.nav-mega {
		padding-inline: 0;
		width: 100%;
	}

	.mega-menu__trigger {
		width: 100%;
		justify-content: space-between;
		text-align: start;
		padding: 0.65rem 0;
		border-bottom: 1px solid rgba(42, 5, 93, 0.08);
	}
}

/* Align with existing nav link weights */
header.my-nav nav.navbar.bg-custom.navbar-light .navbar-nav button.nav-link.mega-menu__trigger:not(.active) {
	color: #2a055d !important;
}

.my-nav .navbar-nav .mega-menu__trigger.active {
	color: #2a055d !important;
	font-weight: 700;
}
