/**
 * HTA custom header.
 *
 * Layout notes:
 * - The whole header is one `position: sticky` element pinned with a negative
 *   top offset equal to the utility bar height. Scrolling therefore pushes the
 *   dark utility row out of view while the orange row stays at the top. Its
 *   containing block is the Astra #page wrapper (full document height), so the
 *   sticky range covers the entire page.
 * - Below 1024px the utility row is hidden and its height variable becomes 0,
 *   which turns the same rule into a plain top-pinned compact header.
 */

/* Brand tokens live in base.css; these are header-specific. */
:root {
	--hta-utility-h: 44px;
	--hta-mainnav-h: 68px;

	--hta-header-z: 990;
	--hta-panel-z: 1000;

	--hta-admin-offset: 0px;
}

/* The WP admin bar is fixed above 782px and static below it. */
body.admin-bar {
	--hta-admin-offset: 32px;
}

/*
 * Astra sets `overflow-x: hidden` on some layouts, which silently breaks
 * position: sticky. `clip` gives the same overflow protection without creating
 * a scroll container.
 */
html,
body {
	overflow-x: clip;
}

/* --------------------------------------------------------------------------
   Shared
   -------------------------------------------------------------------------- */

.hta-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1100;
	padding: 12px 20px;
	background: var(--hta-graphite);
	color: var(--hta-white);
	text-decoration: none;
}

.hta-skip-link:focus {
	left: 0;
}

.hta-header *,
.hta-mobile-panel * {
	box-sizing: border-box;
}

.hta-header .hta-menu,
.hta-mobile-panel .hta-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hta-header a,
.hta-mobile-panel a {
	text-decoration: none;
}

.hta-header a:focus-visible,
.hta-mobile-panel a:focus-visible,
.hta-header button:focus-visible,
.hta-mobile-panel button:focus-visible {
	outline: 2px solid var(--hta-white);
	outline-offset: 2px;
}

.hta-menu-placeholder {
	display: inline-block;
	padding: 4px 10px;
	border: 1px dashed currentColor;
	border-radius: 4px;
	font-size: 12px;
	opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Header shell / sticky behaviour
   -------------------------------------------------------------------------- */

.hta-header {
	position: sticky;
	top: calc(var(--hta-admin-offset) - var(--hta-utility-h));
	z-index: var(--hta-header-z);
	background: var(--hta-orange);
}

.hta-header__sentinel {
	display: block;
	width: 100%;
	height: 0;
}

/* --------------------------------------------------------------------------
   Utility bar (desktop only)
   -------------------------------------------------------------------------- */

.hta-utility {
	height: var(--hta-utility-h);
	background: var(--hta-graphite);
	color: var(--hta-white);
	font-size: 14px;
	line-height: 1.2;
}

.hta-utility__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: 100%;
}

.hta-utility__end {
	display: flex;
	align-items: center;
	gap: 14px;
}

.hta-menu--utility {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 18px;
}

.hta-menu--utility a {
	display: inline-block;
	padding: 4px 0;
	color: #ededed;
	transition: color var(--hta-transition);
}

.hta-menu--utility a:hover,
.hta-menu--utility a:focus-visible,
.hta-menu--utility .current-menu-item > a {
	color: var(--hta-orange);
}

/*
 * Action links render as buttons; the last one is the primary CTA. Admins can
 * also force either style with the menu item CSS class `hta-cta` (filled) or
 * `hta-ghost` (outlined).
 */
.hta-menu--actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.hta-menu--actions a {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 999px;
	color: var(--hta-white);
	white-space: nowrap;
	transition: background-color var(--hta-transition), border-color var(--hta-transition), color var(--hta-transition);
}

.hta-menu--actions a:hover,
.hta-menu--actions a:focus-visible {
	background: rgba(255, 255, 255, 0.14);
	border-color: var(--hta-white);
}

.hta-menu--actions > li:last-child > a,
.hta-menu--actions > li.hta-cta > a {
	background: var(--hta-orange);
	border-color: var(--hta-orange);
}

