/* BAR Theme — Header styles */

.bar-header {
	/* Width of the full-bleed margin: browser edge → site container edge */
	--bar-bleed: max(0px, calc((100% - var(--bar-content)) / 2));
	position: fixed;
	top: 0;
	inset-inline: 0;
	z-index: 900;
	height: 100px;
	background-color: var(--wp--preset--color--secondary);
	overflow: hidden;
}

.bar-header__inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: var(--bar-content);
	height: 100%;
	margin-inline: auto;
	padding-inline: var(--bar-section-x);
}

/* Dark-emerald shape — anchored to the site-container left edge, full height.
 * Inlined from assets/svg/header-bar-bg.svg, natural proportions (no stretch). */
.bar-header > svg {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--bar-bleed);
	width: auto;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

/* Fill set here (not in the SVG) so Illustrator re-exports can't break it —
 * this beats the inline `.st0` rule on specificity regardless of class name. */
.bar-header > svg path {
	fill: #104246;
}

/* Solid emerald fill — site-container left edge out to the browser edge.
 * Overlaps 1px under the SVG to absorb subpixel rounding (no visible seam). */
.bar-header::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: calc(100% - var(--bar-bleed) - 1px);
	background: #104246; /* matches header-bar-bg.svg fill */
	z-index: 0;
}

/* Logo */
.bar-header__logo {
	display: flex;
	align-items: center;
	text-decoration: none;
	flex-shrink: 0;
}

.bar-header__logo img {
	height: 54px;
	width: auto;
	transition: opacity 0.2s ease;
}

.bar-header__logo:hover img,
.bar-header__logo:focus-visible img {
	opacity: 0.8;
}

.bar-header__logo-text {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: 1.25rem;
	color: #fff;
	letter-spacing: -0.02em;
}

/* Nav list */
.bar-nav-list {
	display: flex;
	align-items: center;
	gap: 32px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.bar-nav-list a {
	font-family: var(--wp--preset--font-family--body);
	font-weight: 500;
	font-size: 1rem;
	color: rgba(255, 255, 255, 0.9);
	text-decoration: none;
	transition: color 0.18s ease;
}

.bar-nav-list a:hover,
.bar-nav-list a:focus-visible {
	color: var(--wp--preset--color--accent-soft);
}

.bar-nav-list .is-active > a {
	color: #fff;
}

/* CTA pill — selectors scoped to .bar-nav-list so they out-specify the generic
 * `.bar-nav-list a` rule (which would otherwise collapse the transition). */
.bar-nav-list a.bar-nav-cta {
	display: inline-block;
	padding: 10px 22px;
	background-color: var(--wp--preset--color--footer-bar);
	color: #fff !important;
	border-radius: var(--bar-radius-button);
	font-weight: 500;
	font-size: 0.9375rem;
	text-decoration: none;
	transition:
		background-color 0.18s ease,
		color 0.18s ease,
		box-shadow 0.18s ease,
		transform 0.18s ease;
	box-shadow: var(--bar-shadow-sm);
}

/* Hover = the Accent button style (light blue, dark text) with the same lift
 * as the page buttons — no new colour invented. */
.bar-nav-list a.bar-nav-cta:hover,
.bar-nav-list a.bar-nav-cta:focus-visible {
	background-color: var(--wp--preset--color--accent-soft);
	color: var(--wp--preset--color--primary) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
	.bar-nav-list a.bar-nav-cta {
		transition: background-color 0.18s ease, color 0.18s ease;
	}

	.bar-nav-list a.bar-nav-cta:hover,
	.bar-nav-list a.bar-nav-cta:focus-visible {
		transform: none;
	}
}

/* Hamburger — hidden on desktop */
.bar-header__hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 6px;
	width: 40px;
	height: 40px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
}

