/**
 * Athena - Navigation (SHARED: identical in Athena, AthenaCalm, AthenaEnergetic)
 *
 * Styles the markup produced by core's menu_bs5.cfm: split dropdowns, where the parent label
 * is a link and a separate toggle opens its dropdown. Structure follows Keystone; the look
 * follows the Athena handoff (section 5.3, comps nav-desktop.html / nav-mobile.html).
 *
 * Menu panel (the DEFAULT layout: below 992px, or at 992px+ when theme.js adds .is-compact
 * because the row does not fit): the menu button opens a full-height white panel under the
 * main bar. Search at the top; 54px rows in the heading font with hairline dividers; a section
 * with children gets a 44px chevron toggle that expands its pages (level 2 indented with a 2px
 * soft-primary rule, level 3 muted). Below the list: the quiet header button (full width),
 * account links and the social icons.
 *
 * Desktop (992px+, not compact): one row right of the logo, 16px/500, 28px gaps (20px with a
 * long organization name). The current section is underlined in the primary ink. Level 2 is a
 * dropdown panel (white, radius 14, soft shadow, a 4px primary bar on top); level 3 opens as a
 * flyout to the side. Panels open on hover, and on click / keyboard via the chevron (theme.js
 * handles level 3 so a click does not close level 2).
 */

@charset "UTF-8";

/* Bootstrap's .navbar class is kept only so dropdowns skip Popper positioning; its layout is
   reset. position: static lets the menu panel position against the main bar. */
.at-nav.navbar {
	position: static;
	display: block;
	padding: 0;
	background: transparent;
	box-shadow: none;
	border: 0;
	height: auto !important;
	flex-wrap: nowrap;
}
.at-nav .at-nav__list { margin: 0; padding: 0; list-style: none; }
.at-nav .dropdown-menu > li { list-style: none; }

/* Chevron toggles (menu_bs5 prints them as <a role="button">): drawn as a mask so they take
   the text colour; Bootstrap's caret is replaced */
.at-nav .dropdown-toggle-split::after {
	content: "";
	display: block;
	width: 12px;
	height: 12px;
	margin: 0;
	border: 0;
	background-color: currentColor;
	-webkit-mask: var(--i-chevron-down) center / contain no-repeat;
	        mask: var(--i-chevron-down) center / contain no-repeat;
	transition: transform .15s ease;
}
.at-nav .dropdown-toggle-split[aria-expanded="true"]::after { transform: rotate(180deg); }

/* ========================================
   Menu panel (default)
   ======================================== */
.at-menu {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1020;
	/* Full height below the bar; scrolls inside */
	height: calc(100vh - var(--at-header-bottom, 120px));
	height: calc(100dvh - var(--at-header-bottom, 120px));
	overflow-y: auto;
	overscroll-behavior: contain;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: #fff;
	box-shadow: 0 24px 40px -28px rgb(0 0 0 / .45);
}
.at-nav .at-menu > * {
	max-width: var(--container);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--gutter);
	padding-right: var(--gutter);
}
.at-menu__search { padding-top: 16px; }
.at-menu__search:empty { display: none; }
.at-nav .at-nav__list { display: flex; flex-direction: column; margin-top: 20px; }
.at-nav .at-nav__list > .nav-item {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	border-top: 1px solid var(--line);
}
.at-nav .at-nav__list > .nav-item:last-child { border-bottom: 1px solid var(--line); }
.at-nav .at-nav__list > .nav-item > .nav-link:not(.dropdown-toggle-split) {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	min-height: 54px;
	padding: 6px 0;
	color: var(--ink);
	font-family: var(--font-head);
	font-size: 21px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
}
.at-nav .at-nav__list > .nav-item > .nav-link:not(.dropdown-toggle-split):hover,
.at-nav .at-nav__list > .nav-item > .nav-link.active:not(.dropdown-toggle-split) { color: var(--primary-ink); }

/* 44px chevron toggle; opens the pages beneath (Bootstrap's dropdown toggles .show) */
.at-nav .dropdown-toggle-split {
	flex: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-right: -10px;
	padding: 0;
	border-radius: var(--r-control);
	color: var(--ink);
}
.at-nav .dropdown-toggle-split:hover { background: var(--band); }
.at-nav .dropdown-toggle-split[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary-deep); }
.at-nav .nav-item:has(> .dropdown-toggle-split[aria-expanded="true"]) > .nav-link:not(.dropdown-toggle-split) { color: var(--primary-ink); }

