/**
 * Symbiotic Peptides header.
 *
 * Colors resolve to Kadence globals so the Customizer stays in control, with
 * brand hexes as fallbacks.
 */

/* Shared with the hero, which sizes itself against the header. */
:root {
	--sp-header-height: 78px;
}

@media ( max-width: 860px ) {
	:root {
		--sp-header-height: 68px;
	}
}

.sp-header {
	--sp-header-bg: var( --global-palette9, #ffffff );
	--sp-header-border: var( --global-palette7, #e2e2e2 );
	--sp-nav-color: var( --global-palette4, #1a1a1a );
	--sp-nav-hover: var( --global-palette1, #e8620a );
	--sp-nav-size: 1rem;
	--sp-nav-gap: 1.875rem;
	--sp-icon-color: var( --global-palette3, #000000 );
	--sp-logo-width: 150px;
	--sp-gutter: var( --global-content-edge-padding, 1.5rem );

	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	width: 100% !important;
	z-index: 9999 !important;
	background: rgba( 255, 255, 255, 0.82 ) !important;
	border-bottom: 1px solid rgba( 230, 224, 216, 0.65 ) !important;
	backdrop-filter: blur( 14px ) saturate( 180% ) !important;
	-webkit-backdrop-filter: blur( 14px ) saturate( 180% ) !important;
	transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.sp-header.is-scrolled {
	background: rgba( 255, 255, 255, 0.90 ) !important;
	border-bottom-color: rgba( 224, 218, 210, 0.85 ) !important;
	box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.05 ) !important;
}

/* Admin bar must not cover fixed header. */
.admin-bar #masthead.sp-header,
.admin-bar .sp-header {
	top: 32px !important;
}

@media ( max-width: 782px ) {
	.admin-bar #masthead.sp-header,
	.admin-bar .sp-header {
		top: 46px !important;
	}
}

/* Compensate body padding so content does not hide under fixed header */
body {
	padding-top: var( --sp-header-height, 78px );
}

.sp-header__inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 1.5rem;
	width: 100%;
	max-width: var( --global-content-width, 1290px );
	min-height: var( --sp-header-height );
	margin-inline: auto;
	padding-inline: var( --sp-gutter );
}

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */

.sp-header__brand {
	display: flex;
	align-items: center;
}

.sp-header__brand a {
	display: block;
	line-height: 0;
}

.sp-header__brand img {
	display: block;
	width: var( --sp-logo-width );
	height: auto;
	max-height: calc( var( --sp-header-height ) - 20px );
	object-fit: contain;
}

/* --------------------------------------------------------------------------
   Primary navigation
   -------------------------------------------------------------------------- */

.sp-header__nav {
	display: flex;
	justify-content: center;
}

.sp-menu {
	display: flex;
	align-items: center;
	gap: var( --sp-nav-gap );
	margin: 0;
	padding: 0;
	list-style: none;
}

.sp-menu > li {
	position: relative;
	margin: 0;
}

.sp-menu > li > a {
	display: block;
	padding: 0.25rem 0;
	color: var( --sp-nav-color );
	font-size: var( --sp-nav-size );
	font-weight: 400;
	line-height: 1.4;
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s ease;
}

.sp-menu > li > a::after {
	content: "";
	display: block;
	height: 2px;
	margin-top: 4px;
	background: var( --sp-nav-hover );
	transform: scaleX( 0 );
	transform-origin: left center;
	transition: transform 0.18s ease;
}

.sp-menu > li > a:hover,
.sp-menu > li > a:focus-visible,
.sp-menu > li.current-menu-item > a,
.sp-menu > li.current-menu-ancestor > a {
	color: var( --sp-nav-hover );
}

.sp-menu > li > a:hover::after,
.sp-menu > li > a:focus-visible::after,
.sp-menu > li.current-menu-item > a::after,
.sp-menu > li.current-menu-ancestor > a::after {
	transform: scaleX( 1 );
}

/* Second level */

.sp-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 50%;
	z-index: 20;
	min-width: 220px;
	margin: 0;
	padding: 0.5rem 0;
	background: var( --global-palette9, #ffffff );
	border: 1px solid var( --sp-header-border );
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba( 0, 0, 0, 0.1 );
	list-style: none;
	opacity: 0;
	transform: translate( -50%, 6px );
	visibility: hidden;
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.sp-menu > li:hover > .sub-menu,
.sp-menu > li:focus-within > .sub-menu {
	opacity: 1;
	transform: translate( -50%, 0 );
	visibility: visible;
}

.sp-menu .sub-menu a {
	display: block;
	padding: 0.5rem 1.125rem;
	color: var( --sp-nav-color );
	font-size: 0.9375rem;
	text-decoration: none;
}

.sp-menu .sub-menu a:hover,
.sp-menu .sub-menu a:focus-visible {
	background: var( --global-palette8, #f5f5f5 );
	color: var( --sp-nav-hover );
}

/* --------------------------------------------------------------------------
   Actions: icons + CTA
   -------------------------------------------------------------------------- */

.sp-header__actions {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	justify-content: flex-end;
}

.sp-action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	color: var( --sp-icon-color );
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.sp-action:hover,
.sp-action:focus-visible,
.sp-action[aria-expanded="true"] {
	background: var( --global-palette8, #f5f5f5 );
	color: var( --sp-nav-hover );
}

.sp-action .sp-icon {
	width: 40px;
	height: 40px;
}

.sp-action__count[hidden] {
	display: none;
}

.sp-action__count {
	position: absolute;
	top: 2px;
	right: 1px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	background: var( --global-palette1, #e8620a );
	border-radius: 999px;
	color: #ffffff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
}

.sp-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin-left: 0.75rem;
	padding: 0.6875rem 1.625rem;
	background: var( --global-palette1, #e8620a );
	border-radius: 999px;
	color: #ffffff;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.sp-cta:hover,
.sp-cta:focus-visible {
	background: var( --global-palette2, #be5008 );
	color: #ffffff;
}

.sp-cta:active {
	transform: translateY( 1px );
}

/* Hamburger, desktop-hidden */

.sp-action--toggle {
	display: none;
}

/* Menu icon swaps to a close icon while the drawer is open. */
.sp-burger {
	display: grid;
	place-items: center;
}

.sp-action .sp-burger .sp-icon {
	grid-area: 1 / 1;
	width: 22px;
	height: 22px;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.sp-action .sp-burger .sp-burger__close {
	opacity: 0;
	transform: rotate( -90deg );
}

.sp-action--toggle[aria-expanded="true"] .sp-burger .sp-burger__open {
	opacity: 0;
	transform: rotate( 90deg );
}

.sp-action--toggle[aria-expanded="true"] .sp-burger .sp-burger__close {
	opacity: 1;
	transform: none;
}

/* --------------------------------------------------------------------------
   Search panel
   -------------------------------------------------------------------------- */

.sp-search-panel {
	border-top: 1px solid var( --sp-header-border );
	background: var( --global-palette9, #ffffff );
}

.sp-search-panel[hidden] {
	display: none;
}

.sp-search-form {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	max-width: var( --global-content-width, 1290px );
	margin-inline: auto;
	padding: 1rem var( --sp-gutter );
}

/**
 * Kadence styles inputs via `input[type=search]` and buttons via element
 * selectors, both of which out-specify a lone class. These rules are scoped to
 * .sp-search-form so they win on specificity rather than on load order.
 */

.sp-search-form .sp-search-form__field {
	flex: 1 1 auto;
	min-width: 0;
	height: 48px;
	padding: 0 1.25rem;
	background: var( --global-palette9, #ffffff );
	border: 1px solid var( --sp-header-border );
	border-radius: 999px;
	color: var( --global-palette5, #333333 );
	font-size: 1rem;
	box-shadow: none;
}

.sp-search-form .sp-search-form__field:focus {
	border-color: var( --global-palette1, #e8620a );
	box-shadow: none;
	outline: none;
}

.sp-search-form .sp-search-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	flex: 0 0 auto;
	padding: 0;
	background: var( --global-palette1, #e8620a );
	border: 0;
	border-radius: 50%;
	color: #ffffff;
	cursor: pointer;
}

.sp-search-form .sp-search-form__submit .sp-icon {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
}

.sp-search-form .sp-search-form__submit:hover,
.sp-search-form .sp-search-form__submit:focus-visible {
	background: var( --global-palette2, #be5008 );
}

/* --------------------------------------------------------------------------
   Mobile menu: full screen below the header
   --------------------------------------------------------------------------
   Moved to the end of <body> by header.js. Opens as a curtain that unrolls
   downward from the header (clip-path), with the links fading up one after
   another; closing reverses it. The CTA is pinned at the bottom.
   -------------------------------------------------------------------------- */

.sp-drawer {
	--sp-drawer-gutter: var( --global-content-edge-padding, 1.5rem );
	--sp-drawer-ease: cubic-bezier( 0.22, 1, 0.36, 1 );
	--sp-drawer-speed: 0.5s;

	position: fixed;
	top: var( --sp-header-height, 78px );
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9998;
	display: flex;
	flex-direction: column;
	background: var( --global-palette9, #ffffff );
	border-top: 1px solid var( --global-palette7, #e2e2e2 );
	visibility: hidden;
	clip-path: inset( 0 0 100% 0 );
	transition:
		clip-path var( --sp-drawer-speed ) var( --sp-drawer-ease ),
		visibility 0s linear var( --sp-drawer-speed );
}

.sp-drawer.is-open {
	visibility: visible;
	clip-path: inset( 0 0 0 0 );
	transition:
		clip-path var( --sp-drawer-speed ) var( --sp-drawer-ease ),
		visibility 0s linear 0s;
}

.admin-bar .sp-drawer {
	top: calc( var( --sp-header-height, 78px ) + 32px );
}

@media ( max-width: 782px ) {
	.admin-bar .sp-drawer {
		top: calc( var( --sp-header-height, 78px ) + 46px );
	}
}

/* Page behind can't scroll while the menu is open. */
html.sp-menu-open,
html.sp-menu-open body {
	overflow: hidden;
}

.sp-drawer__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0.75rem var( --sp-drawer-gutter ) 1.5rem;
	-webkit-overflow-scrolling: touch;
}

/* Links fade up in sequence (--i is set per item by header.js). */
.sp-drawer .sp-mobile-menu > li,
.sp-drawer__footer {
	opacity: 0;
	transform: translateY( 14px );
	transition:
		opacity 0.3s ease,
		transform 0.3s var( --sp-drawer-ease );
}

.sp-drawer.is-open .sp-mobile-menu > li,
.sp-drawer.is-open .sp-drawer__footer {
	opacity: 1;
	transform: none;
	transition:
		opacity 0.45s ease calc( 0.12s + var( --i, 0 ) * 0.05s ),
		transform 0.55s var( --sp-drawer-ease ) calc( 0.12s + var( --i, 0 ) * 0.05s );
}

.sp-mobile-menu,
.sp-mobile-menu .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sp-mobile-menu > li {
	border-bottom: 1px solid var( --global-palette7, #e2e2e2 );
}

.sp-mobile-menu a {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.125rem 0.25rem;
	color: var( --global-palette3, #000000 );
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.2;
	text-decoration: none;
	border-radius: 8px;
	transition: color 0.2s ease, padding 0.25s var( --sp-drawer-ease, ease );
}

/* Chevron */
.sp-mobile-menu > li > a::after {
	content: "";
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	background: currentColor;
	opacity: 0.35;
	-webkit-mask: url( ../../images/icons/chevron-right.svg ) center / contain no-repeat;
	mask: url( ../../images/icons/chevron-right.svg ) center / contain no-repeat;
	transition: opacity 0.2s ease, transform 0.25s var( --sp-drawer-ease, ease );
}

/* Hover */
.sp-mobile-menu a:hover {
	padding-left: 0.5rem;
	color: var( --sp-orange-dark, #be5008 );
}

.sp-mobile-menu > li > a:hover::after {
	opacity: 1;
	transform: translateX( 3px );
}

/* Focus (keyboard) */
.sp-mobile-menu a:focus-visible {
	color: var( --sp-orange-dark, #be5008 );
	outline: none;
	box-shadow: 0 0 0 2px var( --global-palette9, #ffffff ), 0 0 0 4px var( --sp-orange, #e8620a );
}

/* Pressed */
.sp-mobile-menu a:active {
	color: var( --sp-orange-dark, #be5008 );
	opacity: 0.8;
}

/* Current page */
.sp-mobile-menu .current-menu-item > a {
	color: var( --sp-orange-dark, #be5008 );
}

.sp-mobile-menu .current-menu-item > a::after {
	opacity: 1;
}

.sp-mobile-menu .sub-menu {
	padding: 0 0 0.75rem 0.75rem;
}

.sp-mobile-menu .sub-menu a {
	padding: 0.625rem 0.25rem;
	color: var( --global-palette6, #6b6b6b );
	font-size: 1rem;
	font-weight: 500;
}

/* CTA pinned at the bottom */
.sp-drawer__footer {
	flex: 0 0 auto;
	padding: 1rem var( --sp-drawer-gutter ) calc( 1rem + env( safe-area-inset-bottom, 0px ) );
	background: var( --global-palette9, #ffffff );
	border-top: 1px solid var( --global-palette7, #e2e2e2 );
}

.sp-drawer .sp-cta--block {
	display: flex;
	width: 100%;
	min-height: 54px;
	margin: 0;
	font-size: 1rem;
}

/* Never shown on desktop, where the nav is inline. */
@media ( min-width: 1025px ) {
	.sp-drawer {
		display: none;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.sp-drawer,
	.sp-drawer.is-open {
		clip-path: none;
		transition: visibility 0s;
	}

	.sp-drawer .sp-mobile-menu > li,
	.sp-drawer__footer,
	.sp-drawer.is-open .sp-mobile-menu > li,
	.sp-drawer.is-open .sp-drawer__footer {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Nav collapses into the drawer. */
@media ( max-width: 1024px ) {
	.sp-header__inner {
		grid-template-columns: auto 1fr;
	}

	.sp-header__nav {
		display: none;
	}

	.sp-action--toggle {
		display: inline-flex;
	}
}

@media ( max-width: 860px ) {
	.sp-header {
		--sp-logo-width: 128px;
	}

	/* CTA lives in the drawer at this size. */
	.sp-header__actions > .sp-cta {
		display: none;
	}
}

@media ( max-width: 480px ) {
	.sp-header {
		--sp-logo-width: 116px;
	}

	.sp-header__actions {
		gap: 0;
	}

	.sp-action {
		width: 36px;
		height: 36px;
	}
}

/* Respect reduced-motion preferences. */
@media ( prefers-reduced-motion: reduce ) {
	.sp-header *,
	.sp-header *::after {
		transition-duration: 0.01ms !important;
	}
}
