/*
	Navigation: site header, search, portal links and the main menu overlay.
	Loaded site-wide after style.css (see functions.php). Brand tokens live in style.css :root.

	Breakpoints
	  < 768   mobile header, drill-down menu
	  < 992   drill-down menu
	  >= 992  three column menu
	  >= 1200 full size header
*/

/* ---------------------------------------------------------------
   Header bar
--------------------------------------------------------------- */

.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	background: var(--brand-navy);
	color: var(--brand-neutral);
	transition: background-color 300ms, margin 300ms;
}
body.admin-bar .site-header {
	top: 32px;
}
@media (max-width:782px){
	body.admin-bar .site-header {
		top: 46px;
	}
}

/* Inner pages: header is solid, push content below it */
.wrapper {
	padding-top: var(--header-height);
}

/* Old spacer for the absolute header; the wrapper padding replaces it */
#pageHeader {
	display: none;
}

/* Home page: header sits over the banner */
body.home .wrapper {
	padding-top: 0;
}
.site-header--transparent {
	background: transparent;
}

/* Scrolled (any page) and menu open */
.site-header.is-scrolled {
	background: var(--brand-navy);
}
body.menuopen .site-header {
	background: transparent;
}

.site-header__bar {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: start;
	padding: 40px 82px 40px 83px;
	transition: padding 300ms;
}

.site-header__left,
.site-header__right {
	display: flex;
	align-items: center;
	gap: 25px;
}
.site-header__left {
	padding-top: 12px;
}
.site-header__right {
	justify-content: flex-end;
	padding-top: 10px;
}

.site-header__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	line-height: 0;
	transition: opacity 200ms;
}
.site-header__icon:hover,
.site-header__icon:focus-visible {
	opacity: 0.7;
}
.site-header__icon img {
	display: block;
	max-width: none;
}

/* Envelope sits on the right on desktop, and moves left inside the mobile menu */
.site-header__contact--menu {
	display: none;
}

.site-header__logo {
	display: block;
	line-height: 0;
}
.site-header__logo img {
	display: block;
	width: 173px;
	height: auto;
	transition: width 300ms;
}

/* Menu / Close button */
.site-header__menu-toggle {
	position: relative;
	padding: 0 0 8px;
	border: 0;
	background: none;
	color: var(--brand-neutral);
	font-family: var(--font-sans);
	font-weight: 300;
	font-size: 14px;
	line-height: 24px;
	letter-spacing: 1.12px;
	text-transform: uppercase;
	cursor: pointer;
}
.site-header__menu-toggle:after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 0;
	width: 24px;
	height: 1px;
	margin-left: -12px;
	background: var(--brand-neutral);
	transition: width 200ms, margin-left 200ms;
}
.site-header__menu-toggle:hover:after,
.site-header__menu-toggle:focus-visible:after {
	width: 100%;
	margin-left: -50%;
}
.site-header__menu-label--close,
body.menuopen .site-header__menu-label--open {
	display: none;
}
body.menuopen .site-header__menu-label--close {
	display: inline;
}

/* Compact header once scrolled */
.site-header.is-scrolled .site-header__bar {
	padding-top: 15px;
	padding-bottom: 15px;
}
.site-header.is-scrolled .site-header__logo img {
	width: 84px;
}
.site-header.is-scrolled .site-header__left,
.site-header.is-scrolled .site-header__right {
	padding-top: 18px;
}

@media (max-width:1199.98px){
	.site-header__bar {
		padding: 25px 40px;
	}
	.site-header__logo img {
		width: 132px;
	}
}

@media (max-width:767.98px){
	.site-header__bar {
		padding: 15px 27px 15px 32px;
	}
	.site-header__left,
	.site-header__right,
	.site-header.is-scrolled .site-header__left,
	.site-header.is-scrolled .site-header__right {
		padding-top: 15px;
	}
	.site-header__logo img,
	.site-header.is-scrolled .site-header__logo img {
		width: 84px;
	}
	.site-header.is-scrolled .site-header__bar {
		padding-top: 10px;
		padding-bottom: 10px;
	}
	.site-header__right .site-header__contact {
		display: none;
	}
}

/* Mobile/tablet menu open: icons left, close right, no logo (as designed) */
@media (max-width:991.98px){
	body.menuopen .site-header__logo {
		visibility: hidden;
	}
	body.menuopen .site-header__contact--menu {
		display: inline-flex;
	}
	body.menuopen .site-header__right .site-header__contact {
		display: none;
	}
}

/* ---------------------------------------------------------------
   Portal links dropdown (Top Links menu)
--------------------------------------------------------------- */

