/* Header */
.header {
	padding: 16px 20px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(243, 248, 250, 0.92) 100%);
	border-bottom: 1px solid var(--vct-border);
	backdrop-filter: blur(10px);
}

.header-inner {
	max-width: 1070px;
	margin: 0 auto;
	display: grid;
	grid-template-areas: "brand nav auth";
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
}

.header-brand-container {
	grid-area: brand;
	min-width: 0;
}

.header-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
	text-decoration: none;
}

.header-logo {
	width: 42px;
	height: 42px;
	display: block;
	flex: 0 0 auto;
}

.header-copy {
	min-width: 0;
}

.header-kicker {
	margin: 0 0 2px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vct-accent);
}

.header h1 {
	margin: 0;
	font-size: 1.45rem;
	line-height: 1.15;
	color: var(--vct-text);
	overflow-wrap: anywhere;
}

.header-nav {
	grid-area: nav;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 14px;
	justify-self: center;
	min-width: 0;
}

.header-nav a {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	font-size: 1rem;
	text-decoration: none;
	color: var(--vct-text-muted);
	padding: 6px 4px;
	border: 0;
	background: transparent;
	transition: color 0.15s ease;
	white-space: nowrap;
}

.header-nav a::after {
	content: "";
	position: absolute;
	right: 4px;
	bottom: 3px;
	left: 4px;
	height: 2px;
	border-radius: 999px;
	background: var(--vct-border-strong);
	transform: scaleX(0);
	transform-origin: center;
	transition: background 0.15s ease, transform 0.15s ease;
}

.header-nav a:hover {
	color: var(--vct-text);
}

.header-nav a:hover::after {
	transform: scaleX(1);
}

.header-nav a:focus-visible {
	outline: none;
	border-radius: 4px;
	box-shadow: 0 0 0 3px var(--vct-accent-ring-soft);
}

.header-nav a.is-active,
.header-nav a[aria-current="page"] {
	color: var(--vct-text);
	font-weight: 600;
}

.header-nav a.is-active::after,
.header-nav a[aria-current="page"]::after {
	background: var(--vct-accent);
	transform: scaleX(1);
}

.header-nav a.is-active:hover,
.header-nav a[aria-current="page"]:hover {
	color: var(--vct-text);
}

.header-nav a.is-active:hover::after,
.header-nav a[aria-current="page"]:hover::after {
	background: var(--vct-accent-strong);
}

/* Header actions */
.vct-auth-button-container {
	grid-area: auth;
	justify-self: end;
	position: relative;
	min-width: 0;
}

.vct-auth-actions {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
}

.vct-auth-btn {
	flex: 1;
	padding: 8px 20px;
}

.avatar-menu {
	position: relative;
}

.avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	background: var(--vct-surface-alt);
	border: 1px solid var(--vct-border);
	color: var(--vct-text);
	font: inherit;
	padding: 0;
	transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.avatar:hover {
	background: var(--vct-surface);
	border-color: var(--vct-border-strong);
	transform: translateY(-1px);
}

.dropdown {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	width: min(208px, calc(100vw - 32px));
	min-width: min(184px, calc(100vw - 32px));
	max-height: min(360px, calc(100vh - 96px));
	overflow-y: auto;
	background: var(--vct-surface);
	border: 1px solid var(--vct-border);
	border-radius: 8px;
	box-shadow: 0 16px 32px rgba(29, 42, 34, 0.14);
	padding: 6px 0;
	z-index: 20;
}

.dropdown .user-info {
	padding: 12px 14px 10px;
}

.dropdown .label {
	font-size: 0.75rem;
	line-height: 1.25;
	color: var(--vct-text-muted);
}

.dropdown .username {
	font-size: 0.9rem;
	line-height: 1.35;
	font-weight: 600;
	color: var(--vct-text);
	margin-top: 2px;
	overflow-wrap: anywhere;
}

.dropdown .divider {
	height: 1px;
	background: var(--vct-border);
	margin: 6px 0;
}

.dropdown .menu-item {
	width: 100%;
	min-height: 44px;
	display: flex;
	align-items: center;
	padding: 10px 14px;
	background: none;
	border: none;
	text-align: left;
	font-size: 0.9rem;
	line-height: 1.25;
	cursor: pointer;
	font: inherit;
}

