.sp-header {
	position: relative;
	z-index: 100;
	width: 100%;
	padding: var(--sp-header-pad-top) 0 0;
	background-color: var(--spaciefy-black);
	background-image:
		radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.08) 1px, transparent 0),
		radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
	background-size: 24px 24px, 48px 48px;
	background-position: 0 0, 12px 12px;
}

/* Hero pages: header overlays the hero so both share the same background */
.sp-has-hero-header {
	--sp-header-offset: calc(var(--sp-header-pad-top) + var(--sp-header-min-height));
}

.sp-has-hero-header .sp-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	background-color: transparent;
	background-image: none;
}

/* Preserve the same gap between header and section content as the stacked layout */
.sp-has-hero-header .sp-hero__inner {
	padding-top: calc(var(--sp-header-offset) + var(--sp-hero-top-gap));
}

.sp-has-hero-header .sp-svc-hero__inner {
	padding-top: calc(var(--sp-header-offset) + var(--sp-svc-hero-pad-top));
}

.sp-has-hero-header .sp-contact {
	padding-top: calc(var(--sp-header-offset) + var(--sp-contact-pad-top));
}

.sp-header__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	grid-template-areas: "nav logo actions";
	align-items: start;
	column-gap: var(--sp-section-gap);
	min-height: var(--sp-header-min-height);
}

.sp-header__nav {
	grid-area: nav;
	justify-self: start;
	min-width: 0;
}

.sp-header__nav-panel {
	display: contents;
}

.sp-header__nav-list--desktop {
	display: flex;
	flex-direction: column;
	gap: var(--sp-header-nav-gap);
}

.sp-header__nav-list--mobile,
.sp-header__nav-bottom {
	display: none;
}

.sp-header__nav-list,
.sp-header__nav-list .menu-item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sp-header__nav-link {
	position: relative;
	display: inline-block;
	font-family: var(--spaciefy-font-manrope);
	font-size: var(--sp-font-nav);
	font-style: normal;
	font-weight: 500;
	line-height: var(--sp-font-nav-lh);
	color: #ffffff;
	transition: opacity 0.2s ease;
}

/*
 * No hit-area overlay here. The desktop nav is a vertical list with
 * --sp-header-nav-gap: 0, so the links already form one contiguous strip with
 * no dead space between them; growing each target past its own box would only
 * take taps from its neighbour. At 24-32px tall they satisfy the WCAG 2.5.8
 * (AA) 24px minimum. Reaching the 44px of 2.5.5 (AAA) would need the header
 * itself to get taller, which is a design change rather than a responsive fix.
 */

.sp-header__nav-link:hover,
.sp-header__nav-link:focus-visible {
	opacity: 0.7;
}

.sp-header__logo {
	position: relative;
	grid-area: logo;
	justify-self: center;
	align-self: start;
	margin-top: clamp(0, 0.25vw, 0.125rem);
	flex-shrink: 0;
}

.sp-header__logo::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: var(--sp-tap-min);
	transform: translateY(-50%);
}

.sp-header__logo-image {
	display: block;
	width: var(--sp-logo-width);
	max-width: 100%;
	height: auto;
	max-height: var(--sp-logo-height);
	aspect-ratio: 160 / 42;
}

.sp-header__logo-text {
	display: inline-block;
	font-size: var(--sp-font-logo);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
	color: var(--spaciefy-white);
	text-transform: lowercase;
}

.sp-header__logo-i {
	position: relative;
	display: inline-block;
}

.sp-header__logo-i::before {
	content: "";
	position: absolute;
	top: 0.05em;
	left: 50%;
	width: 0.22em;
	height: 0.22em;
	border-radius: 50%;
	background-color: var(--spaciefy-yellow);
	transform: translateX(-50%);
}

.sp-header__actions {
	grid-area: actions;
	display: flex;
	align-items: center;
	justify-self: end;
	align-self: start;
	min-width: 0;
}

.sp-header__menu-toggle {
	display: none;
}

.sp-header__menu-toggle-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sp-header__cta {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: var(--sp-header-cta-gap);
	min-height: var(--sp-tap-min);
	max-width: 100%;
	color: #ffffff;
	transition: opacity 0.2s ease;
}

.sp-header__cta:hover,
.sp-header__cta:focus-visible {
	opacity: 0.85;
}

.sp-header__cta-label {
	font-family: var(--spaciefy-font-manrope);
	font-size: var(--sp-header-cta-size);
	font-style: normal;
	font-weight: 500;
	line-height: var(--sp-header-cta-lh);
	color: #ffffff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: clamp(8rem, 20vw, 14rem);
}

