/*
 * verdure/sprungmenue (docs/landingpages-scroll.md, Abschnitt 3.2 und Baustein 2; Referenz
 * docs/referenz/landingpages/landingpage-webdesign.html, nav.lp-jump). Werte aus der Referenz, Farben im Website-Stand.
 * Klebt unter der sichtbaren Kopfzeile (--vd-kopf-sichtbar aus theme.css: 0 bei ausgeblendeter, 72 bzw. 64 px bei
 * kompakter Leiste) und folgt ihr mit derselben Bewegung. Nur geladen, wenn der Block auf der Seite steht.
 */

:root {
	--vd-sprung-hoehe: 56px;
}

@media (min-width: 768px) {
	:root {
		--vd-sprung-hoehe: 72px;
	}
}

/* Sprungziele unter Kopfzeile (kompakt) und Sprungmenü, 24 px Luft: 168 px ab 960 px, mobil 144 px */
html:has(.wp-block-verdure-sprungmenue) {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--vd-kopf-kompakt) + var(--vd-sprung-hoehe) + 24px);
}

/* Ein Fortschritt genügt: der seitenweite Balken (theme.css) entfällt auf Seiten mit Sprungmenü */
body:has(.wp-block-verdure-sprungmenue)::before {
	content: none;
}

/* Direkt unter dem Hero ohne Abstand (Referenz); hero.css gibt dem Nachfolger von Typ 2 sonst 48 bis 72 px */
.wp-block-group.verdure-hero + .wp-block-verdure-sprungmenue.lp-jump.alignfull {
	margin-block-start: 0;
}

.wp-block-verdure-sprungmenue.lp-jump {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--vd-kopf-sichtbar));
	z-index: 50;
	box-sizing: border-box;
	border-bottom: 1px solid var(--wp--preset--color--linie);
	background: var(--wp--preset--color--weiss);
	color: var(--wp--preset--color--schwarz);
	transition: top 0.25s ease-out;
}

.lp-jump__innen {
	display: flex;
	align-items: center;
	gap: 16px 32px;
	box-sizing: border-box;
	max-width: var(--wp--style--global--content-size, 1170px);
	min-height: var(--vd-sprung-hoehe);
	margin-inline: auto;
	padding-inline: 20px;
}

.lp-jump__titel {
	flex: 0 0 auto;
	margin: 0;
	color: var(--wp--preset--color--grau-dunkel);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 2.4px;
	text-transform: uppercase;
}

.lp-jump__links {
	display: flex;
	flex: 1 1 auto;
	gap: 28px;
	min-width: 0;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	scrollbar-width: none;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.3px;
	white-space: nowrap;
	list-style: none;
}

.lp-jump__links::-webkit-scrollbar {
	display: none;
}

.lp-jump__links a {
	display: inline-block;
	padding: 8px 0;
	color: inherit;
	text-decoration: none;
}

.lp-jump__links a:hover {
	text-decoration: underline 3px var(--wp--preset--color--gruen);
	text-underline-offset: 10px;
}

/* Aktiver Abschnitt: grün unterstrichen, 3 px, 10 px Abstand */
.lp-jump__links a[aria-current="true"] {
	text-decoration: underline 3px var(--wp--preset--color--gruen);
	text-underline-offset: 10px;
}

