/* ============================================================
   Mega Menu — matches designs/mega-menu/*.png
   Panels injected into top-nav <li.has-mega-menu> by
   Calwep_Mega_Menu_Walker.
   ============================================================ */

/* Anchor the panel under the header ONLY when the new V2 nav is present.
   Beats the legacy `header.header.updateV1 { position: static !important }`
   (style.css) without disturbing Max Mega Menu (which renders only when the
   V2 nav is NOT shown). */
header.header.updateV1:has(.mega-nav-v2) { position: relative !important; }

#top_menu .has-mega-menu { position: static; }

.mega-nav-v2 .mega-menu {
	position: absolute;
	top: 100%;
	left: 0;
	width: 100%;
	background: #ffffff;
	border-top: 1px solid #e6ebef;
	box-shadow: 0 18px 32px rgba(0, 0, 0, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	z-index: 999;
	text-align: left;
}

#top_menu .has-mega-menu:hover > .mega-menu,
#top_menu .has-mega-menu:focus-within > .mega-menu,
#top_menu .has-mega-menu.mega-open > .mega-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Full-width panel with comfortable side padding. */
.mega-menu__inner {
	display: flex;
	align-items: stretch;
	gap: 44px;
	padding: 36px 56px 48px;
}

/* All mega-menu links: plain Lato 16px, black, underlined, pointer, left.
   !important defeats the inherited nav-link styling (white/bold/centered). */
.mega-nav-v2 .mega-menu a {
	padding: 0 !important;
	margin: 0;
	display: inline-block;
	background: none !important;
	font-family: 'Lato', sans-serif !important;
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.45;
	color: #000000 !important;
	text-align: left !important;
	text-decoration: underline !important;
	cursor: pointer;
}
/* Defeat `.header p { color:#fff }` (main.css) for any paragraph in the panel. */
.mega-nav-v2 .mega-menu p { margin: 0; color: #000000 !important; }

/* ---------- Left card ---------- */
.mega-menu__left {
	flex: 0 0 33%;
	max-width: 33%;
	background: #e9f2fb;
	border-radius: 10px;
	padding: 26px 28px 30px;
}

.mega-menu__left-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.mega-menu__left-title {
	margin: 0;
	font-size: 26px;
	font-weight: 700;
	color: #1a1a1a;
	text-align: left;
}

.mega-menu__left-headlink {
	font-size: 14px;
	color: #1a1a1a !important;
	text-decoration: underline;
	white-space: nowrap;
}

.mega-menu__listings { display: flex; flex-direction: column; gap: 20px; }

.mega-menu__listing { display: flex; gap: 18px; align-items: flex-start; }

.mega-menu__listing-img { flex: 0 0 46%; max-width: 46%; }
.mega-menu__listing-img img {
	width: 100%;
	height: 110px;
	object-fit: cover;
	border-radius: 8px;
	display: block;
}

/* Single listing: image sits centered alongside the copy and shows taller. */
.mega-menu__listings.is-single .mega-menu__listing { align-items: center; }
.mega-menu__listings.is-single .mega-menu__listing-img img { height: auto; max-height: 280px; }

.mega-menu__listing-content { flex: 1 1 auto; min-width: 0; }

.mega-menu__listing-title {
	margin: 0 0 8px;
	font-size: 19px;
	font-weight: 700;
	color: #1a1a1a;
	text-align: left;
}

.mega-menu__listing-body,
.mega-menu__listing-body p {
	font-family: 'Lato', sans-serif !important;
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.55;
	color: #000000 !important;
	text-align: left !important;
}

.mega-menu__listing-link { margin-top: 16px; }

/* ---------- Right columns ---------- */
.mega-menu__columns { flex: 1 1 auto; display: flex; gap: 36px; }

.mega-menu__col { flex: 1 1 0; min-width: 0; }

.mega-menu__col-heading {
	margin: 0 0 14px;
	font-size: 15px;
	color: #1a1a1a;
	text-align: left;
}

.mega-menu__block { margin-bottom: 22px; }
.mega-menu__block:last-child { margin-bottom: 0; }

.mega-menu__block-img { margin-bottom: 14px; }
.mega-menu__block-img img {
	width: 100%;
	height: 150px;
	object-fit: cover;
	border-radius: 12px;
	display: block;
}

.mega-menu__block-title {
	margin: 0 0 8px;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a1a;
	text-align: left;
}

.mega-menu__block-body,
.mega-menu__block-body p {
	font-family: 'Lato', sans-serif !important;
	font-size: 16px !important;
	font-weight: 400 !important;
	line-height: 1.55;
	color: #000000 !important;
	text-align: left !important;
}

.mega-menu__block-links { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Mobile / no-hover: expandable block ---------- */
@media (max-width: 991px) {
	#top_menu .has-mega-menu { position: static; }

	.mega-nav-v2 .mega-menu {
		position: static;
		width: auto;
		box-shadow: none;
		border-top: 0;
		opacity: 1;
		visibility: visible;
		transform: none;
		display: none;
	}

	#top_menu .has-mega-menu.mega-open > .mega-menu { display: block; }

	.mega-menu__inner { flex-direction: column; gap: 20px; padding: 16px 0 8px; }
	.mega-menu__left { flex-basis: auto; max-width: 100%; }
	.mega-menu__columns { flex-direction: column; gap: 24px; }
}

/* ---------- "My CalWEP" CTA button (V2 nav, far right) ---------- */
/* Mirrors the MMM nav button: teal pill at the end of the top nav. The menu
   item carries the `btn` class (Appearance → Menus → CSS Classes). */
.mega-nav-v2 > li.btn { margin-left: 14px; }
.mega-nav-v2 > li.btn > a {
	display: inline-block;
	background: var(--blue) !important;
	color: #ffffff !important;
	padding: 0 22px;
	height: 40px;
	line-height: 40px;
	border-radius: 4px;
	font-weight: 600;
	text-decoration: none !important;
}
.mega-nav-v2 > li.btn > a:hover { background: var(--dark-blue) !important; color: #ffffff !important; }
