// =============================================================================
// layout/_header.scss
// =============================================================================

.site-navbar {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: var(--navbar-bg);
	box-shadow: var(--navbar-shadow);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	transition: box-shadow var(--transition-base), background-color var(--transition-base);

	&.is-scrolled {
		box-shadow: 0 4px 12px var(--color-shadow);
	}
}

// Logo area.
.navbar-logo {
	padding: 0.5rem 0.75rem;

	img {
		max-height: 2.5rem;
		width: auto;
	}
}

.navbar-site-name {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
	color: var(--color-dark) !important;
	white-space: nowrap;
}

.site-title-initial {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background-color: var(--color-primary);
	color: #fff;
	font-weight: 700;
	font-size: 1rem;
}

// Hamburger burger – three-line → X animation.
.navbar-burger {
	background: transparent;
	border: none;
	padding: 0.5rem;
	transition: opacity var(--transition-base);

	span {
		display: block;
		width: 1.25rem;
		height: 2px;
		background: var(--color-text);
		margin: 4px 0;
		transition:
			transform 0.3s ease,
			opacity    0.3s ease;
		transform-origin: center;
	}

	&.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
	&.is-active span:nth-child(2) { opacity: 0; }
	&.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

// Search widget.
.navbar-search-wrap {
	position: relative;
}

.navbar-search-toggle {
	background: transparent;
	border: none;
	color: var(--color-text);
	font-size: 1rem;
	padding: 0.25rem 0.5rem;
	transition: color var(--transition-base);

	&:hover {
		color: var(--color-primary);
	}

	@include focus-ring;
}

.navbar-search-form {
	position: absolute;
	top: 110%;
	right: 0;
	background: var(--color-background);
	border: 1px solid var(--color-border);
	border-radius: 6px;
	padding: 0.5rem;
	box-shadow: var(--card-shadow);
	min-width: 200px;

	.input {
		border-color: var(--color-border);
		background: var(--color-background);
		color: var(--color-text);
	}
}

// Dark-mode toggle.
.theme-toggle {
	background: transparent;
	border: none;
	font-size: 1rem;
	color: var(--color-text);
	padding: 0.25rem 0.5rem;
	transition: color var(--transition-base);
	line-height: 1;

	&:hover {
		color: var(--color-primary);
	}

	@include focus-ring;
}

// Show only the relevant icon.
body:not([data-theme='dark']) .theme-toggle__light-icon { display: none; }
[data-theme='dark'] .theme-toggle__dark-icon { display: none; }

// Back-to-top button.
.back-to-top {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	z-index: 200;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background-color: var(--color-primary);
	color: #fff;
	border: none;
	font-size: 1.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--card-shadow);
	transition:
		opacity    var(--transition-base),
		transform  var(--transition-base),
		box-shadow var(--transition-base);
	opacity: 0;
	transform: translateY(1rem);
	pointer-events: none;

	&.is-visible {
		opacity: 1;
		transform: translateY(0);
		pointer-events: auto;
	}

	&:hover {
		box-shadow: var(--card-shadow-hover);
	}

	@include focus-ring;
}

// Skip link.
.skip-link {
	@include visually-hidden;

	&:focus {
		position: fixed;
		top: var(--space-2);
		left: var(--space-2);
		z-index: 9999;
		background: var(--color-primary);
		color: #fff;
		padding: var(--space-2) var(--space-3);
		border-radius: 4px;
		clip: auto;
		height: auto;
		width: auto;
		font-weight: 700;
		text-decoration: none;
	}
}
