.cmath-site-header {
	position: relative;
	z-index: 1000;
	background: var(--color-bg-default-default);
	border-bottom: var(--border-width-default) solid var(--color-border-accent);
}

.cmath-site-header__bar {
	display: flex;
	align-items: center;
	gap: var(--space-150);
	min-height: 61px;
	padding-block: var(--space-50);
}

/* Logo */
.cmath-site-header__logo {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

.cmath-site-header__logo img {
	height: 42px;
	width: auto;
	display: block;
}

/* Nav */
.cmath-site-header__nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
}

.cmath-menu {
	display: flex;
	align-items: center;
	gap: var(--space-75);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cmath-menu__item {
	position: static;
	margin: 0;
}

.cmath-menu__link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-25);
	padding: var(--space-75);
	font-family: var(--font-family-paragraph);
	font-size: var(--font-body-size);
	font-weight: var(--font-body-weight);
	line-height: 1.3;
	color: var(--color-text-default);
	text-decoration: none;
	white-space: nowrap;
	background: none;
	border: 0;
	cursor: pointer;
	transition: color 0.18s ease;
}

.cmath-menu__item > .cmath-menu__link:hover,
.cmath-menu__item > .cmath-menu__link:focus-visible {
	color: var(--color-text-alt);
}

.cmath-menu__item.is-active > .cmath-menu__link {
	color: var(--color-text-alt);
}

.cmath-chevron {
	flex: 0 0 auto;
	transition: transform 0.2s ease;
}

.cmath-menu__arrow {
	display: none;
	flex: 0 0 auto;
}

.cmath-menu__item--mega:hover > .cmath-menu__toggle,
.cmath-menu__item--mega:focus-within > .cmath-menu__toggle,
.cmath-menu__item--mega.is-open > .cmath-menu__toggle {
	color: var(--color-text-alt);
}

.cmath-menu__item--mega.is-open > .cmath-menu__toggle .cmath-chevron {
	transform: rotate(180deg);
}

/* Megamenu */
.cmath-mega {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-6px);
	padding-top: var(--space-75);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	z-index: 1001;
}

.cmath-menu__item--mega.is-open > .cmath-mega {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

@media (min-width: 1081px) {
	.cmath-menu__item--about {
		position: relative;
	}

	.cmath-mega--about {
		left: 0;
		transform: translateY(-6px);
	}

	.cmath-menu__item--about.is-open > .cmath-mega--about {
		transform: translateY(0);
	}
}

.cmath-mega__inner {
	background: var(--color-bg-default-default);
	border-radius: var(--radius-s);
	box-shadow:
		0 2px 13.55px rgba(0, 0, 0, 0.05),
		0 15px 24.1px -10px rgba(0, 0, 0, 0.1),
		0 4px 4px rgba(0, 0, 0, 0.15);
	max-width: min(977px, 92vw);
}

.cmath-mega--about .cmath-mega__inner {
	display: flex;
	align-items: stretch;
	gap: var(--space-200);
	padding: var(--space-200);
}

.cmath-mega__links {
	display: flex;
	flex-direction: column;
	gap: var(--space-150);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cmath-mega__links a {
	font-family: var(--font-family-paragraph);
	font-size: var(--font-body-size);
	line-height: 1.3;
	color: var(--color-text-default);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.18s ease;
}

.cmath-mega .cmath-mega__links a:hover,
.cmath-mega .cmath-mega__links a:focus-visible {
	color: var(--color-text-alt);
}

/* The services mega grows with content; scroll instead of clipping on short screens. */
.cmath-mega--services {
	max-height: calc(100vh - 110px);
	overflow-y: auto;
}

.cmath-mega--services .cmath-mega__inner {
	display: flex;
	align-items: stretch;
	padding: var(--space-180) var(--space-138);
}

.cmath-mega__col {
	flex: 1 1 0;
	min-width: 215px;
	display: flex;
	flex-direction: column;
	gap: var(--space-200);
	padding: 0 var(--space-150);
}

.cmath-mega__col + .cmath-mega__col {
	border-left: 1px solid var(--color-border-accent);
}

.cmath-mega__heading {
	margin: 0;
	font-family: var(--font-family-paragraph);
	font-weight: 500;
	font-size: var(--space-113);
	line-height: 1.2;
	color: var(--color-text-secondary);
}

.cmath-mega__items {
	display: flex;
	flex-direction: column;
	gap: var(--space-200);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cmath-mega__item {
	display: flex;
	flex-direction: column;
	gap: var(--space-50);
	text-decoration: none;
}

.cmath-mega__item-title {
	font-family: var(--font-family-headers);
	font-weight: 700;
	font-size: var(--font-h6-size);
	line-height: 1.2;
	color: var(--color-text-default);
	transition: color 0.18s ease;
}

.cmath-mega__item:hover .cmath-mega__item-title,
.cmath-mega__item:focus-visible .cmath-mega__item-title {
	color: var(--color-text-alt);
}

.cmath-mega__item-desc {
	font-family: var(--font-family-paragraph);
	font-size: var(--font-label-m-size);
	line-height: 1.3;
	color: var(--color-text-default);
}

/* Actions */
.cmath-site-header__actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: var(--space-50);
}

.cmath-site-header__search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-50) var(--space-100);
	color: var(--color-icon-default);
	background: none;
	border: 0;
	cursor: pointer;
	transition: color 0.18s ease;
}

