/* =========================================================
   STUDY MRCOG HEADER
========================================================= */

:root {
	--header-height: 72px;
	--header-max-width: 1320px;
	--header-text: #111111;
	--header-blue: #2d378e;
	--header-pink: #ef5f93;
}


/* =========================================================
   HEADER
========================================================= */

.site-header {
	position: sticky;
	top: 0;
	z-index: 9999;

	width: 100%;
	height: var(--header-height);

	background: #ffffff;
	border: 0;

	transition:
		background-color 0.25s ease,
		box-shadow 0.25s ease,
		backdrop-filter 0.25s ease;
}

/* Homepage only: let the hero sit behind the header. */
.site-header-home {
	margin-bottom: calc(var(--header-height) * -1);
	background: transparent;
	box-shadow: none;
}

/* White sticky state after scrolling. */
.site-header.is-scrolled {
	background: rgba(255, 255, 255, 0.96);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	box-shadow: 0 5px 24px rgba(26, 32, 70, 0.08);
}


/* =========================================================
   WORDPRESS ADMIN BAR
========================================================= */

.admin-bar .site-header {
	top: 32px;
}


/* =========================================================
   HEADER CONTAINER
========================================================= */

.header-container {
	width: calc(100% - 48px);
	max-width: var(--header-max-width);
	height: 100%;
	margin: 0 auto;

	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 28px;
}


/* =========================================================
   LOGO
========================================================= */

.site-branding {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.site-branding .custom-logo-link {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	line-height: 0;
}

.site-branding .custom-logo {
	display: block;
	width: auto;
	height: 52px;
	max-width: 175px;
	object-fit: contain;
	transition: height 0.25s ease, transform 0.25s ease;
}

.site-header.is-scrolled .custom-logo {
	height: 46px;
}

.site-name {
	color: var(--header-blue);
	font-size: 22px;
	font-weight: 700;
	text-decoration: none;
}


/* =========================================================
   PRIMARY NAVIGATION
========================================================= */

.primary-navigation {
	margin-left: auto;
}

.primary-menu {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-menu li {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-menu > li > a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 9px 14px;

	color: var(--header-text);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.1px;
	text-transform: uppercase;
	text-decoration: none;
	border-radius: 30px;

	transition: color 0.2s ease, background-color 0.2s ease;
}

.primary-menu > li > a:hover {
	background: rgba(255, 255, 255, 0.8);
	color: #111111;
}

.primary-menu > .current-menu-item > a,
.primary-menu > .current-menu-parent > a,
.primary-menu > .current-menu-ancestor > a {
	background: rgba(255, 255, 255, 0.92);
	color: #111111;
}

/* On the white sticky state, keep links dark and the active item subtle. */
.site-header.is-scrolled .primary-menu > li > a {
	color: #111111;
}

.site-header.is-scrolled .primary-menu > li > a:hover,
.site-header.is-scrolled .primary-menu > .current-menu-item > a,
.site-header.is-scrolled .primary-menu > .current-menu-parent > a,
.site-header.is-scrolled .primary-menu > .current-menu-ancestor > a {
	background: #f6f7fb;
	color: #111111;
}


/* =========================================================
   DROPDOWN ARROW
========================================================= */

.primary-menu > .menu-item-has-children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-left: 8px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease, margin-top 0.2s ease;
}

.primary-menu > .menu-item-has-children:hover > a::after,
.primary-menu > .menu-item-has-children:focus-within > a::after {
	transform: rotate(225deg);
	margin-top: 3px;
}


/* =========================================================
   DROPDOWN
========================================================= */

.primary-menu .sub-menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	min-width: 230px;
	margin: 0;
	padding: 9px;

	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.04);
	border-radius: 14px;
	box-shadow: 0 15px 45px rgba(0, 0, 0, 0.11);
	list-style: none;

	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	pointer-events: none;

	transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.primary-menu li:hover > .sub-menu,
