/* ==========================================================================
   Header mega menus (inc/mega-menu.php)
   ========================================================================== */

.gf-menu > li.gf-has-mega > .sub-menu {
	display: none !important;
}

.gf-mega ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gf-menu .gf-mega li {
	border: 0;
}

.gf-mega__arrow {
	flex-shrink: 0;
	color: var(--gf-red);
	transition: transform .2s ease;
}

.gf-menu .gf-mega .gf-mega__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 0;
	font-family: var(--gf-font-alt);
	font-size: 17px;
	line-height: 1.35;
	letter-spacing: -.01em;
	color: var(--gf-navy);
}

.gf-menu .gf-mega .gf-mega__link:hover,
.gf-menu .gf-mega .gf-mega__link:focus-visible,
.gf-menu .gf-mega .gf-mega__link[aria-current="page"] {
	color: var(--gf-red);
}

.gf-mega__link:hover .gf-mega__arrow,
.gf-mega__link:focus-visible .gf-mega__arrow {
	transform: translateX(4px);
}

.gf-mega__heading {
	margin: 0 0 12px;
	font-family: var(--gf-font-alt);
	font-size: 26px;
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -.02em;
	color: var(--gf-navy);
}

.gf-menu .gf-mega .gf-mega__more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 0 2px;
	border-bottom: 1px solid currentColor;
	font-family: var(--gf-font-alt);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--gf-navy);
}

.gf-menu .gf-mega .gf-mega__more:hover,
.gf-menu .gf-mega .gf-mega__more:focus-visible {
	color: var(--gf-red);
}

.gf-mega__pane-title {
	display: none;
}

/* --------------------------------------------------------------------------
   Desktop: panel below the header bar
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
	.gf-header__inner {
		position: relative;
	}

	.gf-menu > li.gf-has-mega {
		position: static;
	}

	/* Caret after the label */
	.gf-menu > li.gf-has-mega > a {
		display: inline-flex;
		align-items: center;
		gap: 8px;
	}

	.gf-menu > li.gf-has-mega > a::after {
		content: "";
		width: 7px;
		height: 7px;
		margin-top: -4px;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		transform: rotate(45deg);
		transition: transform .2s ease, margin .2s ease;
	}

	.gf-menu > li.gf-has-mega.is-mega-open > a {
		color: var(--gf-red);
	}

	.gf-menu > li.gf-has-mega.is-mega-open > a::after {
		margin-top: 3px;
		transform: rotate(-135deg);
	}

	.gf-mega {
		position: absolute;
		top: calc(100% - 6px);
		left: var(--gf-site-pad-l);
		right: var(--gf-site-pad-r);
		z-index: 20;
		opacity: 0;
		visibility: hidden;
		transform: translateY(12px);
		transition: opacity .22s ease, transform .22s ease, visibility .22s;
	}

	.gf-has-mega.is-mega-open > .gf-mega,
	.gf-has-mega:has(:focus-visible) > .gf-mega {
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	.gf-mega__box {
		overflow: hidden;
		background: var(--gf-white);
		border-radius: 16px;
		box-shadow: 0 24px 60px rgb(5 2 47 / 16%), 0 2px 8px rgb(5 2 47 / 6%);
	}

	/* Services: one column per category, navy dividers */
	.gf-mega__cols {
		display: grid;
		grid-template-columns: repeat(var(--gf-mega-cols, 4), minmax(0, 1fr));
		padding: 40px 0;
	}

	.gf-mega__col {
		padding: 0 40px;
	}

	.gf-mega__col + .gf-mega__col {
		border-left: 3px solid var(--gf-navy);
	}

	/* Locations: main locations on the left, sub locations + info on the right */
	.gf-mega__split {
		display: grid;
		grid-template-columns: minmax(280px, 25%) minmax(0, 1fr);
	}

	/* Tabs share the full panel height, so there is no empty space under the last one */
	.gf-mega__tabs {
		display: flex;
		flex-direction: column;
		padding: 0;
		background: #f4f4f8;
		border-right: 1px solid #e6e6ee;
	}

	.gf-mega__tabs > li {
		display: flex;
		flex: 1;
	}

	.gf-mega__tabs > li:last-child .gf-mega__tab {
		border-bottom: 0;
	}

	.gf-menu .gf-mega .gf-mega__tab {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		padding: 20px 26px;
		background: transparent;
		border: 0;
		border-bottom: 1px solid #e6e6ee;
		border-radius: 0;
		font-family: var(--gf-font-alt);
		font-size: 19px;
		font-weight: 500;
		line-height: 1.3;
		text-align: left;
		color: var(--gf-navy);
		cursor: pointer;
		transition: background-color .2s ease, color .2s ease;
	}

	.gf-menu .gf-mega .gf-mega__tab span {
		flex: 1;
		min-width: 0;
		white-space: normal;
		overflow-wrap: anywhere;
	}

	.gf-menu .gf-mega .gf-mega__tab svg {
		flex-shrink: 0;
		transition: transform .2s ease;
	}

	.gf-menu .gf-mega .gf-mega__tab:hover {
		background: #e9e9f2;
	}

	.gf-menu .gf-mega .gf-mega__tab.is-active,
	.gf-menu .gf-mega .gf-mega__tab:focus-visible {
		background: var(--gf-navy);
		color: var(--gf-white);
	}

	.gf-menu .gf-mega .gf-mega__tab.is-active svg {
		transform: translateX(4px);
	}

	/* All panes share one grid cell, so the panel keeps the height of the tallest
	   pane and never jumps when switching tabs. */
	.gf-mega__panes {
		display: grid;
	}

	.gf-mega__pane {
		display: grid;
		grid-area: 1 / 1;
		grid-template-columns: minmax(0, 1fr);
		visibility: hidden;
		opacity: 0;
	}

	/* "inherit", not "visible": a visible child of a closed (hidden) panel would
	   still catch the pointer and open the other mega menu. */
	.gf-mega__pane.is-active {
		visibility: inherit;
		opacity: 1;
		animation: gf-mega-in .3s ease both;
	}

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

	.gf-mega__pane-main {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 28px;
		padding: 32px 40px;
	}

	/* Two columns filled top-to-bottom; every row has the same height in both
	   columns, so the divider lines line up. */
	.gf-mega__grid {
		display: grid;
		grid-auto-flow: column;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: repeat(var(--gf-mega-rows, 3), auto);
		column-gap: 48px;
		width: 100%;
	}

	.gf-mega__grid > li {
		display: flex;
		border-bottom: 1px solid #e3e3ec;
	}

	.gf-menu .gf-mega .gf-mega__link--line {
		flex: 1;
		align-items: center;
		padding: 13px 0;
		font-size: 16px;
	}

	.gf-mega__pane-main .gf-mega__more {
		margin-top: auto;
	}

	.gf-mega__info {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		margin: 32px 0;
		padding: 0 36px;
		border-left: 1px solid #d9d9e3;
	}

	.gf-mega__info-title {
		margin: 0;
		font-family: var(--gf-font-alt);
		font-size: 22px;
		font-weight: 600;
		line-height: 1.2;
		letter-spacing: -.02em;
		color: var(--gf-navy);
	}

	.gf-menu .gf-mega .gf-mega__cta {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 13px 26px;
		background: #e02828;
		border-radius: 100px;
		font-family: var(--gf-font-alt);
		font-size: 16px;
		font-weight: 500;
		line-height: 1.4;
		color: var(--gf-white);
		box-shadow: 0 10px 22px rgb(226 43 43 / 25%);
		transition: background-color .2s ease, transform .2s ease;
	}

	.gf-menu .gf-mega .gf-mega__cta:hover,
	.gf-menu .gf-mega .gf-mega__cta:focus-visible {
		background: var(--gf-red-dark);
		color: var(--gf-white);
		transform: translateY(-1px);
	}

	.gf-mega__info-text {
		margin: 0 0 auto;
		padding-bottom: 20px;
		font-family: var(--gf-font-body);
		font-size: 15px;
		line-height: 1.65;
		color: var(--gf-text);
	}
}