.at-nav .at-nav__list .dropdown-menu {
	position: static !important;
	flex: 0 0 100%;
	float: none;
	min-width: 0;
	margin: 0 0 12px;
	padding: 0 0 0 14px;
	border: 0;
	border-left: 2px solid var(--primary-soft);
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	transform: none !important;
	inset: auto !important;
}
.at-nav .at-nav__list .dropdown-menu .dropdown-menu { margin: 0 0 6px; padding-left: 16px; border-left: 0; }
.at-nav .dropend { position: relative; display: flex; flex-wrap: wrap; align-items: center; }
.at-nav .dropdown-item {
	display: flex;
	flex: 1 1 0;
	align-items: center;
	min-height: 44px;
	padding: 6px 0 6px 8px;
	background: transparent;
	color: var(--ink);
	font-size: 17px;
	line-height: 1.35;
	white-space: normal;
}
.at-nav .dropdown-menu .dropdown-menu .dropdown-item { color: var(--muted); font-size: 16px; }
.at-nav .dropdown-item:hover,
.at-nav .dropdown-item:focus-visible { background: transparent; color: var(--primary-ink); }
.at-nav .dropdown-item.active,
.at-nav .dropdown-item:active { background: transparent; color: var(--primary-deep); font-weight: 600; }
.at-nav .dropend > .dropdown-toggle-split.dropdown-item { flex: none; padding: 0; }

/* Panel extras: the quiet header button (full width), account links, social circles */
.at-menu__extra {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding-top: 20px;
	padding-bottom: 32px;
}
.at-menu__quiet a { width: 100%; }
.at-menu__quiet p { margin: 0; }
.at-menu__account { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 16px; }
.at-menu__account a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); }
.at-menu__account a:hover { color: var(--primary-ink); }
.at-menu__social ul { gap: 8px; }
.at-menu__social a { width: 44px; height: 44px; border: 1px solid var(--line); color: var(--ink); }
.at-menu__social a:hover { border-color: var(--primary-ink); color: var(--primary-ink); }
.at-menu__social a i { font-size: 16px; }

/* Open: lock the page behind the panel (theme.js sets the class) */
html.at-menu-open { overflow: hidden; }

/* ========================================
   Desktop (992px+, not compact)
   ======================================== */
