/**
 * Fixierter Header (sticky) für alle Seiten.
 *
 * Warum nicht die Block-Einstellung «Position: Sticky»? Core bietet sie nur für
 * Blöcke auf oberster Ebene an, und ein so markierter Block innerhalb eines
 * Template-Parts klebt nur innerhalb des <header class="wp-block-template-part">-
 * Wrappers, also gar nicht. Darum wird hier der Wrapper selbst sticky gemacht.
 * Die Admin-Leiste wird über die Core-Variable berücksichtigt.
 */

header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--position-offset, 0px);
	z-index: 100;
}

/*
 * Startseite: Die grosse OPENSTREAM-Wortmarke liegt seit dem 27.11.2026 nicht
 * mehr im Template-Part «header-home», sondern direkt im Template «front-page»
 * (Gruppe «Wortmarke»). So bleibt auch dort nur die Navigationszeile stehen.
 */

/* Sprungmarken (Inhaltsverzeichnis, #kommentare) nicht unter dem Header verstecken. */
html {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--position-offset, 0px) + var(--os-header-height, 96px));
}

/*
 * Glas-Effekt (angelehnt an «Liquid Glass» von iOS 26): leicht durchsichtiger
 * Header, der Inhalt dahinter wird weichgezeichnet, oben eine feine Lichtkante
 * und ein Glanz, der der Maus folgt (--os-glass-x, gesetzt in motion.js).
 *
 * Wichtig: backdrop-filter liegt auf ::before und nicht auf dem Header selbst.
 * Sonst würde der Header zum Bezugsrahmen für position:fixed und das mobile
 * Overlay-Menü wäre auf die Headerhöhe beschränkt.
 */
header.wp-block-template-part > .wp-block-group,
header.wp-block-template-part > .wp-block-group.has-base-background-color,
header.wp-block-template-part > .wp-block-group.has-black-background-color {
	background-color: transparent !important;
}
header.wp-block-template-part::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: color-mix(in srgb, var(--os-glass-tint, var(--wp--preset--color--base)) var(--os-glass-alpha, 58%), transparent);
	/* Bewusst wenig Unschärfe: die feinen Skyline-Linien sollen noch durchschimmern. */
	-webkit-backdrop-filter: blur(6px) saturate(180%);
	backdrop-filter: blur(6px) saturate(180%);
	transition: box-shadow 0.3s ease;
}
/* Lichtkante, Glanz und Trennlinie erst, wenn gescrollt wurde (html.os-scrolled, motion.js). */
html.os-scrolled header.wp-block-template-part::before {
	background:
		radial-gradient(120% 140% at var(--os-glass-x, 50%) -40%, rgba(255, 255, 255, 0.22), transparent 55%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 70%),
		color-mix(in srgb, var(--os-glass-tint, var(--wp--preset--color--base)) var(--os-glass-alpha, 58%), transparent);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.35),
		inset 0 -1px 0 color-mix(in srgb, var(--wp--preset--color--contrast) 10%, transparent),
		0 8px 24px -16px rgba(0, 0, 0, 0.35);
}
html.os-scrolled[data-theme="dark"] header.wp-block-template-part::before {
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.14),
		inset 0 -1px 0 rgba(255, 255, 255, 0.08),
		0 8px 24px -16px rgba(0, 0, 0, 0.6);
}

/*
 * Light Mode: Header überall schwarz (Glas fast deckend, sonst wirkt Schwarz
 * über Weiss grau), Schrift weiss. Im Dark Mode bleibt er in der dunklen
 * Grundfarbe. Das mobile Overlay-Menü hat eigene Farben (mobile-menu.css).
 */
html:not([data-theme="dark"]) header.wp-block-template-part {
	--os-glass-tint: #000;
	--os-glass-alpha: 86%;
	color: #fff;
}
html:not([data-theme="dark"]) header.wp-block-template-part .wp-block-site-title a,
html:not([data-theme="dark"]) header.wp-block-template-part .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content,
html:not([data-theme="dark"]) header.wp-block-template-part .wp-block-navigation__responsive-container-open {
	color: #fff !important;
}

/* Ohne backdrop-filter-Unterstützung lieber deckend statt unlesbar. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	header.wp-block-template-part::before,
	html.os-scrolled header.wp-block-template-part::before {
		background: var(--os-glass-tint, var(--wp--preset--color--base));
	}
}

/*
 * Startseite im Light Mode: ganz oben kein schwarzer Balken, der Header ist
 * durchsichtig mit dunkler Schrift. Erst beim Scrollen (html.os-scrolled)
 * blendet das schwarze Glas ein. Nur mit motion.js (html.os-motion), sonst
 * fehlt der Scroll-Status und der Header bliebe beim Scrollen durchsichtig.
 */
header.wp-block-template-part::before {
	transition: opacity 0.35s ease, box-shadow 0.3s ease;
}
header.wp-block-template-part a,
header.wp-block-template-part .wp-block-navigation__responsive-container-open {
	transition: color 0.35s ease;
}
html.os-motion:not([data-theme="dark"]):not(.os-scrolled) body.home header.wp-block-template-part::before {
	opacity: 0;
}
html.os-motion:not([data-theme="dark"]):not(.os-scrolled) body.home header.wp-block-template-part,
html.os-motion:not([data-theme="dark"]):not(.os-scrolled) body.home header.wp-block-template-part .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content,
html.os-motion:not([data-theme="dark"]):not(.os-scrolled) body.home header.wp-block-template-part .wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--contrast) !important;
}
