/* Site header, scoped under .mf-header. One 80px row at every width. */

/* Fixed, not sticky: the theme's Elementor container is overflow-clipped and
   would clip a sticky header. .mf-header__spacer reserves the 80px. */
/* On :root so other subtrees (archive filter bar) can offset against the fixed header. */
:root {
	--mf-header-h: 80px;
}

.mf-header {
	--mf-header-h: 80px;

	font-family: var(--mf-font);
	background: var(--mf-white);
	border-bottom: 1px solid var(--mf-line);

	position: fixed;
	/* Clears the WP admin bar (see --mf-admin-bar-h in brand.css). */
	top: var(--mf-admin-bar-h, 0px);
	left: 0;
	right: 0;
	width: 100%;
	z-index: 1000;
	transition: transform 0.3s ease;
	will-change: transform;

	/* neutralise any card styling inherited from the theme wrapper */
	border-radius: 0;
	box-shadow: none;
}

.mf-header__spacer {
	height: var(--mf-header-h, 80px);
}

/* The 1px border sits inside the 80px box, so translating the full height clears it. */
.mf-header.is-hidden {
	transform: translateY(-100%);
}

/* Never hide the header while the mobile menu is open. */
.mf-header.is-menu-open.is-hidden {
	transform: none;
}

.mf-header *,
.mf-header *::before,
.mf-header *::after {
	box-sizing: border-box;
}

/* Theme may wrap the logo in a white rounded card that overhangs the bar. */
.mf-header__brand > *,
.mf-header__brand figure,
.mf-header__brand span,
.mf-header__brand div {
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	max-height: 100%;
	line-height: 0;
}

.mf-header__inner {
	max-width: var(--mf-maxw);
	height: var(--mf-header-h);
	margin: 0 auto;
	padding: 0 28px;
	display: flex;
	align-items: center;
	gap: 26px;
	/* one row, never wraps */
	flex-wrap: nowrap;
}

/* brand / logo */