@media (min-width: 992px) {
	.at-mainbar:not(.is-compact) .at-nav { margin-left: auto; }
	.at-mainbar:not(.is-compact) .at-menu {
		position: static;
		display: block !important;   /* beats Bootstrap's .collapse:not(.show) */
		height: auto !important;
		max-height: none;
		overflow: visible;
		border: 0;
		background: transparent;
		box-shadow: none;
	}
	.at-mainbar:not(.is-compact) .at-menu > * { max-width: none; margin: 0; padding: 0; }
	.at-mainbar:not(.is-compact) :is(.at-menu__extra, .at-menu__search) { display: none; }

	.at-mainbar:not(.is-compact) .at-nav__list {
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 28px;
		margin: 0;
	}
	.at-mainbar.is-long:not(.is-compact) .at-nav__list { gap: 20px; }
	.at-mainbar:not(.is-compact) .at-nav__list > .nav-item { flex-wrap: nowrap; border: 0; }
	.at-mainbar:not(.is-compact) .at-nav__list > .nav-item:last-child { border: 0; }
	.at-mainbar:not(.is-compact) .at-nav__list > .nav-item > .nav-link:not(.dropdown-toggle-split) {
		flex: none;
		min-height: 0;
		padding: 8px 0;
		font-family: var(--font-body);
		font-size: 16px;
		font-weight: 500;
		line-height: 1.3;
		white-space: nowrap;
	}
	/* Current section: underlined in the primary ink */
	.at-mainbar:not(.is-compact) .at-nav__list > .nav-item > .nav-link.active:not(.dropdown-toggle-split) {
		color: var(--primary-ink);
		box-shadow: inset 0 -2px 0 var(--primary-ink);
	}

	/* Split parent: label + a small chevron button, close together */
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown > .dropdown-toggle-split {
		width: 28px;
		height: 36px;
		margin: 0 0 0 -2px;
		border-radius: 6px;
		background: transparent;
		color: var(--ink);
	}
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown:is(:hover, :focus-within) > :is(.nav-link, .dropdown-toggle-split) { color: var(--primary-ink); }

	/* Level 2: dropdown panel */
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown > .dropdown-menu {
		position: absolute !important;
		top: calc(100% + 18px) !important;
		left: -18px !important;
		right: auto !important;
		display: none;
		min-width: 280px;
		max-width: 360px;
		margin: 0;
		padding: 8px;
		border: 1px solid var(--line);
		border-radius: 14px;
		background: #fff;
		box-shadow: var(--shadow-dropdown);
	}
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown > .dropdown-menu::before {
		content: "";
		position: absolute;
		top: -6px;
		left: 0;
		right: 0;
		height: 4px;
		border-radius: 14px 14px 0 0;
		background: var(--brand-primary);
	}
	/* A hover bridge over the gap, so the panel does not close on the way down */
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown > .dropdown-menu::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		top: -24px;
		height: 18px;
	}
	/* The last items open leftwards so the panel stays on screen */
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown:nth-last-child(-n+2) > .dropdown-menu { left: auto !important; right: -18px !important; }
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown:is(:hover, :focus-within) > .dropdown-menu,
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown > .dropdown-menu.show { display: block; }
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown:is(:hover, :focus-within) > .dropdown-toggle-split::after { transform: rotate(180deg); }

	.at-mainbar:not(.is-compact) .at-nav .dropdown-item {
		min-height: 44px;
		padding: 10px 14px;
		border-radius: var(--r-control);
		color: var(--ink);
		font-size: 16px;
		font-weight: 400;
		line-height: 1.3;
	}
	.at-mainbar:not(.is-compact) .at-nav .dropdown-item:hover,
	.at-mainbar:not(.is-compact) .at-nav .dropdown-item:focus-visible { background: var(--band); color: var(--primary-ink); }
	.at-mainbar:not(.is-compact) .at-nav .dropdown-item.active { background: transparent; color: var(--primary-deep); font-weight: 600; }
	.at-mainbar:not(.is-compact) .at-nav .dropdown-item:focus-visible { outline-offset: -3px; }

	/* Level 3: a flyout beside its parent item */
	.at-mainbar:not(.is-compact) .at-nav .dropend { position: relative; flex-wrap: nowrap; border-radius: var(--r-control); }
	.at-mainbar:not(.is-compact) .at-nav .dropend:is(:hover, :focus-within) { background: var(--band); }
	.at-mainbar:not(.is-compact) .at-nav .dropend:is(:hover, :focus-within) > .dropdown-item { color: var(--primary-ink); }
	.at-mainbar:not(.is-compact) .at-nav .dropend > .dropdown-toggle-split {
		width: 36px;
		height: 44px;
		margin: 0;
		padding: 0;
		border-radius: var(--r-control);
		background: transparent;
	}
	.at-mainbar:not(.is-compact) .at-nav .dropend > .dropdown-toggle-split::after {
		-webkit-mask-image: var(--i-chevron-right);
		        mask-image: var(--i-chevron-right);
		transform: none;
	}
	.at-mainbar:not(.is-compact) .at-nav .dropend > .dropdown-menu {
		position: absolute !important;
		top: -9px !important;
		left: calc(100% + 6px) !important;
		right: auto !important;
		display: none;
		min-width: 240px;
		max-width: 320px;
		margin: 0;
		padding: 8px;
		border: 1px solid var(--line);
		border-radius: 14px;
		background: #fff;
		box-shadow: var(--shadow-dropdown);
	}
	.at-mainbar:not(.is-compact) .at-nav .dropend > .dropdown-menu::before {
		content: "";
		position: absolute;
		top: 0;
		bottom: 0;
		left: -10px;
		width: 10px;
	}
	.at-mainbar:not(.is-compact) .at-nav .dropend:is(:hover, :focus-within) > .dropdown-menu,
	.at-mainbar:not(.is-compact) .at-nav .dropend > .dropdown-menu.show { display: block; }
	/* Near the right edge the flyout opens to the left */
	.at-mainbar:not(.is-compact) .at-nav__list > .dropdown:nth-last-child(-n+2) .dropend > .dropdown-menu { left: auto !important; right: calc(100% + 6px) !important; }
}
