/* ==========================================================================
   BUDDIES HEADER + ANNOUNCEMENT BAR
   Loaded only on the pages in the plugin's page map.

   THE SCROLL BEHAVIOUR IS PURE CSS.
   .bwh-bar and .bwh-head are siblings in normal flow. Only the header is
   position:sticky, so the bar scrolls up and out with the page and the header
   then pins itself at top:0. No scroll listener, nothing to fall out of sync,
   and on a browser without sticky support it degrades to a normal header
   rather than breaking.
   ========================================================================== */

/* --- Suppress what would otherwise be duplicated ------------------------- */

/* The theme's own header. Scoped to .buddies-page so the client's other pages
   are untouched. Several selectors because we do not control the theme; the
   JS adds a last-resort fallback for a theme none of these match. */
body.buddies-page > header,
body.buddies-page #masthead,
body.buddies-page .site-header,
body.buddies-page header.site-header,
body.buddies-page header#header,
body.buddies-page .elementor-location-header,
body.buddies-page [data-elementor-type="header"] {
	display: none !important;
}

/* The announcement bar also exists inside the homepage content, because it was
   section 00 of the design file. Now that the plugin renders it globally, hide
   the in-page copy rather than editing the page — reversible, and it survives
   a re-import of the page content. */
body.buddies-page .elementor section[data-screen-label="00 Ankündigung"] {
	display: none !important;
}

/* --- Root ---------------------------------------------------------------- */

/* display:contents is load-bearing, not tidying.
   A position:sticky element can only stick inside its own parent's box. With
   .bwh-root as a normal div, that box ends just below the header — so the
   header unstuck itself and scrolled away the moment you passed it. Taking the
   wrapper out of the layout makes the bar and the header direct children of
   <body> for layout purposes, and the header then sticks for the whole page.
   Do not give this element a display value that creates a box again. */
.bwh-root {
	display: contents;
	font-family: var(--font-body, "Lato", system-ui, sans-serif);
	--bwh-h: 76px;
}
/* --bwh-h must also reach the header if a browser ever ignores the above. */
.bwh-bar, .bwh-head { --bwh-h: 76px; }
@media (max-width: 1100px) { .bwh-bar, .bwh-head { --bwh-h: 66px; } }
.bwh-root *,
.bwh-root *::before,
.bwh-root *::after { box-sizing: border-box; }

/* --- Announcement bar ---------------------------------------------------- */

