/*
 * Heidesee Header widget — transparent-over-hero bar with a two-bar menu
 * toggle that opens a full-screen overlay navigation. The nav list is a
 * WordPress menu (location "heidesee-primary"). See widgets/class-header.php
 * and assets/header.js.
 */

:root {
	--hd-header-h: 88px;
}

/* Offset in-page anchor jumps for the fixed header (one-pager nav). */
html {
	scroll-padding-top: var(--hd-header-h);
	scroll-behavior: smooth;
}

.hd-header {
	width: 100%;
	background-color: transparent;
	transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Sticky variant: pinned to the top, over the hero — permanently visible,
   the bar never retracts on scroll (see header.js). */
.hd-header[data-sticky="1"] {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
}

/* Solid state once the page is scrolled: black bar, light content
   (customer call 2026-05-05). */
.hd-header.is-solid {
	background-color: var(--c-graphit);
	color: var(--c-kalkstein);
	box-shadow: 0 1px 0 rgba(232, 233, 228, 0.12);
}

/* The logo SVG is a dark single-fill graphic — brightness(0) + invert turns
   it pure white (customer request 2026-08: white beats kalkstein for
   contrast on the black bar). */
.hd-header.is-solid .hd-header__logo img {
	filter: brightness(0) invert(1);
}

.hd-header.is-solid .hd-header__bars i {
	background-color: #fff;
}

/* Full-width with the same --gutter inset as the hero caption, so the logo
   lines up with the content below (no --wrap-max centering here). */
.hd-header__inner {
	position: relative;
	z-index: 1002;
	padding: 16px var(--gutter);
	transition: padding 0.3s ease;
	min-height: var(--hd-header-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.hd-header__logo {
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

/* Height comes from the widget's slider (--hd-logo-h on .hd-header);
   once the bar is scrolled/solid the logo shrinks to ~70%. */
.hd-header__logo img {
	height: var(--hd-logo-h, 64px);
	width: auto;
	display: block;
	transition: height 0.25s ease;
}

.hd-header.is-solid .hd-header__logo img {
	height: calc(var(--hd-logo-h, 64px) * 0.7);
}

/* --- Buttons: reset the Elementor/theme kit button styling (fill, focus bg) --- */
.hd-header__toggle,
.hd-header__close {
	-webkit-appearance: none;
	appearance: none;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	color: inherit;
	cursor: pointer;
}

.hd-header__toggle:hover,
.hd-header__toggle:focus,
.hd-header__toggle:active,
.hd-header__close:hover,
.hd-header__close:focus,
.hd-header__close:active {
	background: transparent !important;
	box-shadow: none !important;
	outline: none;
}

.hd-header__toggle:focus-visible,
.hd-header__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* --- Three-bar toggle (Figma "Nav" icon: rounded 3px bars of 32/24/29px,
       the middle one shifted 4px down, the right one 1.5px) --- */
.hd-header__toggle {
	padding: 8px;
	margin: -8px;
	line-height: 0;
}

.hd-header__bars {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	height: 32px;
}

.hd-header__bars i {
	display: block;
	width: 3px;
	border-radius: 4px;
	background-color: var(--c-graphit);
	transition: opacity 0.2s ease;
}

.hd-header__bars i:nth-child(1) {
	height: 32px;
}

.hd-header__bars i:nth-child(2) {
	height: 24px;
	transform: translateY(4px);
}

.hd-header__bars i:nth-child(3) {
	height: 29px;
	transform: translateY(1.5px);
}

.hd-header__toggle:hover .hd-header__bars i {
	opacity: 0.6;
}

/* --- Full-screen overlay navigation --- */
.hd-header__overlay {
	position: fixed;
	inset: 0;
	z-index: 1001;
	/* Pure white for menu text and close X (customer request 2026-08:
	   kalkstein was hard to read on the green). */
	color: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 96px var(--gutter) 64px;
	visibility: hidden;
	transition: visibility 0.3s ease;
}

/* The green backdrop lives on a ::before so it can become fully opaque quickly,
   before the menu text fades in — otherwise the light text sits over a still
   translucent green during the open transition and is unreadable. */
.hd-header__overlay::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: var(--c-green);
	opacity: 0;
	transition: opacity 0.18s ease;
}

/* Menu content (close button + links) fades in only after the backdrop is
   opaque, so it is never shown over the still-translucent green. */
.hd-header__overlay > * {
	opacity: 0;
	transition: opacity 0.25s ease 0.12s;
}

.hd-header__overlay.is-open {
	visibility: visible;
}

.hd-header__overlay.is-open::before {
	opacity: 1;
}

.hd-header__overlay.is-open > * {
	opacity: 1;
}

/* When the browser supports :not() with [hidden] removed by JS, the overlay is
   display:flex; the [hidden] attribute (no-JS fallback) still fully hides it. */
.hd-header__overlay[hidden] {
	display: none;
}

/* Optically centered on the three-bar toggle so the icon doesn't jump when
   the overlay opens: the bars (25px wide) sit flush at the gutter, their
   center 12.5px in — the 40px button is offset so both centers coincide.
   Vertically the button spans the same height as the bar (logo height +
   2×16px padding, at least --hd-header-h) with the X centered inside,
   mirroring how the toggle is centered in the flex bar. */
.hd-header__close {
	position: absolute;
	top: 0;
	right: calc(max(20px, var(--gutter)) - 7.5px);
	width: 40px;
	height: calc(var(--hd-logo-h, 64px) + 32px);
	min-height: var(--hd-header-h);
	appearance: none;
	background: none;
	border: 0;
	cursor: pointer;
	color: inherit;
}

.hd-header__close span {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 2px;
	background-color: currentColor;
}

.hd-header__close span:first-child {
	transform: translate(-50%, -50%) rotate(45deg);
}

.hd-header__close span:last-child {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* Solid state: the logo (and with it the bar) is smaller — keep the X on the
   toggle's center there too. */
.hd-header.is-solid .hd-header__close {
	height: calc(var(--hd-logo-h, 64px) * 0.7 + 32px);
}

/* Over the hero (not yet scrolled) the bar sits lower — more air above the
   logo per Figma (y=34) and customer call 2026-05-05. The compact 16px
   padding returns with the solid state; mobile keeps the tight bar. The
   close button mirrors the taller bar so the X stays on the toggle center. */
@media (min-width: 768px) {
	.hd-header:not(.is-solid) .hd-header__inner {
		padding-top: 34px;
	}

	/* Toggle center = padding-top 34 + content-half; the X span sits at 50%
	   of this button, so height = 2 × (34px + logo/2) = logo + 68px. */
	.hd-header:not(.is-solid) .hd-header__close {
		height: calc(var(--hd-logo-h, 64px) + 68px);
	}
}

.hd-header__close:hover {
	opacity: 0.7;
}

.hd-header__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(16px, 2.5vw, 28px);
	text-align: center;
}

.hd-header__menu a {
	color: inherit;
	text-decoration: none;
	font-weight: var(--fw-medium);
	font-size: clamp(28px, 4vw, 50px);
	line-height: 1.1;
}

/* Accessible hover/focus: an underline instead of dimming — the links stay
   pure white and the state doesn't rely on a contrast change alone. No
   current-item marker: on the one-pager WP flags every anchor link as
   "current" (they all point to the front page). */
.hd-header__menu a:hover,
.hd-header__menu a:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 8px;
}

.hd-header__hint {
	max-width: 40ch;
	text-align: center;
	font-size: var(--fs-hinweis);
	opacity: 0.85;
}

/* Prevent body scroll while the overlay is open (class set by header.js). */
body.hd-menu-open {
	overflow: hidden;
}

/* While the overlay is open, hide the bar (logo + toggle) so only the overlay's
   own close button remains — avoids the dark logo/toggle sitting unreadably on
   the green overlay and the toggle overlapping the close button. The bar itself
   (z-index above the overlay) must not swallow clicks on the close button. */
body.hd-menu-open .hd-header__inner {
	pointer-events: none;
}

body.hd-menu-open .hd-header__logo,
body.hd-menu-open .hd-header__toggle {
	opacity: 0;
}

@media (max-width: 767px) {
	:root {
		--hd-header-h: 72px;
	}
	.hd-header {
		--hd-logo-h: 48px;
	}
}
