/* ==========================================================================
   Babor FSE Studio Theme — Header/Footer-Feinwerte
   ==========================================================================
   Alle Zahlen sind gegen den Husum-Master gemessen (tools/paritaet, Baseline
   in docs/P0-ABNAHME.md). Was theme.json ausdruecken kann, steht dort; hier
   nur Raster, Sticky, Breakpoints und Detailabstaende.

   Breakpoints (bewusst nur zwei Stufen, der Husum-Tablet-Header wird nicht
   uebernommen):
     >= 1024px  Desktop-Hauptzeile (Logo | Navigation | TERMINE)
     <  1024px  Burger; TERMINE bleibt bis 768px sichtbar
     <   768px  Mobil (TERMINE aus, Footer gestapelt)
   ========================================================================== */

/* --- Seitengeruest --------------------------------------------------------
   Kein Block-Gap zwischen Meta-Leiste, Header, Inhalt und Footer. */
.wp-site-blocks > * {
	margin-block-start: 0;
}

/* Meta-Leiste und Hauptzeile sind Grid-Container (vertikale Mitte). Ein
   Grid-Kind mit margin-inline:auto (constrained layout) schrumpft sonst auf
   Inhaltsbreite und wandert in die Mitte -> Breite explizit auf die Box. */
.bfs-topbar > *,
.bfs-hauptzeile > * {
	width: 100%;
}

/* ==========================================================================
   Meta-Leiste (45px, scrollt mit — nicht sticky)
   ========================================================================== */
.bfs-topbar {
	display: grid;
	align-content: center;
	min-height: var(--wp--custom--header--topbar-height);
	padding-block: 0;
}

.bfs-topbar__adresse {
	position: relative;
	margin: 0;
	box-sizing: border-box;
	padding-left: 21.3px; /* Icon 13px + 8.3px bis zur Glyphe (gemessen 120 -> 141.3) */
	font-size: 12.8px;
	font-weight: 400;
	line-height: 1.35;
	text-transform: uppercase;
	color: var(--wp--preset--color--black);
}

.bfs-topbar__adresse::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 13px;
	height: 13px;
	transform: translateY(-50%);
	background: url("../icons/map-marker.svg") center / contain no-repeat;
}

/* Schriftstufe wie Husum ab <= 1024px (Elementor-Tablet-Grenze einschliesslich). */
@media (max-width: 1024px) {
	.bfs-topbar__adresse { font-size: 12px; }
}
@media (max-width: 767.98px) {
	.bfs-topbar__adresse { font-size: 2.4vw; }
}

/* ==========================================================================
   Hauptzeile (80px fix, sticky)
   ==========================================================================
   Husum: min-height 12vh (= 80px nur bei 667px Fensterhoehe, 108px bei 900px).
   Abnahme-Entscheidung: fix 80px auf allen Breiten.
   Sticky sitzt am Template-Part-Wrapper, nicht an der Gruppe: position:sticky
   wirkt nur innerhalb des Elternelements, und das ist .wp-site-blocks. */
.wp-site-blocks > .bfs-header-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}
@media (max-width: 600px) {
	/* Admin-Bar ist hier nicht fixiert -> kein Versatz. */
	.wp-site-blocks > .bfs-header-part { top: 0; }
}

.bfs-hauptzeile {
	display: grid;
	align-content: center;
	min-height: var(--wp--custom--header--main-height);
	padding-block: 0;
	box-shadow: 0 0 38px 0 rgba(0, 0, 0, 0.1);
}

/* Spaltenraster wie Husum (Logo | Navigation | Button) in der 1200er-Box. */
.bfs-hauptzeile .bfs-hauptzeile__raster {
	display: grid;
	/* Husum: 17.982 | 63.695 | 17.987 % = 99.664 %; den Rest (0.336 %)
	   bekommt die Button-Spalte, damit TERMINE an der Content-Kante endet
	   (1320 bei 1440). justify-content:start neutralisiert das space-between
	   des Flex-Layouts, das sonst Luft zwischen die Spuren verteilt. */
	grid-template-columns: 17.982% 63.695% 1fr;
	justify-content: start;
	align-items: center;
	gap: 0;
}