.bwh-bar {
	background: var(--black, #000);
	color: var(--white, #fff);
	padding: 12px 24px;
}
.bwh-bar-inner {
	max-width: min(1720px, 94vw);
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px 28px;
	text-align: center;
}
.bwh-bar-text,
.bwh-count,
.bwh-bar-cta {
	font-family: var(--font-heading, "M PLUS 2", system-ui, sans-serif);
	font-weight: var(--weight-heading-alt, 800);
	font-size: 12px;
	letter-spacing: .12em;
	text-transform: uppercase;
	line-height: 1.4;
}
.bwh-bar-text { display: flex; align-items: center; gap: 10px; }
.bwh-dot {
	width: 8px; height: 8px; border-radius: 999px;
	background: var(--gold-500, #EFAB00); flex: none;
}
.bwh-count {
	color: var(--gold-500, #EFAB00);
	letter-spacing: .1em;
	font-variant-numeric: tabular-nums;
}
.bwh-bar-cta {
	color: var(--white, #fff);
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-color: var(--gold-500, #EFAB00);
	letter-spacing: .1em;
}
.bwh-bar-cta:hover { text-decoration-color: var(--white, #fff); }

/* --- Header -------------------------------------------------------------- */

/* THIS RULE IS WHAT MAKES THE HEADER STICK AT ALL.
   The theme sets `overflow-x: hidden` on <body> to stop sideways scrolling.
   Any overflow value other than `visible` turns that element into the scroll
   container for position:sticky inside it — and because <body> itself never
   scrolls (the document does), the header had nothing to stick to and simply
   scrolled away. `clip` prevents the same sideways scrolling but does NOT
   create a scroll container, so sticky works again.
   Scoped to .buddies-page: the client's own pages keep the theme's `hidden`.
   Verified separately that all 13 pages have zero horizontal overflow, so
   nothing is being clipped that should have been reachable. On a browser too
   old for `clip` the declaration is ignored, the theme's `hidden` stands, and
   the header degrades to a normal non-sticky one — no layout damage. */
body.buddies-page {
	overflow-x: clip;
}

.bwh-head {
	position: sticky;
	top: 0;
	z-index: 900;
	background: var(--white, #fff);
	border-bottom: 1px solid transparent;
	transition: box-shadow .18s ease, border-color .18s ease;
}
/* JS sets data-stuck once the header has actually pinned, so the shadow only
   appears when it is floating over content and not while it sits in the flow. */
/* Logged-in editors get WordPress's fixed admin bar across the top; without
   this the pinned header slides underneath it. Visitors never see this rule. */
body.admin-bar .bwh-head { top: 32px; }
@media screen and (max-width: 782px) { body.admin-bar .bwh-head { top: 46px; } }

.bwh-head[data-stuck="true"] {
	border-bottom-color: var(--sand-300, #E2D7CB);
	box-shadow: 0 6px 24px -18px rgba(0, 0, 0, .45);
}
.bwh-head-inner {
	max-width: min(1720px, 94vw);
	margin: 0 auto;
	min-height: var(--bwh-h);
	display: flex;
	align-items: center;
	gap: 24px;
}

/* --- Logo ---------------------------------------------------------------- */

.bwh-logo { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.bwh-logo-img { display: block; height: 44px; width: auto; max-width: 220px; }
.bwh-logo--text {
	font-family: var(--font-heading, "M PLUS 2", system-ui, sans-serif);
	font-weight: 800;
	font-size: 30px;
	letter-spacing: -.02em;
	color: var(--blue-500, #2660FF);
}

/* --- Nav ----------------------------------------------------------------- */

.bwh-nav {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 28px;
}
.bwh-menu {
	display: flex;
	align-items: center;
	gap: 26px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.bwh-item { position: relative; margin: 0; }

/* SPECIFICITY, NOT DECORATION.
   "Leistungen" and "Standorte" are <button> elements, and the client's theme
   styles bare buttons with a blue pill background, its own font and its own
   padding. A single .bwh-top class lost that fight and the two dropdown
   triggers rendered as blue buttons instead of nav links. This longer selector
   outranks the theme without resorting to !important, which would in turn be
   impossible for anyone to override later. */
.bwh-root .bwh-head .bwh-menu button.bwh-top,
.bwh-root .bwh-head .bwh-menu a.bwh-top,
.bwh-top {
	appearance: none;
	-webkit-appearance: none;
	background: none;
	background-color: transparent;
	background-image: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	min-height: 0;
	width: auto;
	line-height: 1.2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-heading, "M PLUS 2", system-ui, sans-serif);
	font-weight: 800;
	font-size: 14px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--black, #000);
	text-decoration: none;
	background: none;
	border: 0;
	padding: 8px 0;
	cursor: pointer;
	white-space: nowrap;
}
.bwh-top:hover { color: var(--blue-500, #2660FF); }
.bwh-caret { transition: transform .18s ease; }
.bwh-item.is-open > .bwh-top .bwh-caret { transform: rotate(180deg); }

/* Dropdown */

/* THE 10px GAP HAS TO BE HOVERABLE, OR THE MENU IS UNUSABLE.
   The panel is offset 10px below the trigger so it reads as a separate card.
   But the <li> that owns the hover ends at the button's bottom edge, so moving
   the pointer down into the panel crosses 10px of nothing — mouseleave fires on
   the li and the menu closes before the cursor arrives. Reported from the live
   dev site: "the dropdown closes as soon as the cursor leaves the header".

   This bridges the gap with a transparent strip that belongs to the panel, so
   the pointer never leaves the li's subtree. It spans the panel's full width,
   which is wider than the trigger, so diagonal approaches are covered too. The
   panel is pointer-events:none while closed, so the bridge is inert until the
   menu is actually open and can never swallow a click on the page behind it. */
.bwh-sub::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -14px;
	height: 14px;
}

.bwh-sub {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%) translateY(-6px);
	min-width: 250px;
	background: var(--white, #fff);
	border: 1px solid var(--sand-300, #E2D7CB);
	border-radius: 14px;
	box-shadow: 0 18px 44px -24px rgba(0, 0, 0, .5);
	padding: 8px;
	list-style: none;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.bwh-item.is-open > .bwh-sub {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}
.bwh-sub li { margin: 0; }
.bwh-sublink {
	display: block;
	padding: 10px 14px;
	border-radius: 9px;
	font-size: 15px;
	line-height: 1.35;
	color: var(--ink-600, #3D3D3D);
	text-decoration: none;
}
.bwh-sublink:hover {
	background: var(--blue-050, #EDF2FF);
	color: var(--blue-700, #1B47C4);
}

/* --- Buttons ------------------------------------------------------------- */

.bwh-cta { display: flex; align-items: center; gap: 12px; flex: none; }
.bwh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-heading, "M PLUS 2", system-ui, sans-serif);
	font-weight: 800;
	font-size: 13px;
	letter-spacing: .07em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 13px 26px;
	border-radius: 999px;
	white-space: nowrap;
	transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.bwh-btn--ghost {
	color: var(--blue-500, #2660FF);
	border: 2px solid var(--blue-500, #2660FF);
	background: transparent;
}
.bwh-btn--ghost:hover { background: var(--blue-050, #EDF2FF); }
.bwh-btn--solid {
	color: var(--black, #000);
	background: var(--gold-500, #EFAB00);
	border: 2px solid var(--gold-500, #EFAB00);
}
.bwh-btn--solid:hover {
	background: var(--gold-600, #D69A00);
	border-color: var(--gold-600, #D69A00);
}

/* A link with no destination configured yet.
   This used to fade the button and set cursor:not-allowed, which made a
   perfectly finished header look broken in front of a client. All three CTAs
   now have real URLs, so nothing should ever match this — and if a future one
   does, a faint dotted underline flags it without wrecking how it looks. */
.bwh-root .is-pending {
	text-decoration: underline dotted;
	text-underline-offset: 5px;
	text-decoration-thickness: 1px;
}

/* --- Focus --------------------------------------------------------------- */

.bwh-root a:focus-visible,
.bwh-root button:focus-visible {
	outline: 3px solid var(--focus-ring, #2660FF);
	outline-offset: 3px;
	border-radius: 6px;
}

/* --- Burger -------------------------------------------------------------- */

/* Same theme-button problem as .bwh-top — see the note there. */
.bwh-root .bwh-head button.bwh-burger,
.bwh-burger {
	display: none;
	margin-left: auto;
	width: 46px; height: 46px;
	min-height: 0;
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	border-radius: 0;
	background: none;
	background-color: transparent;
	box-shadow: none;
	padding: 11px;
	cursor: pointer;
	flex-direction: column;
	justify-content: space-between;
}
.bwh-burger span {
	display: block; height: 2.5px; width: 100%;
	background: var(--black, #000); border-radius: 2px;
	transition: transform .2s ease, opacity .2s ease;
}
.bwh-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
.bwh-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.bwh-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-9.5px) rotate(-45deg); }

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

@media (max-width: 1100px) {
	.bwh-root { --bwh-h: 66px; }

	/* These must match the raised specificity used above, or the desktop rules
	   would keep winning inside this media query and the burger would stay
	   hidden on mobile. */
	.bwh-root .bwh-head button.bwh-burger,
	.bwh-burger { display: flex; }

	.bwh-nav {
		position: fixed;
		inset: 0 0 0 auto;
		width: min(400px, 88vw);
		background: var(--white, #fff);
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 0;
		padding: 22px 22px 40px;
		overflow-y: auto;
		transform: translateX(100%);
		transition: transform .24s ease;
		box-shadow: -20px 0 50px -30px rgba(0, 0, 0, .6);
		z-index: 950;
	}
	.bwh-nav.is-open { transform: translateX(0); }

	.bwh-menu { flex-direction: column; align-items: stretch; gap: 0; }
	.bwh-item { border-bottom: 1px solid var(--sand-200, #EEE6DD); }
	.bwh-root .bwh-head .bwh-menu button.bwh-top,
	.bwh-root .bwh-head .bwh-menu a.bwh-top,
	.bwh-top {
		width: 100%;
		justify-content: space-between;
		padding: 16px 2px;
		font-size: 15px;
	}

	.bwh-sub {
		position: static;
		transform: none;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		border: 0;
		box-shadow: none;
		border-radius: 0;
		min-width: 0;
		padding: 0 0 10px 12px;
		display: none;
	}
	.bwh-item.is-open > .bwh-sub { display: block; transform: none; }

	.bwh-cta {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		margin-top: 24px;
	}
	.bwh-btn { padding: 15px 22px; }

	/* Dim the page behind the open drawer. */
	.bwh-scrim {
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, .42);
		opacity: 0;
		visibility: hidden;
		transition: opacity .24s ease, visibility .24s;
		z-index: 940;
	}
	.bwh-scrim.is-open { opacity: 1; visibility: visible; }
}

@media (max-width: 1100px) {
	/* The logo anchor is a flex item with no ceiling, so a wide custom logo let
	   it take the full width and shoved the burger off the right edge — measured
	   at 390px, the logo was 390px wide inside a 366px bar and the burger sat
	   58px past the viewport. Reserve room for the burger and cap the rest. */
	.bwh-logo { max-width: calc(100% - 62px); }
	.bwh-logo-img { max-width: 100%; }
}

@media (max-width: 560px) {
	.bwh-bar-inner { gap: 6px 16px; }
	.bwh-bar-text,
	.bwh-count,
	.bwh-bar-cta { font-size: 11px; letter-spacing: .08em; }
	.bwh-logo-img { height: 36px; }
	.bwh-logo--text { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
	.bwh-root *,
	.bwh-scrim { transition: none !important; }
}

/* Printing a page with a pinned header repeats it on every sheet. */
@media print {
	.bwh-bar, .bwh-burger, .bwh-cta { display: none; }
	.bwh-head { position: static; box-shadow: none; }
}