.cmath-site-header__search-toggle:hover,
.cmath-site-header__search-toggle:focus-visible {
	color: var(--color-text-alt);
}

.cmath-site-header__nav-cta,
.cmath-site-header__drawer-search,
.cmath-mega__back {
	display: none;
}

/* Search */
.cmath-site-header__search {
	display: none;
	flex: 0 1 402px;
	margin-left: auto;
	align-items: center;
	gap: var(--space-50);
	padding: var(--space-25) var(--space-75);
	background: transparent;
	border: 1px solid var(--color-border-accent);
}

.cmath-site-header__search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	font-family: var(--font-family-paragraph);
	font-size: var(--font-body-size);
	line-height: 1.3;
	color: var(--color-text-default);
	background: transparent;
	border: 0;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
}

.cmath-site-header__search input[type="search"]::placeholder {
	color: var(--color-text-secondary);
	opacity: 1;
}

.cmath-site-header__search input[type="search"]::-webkit-search-cancel-button,
.cmath-site-header__drawer-search input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.cmath-site-header__search-submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	color: var(--color-icon-default);
	background: none;
	border: 0;
	cursor: pointer;
}

.cmath-site-header.is-searching .cmath-site-header__nav,
.cmath-site-header.is-searching .cmath-site-header__search-toggle {
	display: none;
}

.cmath-site-header.is-searching .cmath-site-header__search {
	display: flex;
	animation: cmath-search-in 0.25s ease;
}