.dropdown .menu-item:hover,
.dropdown .menu-item:focus-visible {
	background: var(--vct-surface-alt);
	outline: none;
}

.dropdown .menu-item.logout {
	color: #dc2626;
}

.vct-auth-dropdown-toggle {
	cursor: pointer;
}

.vct-auth-dropdown-toggle[aria-expanded="true"] {
	box-shadow: 0 0 0 3px var(--vct-accent-ring-soft);
	background: var(--vct-surface);
	border-color: var(--vct-accent);
}

.vct-auth-btn:enabled:hover {
	transform: translateY(-1px);
}

.vct-auth-btn.logout:enabled:hover {
	background: var(--vct-danger-soft);
	border-color: #f1bdbd;
	color: var(--vct-danger);
}

.vct-user-indicator {
	position: relative;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	border: 1px solid var(--vct-border);
	background: var(--vct-surface-alt);
}

.vct-user-indicator:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--vct-accent-ring);
}

.vct-user-avatar::before {
	content: "";
	position: absolute;
	top: 8px;
	left: 50%;
	width: 10px;
	height: 10px;
	border-radius: 999px;
	background: #5a685f;
	transform: translateX(-50%);
}

.vct-user-avatar::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 8px;
	width: 16px;
	height: 9px;
	border-radius: 9px 9px 6px 6px;
	background: #5a685f;
	transform: translateX(-50%);
}

.vct-login-dialog {
	border: 0;
	border-radius: 12px;
	padding: 0;
	width: min(420px, calc(100vw - 32px));
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.vct-login-dialog::backdrop {
	background: rgba(29, 42, 34, 0.4);
}

.vct-login-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
}

.vct-login-form h2 {
	margin: 0 0 4px;
	font-size: 1.1rem;
}

.vct-login-label {
	font-size: 0.85rem;
	color: var(--vct-text-muted);
}

.vct-login-input {
	width: 100%;
	padding: 10px;
	border-radius: 8px;
	border: 1px solid var(--vct-border);
	font-size: 0.9rem;
}

.vct-login-input:focus-visible {
	outline: none;
	border-color: var(--vct-accent);
	box-shadow: 0 0 0 3px var(--vct-accent-ring-soft);
}

.vct-login-error {
	margin: 4px 0 0;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 0.8rem;
	color: var(--vct-danger);
	background: var(--vct-danger-soft);
	border: 1px solid #f1bdbd;
}

.vct-login-actions {
	margin-top: 6px;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

@media (max-width: 680px) {
	.header {
		padding: 12px 16px;
	}

	.header-inner {
		grid-template-areas:
			"brand auth"
			"nav nav";
		grid-template-columns: minmax(0, 1fr) auto;
		row-gap: 10px;
	}

	.header-nav {
		justify-self: stretch;
		justify-content: center;
		gap: 10px 14px;
	}

	.vct-auth-button-container {
		justify-self: end;
	}

}

@media (max-width: 520px) {
	.header {
		padding: 10px 12px;
	}

	.header-inner {
		gap: 10px;
	}

	.header-brand {
		gap: 9px;
	}

	.header-nav {
		justify-content: flex-start;
		flex-wrap: nowrap;
		gap: 14px;
		overflow-x: auto;
		padding: 0 2px 6px;
		scroll-padding-inline: 2px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.header-nav::-webkit-scrollbar {
		display: none;
	}

	.header-nav a {
		flex: 0 0 auto;
	}

	.vct-auth-button-container {
		align-self: center;
	}

	.vct-auth-actions {
		justify-content: flex-end;
	}

	.vct-auth-btn {
		min-height: 38px;
		padding: 8px 14px;
	}

	.avatar,
	.vct-user-indicator {
		width: 38px;
		height: 38px;
		flex-basis: 38px;
	}

	.vct-user-avatar::before {
		top: 7px;
	}

	.vct-user-avatar::after {
		bottom: 7px;
	}

	.dropdown {
		right: -2px;
		width: min(208px, calc(100vw - 24px));
		min-width: min(184px, calc(100vw - 24px));
	}
}

@media (max-width: 360px) {
	.header-brand {
		gap: 7px;
	}
}