.primary-menu li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.primary-menu .sub-menu a {
	display: block;
	padding: 11px 14px;
	color: #151515;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	text-decoration: none;
	border-radius: 8px;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.primary-menu .sub-menu a:hover,
.primary-menu .sub-menu a:focus {
	background: #f8f4f7;
	color: var(--header-pink);
}

.primary-menu .sub-menu .sub-menu {
	top: 0;
	left: calc(100% + 8px);
}


/* =========================================================
   LMS LOGIN BUTTON
========================================================= */

.primary-menu > li.lms-login > a {
	min-width: 116px;
	padding: 10px 17px;
	background: linear-gradient(105deg, #299bea 0%, #e9589a 100%);
	color: #101010;
	border: 1px solid #111111;
	border-radius: 30px;
	transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.primary-menu > li.lms-login > a:hover {
	background: linear-gradient(105deg, #248ed9 0%, #dc4f8d 100%);
	color: #ffffff;
	transform: translateY(-1px);
}

.site-header.is-scrolled .primary-menu > li.lms-login > a {
	color: #101010;
}

.site-header.is-scrolled .primary-menu > li.lms-login > a:hover {
	color: #ffffff;
}


/* =========================================================
   MOBILE BUTTON
========================================================= */

.mobile-menu-toggle {
	display: none;
	width: 42px;
	height: 42px;
	padding: 8px;
	margin: 0;
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

.mobile-menu-toggle span {
	display: block;
	width: 24px;
	height: 2px;
	margin: 5px auto;
	background: #111111;
	border-radius: 20px;
	transition: background-color 0.2s ease, transform 0.25s ease, opacity 0.25s ease;
}

.mobile-menu-toggle.is-active span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.is-active span:nth-child(2) {
	opacity: 0;
}

.mobile-menu-toggle.is-active span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}


/* =========================================================
   TABLET / MOBILE
========================================================= */

@media (max-width: 1024px) {
	:root {
		--header-height: 68px;
	}

	.header-container {
		width: calc(100% - 32px);
	}

	.site-branding .custom-logo,
	.site-header.is-scrolled .custom-logo {
		height: 46px;
		max-width: 155px;
	}

	.mobile-menu-toggle {
		display: block;
		margin-left: auto;
	}

	.primary-navigation {
		position: absolute;
		top: 100%;
		left: 0;
		width: 100%;
		max-height: calc(100vh - var(--header-height));
		margin: 0;
		padding: 18px 20px 25px;
		background: rgba(255, 255, 255, 0.98);
		-webkit-backdrop-filter: blur(14px);
		backdrop-filter: blur(14px);
		box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
		overflow-x: hidden;
		overflow-y: auto;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-10px);
		pointer-events: none;
		transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
	}

	.primary-navigation.is-open {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
		pointer-events: auto;
	}

	.primary-menu {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 3px;
	}

	.primary-menu > li {
		width: 100%;
	}

	.primary-menu > li > a,
	.site-header.is-scrolled .primary-menu > li > a {
		width: 100%;
		min-height: 46px;
		justify-content: space-between;
		padding: 12px 14px;
		color: #111111;
		border-radius: 10px;
	}

	.primary-menu > li > a:hover,
	.primary-menu > .current-menu-item > a,
	.primary-menu > .current-menu-parent > a,
	.primary-menu > .current-menu-ancestor > a {
		background: #f8f4f7;
		color: #111111;
	}

	.primary-menu .sub-menu {
		position: static;
		display: none;
		width: 100%;
		min-width: 0;
		margin: 2px 0 8px;
		padding: 4px 0 4px 14px;
		background: transparent;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		pointer-events: auto;
		transition: none;
	}

	.primary-menu li.submenu-open > .sub-menu {
		display: block;
	}

	.primary-menu .sub-menu a {
		padding: 11px 14px;
		color: #151515;
		white-space: normal;
	}

	.primary-menu .sub-menu .sub-menu {
		position: static;
		margin-left: 10px;
	}

	.primary-menu > li.lms-login > a,
	.site-header.is-scrolled .primary-menu > li.lms-login > a {
		margin-top: 8px;
		justify-content: center;
		text-align: center;
		color: #101010;
	}

	.primary-menu > li.lms-login > a:hover,
	.site-header.is-scrolled .primary-menu > li.lms-login > a:hover {
		color: #ffffff;
	}
}


/* =========================================================
   WORDPRESS ADMIN BAR MOBILE
========================================================= */

@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 600px) {
	:root {
		--header-height: 64px;
	}

	.header-container {
		width: calc(100% - 28px);
	}

	.site-branding .custom-logo,
	.site-header.is-scrolled .custom-logo {
		height: 42px;
		max-width: 145px;
	}

	.mobile-menu-toggle {
		width: 40px;
		height: 40px;
		padding: 7px;
	}

	.mobile-menu-toggle span {
		width: 23px;
	}
}