.bar-hamburger__line {
	display: block;
	width: 26px;
	height: 2px;
	background-color: #fff;
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Mobile nav drawer — top-anchored translucent sheet, only as tall as its
 * content (max-content). The page hero shows through the 80% emerald veil. */
.bar-nav-drawer {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: max-content;
	max-height: 100dvh;
	z-index: 950;
	background-color: rgba(16, 66, 74, 0.8); /* #104246 @ 80% */
	backdrop-filter: blur(2px);
	padding: 0 0;
	overflow-y: auto;
	transform: translateY(-100%);
	transition: transform 0.28s ease;
}

.bar-nav-drawer[hidden] {
	display: none;
}

.bar-nav-drawer.is-open {
	display: block;
	transform: translateY(0);
}

/* Curved emerald top bar — same composition as the site header: dark blob
 * left-anchored at natural proportions (width auto — never centred/stretched)
 * holding the logo, curving up to the top-right; the X sits on the green. */
.bar-nav-drawer__bar {
	position: relative;
	display: flex;
	align-items: center;
	height: 88px;
	background-color: #397767;
	overflow: hidden;
}

.bar-nav-drawer__bar > svg {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: auto;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

/* Fill set here (not in the SVG) so re-exports can't break it. */
.bar-nav-drawer__bar > svg path {
	fill: #104246;
}

.bar-nav-drawer__logo {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	padding-left: 24px;
	text-decoration: none;
}

.bar-nav-drawer__logo img {
	height: 44px;
	width: auto;
}

.bar-nav-drawer__close {
	position: absolute;
	top: 50%;
	right: 20px;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	cursor: pointer;
	color: #fff;
	padding: 0;
	transition: opacity 0.18s ease;
}

.bar-nav-drawer__close:hover,
.bar-nav-drawer__close:focus-visible {
	opacity: 0.75;
}

.bar-nav-drawer__close svg {
	width: 34px;
	height: 34px;
	stroke: currentcolor;
	stroke-width: 2.25;
}

/* Nav — centred link stack */
.bar-nav-drawer__nav {
	padding: 20px 20px 24px;
	background-color: #397767;
}

.bar-nav-drawer__list {
	list-style: none;
	margin: 0;
	padding: 0;
	text-align: center;
}

.bar-nav-drawer__list a {
	display: block;
	padding: 16px 0;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: clamp(20px, 5.5vw, 24px);
	color: #fff;
	text-decoration: none;
	letter-spacing: -0.02em;
	transition: color 0.18s ease;
}

.bar-nav-drawer__list a:hover,
.bar-nav-drawer__list a:focus-visible {
	color: var(--wp--preset--color--accent-soft);
}

/* Overlay — green veil (not black) so the hero behind reads as in the design */
.bar-nav-overlay {
	position: fixed;
	inset: 0;
	z-index: 940;
	background-color: rgba(16, 66, 74, 0.55);
}

.bar-nav-overlay[hidden] {
	display: none;
}

/* Offset page content for fixed header */
body {
	padding-top: 100px;
}

/* Admin bar offset — WP adds 32px top margin to body when admin bar is visible */
.admin-bar .bar-header {
	top: 32px;
}

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

/* Tablet — the horizontal menu stops fitting cleanly below ~920px (client snag:
 * it wraps and cramps across the ~769–920 band), so swap to the hamburger drawer
 * here. The bar keeps its full 100px height down to 768px; only the nav changes. */
@media (max-width: 920px) {
	.bar-header__nav {
		display: none;
	}

	.bar-header__hamburger {
		display: flex;
	}

	/* Animate hamburger to X when open */
	.bar-header__hamburger[aria-expanded="true"] .bar-hamburger__line:nth-child(1) {
		transform: translateY(8px) rotate(45deg);
	}

	.bar-header__hamburger[aria-expanded="true"] .bar-hamburger__line:nth-child(2) {
		opacity: 0;
	}

	.bar-header__hamburger[aria-expanded="true"] .bar-hamburger__line:nth-child(3) {
		transform: translateY(-8px) rotate(-45deg);
	}
}

/* Phone — shrink the bar itself. */
@media (max-width: 768px) {
	.bar-header {
		height: 60px;
	}

	body {
		padding-top: 60px;
	}

	.bar-header__inner {
		padding-inline: 20px;
	}

	.bar-header__logo img {
		height: 39px;
	}

	/* Admin bar is 46px on narrow screens */
	.admin-bar .bar-header {
		top: 0;
	}
}