.lp-jump__cta {
	--vd-icon: url(../../../icons/pfeil-rechts.svg);
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	padding: 9px 18px;
	border: 2px solid var(--wp--preset--color--gruen);
	color: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 2.4px;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.lp-jump__cta::after {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background-color: currentColor;
	-webkit-mask: var(--vd-icon) center / contain no-repeat;
	mask: var(--vd-icon) center / contain no-repeat;
}

.lp-jump__cta.lp-jump__cta:hover,
.lp-jump__cta.lp-jump__cta:focus-visible {
	background: var(--wp--preset--color--gruen);
	color: inherit;
	text-decoration: none;
}

/* Erst sichtbar, wenn die Leiste klebt (landingpage.js setzt ist-fest); vorher steht der Haupt-CTA im Hero im Blick.
   visibility nimmt den Knopf auch aus der Tab-Reihenfolge; der Platz bleibt, damit nichts springt. */
.lp-jump__cta {
	transition: opacity 0.2s ease-out, visibility 0.2s;
}

.lp-jump.ist-bereit:not(.ist-fest) .lp-jump__cta {
	visibility: hidden;
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.lp-jump__cta {
		transition: none;
	}
}

.lp-jump__cta-kurz {
	display: none;
}

.lp-jump :focus-visible {
	outline: 2px solid var(--wp--preset--color--schwarz);
	outline-offset: 3px;
}

/* Lesefortschritt: 3 px Grün auf der Unterkante, per Scroll-Timeline; sonst setzt landingpage.js transform */
.lp-jump__fortschritt {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 3px;
	background: var(--wp--preset--color--gruen);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

@supports (animation-timeline: scroll()) {
	.lp-jump__fortschritt {
		animation: vd-sprung-fortschritt linear both;
		animation-timeline: scroll(root block);
	}
}

@keyframes vd-sprung-fortschritt {
	to {
		transform: scaleX(1);
	}
}

.lp-jump .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

/* Knopf der Aufklappliste: nur mobil und nur mit Skript (render.php setzt hidden, landingpage.js nimmt es weg) */
.lp-jump__auswahl {
	display: none;
}

/* Mobil (unter 768 px): Abschnittsleiste 56 px. Ohne Skript bleibt die waagrecht scrollbare Linkzeile. */
@media (max-width: 767px) {
	.lp-jump__innen {
		gap: 12px;
	}

	.lp-jump__titel {
		display: none;
	}

	.lp-jump__cta {
		padding: 7px 14px;
	}

	.lp-jump__cta-lang {
		display: none;
	}

	.lp-jump__cta-kurz {
		display: inline;
	}

	.lp-jump.ist-bereit .lp-jump__auswahl:not([hidden]) {
		--vd-icon: url(../../../icons/pfeil-unten.svg);
		display: inline-flex;
		flex: 1 1 auto;
		align-items: center;
		gap: 10px;
		min-width: 0;
		min-height: 44px;
		padding: 0;
		border: 0;
		background: none;
		color: inherit;
		font: inherit;
		font-size: 16px;
		font-weight: 600;
		letter-spacing: 0.3px;
		text-align: left;
		cursor: pointer;
	}

	.lp-jump.ist-bereit .lp-jump__auswahl::after {
		content: "";
		flex: none;
		width: 10px;
		height: 10px;
		background-color: currentColor;
		-webkit-mask: var(--vd-icon) center / contain no-repeat;
		mask: var(--vd-icon) center / contain no-repeat;
		transition: transform 0.25s ease-out;
	}

	.lp-jump.ist-bereit .lp-jump__auswahl[aria-expanded="true"]::after {
		transform: rotate(180deg);
	}

	.lp-jump__aktuell {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* Liste klappt unter der Leiste auf, über dem Inhalt */
	.lp-jump.ist-bereit .lp-jump__links {
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		display: none;
		flex-direction: column;
		gap: 0;
		padding: 8px 20px 16px;
		border-bottom: 1px solid var(--wp--preset--color--linie);
		background: var(--wp--preset--color--weiss);
		box-shadow: 0 12px 24px rgb(0 10 5 / 0.08);
	}

	.lp-jump.ist-bereit .lp-jump__auswahl[aria-expanded="true"] + .lp-jump__links {
		display: flex;
	}

	.lp-jump.ist-bereit .lp-jump__links a {
		display: block;
		padding: 12px 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-verdure-sprungmenue.lp-jump,
	.lp-jump.ist-bereit .lp-jump__auswahl::after {
		transition: none;
	}

}

/* Editor: im Fluss, kein Kleben, Fortschritt nicht sichtbar */
.editor-styles-wrapper .wp-block-verdure-sprungmenue.lp-jump {
	position: relative;
	top: auto;
}
