/*
 * Header menus (inc/menus.php). Matches the old Max Mega Menu theme:
 * navy lowercase links, cream full-width panels, cream mobile overlay.
 */

/* Panels and the mobile menu are positioned against the header bar. */
header.wp-block-template-part > .wp-block-group:first-child {
	position: relative;
	z-index: 999;
}

header.wp-block-template-part > .wp-block-group:first-child .wp-block-group:has(.od-nav) {
	position: static;
}

.od-nav {
	font-family: "founders-grotesk", sans-serif;
	line-height: 1.7;
}

.od-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.od-nav a {
	color: var(--od-navy, #142591);
	text-decoration: none;
}

.od-nav :focus:not(:focus-visible) {
	outline: none;
}

.od-nav button {
	font: inherit;
	color: var(--od-navy, #142591);
	background: none;
	border: 0;
	cursor: pointer;
}

.od-nav .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.od-nav .od-nav__menu {
	display: flex;
	align-items: center;
	padding: 0 20px;
}

.od-nav__link {
	display: flex;
	align-items: center;
	height: 95px;
	padding: 0 10px;
	font-size: 22px;
	text-transform: lowercase;
}

.od-nav__link:hover,
.od-nav__item.is-open > .od-nav__link {
	text-decoration: underline;
}

.od-nav__item.profile > .od-nav__link {
	text-decoration: none;
}

.od-nav__link svg {
	display: block;
}

/* Items with a panel or dropdown: the link goes to its page, the arrow button opens the menu. */
.od-nav__item.has-panel,
.od-nav__item.has-flyout {
	display: flex;
	align-items: center;
}

.od-nav__item.has-panel > .od-nav__link,
.od-nav__item.has-flyout > .od-nav__link {
	padding-right: 4px;
}

.od-nav .od-nav__expand {
	width: 32px;
	height: 95px;
	margin-right: 2px;
	padding: 0;
}

.od-nav .od-nav__expand:hover {
	color: #4a5bc4;
}

.od-nav__expand::before {
	content: "";
	display: block;
	width: 8px;
	height: 8px;
	margin: -4px auto 0;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s;
}

.od-nav__item.is-open > .od-nav__expand::before {
	margin-top: 4px;
	transform: rotate(-135deg);
}

.od-nav__toggle {
	display: none;
}

/* Mega panel */
.od-panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	padding-bottom: 40px;
	background: var(--od-cream, #fff8ef) url(../images/menu-panel-bg.png) no-repeat bottom right;
	text-align: left;
}

.od-panel__inner {
	max-width: var(--wp--style--global--wide-size, 1280px);
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: border-box;
}

.od-panel__heading {
	display: inline-block;
	padding: 15px 45px 15px 15px;
}

.od-panel .menu-heading {
	margin: 0 !important;
	font-size: 3rem !important;
	text-transform: lowercase;
}

.od-panel__cols {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.od-panel__col {
	padding: 5px 15px;
}

.od-panel .blue-line {
	height: 1px;
	margin: 15px 30px 15px 0;
	border: 0;
	background: var(--od-navy, #142591);
	color: var(--od-navy, #142591);
}

.od-panel__title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 30px 20px 0;
	font-size: 22px;
}

.od-panel__title svg {
	flex: none;
	position: relative;
	top: 2px;
}

.od-panel__link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 2px 0;
	font-size: 17px;
	color: #333132 !important;
}

.od-panel__link:hover {
	color: #666 !important;
	text-decoration: underline;
}

.od-panel__plus {
	flex: none;
	color: var(--od-navy, #142591);
}

/* Profile dropdown */
.od-nav__item.has-flyout {
	position: relative;
}

.od-flyout {
	display: none;
	position: absolute;
	top: 100%;
	right: 0;
	width: 250px;
	background: var(--od-cream, #fff8ef);
}

.od-flyout__link {
	display: block;
	padding: 10px 5px;
	font-size: 16px;
	text-align: center;
	background: var(--od-cream, #fff8ef);
}

.od-flyout__link:hover {
	text-decoration: underline;
}

/* Open state: set on click (js/menu.js). */
.od-nav__item.is-open > .od-panel,
.od-nav__item.is-open > .od-flyout {
	display: block;
}

/* Search box added to the members menu for phones (functions.php). */
.od-nav #search-box-mobile {
	display: none;
}

/* Mobile: hamburger, cream overlay, sub-menus open below their item. */
@media (max-width: 767px) {
	.od-nav__toggle {
		display: block;
		position: relative;
		width: 44px;
		height: 44px;
		padding: 0;
	}

	.od-nav__bars,
	.od-nav__bars::before,
	.od-nav__bars::after {
		position: absolute;
		left: 8px;
		width: 28px;
		height: 3px;
		border-radius: 2px;
		background: var(--od-navy, #142591);
		transition: transform 0.2s;
	}

	.od-nav__bars {
		top: 20px;
	}

	.od-nav__bars::before,
	.od-nav__bars::after {
		content: "";
		left: 0;
	}

	.od-nav__bars::before {
		top: -8px;
	}

	.od-nav__bars::after {
		top: 8px;
	}

	.od-nav.is-open .od-nav__bars {
		background: transparent;
	}

	.od-nav.is-open .od-nav__bars::before {
		transform: translateY(8px) rotate(45deg);
	}

	.od-nav.is-open .od-nav__bars::after {
		transform: translateY(-8px) rotate(-45deg);
	}

	.od-nav .od-nav__menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		max-height: calc(100vh - 100px);
		overflow-y: auto;
		padding: 20px;
		background: var(--od-cream, #fff8ef);
		box-sizing: border-box;
	}

	.od-nav.is-open .od-nav__menu {
		display: flex;
	}

	.od-nav__item,
	.od-nav__item.has-panel,
	.od-nav__item.has-flyout {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.od-nav__item.has-panel > .od-nav__link {
		padding-right: 0;
	}

	.od-nav__link {
		flex: 1;
		height: 60px;
		padding: 0;
		font-size: 24px;
	}

	.od-nav .od-nav__expand {
		width: 44px;
		height: 60px;
		margin-right: 0;
	}

	.od-nav__expand::before {
		width: 10px;
		height: 10px;
	}

	.od-panel,
	.od-flyout {
		position: static;
		flex-basis: 100%;
		width: auto;
		padding-bottom: 10px;
		background-image: none;
	}

	.od-panel__inner {
		padding: 0;
	}

	.od-panel__heading {
		display: none;
	}

	.od-panel__cols {
		grid-template-columns: 1fr;
	}

	.od-panel__col {
		padding: 0;
	}

	.od-panel .blue-line {
		margin: 10px 0;
	}

	.od-panel__title {
		margin: 0 0 6px;
	}

	/* Tap targets of at least 44px. */
	.od-panel__title,
	.od-panel__link,
	.od-flyout__link {
		min-height: 44px;
		box-sizing: border-box;
	}

	.od-flyout__link {
		display: flex;
		align-items: center;
		text-align: left;
	}

	/* The cookie banner would cover the open menu; it comes back when the menu closes. */
	/* The plugin forces display and visibility with !important. */
	html.od-nav-open #cc_div #cm {
		visibility: hidden !important;
		opacity: 0 !important;
		pointer-events: none;
	}

	/* The profile icon is pointless as a heading in the list: show its links directly. */
	.od-nav__item.profile > .od-nav__link,
	.od-nav__item.profile > .od-nav__expand {
		display: none;
	}

	.od-nav__item.profile > .od-flyout {
		display: block;
		padding: 10px 0 0;
	}

	.od-nav #search-box-mobile {
		display: block;
		order: 90;
		padding-top: 15px;
	}
}