.mf-header__brand,
.mf-header__brand:hover,
.mf-header__brand:focus,
.mf-header__brand:active {
	display: inline-flex;
	align-items: center;
	flex: none;
	max-height: 100%;
	text-decoration: none !important;
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

.mf-header__logo {
	display: block;
	/* smaller, with clear air above/below inside the 80px bar */
	height: 34px;
	width: auto;
	max-width: 100%;
	max-height: calc(var(--mf-header-h) - 32px);
	object-fit: contain;
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* desktop nav (centre) */

.mf-header__nav {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	justify-content: center;
}

.mf-header__menu {
	display: flex;
	align-items: center;
	gap: clamp(18px, 2.8vw, 42px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mf-header__item {
	margin: 0;
}

.mf-header__link,
.mf-header__link:link,
.mf-header__link:visited,
.mf-header__link:hover,
.mf-header__link:focus,
.mf-header__link:active {
	display: inline-block;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none !important;
	color: var(--mf-navy) !important;
	background: transparent !important;
	padding: 6px 2px;
	border: none !important;
	box-shadow: none !important;
	transition: color 0.18s ease;
}

.mf-header__link:hover,
.mf-header__link:focus-visible {
	color: var(--mf-blue) !important;
}

/* subtle underline for the active page */
.mf-header__link.is-current {
	color: var(--mf-blue) !important;
	position: relative;
}

.mf-header__link.is-current::after {
	content: "";
	position: absolute;
	left: 2px;
	right: 2px;
	bottom: -4px;
	height: 2px;
	border-radius: 2px;
	background: var(--mf-blue);
}

.mf-header__link:focus-visible {
	outline: 2px solid var(--mf-blue);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Coach portaal pill, pushed to the right edge of the nav. */
.mf-header__item--login {
	margin-left: auto;
}

.mf-header__link--login,
.mf-header__link--login:link,
.mf-header__link--login:visited,
.mf-header__link--login:hover,
.mf-header__link--login:focus,
.mf-header__link--login:active {
	color: var(--mf-white) !important;
	background: var(--mf-blue) !important;
	padding: 10px 20px;
	border-radius: 999px;
	transition: background 0.18s ease, transform 0.15s ease;
}

.mf-header__link--login:hover,
.mf-header__link--login:focus-visible {
	color: var(--mf-white) !important;
	background: var(--mf-dark-blue) !important;
	transform: translateY(-1px);
}

/* the login item never gets the "current page" underline */
.mf-header__link--login.is-current::after {
	display: none;
}

/* hamburger (mobile only) */

.mf-header__burger,
.mf-header__burger:hover,
.mf-header__burger:focus,
.mf-header__burger:active {
	display: none;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 48px;
	height: 48px;
	margin-left: auto;
	padding: 0;
	/* a distinct white chip with rounded edges */
	border: 1.5px solid var(--mf-line) !important;
	background: var(--mf-white) !important;
	box-shadow: var(--mf-shadow) !important;
	border-radius: 14px;
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease;
}

.mf-header__burger:hover,
.mf-header__burger:focus-visible {
	background: var(--mf-light-blue) !important;
	border-color: var(--mf-blue) !important;
}

.mf-header__burger-box {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 22px;
	height: 22px;
}

.mf-header__burger-line {
	display: block;
	width: 22px;
	/* bolder bars */
	height: 3px;
	border-radius: 2px;
	background: var(--mf-navy);
	transition: transform 0.25s ease, opacity 0.2s ease;
}

/* animate to an X when open (offset = line height 3px + gap 5px = 8px) */
.mf-header__burger[aria-expanded="true"] .mf-header__burger-line:nth-child(1) {
	transform: translateY(8px) rotate(45deg);
}

.mf-header__burger[aria-expanded="true"] .mf-header__burger-line:nth-child(2) {
	opacity: 0;
}

.mf-header__burger[aria-expanded="true"] .mf-header__burger-line:nth-child(3) {
	transform: translateY(-8px) rotate(-45deg);
}

/* mobile drawer (slides in from the right) */

.mf-header__backdrop {
	position: fixed;
	inset: 0;
	z-index: 1001;
	background: rgba(10, 43, 84, 0.5); /* --mf-dark-blue @ 50% */
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.mf-header__backdrop[hidden] {
	display: none;
}

.mf-header__backdrop.is-open {
	opacity: 1;
}

.mf-header__drawer {
	position: fixed;
	/* Clear the admin bar (z-index 99999) or the close button hides under it;
	   shrink the height too, or the login button falls below the fold. */
	top: var(--mf-admin-bar-h, 0px);
	right: 0;
	bottom: 0;
	z-index: 1002;
	width: min(78vw, 300px);
	height: calc(100dvh - var(--mf-admin-bar-h, 0px));
	display: flex;
	flex-direction: column;
	background: var(--mf-white);
	box-shadow: var(--mf-shadow-float);
	transform: translateX(100%);
	transition: transform 0.3s ease;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.mf-header__drawer[hidden] {
	display: none;
}

.mf-header__drawer.is-open {
	transform: translateX(0);
}

/* drawer header: eyebrow label + close (X) */

.mf-header__drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: none;
	padding: 22px 22px 14px;
}

.mf-header__drawer-eyebrow {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--mf-sky-3);
}

.mf-header__drawer-close,
.mf-header__drawer-close:hover,
.mf-header__drawer-close:focus,
.mf-header__drawer-close:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1.5px solid var(--mf-line) !important;
	background: var(--mf-white) !important;
	box-shadow: none !important;
	border-radius: 12px;
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease;
}

.mf-header__drawer-close:hover,
.mf-header__drawer-close:focus-visible {
	background: var(--mf-light-blue) !important;
	border-color: var(--mf-blue) !important;
}

.mf-header__drawer-close:focus-visible {
	outline: 2px solid var(--mf-blue);
	outline-offset: 2px;
}

.mf-header__drawer-close-box {
	position: relative;
	display: inline-block;
	width: 20px;
	height: 20px;
}

.mf-header__drawer-close-line {
	position: absolute;
	top: 50%;
	left: 0;
	width: 20px;
	height: 3px;
	border-radius: 2px;
	background: var(--mf-navy);
}

.mf-header__drawer-close-line:nth-child(1) {
	transform: translateY(-50%) rotate(45deg);
}

.mf-header__drawer-close-line:nth-child(2) {
	transform: translateY(-50%) rotate(-45deg);
}

/* drawer nav: large tappable rows with a nudging chevron */

.mf-header__drawer-nav {
	/* Hug the links so the login pill sits right beneath them, not at the panel bottom. */
	flex: 0 0 auto;
	padding: 6px 12px;
}

.mf-header__drawer-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mf-header__drawer-menu li + li {
	border-top: 1px solid var(--mf-line);
}

.mf-header__drawer-link,
.mf-header__drawer-link:link,
.mf-header__drawer-link:visited,
.mf-header__drawer-link:hover,
.mf-header__drawer-link:focus,
.mf-header__drawer-link:active {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	color: var(--mf-navy) !important;
	background: transparent !important;
	padding: 16px 10px;
	border-radius: 12px;
	transition: color 0.18s ease, background 0.18s ease;
}

.mf-header__drawer-link:hover,
.mf-header__drawer-link:focus-visible {
	color: var(--mf-blue) !important;
	background: var(--mf-light-blue) !important;
}

.mf-header__drawer-link.is-current {
	color: var(--mf-blue) !important;
}

.mf-header__drawer-link:focus-visible {
	outline: 2px solid var(--mf-blue);
	outline-offset: 2px;
}

.mf-header__drawer-arrow {
	flex: none;
	font-size: 18px;
	color: var(--mf-sky-3);
	transform: translateX(-2px);
	opacity: 0;
	transition: transform 0.18s ease, opacity 0.18s ease;
}

.mf-header__drawer-link:hover .mf-header__drawer-arrow,
.mf-header__drawer-link:focus-visible .mf-header__drawer-arrow,
.mf-header__drawer-link.is-current .mf-header__drawer-arrow {
	opacity: 1;
	transform: translateX(0);
	color: var(--mf-blue);
}

/* drawer footer: coach login as a full-width pill */

.mf-header__drawer-foot {
	flex: none;
	margin-top: 6px;
	padding: 16px 22px calc(22px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--mf-line);
}

.mf-header__drawer-login,
.mf-header__drawer-login:link,
.mf-header__drawer-login:visited,
.mf-header__drawer-login:hover,
.mf-header__drawer-login:focus,
.mf-header__drawer-login:active {
	display: block;
	text-align: center;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	color: var(--mf-white) !important;
	background: var(--mf-blue) !important;
	border: none !important;
	box-shadow: none !important;
	border-radius: var(--mf-radius-pill);
	padding: 14px 20px;
	transition: background 0.18s ease;
}

.mf-header__drawer-login:hover,
.mf-header__drawer-login:focus-visible {
	background: var(--mf-dark-blue) !important;
}

.mf-header__drawer-login:focus-visible {
	outline: 2px solid var(--mf-blue);
	outline-offset: 2px;
}

/* Responsive */

/* Narrow desktop: the 80px row may not wrap (an overflow squeezes the logo),
   so give back a few px of spacing before the hamburger takes over. */
@media (min-width: 901px) and (max-width: 1080px) {
	.mf-header__inner {
		padding: 0 20px;
		gap: 18px;
	}

	.mf-header__menu {
		gap: 18px;
	}

	.mf-header__link--login {
		padding: 10px 16px;
	}
}

@media (max-width: 900px) {
	.mf-header__inner {
		gap: 12px;
	}

	.mf-header__nav {
		display: none;
	}

	.mf-header__brand {
		order: 1;
	}

	.mf-header__burger,
	.mf-header__burger:hover,
	.mf-header__burger:focus,
	.mf-header__burger:active {
		display: inline-flex;
		order: 2;
		margin-left: auto;
	}

	.mf-header__logo {
		height: 30px;
	}
}

@media (max-width: 520px) {
	.mf-header__inner {
		padding: 0 16px;
	}
}

/* Defensive hard hide of the mobile drawer on wide screens. */
@media (min-width: 901px) {
	.mf-header__backdrop,
	.mf-header__drawer {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mf-header,
	.mf-header__burger-line,
	.mf-header__backdrop,
	.mf-header__drawer {
		transition: none !important;
	}
}