.site-header__portal {
	position: relative;
	line-height: 0;
}
.site-header__portal-menu {
	position: absolute;
	top: 100%;
	left: -20px;
	margin-top: 15px;
	min-width: 220px;
	padding: 10px 20px;
	background: var(--brand-navy);
	box-shadow: 0 6px 20px rgba(0,0,0,0.25);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-5px);
	transition: opacity 200ms, transform 200ms, visibility 200ms;
	line-height: normal;
}
.site-header__portal.is-open .site-header__portal-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
}
.site-header__portal-menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.site-header__portal-menu a {
	display: block;
	padding: 8px 0;
	color: var(--brand-neutral);
	font-family: var(--font-sans);
	font-weight: 300;
	font-size: 14px;
	line-height: 24px;
	letter-spacing: 1.12px;
	text-transform: uppercase;
}
.site-header__portal-menu a:hover,
.site-header__portal-menu a:focus-visible {
	color: var(--brand-gold);
}

/* ---------------------------------------------------------------
   Search panel
--------------------------------------------------------------- */

.site-search {
	padding: 0 83px 30px;
}
.site-search[hidden] {
	display: none;
}
.site-header--transparent .site-search {
	background: var(--brand-navy);
	padding-top: 30px;
	position: absolute;
	top:-104px;
	left:0;
	width:100%;
}
.site-search .searchform {
	max-width: 600px;
	margin: 0 auto;
	padding-right: 40px;
	color: var(--brand-neutral);
}
.site-search .searchform input.s {
	width: 100%;
	height: 44px;
	padding: 8px 0;
	border: 0;
	border-bottom: 1px solid var(--brand-neutral);
	background: transparent;
	color: var(--brand-neutral);
	font-family: var(--font-sans);
	font-weight: 300;
	font-size: 18px;
}
.site-search .searchform input.s::placeholder {
	color: rgba(246,246,246,0.7);
}
.site-search .searchform input.s:focus {
	outline: 0;
	border-bottom-color: var(--brand-gold);
}
.site-search .searchSubmit {
	top: 8px;
	color: var(--brand-neutral);
}
body.searchOpen .site-header{
	margin-top:104px;
}
@media (max-width:767.98px){
	.site-search {
		padding: 0 27px 20px 32px;
	}
	.site-header--transparent .site-search {
		padding-top: 20px;
	}
}

/* ---------------------------------------------------------------
   Menu overlay
--------------------------------------------------------------- */

.nav-overlay {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: var(--brand-navy);
	overflow-y: auto;
	opacity: 0;
	visibility: hidden;
	transition: opacity 300ms, visibility 300ms;
}
body.menuopen {
	overflow: hidden;
}
body.menuopen .nav-overlay {
	opacity: 1;
	visibility: visible;
}

.nav-overlay__menu,
.nav-overlay__menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.nav-overlay__menu a {
	text-decoration: none;
	vertical-align: top;
}

/* Level 1 */
.nav-overlay__menu > li > a {
	display: inline-block;
	color: var(--brand-neutral);
	font-family: var(--font-serif);
	font-weight: 400;
	font-size: 32px;
	line-height: 50px;
	transition: color 200ms;
	padding-bottom: 0px;
}
.nav-overlay__menu > li > a:hover,
.nav-overlay__menu > li > a:focus-visible,
.nav-overlay__menu > li.is-active > a {
	color: var(--brand-gold);
}

/* Levels 2 and 3 */
.nav-overlay__menu .sub-menu a {
	position: relative;
	display: inline-block;
	padding-bottom: 6px;
	color: var(--brand-neutral);
	font-family: var(--font-sans);
	font-weight: 300;
	font-size: 14px;
	line-height: 24px;
	letter-spacing: 1.12px;
	text-transform: uppercase;
}
.nav-overlay__menu .sub-menu a:after {
	content: '';
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 1px;
	background: var(--brand-neutral);
	transition: width 200ms;
}
.nav-overlay__menu .sub-menu a:hover:after,
.nav-overlay__menu .sub-menu a:focus-visible:after,
.nav-overlay__menu .sub-menu li.is-active > a:after,
.nav-overlay__menu .sub-menu li.current-menu-item > a:after {
	width: 24px;
}
.nav-overlay__menu .sub-menu > li + li {
	margin-top: 12px;
}

/* Chevron on level 2 items that have children */
.nav-overlay__menu li.menu-item-has-children > a {
	padding-right:calc(1em + 8px);
	position: relative;
}
.nav-overlay__menu li.menu-item-has-children > a:before {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
    transform: translateY(calc(-50% - 1px));
    width: calc(8px + 0.5em);
    height: calc(8px + 0.5em);
	background-color: currentColor;
	mask: url(../images/2026/icon-chevron-right.svg) center / 100% 100% no-repeat;
}

.nav-overlay__menu .sub-menu li.menu-item-has-children > a:before {
    transform: translateY(calc(-50% - 3px));
}
/* Each sub menu starts with a link to its parent page (nav.js); the back button is drill-down only */
.nav-overlay__menu .nav-back {
	display: none;
}
@media (min-width:992px){
	.nav-overlay__menu .sub-menu > li.nav-back + li {
		margin-top: 0;
	}
}