/* Dimmed page behind an open mega menu (element added by header.js) */
.gf-mega-overlay {
	position: fixed;
	inset: 0;
	z-index: 998;
	background: rgb(5 2 47 / 45%);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s;
}

body.gf-mega-active .gf-mega-overlay {
	opacity: 1;
	visibility: visible;
}

@media (max-width: 1199px) {
	.gf-mega-overlay {
		display: none;
	}
}

@media (min-width: 1200px) and (max-width: 1440px) {
	.gf-mega__col {
		padding: 0 26px;
	}

	.gf-mega__heading {
		font-size: 22px;
	}

	.gf-menu .gf-mega .gf-mega__link {
		font-size: 15px;
	}

	.gf-mega__pane-main {
		padding: 28px 30px;
	}

	.gf-mega__grid {
		column-gap: 30px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gf-mega,
	.gf-mega__pane.is-active {
		transition: none;
		animation: none;
	}
}

/* --------------------------------------------------------------------------
   Mobile / tablet: nested accordion inside the slide-down panel
   (tap "Services" → tap a group → its links)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
	.gf-mega {
		display: none;
		padding: 0 0 8px 14px;
	}

	.gf-menu li.is-open > .gf-mega {
		display: block;
	}

	.gf-mega__tabs,
	.gf-mega__info,
	.gf-mega__more,
	.gf-mega__cta,
	.gf-mega__heading {
		display: none !important;
	}

	.gf-mega__pane + .gf-mega__pane {
		border-top: 1px solid #f0f0f4;
	}

	.gf-menu .gf-mega .gf-mega__pane-title {
		position: relative;
		display: flex;
		align-items: center;
		width: 100%;
		min-height: 48px;
		margin: 0;
		padding: 12px 40px 12px 0;
		background: transparent;
		border: 0;
		border-radius: 0;
		font-family: var(--gf-font-alt);
		font-size: 16px;
		font-weight: 500;
		line-height: 1.35;
		letter-spacing: 0;
		text-align: left;
		text-transform: none;
		color: var(--gf-navy);
		cursor: pointer;
	}

	.gf-menu .gf-mega .gf-mega__pane-title:hover,
	.gf-menu .gf-mega .gf-mega__pane-title:focus {
		background: transparent;
		color: var(--gf-red);
	}

	/* + / − sign */
	.gf-mega__pane-title::before,
	.gf-mega__pane-title::after {
		content: "";
		position: absolute;
		top: 50%;
		right: 14px;
		width: 12px;
		height: 2px;
		margin-top: -1px;
		background: currentColor;
		transition: transform .2s ease;
	}

	.gf-mega__pane-title::after {
		transform: rotate(90deg);
	}

	.gf-mega__pane.is-m-open .gf-mega__pane-title::after {
		transform: rotate(0deg);
	}

	.gf-mega__pane .gf-mega__grid {
		display: none;
	}

	.gf-mega__pane.is-m-open .gf-mega__grid {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
		column-gap: 24px;
		padding: 0 0 10px 4px;
	}

	.gf-menu .gf-mega .gf-mega__link {
		gap: 10px;
		padding: 9px 0;
		font-size: 15px;
		line-height: 1.4;
		color: #3a3a4a;
	}
}