/* Logo: Breite kommt aus dem Block-Attribut (Site-Editor), die Spalte deckelt.
   Husum: Attribut 216 -> 215.8px bei 1440, 176.9px bei 1024 (Spalte 17.982 %),
   130px mobil. Hamburg: Attribut 130 -> ueberall 130 x 37.1px. */
.bfs-logo {
	margin: 0;
	line-height: 0;
}
.bfs-logo a {
	display: block;
}
.bfs-logo img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* --- Navigation (Desktop) ------------------------------------------------- */
.bfs-hauptnav {
	justify-self: center;
	font-size: 16px;
	font-weight: 400;
	line-height: 20px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
}
.bfs-hauptnav,
.bfs-hauptnav .wp-block-navigation__container {
	gap: 8px; /* Elementor: 4px Margin je Seite zwischen den Links */
}

.bfs-hauptnav .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	padding: 0 5px;
}
.bfs-hauptnav .wp-block-navigation__container > .has-child > .wp-block-navigation-item__content {
	padding-right: 0;
}

.bfs-hauptnav .wp-block-navigation-item__content:hover,
.bfs-hauptnav .wp-block-navigation-item__content:focus-visible {
	color: var(--wp--preset--color--grey);
}
.bfs-hauptnav .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--black);
}

/* Caret: gefuelltes Dreieck wie Husum statt Core-Chevron.
   Text -> 10px -> 16px-Icon -> 5px (gemessen: Linkbreite 171.4px). */
.bfs-hauptnav .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-icon {
	width: 16px;
	height: 16px;
	margin: 0 5px 0 10px;
	padding: 0;
}
.bfs-hauptnav .wp-block-navigation__submenu-icon svg {
	display: none;
}
.bfs-hauptnav .wp-block-navigation__submenu-icon::before {
	content: "";
	display: block;
	width: 100%;
	height: 100%;
	background-color: currentColor;
	-webkit-mask: url("../icons/caret-down.svg") center / contain no-repeat;
	mask: url("../icons/caret-down.svg") center / contain no-repeat;
}

/* Untermenue (Desktop): weiss, ohne Rahmen/Schatten, so breit wie der
   laengste Eintrag (Husum 221px), Eintraege 12px Innenabstand, 28px unter
   dem Link. Selektoren mit .wp-block-navigation, weil Core mit (0,4,0)
   Rahmen, Padding .5em 1em und Schwarz setzt. */
.bfs-hauptnav.wp-block-navigation .wp-block-navigation__submenu-container {
	left: 0;
	width: max-content;
	min-width: 0;
	margin-top: 28px;
	padding: 0;
	border: 0;
	box-shadow: none;
	background-color: var(--wp--preset--color--white);
	font-size: 16px;
	font-weight: 400; /* Husum: 500 -> rendert mangels Datei als 400, s. Doku */
	letter-spacing: normal;
	text-transform: none;
	color: #33373d;
}
/* Unsichtbare Bruecke ueber die 28px, damit Hover nicht abreisst. */
.bfs-hauptnav .wp-block-navigation__submenu-container::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 28px;
}
.bfs-hauptnav.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	left: 100%;
	top: 0;
	margin-top: 0;
}
.bfs-hauptnav.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before {
	content: none;
}
.bfs-hauptnav.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 12px 12px 12px 20px; /* Elementor: +8px border-inline-start je Unterpunkt */
	white-space: nowrap;
}
/* Verschachtelt (Medical): Caret nach rechts, direkt hinter dem Text. */
.bfs-hauptnav.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon {
	position: static;
	width: 10px;
	height: 16px;
	margin: 0 12px 0 -4px;
	padding: 0;
	transform: rotate(-90deg);
}

