/*
 * Hinweis auf den nächsten Termin (inc/hinweis.php, assets/hinweis.js) — eine kleine Leiste am unteren Rand:
 * [Zeichen] „Gottesdienst“ / „Heute, 10:00 Uhr · Livestream ab 9:50 Uhr ˅“ [Zum Livestream] ×. Ein Tipp auf den Text
 * klappt darunter Tag und Uhrzeit, Ort, Livestream und die Links auf (zur Seite des Termins, in meinen Kalender).
 *
 * Aussehen im Plugin wie bei der Player-Leiste, damit die Leiste jeden Theme-Wechsel überlebt. Farben, Schriften, Radien
 * und Schatten kommen aus den Variablen des Themes (var(--wp--preset--…), var(--wp--custom--…)) mit Rückfallwerten.
 *
 * Seit 04.11.2026 (Lukas: „lass uns das mal bitte etwas besser designen vom aussehen usw“) aus demselben Stoff wie die
 * Player-Leiste: Logo-Schwarz mit dem Schatten „Über allem“ und einer feinen hellen Kante (sie liegt auch über dem dunklen
 * Fuß). Was unten am Bildschirm schwebt, ist damit eine Familie; auf der hellen Seite steht die Leiste für sich, statt wie
 * ein weißer Kasten im Inhalt zu verschwinden. Aufbau wie jeder Eintrag der Terminlisten: Titel, darunter Tag und Uhrzeit
 * mit fetter Anfangszeit. Links das Zeichen wie das Cover im Player (ab 641 px). Amber nur am Knopf und am Fokus, Radien
 * 10 px (Leiste, Knopf), kein Verlauf, kein Schein, nichts blinkt. Live-Rot ist nur der 7-px-Punkt vor „Livestream“.
 * Bis 03.11.2026 war die Leiste Papier mit 1-px-Linie, die Zeit stand grau über dem Titel.
 *
 * Lage: fest unten, mittig, unter dem Cookie-Hinweis (1000) und knapp unter der Player-Leiste (50), damit deren
 * Tempo-Menü darüber aufgeht. Läuft eine Predigt, sitzt die Leiste über der Player-Leiste — die meldet ihre Höhe samt
 * Abstand zum Rand als --fhd-player-hoehe auf <html> (fhd-kern, player.js). Solange die Leiste steht, trägt <html> die
 * Klasse fhd-termin-hinweis-an und ihre Höhe als --fhd-termin-hinweis-hoehe: Der Fuß der Seite bekommt so viel Platz,
 * dass seine letzte Zeile lesbar bleibt.
 */