/* Desktop: three columns */
@media (min-width:992px){

	.nav-overlay__inner {
		position: relative;
		/* top space scales with screen height so the 9-item menu (546px) always fits */
		padding: clamp(150px, calc(100vh - 590px), 260px) 0 80px 13.4%;
		min-height: 100%;
	}

	.nav-overlay__menu > li + li {
		margin-top: 12px;
	}

	/* only the words trigger a column, not the whole row */
	.nav-overlay__menu li {
		width: fit-content;
	}

	/* li are static so sub menus position against .nav-overlay__inner */
	.nav-overlay__menu li {
		position: static;
	}

	.nav-overlay__menu .sub-menu {
		position: absolute;
		top: calc(clamp(150px, calc(100vh - 590px), 260px) + 13px); /* first sub item lines up with the top-level menu */
		opacity: 0;
		visibility: hidden;
		transition: opacity 200ms, visibility 200ms, transform 200ms;
		transform:translateX(15%);
	}
	/* columns at 743px and 1040px of the 1560px design */
	.nav-overlay__menu > li > .sub-menu {
		left: 47.6%;
		width: 19.1%;
	}
	/* level 3 positions against the (absolute) level 2 list */
	.nav-overlay__menu .sub-menu .sub-menu {
		top: 0;
		left: 100%;
		width: 140%;
	}
	.nav-overlay__menu li.is-active > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform:translateX(0%);
	}
}

@media (min-width:992px) and (max-width:1399.98px){
	.nav-overlay__inner {
		padding-top: clamp(150px, calc(100vh - 590px), 260px);
	}
	.nav-overlay__menu .sub-menu {
		top: calc(clamp(150px, calc(100vh - 590px), 260px) + 13px); /* first sub item lines up with the top-level menu */
	}
	.nav-overlay__menu > li > a {
		font-size: 32px;
		line-height: 40px;
	}
	.nav-overlay__menu > li + li {
		margin-top: 18px;
	}
}

/* Mobile/tablet: drill-down panels */
@media (max-width:991.98px){

	.nav-overlay__inner {
		position: relative;
		margin-top: 104px;
		padding: 0 32px 60px;
		min-height: calc(100% - 104px);
	}
	.nav-overlay__menu {
		padding-top: 92px;
	}
	.nav-overlay__menu > li + li {
		margin-top: 15px;
	}
	.nav-overlay__menu > li > a {
		font-size: 26.44px;
		line-height: 31.48px;
	}

	.nav-overlay__menu li {
		position: static;
	}

	.nav-overlay__menu .sub-menu {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		min-height: 100%;
		padding: 0 32px 60px;
		background: var(--brand-navy);
		transform: translateX(100%);
		visibility: hidden;
		transition: transform 300ms, visibility 300ms;
	}
	.nav-overlay__menu li.is-open > .sub-menu {
		transform: none;
		visibility: visible;
	}

	.nav-overlay__menu .nav-parent-link,
	.nav-overlay__menu .nav-back {
		display: block;
	}

	/* Back sits at the top of the panel, list starts 44px below */
	.nav-overlay__menu .sub-menu > li.nav-back {
		margin-bottom: 44px;
		margin-left: -6px;
	}
	.nav-overlay__menu .sub-menu > li.nav-back + li {
		margin-top: 0;
	}
	.nav-back button {
		position: relative;
		padding: 0 6px 8px;
		border: 0;
		background: none;
		color: var(--brand-neutral);
		font-family: var(--font-sans);
		font-weight: 300;
		font-size: 14px;
		line-height: 24px;
		letter-spacing: 1.12px;
		text-transform: uppercase;
		cursor: pointer;
	}
	.nav-back button:after {
		content: '';
		position: absolute;
		left: 6px;
		bottom: 0;
		width: 24px;
		height: 1px;
		background: var(--brand-neutral);
	}
}

/* header bar sits above the menu overlay: let clicks reach the menu overlay through its empty areas */
.site-header {
	pointer-events: none;
}
.site-header__left,
.site-header__logo,
.site-header__right,
.site-search {
	pointer-events: auto;
}

/* mobile: hide the first level while a submenu is open (links are position:relative so they painted over it) */
@media (max-width:991.98px){
	.nav-overlay__menu .sub-menu {
		z-index: 2;
	}
	.nav-overlay__menu:has(> li.is-open) > li:not(.is-open),
	.nav-overlay__menu > li.is-open > a {
		visibility: hidden;
	}
}

/* Short desktop screens: stop the open menu overlapping the logo */
@media (min-width: 992px) and (max-height: 820px) {
	body.menuopen .site-header__bar { padding-top: 15px; padding-bottom: 15px; }
	body.menuopen .site-header__logo img { width: 84px; }
	.nav-overlay__menu > li > a { font-size: 26px; line-height: 40px; }
	.nav-overlay__menu > li + li { margin-top: 6px; }
}