/* --- TERMINE-Button ------------------------------------------------------- */
.bfs-termine {
	justify-content: flex-end;
}
.bfs-termine .wp-block-button__link {
	line-height: 14px;
	box-shadow: 0 0 27px 0 rgba(0, 0, 0, 0.12);
	text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Sichtbarer Fokus (WCAG 2.4.7) */
.bfs-hauptzeile a:focus-visible,
.bfs-hauptzeile button:focus-visible,
.bfs-footer-haupt a:focus-visible,
.bfs-footer-service a:focus-visible,
.bfs-footer-recht a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* --- Burger unter 1024px --------------------------------------------------
   Core schaltet erst unter 600px auf Burger. Zwischen 600 und 1023px wird
   das Overlay hier erzwungen. */
@media (min-width: 600px) and (max-width: 1023.98px) {
	.bfs-hauptnav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
	.bfs-hauptnav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

@media (max-width: 1023.98px) {
	.bfs-hauptzeile .bfs-hauptzeile__raster {
		grid-template-columns: 17.982% 1fr auto auto;
		column-gap: 20px;
	}
	.bfs-termine { order: 2; grid-column: 3; }
	.bfs-hauptnav { order: 3; grid-column: 4; justify-self: end; }
}

@media (max-width: 767.98px) {
	.bfs-hauptzeile .bfs-hauptzeile__raster {
		grid-template-columns: 130px 1fr auto;
	}
	.bfs-hauptzeile .bfs-termine { display: none; } /* schlaegt .is-layout-flex */
	.bfs-hauptnav { grid-column: 3; }
}

.bfs-hauptnav .wp-block-navigation__responsive-container-open {
	color: #33373d;
}
.bfs-hauptnav .wp-block-navigation__responsive-container-open svg {
	width: 28px;
	height: 28px;
}

/* Overlay (offenes Burger-Menue). Husum klappt eine Liste unter dem Header
   auf; Core bringt ein Vollbild-Overlay — Optik angeglichen (links,
   Hauptpunkte versal 16.9px, Unterpunkte normal), Verhalten bewusst Core
   (Fokusfalle, Esc, aria) statt Nachbau. */
.bfs-hauptnav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 20px var(--wp--custom--inset);
	background-color: var(--wp--preset--color--white);
	color: #33373d;
}
.bfs-hauptnav .is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: 60px;
	align-items: flex-start;
}
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation__container,
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation-item,
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation__submenu-container {
	align-items: flex-start;
	text-align: left;
}
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation__container {
	gap: 12px;
	font-size: 16.9px;
}
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation__submenu-container {
	width: auto;
	margin-top: 0;
	padding: 6px 0 0 20px;
	gap: 6px;
	font-size: 16.9px;
}
.bfs-hauptnav.wp-block-navigation .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0;
	white-space: normal;
}
.bfs-hauptnav .is-menu-open .wp-block-navigation__submenu-container::before {
	content: none;
}

/* ==========================================================================
   Footer — Hauptzeile (schwarz, 4 x 25 %)
   ========================================================================== */
.bfs-footer-haupt {
	padding-block: 100px; /* Husum: 90px Section + 10px Spalten-Innenabstand */
}

.bfs-footer-spalten,
.bfs-footer-service__spalten {
	gap: 0;
	margin: 0;
}

@media (min-width: 768px) {
	.bfs-footer-spalten,
	.bfs-footer-service__spalten {
		flex-wrap: nowrap !important;
	}
	/* Feste Anteile statt flex-basis:0 — sonst verteilt Flex den Rest NACH
	   den ungleichen Spalten-Paddings und die Service-Spalten werden
	   390/420/390 statt 400/400/400 breit. */
	.bfs-footer-spalten > .wp-block-column {
		flex: 0 0 25% !important;
	}
	.bfs-footer-service__spalten > .wp-block-column {
		flex: 0 0 33.3333% !important;
		box-sizing: border-box;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.bfs-footer-haupt { padding-block: 70px; } /* Husum-Tablet: 60px + 10px */
}

.bfs-footer-spalten > .wp-block-column > *,
.bfs-footer-service__spalten > .wp-block-column > * {
	margin-block: 0;
}

.bfs-footer-titel {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--wp--preset--color--sand);
}