@keyframes cmath-search-in {
	from {
		opacity: 0;
		transform: translateX(24px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cmath-site-header.is-searching .cmath-site-header__search {
		animation: none;
	}
}

.cmath-site-header.is-searching .cmath-site-header__bar {
	gap: var(--space-50);
}

/* Burger */
.cmath-site-header__burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: var(--space-75);
	background: none;
	border: 0;
	cursor: pointer;
}

.cmath-site-header__burger span {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--color-text-default);
	border-radius: var(--radius-full);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.cmath-site-header__burger[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

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

.cmath-site-header__burger[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Mobile */
@media (max-width: 1080px) {
	.cmath-site-header__bar {
		justify-content: space-between;
		padding-block: var(--space-100);
	}

	.cmath-site-header__logo img {
		height: 34px;
	}

	.cmath-site-header__nav {
		display: none;
	}

	.cmath-site-header__actions .cmath-btn--primary,
	.cmath-site-header__search-toggle {
		display: none;
	}

	.cmath-site-header__burger {
		display: flex;
	}

	.cmath-site-header.is-mobile-open .cmath-site-header__bar {
		position: relative;
		z-index: 1001;
		background: var(--color-bg-default-default);
	}

	.cmath-site-header.is-mobile-open .cmath-site-header__nav {
		position: fixed;
		top: var(--cmath-bar-h, 68px);
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1000;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		gap: var(--space-150);
		padding: var(--space-150) var(--grid-margins);
		background: var(--color-bg-default-default);
		overflow: hidden;
	}

	.cmath-site-header__drawer-search {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--space-50);
		flex: 0 0 auto;
		width: 100%;
		padding: var(--space-50) var(--space-100);
		background: transparent;
		border: var(--border-width-default) solid var(--color-border-input);
		border-radius: var(--radius-full);
	}

	.cmath-site-header__drawer-search input[type="search"] {
		flex: 1 1 auto;
		min-width: 0;
		font-family: var(--font-family-paragraph);
		font-size: var(--font-body-size);
		color: var(--color-text-default);
		background: transparent;
		border: 0;
		outline: none;
		appearance: none;
		-webkit-appearance: none;
	}

	.cmath-site-header__drawer-search input::placeholder {
		color: var(--color-text-accent);
		opacity: 1;
	}

	.cmath-site-header__drawer-search-submit {
		flex: 0 0 auto;
		display: inline-flex;
		color: var(--color-text-accent);
		background: none;
		border: 0;
		padding: 0;
		cursor: pointer;
	}

	.cmath-menu {
		flex: 1 1 auto;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		gap: var(--space-75);
	}

	.cmath-menu__item {
		width: 100%;
	}

	.cmath-menu__link {
		width: 100%;
		justify-content: center;
		gap: var(--space-25);
		padding: var(--space-75);
		font-family: var(--font-family-headers);
		font-weight: 700;
		font-size: var(--font-h6-size);
		color: var(--color-text-default);
	}

	.cmath-menu__item--mega .cmath-chevron {
		display: none;
	}

	.cmath-menu__item--mega .cmath-menu__arrow {
		display: inline-flex;
	}

	.cmath-site-header__nav-cta {
		display: inline-flex;
		flex: 0 0 auto;
		width: 100%;
	}

	.cmath-mega {
		position: absolute;
		inset: 0;
		left: auto;
		width: 100%;
		max-width: none;
		padding: var(--space-150) var(--grid-margins);
		transform: translateX(100%);
		opacity: 1;
		visibility: hidden;
		pointer-events: none;
		background: var(--color-bg-default-default);
		overflow-y: auto;
		transition: transform 0.25s ease, visibility 0.25s;
		z-index: 2;
	}

	.cmath-menu__item--mega.is-open > .cmath-mega {
		transform: translateX(0);
		visibility: visible;
		pointer-events: auto;
	}

	.cmath-mega__back {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: var(--space-50);
		width: 100%;
		padding: var(--space-75) 0;
		margin-bottom: var(--space-100);
		font-family: var(--font-family-paragraph);
		font-size: var(--font-body-size);
		color: var(--color-text-default);
		background: none;
		border: 0;
		border-bottom: 1px solid var(--color-border-accent);
		cursor: pointer;
	}

	.cmath-mega__inner,
	.cmath-mega--about .cmath-mega__inner,
	.cmath-mega--services .cmath-mega__inner {
		flex-direction: column;
		gap: var(--space-200);
		padding: 0;
		max-width: none;
		box-shadow: none;
		background: transparent;
		border-radius: 0;
	}

	.cmath-mega--about .cmath-mega__links {
		align-items: center;
		text-align: center;
		gap: var(--space-150);
		padding: 0;
	}

	.cmath-mega--about .cmath-mega__links a {
		font-family: var(--font-family-headers);
		font-weight: 700;
		font-size: var(--font-h6-size);
	}

	.cmath-mega__col {
		padding: 0;
		min-width: 0;
	}

	.cmath-mega__col + .cmath-mega__col {
		border-left: 0;
		border-top: 1px solid var(--color-border-accent);
		padding-top: var(--space-200);
	}
}
