/* ==========================================================================
   Site header — nav left, logo centred, actions right
   ========================================================================== */

/* Fixed rather than sticky so it spans the full viewport width — the sidebar
   rail insets the body, and a sticky header would be pushed in with it. */
.bj-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--bj-z-header);
	background-color: var(--bj-surface);
	border-bottom: 1px solid var(--bj-border);
}

/* Keep clear of the WP admin bar. */
body.admin-bar .bj-header {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .bj-header {
		top: 46px;
	}
}

.bj-header__inner {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	height: var(--bj-header-height);
	max-width: none;
	padding-inline: var(--bj-gutter);
}

/* --- Left: primary nav ------------------------------------------------ */

.bj-header__nav {
	justify-self: start;
}

.bj-nav__list {
	display: flex;
	align-items: center;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Top-level items fill the header height so the dropdown sits flush against
   them — no dead gap for the pointer to fall through on the way down. */
.bj-nav__list > li {
	position: relative;
	display: flex;
	align-items: center;
	height: var(--bj-header-height);
}

.bj-nav__list a {
	display: block;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bj-text);
	transition: color var(--bj-transition);
}

.bj-nav__list a:hover,
.bj-nav__list .current-menu-item > a,
.bj-nav__list .current-menu-ancestor > a {
	color: var(--bj-text-strong);
}

/* --- Dropdowns --------------------------------------------------------- */

.bj-nav__list .menu-item-has-children > a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

/* Chevron on parent items */
.bj-nav__list .menu-item-has-children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--bj-transition);
}

.bj-nav__list .sub-menu {
	position: absolute;
	top: 100%;
	left: -14px;
	z-index: 1;
	min-width: 200px;
	margin: 0;
	padding: 6px;
	list-style: none;
	background-color: var(--bj-surface-2);
	border: 1px solid var(--bj-border);
	border-radius: var(--bj-radius-md);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity var(--bj-transition), transform var(--bj-transition),
		visibility var(--bj-transition);
}

.bj-nav__list .sub-menu a {
	padding: 10px 14px;
	border-radius: 6px;
	letter-spacing: 0.05em;
	white-space: nowrap;
	transition: color var(--bj-transition), background-color var(--bj-transition);
}

.bj-nav__list .sub-menu a:hover,
.bj-nav__list .sub-menu a:focus-visible {
	background-color: var(--bj-surface-3);
	color: var(--bj-text-strong);
}

/* Hover for pointers, focus-within for keyboards */
.bj-nav__list > .menu-item-has-children:hover > .sub-menu,
.bj-nav__list > .menu-item-has-children:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.bj-nav__list > .menu-item-has-children:hover > a::after,
.bj-nav__list > .menu-item-has-children:focus-within > a::after {
	transform: rotate(-135deg);
	margin-top: 2px;
}

/* --- Centre: logo ----------------------------------------------------- */

.bj-header__logo {
	justify-self: center;
	display: flex;
	align-items: center;
	font-size: 26px;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1;
	color: var(--bj-text-strong);
}

.bj-header__logo img {
	display: block;
	max-height: calc(var(--bj-header-height) - 22px);
	width: auto;
}

.bj-header__logo-accent {
	color: var(--bj-red);
}

/* --- Right: actions --------------------------------------------------- */

.bj-header__actions {
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 20px;
}

/* --- Mobile menu toggle ----------------------------------------------- */

.bj-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-left: -8px;
	padding: 0;
	border: 0;
	border-radius: var(--bj-radius-md);
	background: none;
	color: var(--bj-text);
	cursor: pointer;
}

.bj-header__toggle:hover {
	background-color: var(--bj-surface-3);
}

.bj-header__toggle span {
	position: relative;
	display: block;
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background-color: currentColor;
}

.bj-header__toggle span::before,
.bj-header__toggle span::after {
	content: "";
	position: absolute;
	left: 0;
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background-color: currentColor;
}

.bj-header__toggle span::before {
	top: -6px;
}

.bj-header__toggle span::after {
	top: 6px;
}

/* --- Responsive -------------------------------------------------------- */

@media (max-width: 1024px) {
	.bj-header__toggle {
		display: inline-flex;
	}

	.bj-header__nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		padding: 8px var(--bj-gutter) 20px;
		background-color: var(--bj-surface);
		border-bottom: 1px solid var(--bj-border);
	}

	.bj-header.is-menu-open .bj-header__nav {
		display: block;
	}

	.bj-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.bj-nav__list > li {
		display: block;
		height: auto;
	}

	.bj-nav__list a {
		padding: 14px 0;
		border-bottom: 1px solid var(--bj-border);
	}

	/* Dropdowns flatten into an indented block — no hover on touch. */
	.bj-nav__list .sub-menu {
		position: static;
		min-width: 0;
		padding: 0 0 0 18px;
		background: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	.bj-nav__list .sub-menu a {
		padding: 12px 0;
		border-radius: 0;
		color: var(--bj-text-muted);
		white-space: normal;
	}

	.bj-nav__list .sub-menu a:hover,
	.bj-nav__list .sub-menu a:focus-visible {
		background: none;
	}

	.bj-nav__list .menu-item-has-children > a::after {
		display: none;
	}

	.bj-header__actions {
		gap: 12px;
	}
}

@media (max-width: 640px) {
	.bj-header__logo {
		font-size: 21px;
	}

	.bj-header__login {
		display: none;
	}

	.bj-btn--outline {
		padding: 10px 16px;
		font-size: 12px;
	}
}