.hta-menu--actions > li:last-child > a:hover,
.hta-menu--actions > li:last-child > a:focus-visible,
.hta-menu--actions > li.hta-cta > a:hover,
.hta-menu--actions > li.hta-cta > a:focus-visible {
	background: var(--hta-orange-dark);
	border-color: var(--hta-orange-dark);
}

.hta-menu--actions > li.hta-ghost > a {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.55);
}

/* Language switcher */

.hta-lang {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.04em;
}

.hta-lang__current {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.12);
	color: var(--hta-white);
}

.hta-lang__link {
	display: inline-block;
	padding: 4px 8px;
	color: #ededed;
}

.hta-lang__link:hover,
.hta-lang__link:focus-visible {
	color: var(--hta-orange);
}

/* --------------------------------------------------------------------------
   Main navigation
   -------------------------------------------------------------------------- */

.hta-mainnav {
	background: var(--hta-orange);
	color: var(--hta-white);
}

.hta-mainnav__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: var(--hta-mainnav-h);
	transition: min-height var(--hta-transition);
}

.hta-brand {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.hta-brand__text {
	color: var(--hta-white);
	font-size: 20px;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hta-brand .custom-logo-link {
	display: inline-flex;
	align-items: center;
}

.hta-brand .custom-logo {
	display: block;
	width: auto;
	max-height: calc(var(--hta-mainnav-h) - 20px);
	transition: max-height var(--hta-transition);
}

.hta-mainnav__nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: flex-end;
}

.hta-menu--primary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 2px 4px;
}

.hta-menu--primary > li {
	position: relative;
}

.hta-menu--primary > li > a {
	display: inline-block;
	padding: 10px 12px;
	border-radius: 4px;
	color: var(--hta-white);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	transition: background-color var(--hta-transition);
}

.hta-menu--primary > li > a:hover,
.hta-menu--primary > li > a:focus-visible,
.hta-menu--primary > li.current-menu-item > a,
.hta-menu--primary > li.current-menu-ancestor > a {
	background: var(--hta-orange-dark);
}

/* One level of dropdowns, opened on hover and on keyboard focus. */
.hta-menu--primary .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1;
	min-width: 220px;
	margin: 0;
	padding: 6px 0;
	list-style: none;
	background: var(--hta-white);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--hta-transition), transform var(--hta-transition), visibility var(--hta-transition);
}

.hta-menu--primary > li:hover > .sub-menu,
.hta-menu--primary > li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.hta-menu--primary .sub-menu a {
	display: block;
	padding: 9px 16px;
	color: var(--hta-ink);
	font-size: 15px;
}

.hta-menu--primary .sub-menu a:hover,
.hta-menu--primary .sub-menu a:focus-visible {
	background: #f5f5f5;
	color: var(--hta-orange);
}

/* White focus rings are invisible on the light dropdown panel. */
.hta-menu--primary .sub-menu a:focus-visible {
	outline-color: var(--hta-graphite);
}

/* Slightly compacted once pinned. */
body.hta-header-stuck .hta-mainnav__inner {
	min-height: 58px;
}

body.hta-header-stuck .hta-brand .custom-logo {
	max-height: 38px;
}

/* --------------------------------------------------------------------------
   Hamburger
   -------------------------------------------------------------------------- */

.hta-burger {
	display: none;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--hta-white);
	cursor: pointer;
}

.hta-burger__box {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 26px;
	height: 18px;
}

.hta-burger__line {
	display: block;
	width: 100%;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform var(--hta-transition), opacity var(--hta-transition);
}

.hta-burger[aria-expanded="true"] .hta-burger__line:nth-child(1) {
	transform: translateY(8px) rotate(45deg);
}

.hta-burger[aria-expanded="true"] .hta-burger__line:nth-child(2) {
	opacity: 0;
}

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

/* --------------------------------------------------------------------------
   Mobile panel
   -------------------------------------------------------------------------- */