.fhd-termin-hinweis {
	--fhd-th-amber: var(--wp--preset--color--amber, #f49e02);
	--fhd-th-amber-hover: var(--wp--preset--color--amber-hover, #e08900);
	--fhd-th-amber-tief: var(--wp--preset--color--amber-tief, #8a5200);
	--fhd-th-espresso: var(--wp--preset--color--espresso, #1b1e15);
	--fhd-th-espresso-2: var(--wp--preset--color--espresso-2, #262b1f);
	--fhd-th-hell: var(--wp--preset--color--auf-dunkel, #f0f0ec);
	--fhd-th-leise: var(--wp--preset--color--auf-dunkel-leise, #b4b5ad);
	--fhd-th-kante: color-mix(in srgb, var(--fhd-th-hell) 11%, transparent);
	--fhd-th-live: var(--wp--preset--color--live, #c93126);
	--fhd-th-radius: var(--wp--custom--radius--gross, 10px);
	--fhd-th-radius-klein: var(--wp--custom--radius--klein, 6px);
	--fhd-th-uebergang: var(--wp--custom--uebergang, 160ms cubic-bezier(0.2, 0.7, 0.2, 1));
	--fhd-th-rand: 14px; /* Abstand zum unteren Rand, wie die Player-Leiste */
	--fhd-th-einzug: 68px; /* linke Kante des Texts: Innenabstand 10 + Zeichen 44 + Abstand 14 */

	position: fixed;
	left: 10px;
	right: 10px;
	bottom: var(--fhd-th-rand);
	z-index: 49;
	box-sizing: border-box;
	width: fit-content;
	min-width: min(440px, calc(100% - 20px));
	max-width: min(820px, calc(100% - 20px));
	margin: 0 auto;
	background: var(--fhd-th-espresso);
	color: var(--fhd-th-hell);
	border: 1px solid var(--fhd-th-kante);
	border-radius: var(--fhd-th-radius);
	box-shadow: var(--wp--custom--schatten--player, 0 2px 6px rgba(0, 0, 0, 0.25), 0 24px 56px -12px rgba(0, 0, 0, 0.5));
	font-family: var(--wp--preset--font-family--text, system-ui, sans-serif);
	font-size: 1rem;
	line-height: 1.35;
	font-variant-numeric: tabular-nums;
	/* Mit der Player-Leiste nach oben: dieselbe Bewegung, dieselbe Dauer (320 ms) */
	transition: bottom 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
	animation: fhd-termin-hinweis-ein 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Verborgenes bleibt verborgen, auch wo weiter unten eine Regel gleichen Gewichts display setzt (Knopf auf der Zielseite).
   Ohne JavaScript hebt inc/hinweis.php das für die Leiste selbst wieder auf (#fhd-termin-hinweis[hidden], höheres Gewicht). */
.fhd-termin-hinweis[hidden],
.fhd-termin-hinweis [hidden] {
	display: none !important;
}

.fhd-termin-hinweis *,
.fhd-termin-hinweis *::before,
.fhd-termin-hinweis *::after {
	box-sizing: border-box;
}

.fhd-termin-hinweis ::selection {
	background: var(--fhd-th-amber);
	color: var(--fhd-th-espresso);
}

/* Erscheinen: einmal 8 px von unten, wie die Player-Leiste aus dem Rand kommt — keine Wiederholung, kein Blinken */
@keyframes fhd-termin-hinweis-ein {
	from {
		opacity: 0;
		translate: 0 8px;
	}
}

/* Über der Player-Leiste, solange eine Predigt läuft (8 px Luft) */
body.fhd-player-aktiv .fhd-termin-hinweis {
	bottom: calc(var(--fhd-player-hoehe, 102px) + 8px);
}

/* Nach dem Schließen des Players steht 5 s an seiner Stelle „Player geschlossen · Rückgängig“ (52 px hoch) */
body:has(.fhd-player-meldung.sichtbar) .fhd-termin-hinweis {
	bottom: calc(var(--fhd-th-rand) + 52px + 8px);
}

/* Offenes Handy-Menü (WordPress setzt dann has-modal-open an <html>): Die Leiste läge über den letzten Menüpunkten —
   die Kopfzeile bildet eine eigene Ebene (20), ihr Menü kommt nicht über die Leiste. Solange ist sie unsichtbar und
   nicht bedienbar; ihr Platz und ihr Zustand bleiben. */
html.has-modal-open .fhd-termin-hinweis {
	visibility: hidden;
}

/* ---------- Zeile: Zeichen, Text (Knopf zum Aufklappen), Knopf, Schließen ---------- */

.fhd-termin-hinweis__innen {
	display: flex;
	align-items: center;
	gap: 8px 14px;
	padding: 10px 8px 10px 10px;
}

/* Das Zeichen: wie das Cover der Player-Leiste eine erhobene Fläche mit feiner Kante */
.fhd-termin-hinweis__marke {
	display: grid;
	flex: none;
	place-items: center;
	align-self: flex-start;
	width: 44px;
	height: 44px;
	border-radius: var(--fhd-th-radius-klein);
	background: var(--fhd-th-espresso-2);
	box-shadow: inset 0 0 0 1px var(--fhd-th-kante);
	color: var(--fhd-th-hell);
}

.fhd-termin-hinweis__marke svg {
	width: 24px;
	height: 24px;
}

.fhd-termin-hinweis__marke-live,
.fhd-termin-hinweis.ist-livestream .fhd-termin-hinweis__marke-termin {
	display: none;
}

.fhd-termin-hinweis.ist-livestream .fhd-termin-hinweis__marke-live {
	display: block;
}

.fhd-termin-hinweis__text {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	min-width: 0;
	margin: 0;
}

/* Der Text ist ein Knopf: zugeklappt Titel und eine Zeile darunter, aufgeklappt bricht der Titel um */
.fhd-termin-hinweis .fhd-termin-hinweis__auf {
	margin: 0 0 0 -4px;
	padding: 2px 4px;
	background: transparent;
	color: inherit;
	border: 0;
	border-radius: var(--fhd-th-radius-klein);
	font: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.fhd-termin-hinweis__zeile {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

/* Titel: Listentitel (Geologica 600), eine Zeile mit „…“; der ganze Titel steht aufgeklappt */
.fhd-termin-hinweis__titel {
	overflow: hidden;
	color: var(--fhd-th-hell);
	font-family: var(--wp--preset--font-family--titel, inherit);
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.01em;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.fhd-termin-hinweis.ist-offen .fhd-termin-hinweis__titel {
	overflow: visible;
	white-space: normal;
	overflow-wrap: anywhere;
	text-wrap: balance;
}

.fhd-termin-hinweis__auf:hover .fhd-termin-hinweis__titel {
	text-decoration: underline;
	text-decoration-color: var(--fhd-th-amber);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

/* Darunter: Tag und Uhrzeit (Anfangszeit fett und hell), dahinter leise der Zusatz, am Ende der Pfeil zum Aufklappen */
.fhd-termin-hinweis__unter {
	display: flex;
	align-items: center;
	min-width: 0;
	color: var(--fhd-th-leise);
	font-size: 1rem;
	line-height: 1.35;
	white-space: nowrap;
}

.fhd-termin-hinweis__wann {
	flex: none;
}

.fhd-termin-hinweis__wann b {
	color: var(--fhd-th-hell);
	font-weight: 600;
}

/* Zwischen Zeit und Zusatz eine feine Trennlinie statt eines Mittelpunkts (der Punkt gehört dem Livestream) */
.fhd-termin-hinweis__zusatz {
	min-width: 0;
	margin-left: 10px;
	padding-left: 10px;
	overflow: hidden;
	border-left: 1px solid color-mix(in srgb, var(--fhd-th-hell) 22%, transparent);
	text-overflow: ellipsis;
}

/* Aufgeklappt sagt das Feld darunter Tag, Uhrzeit und Livestream ganz — der Zusatz stünde sonst zweimal da */
.fhd-termin-hinweis.ist-offen .fhd-termin-hinweis__zusatz {
	display: none;
}

/* Der rote Punkt vor „Livestream“ — das Zeichen der Website dafür, kein Etikett */
.fhd-termin-hinweis__zusatz--livestream::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 7px;
	border-radius: 50%;
	background: var(--fhd-th-live);
	box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--fhd-th-live) 35%, transparent);
	vertical-align: 0.12em;
}

/* Linienpfeil hinter der Zeile: „hier gibt es mehr“, dreht sich beim Aufklappen */
.fhd-termin-hinweis__winkel {
	flex: none;
	width: 16px;
	height: 16px;
	margin-left: 6px;
	color: var(--fhd-th-leise);
	transition: rotate 200ms cubic-bezier(0.2, 0.7, 0.2, 1), color var(--fhd-th-uebergang);
}

.fhd-termin-hinweis__auf:hover .fhd-termin-hinweis__winkel {
	color: var(--fhd-th-amber);
}

.fhd-termin-hinweis__auf[aria-expanded="true"] .fhd-termin-hinweis__winkel {
	rotate: 180deg;
}

/* Knopf: flach, Amber mit feiner Kontur, Radius wie die Leiste — Amber auf Logo-Schwarz ist die Paarung des Logos.
   46 statt 52 px hoch, damit die Leiste klein bleibt. */
.fhd-termin-hinweis .fhd-termin-hinweis__knopf {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	margin-left: 2px;
	padding: 0 20px;
	background: var(--fhd-th-amber);
	color: var(--fhd-th-espresso);
	border: 1px solid color-mix(in srgb, var(--fhd-th-amber-tief) 55%, transparent);
	border-radius: var(--fhd-th-radius);
	box-shadow: none;
	font-family: inherit;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--fhd-th-uebergang), transform var(--fhd-th-uebergang);
}

.fhd-termin-hinweis .fhd-termin-hinweis__knopf:hover {
	background: var(--fhd-th-amber-hover);
	color: var(--fhd-th-espresso);
}

.fhd-termin-hinweis .fhd-termin-hinweis__knopf:active {
	transform: scale(0.985);
}

/* Schließen: runder Icon-Knopf wie in der Player-Leiste */
.fhd-termin-hinweis__schliessen {
	display: grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	background: transparent;
	color: var(--fhd-th-leise);
	border: 0;
	border-radius: 50%;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color var(--fhd-th-uebergang), color var(--fhd-th-uebergang);
}

.fhd-termin-hinweis__schliessen:hover {
	background: color-mix(in srgb, var(--fhd-th-hell) 8%, transparent);
	color: var(--fhd-th-amber);
}

.fhd-termin-hinweis__schliessen:active {
	transform: scale(0.96);
}

.fhd-termin-hinweis__x {
	display: block;
	width: 20px;
	height: 20px;
}

/* Fokus auf der dunklen Fläche wie in der Player-Leiste: Amber-Ring mit dunklem Hof (≥ 3:1) */
.fhd-termin-hinweis :focus-visible {
	outline: 3px solid var(--fhd-th-amber);
	outline-offset: 2px;
	box-shadow: 0 0 0 7px color-mix(in srgb, var(--fhd-th-espresso) 70%, transparent);
}

/* ---------- Aufklappen (Lukas, 19.10.2026: „kann man die hinweisleiste aufklappen? … mehr infos … und auch alle links“) ---------- */

/* Aufgeklappt: Tag und Uhrzeit, Ort, Livestream, Links — unter der Zeile, bündig mit dem Text darüber */
.fhd-termin-hinweis__mehr {
	display: grid;
	gap: 4px;
	margin: 0 12px;
	padding: 12px 0 14px calc(var(--fhd-th-einzug) - 12px);
	border-top: 1px solid var(--fhd-th-kante);
}

.fhd-termin-hinweis__mehr p {
	margin: 0;
}

.fhd-termin-hinweis__mehr-zeit {
	color: var(--fhd-th-hell);
	font-weight: 600;
}

.fhd-termin-hinweis__mehr-ort,
.fhd-termin-hinweis__mehr-live {
	color: var(--fhd-th-leise);
}

.fhd-termin-hinweis__mehr-live::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 8px;
	border-radius: 50%;
	background: var(--fhd-th-live);
	box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--fhd-th-live) 35%, transparent);
	vertical-align: 0.12em;
}

.fhd-termin-hinweis__mehr-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 10px;
	padding-top: 10px;
}

/* Zweitknöpfe auf Dunkel: helle Linie, flach, ohne Invertieren (DESIGN.md, knopf-hell) */
.fhd-termin-hinweis .fhd-termin-hinweis__mehr-links a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	color: var(--fhd-th-hell);
	border: 1.5px solid color-mix(in srgb, var(--fhd-th-hell) 70%, transparent);
	border-radius: var(--fhd-th-radius);
	font-weight: 600;
	text-decoration: none;
	transition: background-color var(--fhd-th-uebergang);
}

.fhd-termin-hinweis .fhd-termin-hinweis__mehr-links a:hover {
	background: color-mix(in srgb, var(--fhd-th-hell) 10%, transparent);
	color: var(--fhd-th-hell);
}

.fhd-termin-hinweis__mehr-icon {
	width: 20px;
	height: 20px;
}

/* ---------- Platz am Seitenende, solange die Leiste steht ---------- */

/* Der Fuß (Theme: .fhd-fuss, unten 28 px, mit Player 132 px) bekommt die Höhe der Leiste dazu. */
html.fhd-termin-hinweis-an .wp-block-group.fhd-fuss {
	padding-bottom: calc(28px + var(--fhd-termin-hinweis-hoehe, 64px) + 14px);
}

html.fhd-termin-hinweis-an body.fhd-player-aktiv .wp-block-group.fhd-fuss {
	padding-bottom: calc(132px + var(--fhd-termin-hinweis-hoehe, 64px) + 8px);
}

/* Springt die Seite zu einer Stelle, endet sie nicht hinter der Leiste */
html.fhd-termin-hinweis-an {
	scroll-padding-bottom: calc(var(--fhd-player-hoehe, 0px) + var(--fhd-termin-hinweis-hoehe, 64px) + 28px);
}

/* ---------- Handy: eine Zeile — Text (zum Aufklappen), Knopf, Schließen ---------- */

/* Bis 19.10.2026 standen Text und Schließen oben und der Knopf darunter über die ganze Breite: 126 px hoch, mit der
   Player-Leiste zusammen ein Viertel des Bildschirms (Handy-Prüfung 19.10.2026, Befund 3). Jetzt eine Zeile von rund
   58 px ohne Zeichen; der Zusatz („Livestream ab 9:50 Uhr“, „seit 10:00 Uhr“) steht im aufgeklappten Feld. */
@media (max-width: 640px) {
	.fhd-termin-hinweis {
		--fhd-th-rand: max(10px, env(safe-area-inset-bottom, 0px));
		--fhd-th-einzug: 14px;

		width: auto;
		min-width: 0;
		max-width: none;
	}

	.fhd-termin-hinweis__innen {
		gap: 4px;
		padding: 6px 4px 6px 14px;
	}

	.fhd-termin-hinweis__marke {
		display: none;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__text {
		min-height: 44px;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__zeile {
		gap: 1px;
	}

	.fhd-termin-hinweis__titel {
		font-size: 1rem;
		line-height: 1.25;
	}

	/* Passt der Titel nicht, erst eine Stufe kleiner, dann „…“ (assets/hinweis.js, passeTitelAn) */
	.fhd-termin-hinweis.titel-kleiner .fhd-termin-hinweis__titel {
		font-size: 0.9375rem;
	}

	.fhd-termin-hinweis__unter {
		font-size: 0.9375rem;
		line-height: 1.3;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__zusatz {
		display: none;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__knopf {
		min-height: 44px;
		margin-left: 4px;
		padding: 0 14px;
		font-size: 0.9375rem;
	}

	.fhd-termin-hinweis__mehr {
		margin: 0 14px;
		padding: 10px 0 14px;
	}
}

/* ---------- Bewegung reduzieren, Kontrastmodus, Druck ---------- */

@media (prefers-reduced-motion: reduce) {
	.fhd-termin-hinweis {
		transition: none;
		animation: none;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__knopf,
	.fhd-termin-hinweis__schliessen,
	.fhd-termin-hinweis__winkel {
		transition: none;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__knopf:active,
	.fhd-termin-hinweis__schliessen:active {
		transform: none;
	}
}

@media (forced-colors: active) {
	.fhd-termin-hinweis {
		border-color: CanvasText;
	}

	.fhd-termin-hinweis__zusatz--livestream::before,
	.fhd-termin-hinweis__mehr-live::before {
		background: CanvasText;
	}

	.fhd-termin-hinweis .fhd-termin-hinweis__knopf {
		border-color: ButtonText;
	}
}

@media print {
	.fhd-termin-hinweis {
		display: none !important;
	}
}