.sp-header__cta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: var(--sp-header-cta-icon-size);
	height: var(--sp-header-cta-icon-size);
	min-width: var(--sp-header-cta-icon-size);
	min-height: var(--sp-header-cta-icon-size);
	border-radius: var(--sp-header-cta-icon-radius);
	color: var(--spaciefy-black);
	background-color: var(--spaciefy-yellow);
}

.sp-header__cta-icon svg {
	display: block;
	width: var(--sp-header-cta-icon-svg);
	height: var(--sp-header-cta-icon-svg);
}

@media (max-width: 768px) {
	.sp-header {
		--sp-menu-icon-width: 24px;
		--sp-menu-icon-line: 2px;
		--sp-menu-icon-gap: 6px;
		--sp-header-mobile-inline: calc((100vw - var(--spaciefy-container-width)) / 2);
		padding-top: var(--sp-header-pad-top);
		background-image: none;
	}

	.sp-has-hero-header {
		--sp-header-offset: calc(var(--sp-header-pad-top) + var(--sp-logo-height));
	}

	.sp-header__inner {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas: "logo actions";
		align-items: center;
		column-gap: clamp(0.5rem, 2vw, 0.75rem);
		min-height: auto;
		width: var(--spaciefy-container-width);
		max-width: var(--spaciefy-container);
		margin-left: auto;
		margin-right: auto;
		padding-left: var(--spaciefy-container-pad-x);
		padding-right: var(--spaciefy-container-pad-x);
	}

	.sp-header__logo {
		position: relative;
		z-index: 102;
		justify-self: start;
		align-self: center;
		display: flex;
		align-items: center;
		min-width: 0;
		margin-top: 0;
	}

	.sp-header__actions {
		position: relative;
		z-index: 102;
		display: flex;
		align-items: center;
		align-self: center;
		flex-shrink: 0;
		justify-content: flex-end;
		gap: 0;
	}

	/* Figma mobile (iPhone 16/17): logo left, "Menu" label right on solid black bar. */
	.sp-header__menu-toggle {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		min-width: var(--sp-tap-min);
		min-height: var(--sp-tap-min);
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		color: var(--spaciefy-white);
		background: transparent;
		cursor: pointer;
		transition: opacity 0.2s ease;
	}

	.sp-header__menu-toggle:hover,
	.sp-header__menu-toggle:focus-visible {
		opacity: 0.72;
	}

	.sp-header__menu-toggle-label {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		padding: 0;
		overflow: visible;
		clip: auto;
		white-space: nowrap;
		border: 0;
		font-family: var(--spaciefy-font-manrope);
		font-size: var(--sp-header-menu-label-size);
		font-weight: 500;
		line-height: 1.14;
		color: inherit;
	}

	.sp-header__menu-toggle-label--closed {
		display: inline;
	}

	.sp-header__menu-toggle-close {
		display: none;
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
		color: inherit;
	}

	.sp-header__menu-toggle-close svg {
		display: block;
		width: 100%;
		height: 100%;
	}

	.sp-header.is-menu-open .sp-header__menu-toggle-label--closed {
		display: none;
	}

	.sp-header.is-menu-open .sp-header__menu-toggle-close {
		display: inline-flex;
	}

	.sp-header__menu-toggle-icon {
		display: none;
	}

	.sp-header__cta {
		display: none;
	}

	.sp-header__nav {
		position: fixed;
		inset: 0;
		z-index: 100;
		display: flex;
		align-items: stretch;
		justify-content: flex-end;
		width: 100%;
		max-width: 100%;
		padding: 0;
		overflow-x: hidden;
		background-color: rgba(0, 0, 0, 0.45);
		background-image: none;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.35s ease, visibility 0s linear 0.35s;
	}

	.sp-header.is-menu-open .sp-header__nav {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transition: opacity 0.35s ease, visibility 0s;
	}

	.sp-header__nav-panel {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
		width: 100%;
		height: 100%;
		min-height: 100%;
		background-color: var(--spaciefy-black);
		padding:
			calc(var(--sp-header-pad-top) + var(--sp-logo-height) + clamp(32px, 8vw, 56px))
			0
			0;
		transform: translateX(100%);
		transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: transform;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	.sp-header.is-menu-open .sp-header__nav-panel {
		transform: translateX(0);
	}

	.sp-header__nav-list--desktop {
		display: none;
	}

	.sp-header__nav-list--mobile {
		display: flex;
		width: 100%;
		max-width: none;
		flex: 0 0 auto;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding-top: clamp(24px, 6vh, 48px);
		border-top: 1px solid rgba(255, 255, 255, 0.1);
	}

	.sp-header__nav-list--mobile .menu-item {
		width: 100%;
		transform: translateX(-20px);
		border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item {
		animation: sp-header-nav-item-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(1) {
		animation-delay: 0.12s;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(2) {
		animation-delay: 0.2s;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(3) {
		animation-delay: 0.28s;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(4) {
		animation-delay: 0.36s;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(5) {
		animation-delay: 0.44s;
	}

	.sp-header.is-menu-open .sp-header__nav-list--mobile .menu-item:nth-child(6) {
		animation-delay: 0.52s;
	}

	.sp-header__nav-list--mobile .sp-header__nav-link {
		display: block;
		width: 100%;
		padding: 0.75rem var(--sp-header-mobile-inline);
		font-family: var(--spaciefy-font-manrope);
		font-size: 22px;
		font-weight: 500;
		line-height: 1.4;
		letter-spacing: 0;
		text-align: left;
		color: var(--spaciefy-white);
		opacity: 1;
		touch-action: manipulation;
		transition: opacity 0.2s ease, color 0.2s ease;
	}

	.sp-header__nav-list--mobile .sp-header__nav-link::before,
	.sp-header__nav-list--mobile .sp-header__nav-link::after {
		display: none;
	}

	.sp-header__nav-list--mobile .sp-header__nav-link:hover,
	.sp-header__nav-list--mobile .sp-header__nav-link:focus-visible {
		opacity: 0.7;
		color: var(--spaciefy-white);
	}

	.sp-header__nav-bottom {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: clamp(0.75rem, 2vh, 1rem);
		width: 100%;
		margin-top: auto;
		padding:
			clamp(1.25rem, 3vh, 1.75rem)
			var(--sp-header-mobile-inline)
			max(5vh, 32px);
		border-top: 1px solid rgba(255, 255, 255, 0.1);
		transform: translateX(-20px);
	}

	.sp-header.is-menu-open .sp-header__nav-bottom {
		animation: sp-header-nav-item-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
		animation-delay: 0.4s;
	}

	.sp-header__nav-contact {
		display: inline-flex;
		align-items: center;
		justify-content: flex-start;
		gap: var(--sp-header-cta-gap);
		width: 100%;
		color: var(--spaciefy-white);
		touch-action: manipulation;
	}

	.sp-header__nav-email {
		display: block;
		width: 100%;
		font-family: var(--spaciefy-font-manrope);
		font-size: 16px;
		font-weight: 400;
		line-height: 1.4;
		letter-spacing: 0.04em;
		text-align: left;
		color: rgba(255, 255, 255, 0.72);
		touch-action: manipulation;
		transition: color 0.2s ease;
	}

	.sp-header__nav-email:hover,
	.sp-header__nav-email:focus-visible {
		color: var(--spaciefy-white);
	}

	.sp-header__nav-contact-label {
		font-family: var(--spaciefy-font-manrope);
		font-size: var(--sp-header-cta-size);
		font-weight: 500;
		line-height: var(--sp-header-cta-lh);
		color: var(--spaciefy-white);
	}

	.sp-header__nav-contact-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: var(--sp-header-cta-icon-size);
		height: var(--sp-header-cta-icon-size);
		min-width: var(--sp-header-cta-icon-size);
		min-height: var(--sp-header-cta-icon-size);
		border-radius: var(--sp-header-cta-icon-radius);
		color: var(--spaciefy-black);
		background-color: var(--spaciefy-yellow);
	}

	.sp-header__nav-contact-icon svg {
		display: block;
		width: var(--sp-header-cta-icon-svg);
		height: var(--sp-header-cta-icon-svg);
	}

	.sp-header__cta {
		display: none;
	}

	html.sp-header-menu-open,
	body.sp-header-menu-open {
		overflow: hidden;
	}

	.sp-header.is-menu-open {
		z-index: 101;
		background-image: none;
	}

	@keyframes sp-header-nav-item-in {
		from {
			transform: translateX(-20px);
		}

		to {
			transform: translateX(0);
		}
	}
}

@media (max-width: 480px) {
	.sp-header__nav-list--mobile .sp-header__nav-link {
		font-size: 22px;
	}
}