.hta-mobile-panel {
	position: fixed;
	inset: 0;
	z-index: var(--hta-panel-z);
	visibility: hidden;
	pointer-events: none;
}

body.hta-nav-open .hta-mobile-panel {
	visibility: visible;
	pointer-events: auto;
}

.hta-mobile-panel__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity var(--hta-transition);
}

body.hta-nav-open .hta-mobile-panel__backdrop {
	opacity: 1;
}

.hta-mobile-panel__inner {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(360px, 88vw);
	padding: 64px 24px 32px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--hta-graphite);
	color: var(--hta-white);
	transform: translateX(100%);
	transition: transform var(--hta-transition);
}

body.hta-nav-open .hta-mobile-panel__inner {
	transform: translateX(0);
}

.hta-mobile-panel__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--hta-white);
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}

.hta-mobile-panel__nav + .hta-mobile-panel__nav {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.hta-mobile-panel .hta-menu a {
	display: block;
	padding: 12px 0;
	color: var(--hta-white);
	line-height: 1.3;
}

.hta-menu--mobile-primary > li > a {
	font-size: 18px;
	font-weight: 700;
}

.hta-menu--mobile-primary .sub-menu {
	margin: 0 0 6px;
	padding: 0 0 0 16px;
	list-style: none;
	border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.hta-menu--mobile-primary .sub-menu a {
	padding: 9px 0;
	font-size: 15px;
	font-weight: 400;
	color: #e2e2e2;
}

.hta-menu--mobile-utility a {
	font-size: 16px;
	color: #e2e2e2;
}

.hta-mobile-panel .hta-menu a:hover,
.hta-mobile-panel .hta-menu a:focus-visible,
.hta-mobile-panel .current-menu-item > a {
	color: var(--hta-orange);
}

.hta-menu--mobile-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 12px;
}

.hta-menu--mobile-actions a {
	padding: 12px 16px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 999px;
	text-align: center;
	font-weight: 600;
}

.hta-menu--mobile-actions > li:last-child > a,
.hta-menu--mobile-actions > li.hta-cta > a {
	background: var(--hta-orange);
	border-color: var(--hta-orange);
}

.hta-mobile-panel .hta-menu--mobile-actions a:hover,
.hta-mobile-panel .hta-menu--mobile-actions a:focus-visible {
	color: var(--hta-white);
	border-color: var(--hta-white);
}

.hta-mobile-panel__lang {
	margin-top: 20px;
}

body.hta-nav-open {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
   Breakpoints
   -------------------------------------------------------------------------- */

/* Large tablet / small laptop: keep both desktop rows, tighten spacing. */
@media (max-width: 1200px) {

	.hta-menu--primary > li > a {
		padding: 10px 9px;
		font-size: 15px;
	}

	.hta-menu--utility {
		gap: 4px 14px;
	}

	.hta-menu--actions a {
		padding: 6px 12px;
	}
}

/* Tablet and mobile: one compact sticky orange header. */
@media (max-width: 1024px) {

	:root {
		--hta-utility-h: 0px;
		--hta-mainnav-h: 60px;
	}

	.hta-utility {
		display: none;
	}

	.hta-mainnav__nav {
		display: none;
	}

	.hta-burger {
		display: inline-flex;
	}

	.hta-mainnav__inner {
		gap: 12px;
	}

	body.hta-header-stuck .hta-mainnav__inner {
		min-height: var(--hta-mainnav-h);
	}
}

/* The WP admin bar is not fixed at this width, so no offset is needed. */
@media (max-width: 782px) {

	body.admin-bar {
		--hta-admin-offset: 0px;
	}
}

@media (max-width: 480px) {

	.hta-brand__text {
		font-size: 17px;
		letter-spacing: 0.04em;
	}
}

@media (prefers-reduced-motion: reduce) {

	.hta-header *,
	.hta-mobile-panel,
	.hta-mobile-panel * {
		transition-duration: 0.01ms !important;
	}
}