.bfs-footer-spalten > .wp-block-column > .bfs-footer-liste {
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
	line-height: 25.6px;
}
.bfs-footer-liste li {
	margin: 0;
}
.bfs-footer-liste li + li {
	margin-top: 7px;
}
.bfs-footer-spalten > .wp-block-column > .bfs-footer-liste--kontakt,
.bfs-footer-spalten > .wp-block-column > .bfs-footer-liste--abstand {
	margin-top: 14.4px; /* Husum: Leer-Item zwischen Adresse und Kontakt */
}

.bfs-footer-haupt a {
	color: inherit;
	text-decoration: none;
}
.bfs-footer-haupt a:hover {
	text-decoration: underline;
}

@media (max-width: 767.98px) {
	.bfs-footer-haupt {
		padding-block: 60px 66px;
	}
	.bfs-footer-spalten {
		/* Husum gestapelt: Inhalt -> naechster Titel 55 / 60 / 60px */
		row-gap: 60px;
	}
	.bfs-footer-spalten > .wp-block-column:first-child {
		margin-bottom: -5px;
	}
}

/* ==========================================================================
   Footer — Service-Zeile (Newsletter | Social | Zahlungsarten)
   ========================================================================== */
.bfs-footer-service {
	padding-block: 30px 0;
}
.bfs-footer-service__spalten > .wp-block-column {
	padding: 30px;
}
.bfs-footer-service__spalten > .wp-block-column:first-child {
	padding-left: 0;
}
.bfs-footer-service__spalten > .wp-block-column:last-child {
	padding-right: 0;
}

.bfs-footer-untertitel {
	font-size: 16px;
	font-weight: 400; /* Husum: 500 -> rendert als 400, s. Doku */
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--wp--preset--color--black);
}
.bfs-footer-service__social .bfs-footer-untertitel {
	text-align: center;
}

.bfs-footer-service__spalten > .wp-block-column > .bfs-social {
	gap: 15px;
	margin-top: 20px;
}
.bfs-social .wp-social-link {
	box-sizing: border-box; /* 50px inkl. Ring, wie Husum */
	width: 50px;
	height: 50px;
	border: 1px solid currentColor; /* Husum: 1px, Radius 25px */
	border-radius: 50%;
}
.bfs-social .wp-social-link a {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	padding: 0;
}
.bfs-social .wp-social-link svg {
	width: 25px;
	height: 25px;
}

/* Zahlungsarten: Husum-Modell 45px Feld + 12.5px Rand je Seite (Schritt 70px). */
.bfs-footer-service__spalten > .wp-block-column > .bfs-zahlungsarten {
	gap: 0;
	margin: 20px -12.5px 0;
}
.bfs-zahlungsarten > .wp-block-image {
	width: 45px;
	margin: 0 12.5px;
}
.bfs-zahlungsarten > .wp-block-image img {
	display: block;
}

@media (max-width: 767.98px) {
	/* Husum gestapelt: Newsletter + Social behalten 30px rechts (Titel
	   zentriert in 320px), Zahlungsarten volle 350px, linksbuendig. */
	.bfs-footer-service__spalten > .wp-block-column {
		padding-left: 0;
	}
	.bfs-footer-service__spalten > .wp-block-column:first-child {
		margin-bottom: 35px;
	}
	.bfs-footer-service__newsletter .bfs-footer-untertitel {
		text-align: center;
	}
	.bfs-footer-service__spalten > .wp-block-column > .bfs-zahlungsarten {
		justify-content: center;
	}
	.bfs-zahlungsarten > .wp-block-image img {
		margin-left: 4px; /* Husum: Icon 4px im 45px-Feld eingerueckt */
	}
}

/* ==========================================================================
   Footer — Rechtliches
   ========================================================================== */
.bfs-footer-recht {
	padding-block: 10px;
}
.bfs-footer-recht__liste {
	display: flex;
	justify-content: center;
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 12px;
	line-height: 25.6px;
}
.bfs-footer-recht a {
	color: var(--wp--preset--color--black);
	text-decoration: none;
}
.bfs-footer-recht a:hover {
	text-decoration: underline;
}

@media (max-width: 767.98px) {
	.bfs-footer-recht { padding-bottom: 45px; }
	.bfs-footer-recht__liste { font-size: 13px; }
}
