.header {
	position: sticky;
	top: 0;
	z-index: 100;
	width: 100%;
}

.header_position-wrapper {
	width: 100%;
	max-width: var(--shell-max-width);
	margin-inline: auto;
	padding-inline: var(--space-lg);
	padding-top: var(--space-lg);
}

.header_bar {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	column-gap: var(--space-md);
	width: 100%;
	max-width: var(--header-bar-max-width);
	margin-inline: auto;
	padding: 0.625rem 1.25rem;
	border-radius: 9999px;
	border: 1px solid var(--color-border);
	background-color: var(--color-surface);
	backdrop-filter: blur(12px);
	box-shadow: var(--color-shadow);
}

.header_brand { justify-self: start; }
.header_nav { justify-self: center; }

.header_nav-list {
	display: flex;
	align-items: center;
	gap: 0.125rem;
}

.header_nav-link {
	display: inline-flex;
	align-items: center;
	padding: 0.375rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--color-text-muted);
	white-space: nowrap;
	transition: color 150ms ease, background-color 150ms ease;
}

.header_nav-link:hover {
	color: var(--color-text);
	background-color: var(--color-hover);
}

.header_nav-link-active { color: var(--color-primary); }

.header_nav-link-active:hover {
	color: var(--color-primary);
	background-color: transparent;
}

.header_actions {
	justify-self: end;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-width: 4.5rem;
}

.header_theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border-radius: 9999px;
	border: 1px solid var(--color-border);
	background-color: var(--color-surface);
	box-shadow: var(--color-shadow);
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease;
}

.header_theme-toggle:hover { opacity: 0.85; }

.header_theme-toggle:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.header_theme-icon {
	width: 1rem;
	height: 1rem;
	object-fit: contain;
	display: none;
}

html:not([data-theme="light"]) .header_theme-icon--sun {
	display: block;
	width: 1.15rem;
	height: 1.15rem;
	filter: invert(1);
}

html[data-theme="light"] .header_theme-icon--moon { display: block; }

.mobile_header_bar { display: none; }

@media (max-width: 450px) {
	.page > .header { display: none; }

	.page > .mobile_header_bar {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		position: fixed;
		right: var(--space-sm);
		bottom: max(var(--space-sm), env(safe-area-inset-bottom, 0px));
		left: var(--space-sm);
		z-index: 1000;
		width: auto;
		max-width: none;
		padding: 0.625rem 1.25rem;
		border-radius: 1.25rem;
		border: 1px solid var(--color-border);
		background-color: var(--color-surface);
		backdrop-filter: blur(12px);
		box-shadow: var(--color-shadow);
		overflow: hidden;
	}

	.mobile_header_bar-row {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: var(--space-md);
	}

	.mobile_header_nav {
		max-height: 0;
		opacity: 0;
		overflow: hidden;
		transition:
			max-height 0.35s ease,
			opacity 0.25s ease,
			margin 0.35s ease;
	}

	.mobile_header_bar--open .mobile_header_nav {
		max-height: 20rem;
		opacity: 1;
		margin-bottom: var(--space-sm);
	}

	.mobile_header_nav-inner {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: var(--space-sm);
	}

	.mobile_header_nav-list {
		display: flex;
		flex-direction: column;
		gap: 0.15rem;
	}

	.mobile_header_link {
		display: flex;
		align-items: center;
		min-height: 2.25rem;
		padding: 0.375rem 0.75rem;
		border-radius: 9999px;
		font-size: 0.875rem;
		font-weight: 500;
		color: var(--color-text-muted);
		transition: color 150ms ease, background-color 150ms ease;
	}

	.mobile_header_link:hover {
		color: var(--color-text);
		background-color: var(--color-hover);
	}

	.mobile_header_link-active {
		color: var(--color-primary);
	}

	.mobile_header_actions {
		display: flex;
		align-items: center;
		gap: var(--space-xs);
	}

	.mobile_header_menu {
		display: inline-flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		gap: 0.22rem;
		width: 2rem;
		height: 2rem;
		padding: 0;
		border: none;
		border-radius: 9999px;
		background: transparent;
		color: var(--color-text);
		cursor: pointer;
	}

	.mobile_header_menu:focus-visible {
		outline: 2px solid var(--color-primary);
		outline-offset: 2px;
	}

	.mobile_header_menu-line {
		display: block;
		width: 1.05rem;
		height: 1.5px;
		border-radius: 9999px;
		background-color: currentColor;
		transform-origin: center;
		transition:
			transform 0.25s ease,
			opacity 0.2s ease;
	}

	.mobile_header_bar--open .mobile_header_menu-line:nth-child(1) {
		transform: translateY(0.3rem) rotate(45deg);
	}

	.mobile_header_bar--open .mobile_header_menu-line:nth-child(2) {
		opacity: 0;
	}

	.mobile_header_bar--open .mobile_header_menu-line:nth-child(3) {
		transform: translateY(-0.3rem) rotate(-45deg);
	}
}
