/*
 * UAP Calendar - Frontend
 *
 * Aufbau wie bei UAP Gallery: kein pro Event erzeugtes Stylesheet. Die
 * Gestaltung reist als CSS-Custom-Properties in einem Inline-style-Attribut am
 * Scope-Element, die Regeln hier sind statisch und lesen nur var(...).
 *
 * BEFUND 2026-09-19, real gemessen mit echten computed styles in Chromium
 * gegen die gemountete TESTUMGEBUNG-CUSTOM-CSS.css: Die Custom-Design-Regeln
 * trugen den ID-Anker, aber KEIN !important, und wirkten auf der Zielseite
 * trotzdem nicht. Ruhezustand und Hover zeigten unveraendert die Farben aus
 * TESTUMGEBUNG-CUSTOM-CSS.css:98-109 bzw. :112-119, obwohl die CSS-Variablen
 * nachweislich korrekt im style-Attribut ankamen.
 *
 * URSACHE, die den fruehreren Kommentar hier widerlegt: Die Kaskade wertet
 * !important VOR der Spezifitaet. Custom CSS traegt !important auf jeder
 * Deklaration; eine Plug-in-Regel ohne !important verliert daher IMMER gegen
 * eine Custom-CSS-Regel mit !important, unabhaengig von ihrer Spezifitaet -
 * auch mit ID-Anker. Der fruehere Satz "die ID-Spezifitaet schlaegt jede
 * klassenbasierte Custom CSS unabhaengig von der Ladereihenfolge" war falsch,
 * weil er !important und Spezifitaet verwechselt hat. Beides wird jetzt
 * gebraucht: !important, damit die Regel ueberhaupt in derselben
 * Kaskadenebene wie die Custom CSS spielt, und die ID-Spezifitaet, damit sie
 * dort gewinnt, wenn beide Seiten !important tragen (WPZOOM Inspiro nutzt
 * durchgehend !important, siehe TESTUMGEBUNG-CUSTOM-CSS.css).
 *
 * SPEZIFITAET, real gerechnet am 2026-09-19 gegen TESTUMGEBUNG-CUSTOM-CSS.css:
 *   Zeile 98-109 dort (Button-Grundzustand, color/border !important) = (0,2,1)
 *   Zeile 112-115 dort (Button-Hover, color !important)              = (0,6,1)
 *   Zeile 55 dort (jeder einfache Link, color !important)            = (0,9,1)
 *   .uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)
 *     Grundzustand                                                   = (1,2,0)
 *     ::before / ::after                                             = (1,2,1)
 *     :hover / :focus-visible / :active                              = (1,3,0)
 * Alle eigenen Selektoren liegen mit der 1 in der ID-Stelle ueber jedem der
 * obigen (0,x,y)-Werte, unabhaengig davon wie hoch x wird.
 *
 * Der am 2026-09-02 gemeldete Vorfall betraf laut Root-AGENTS.md den
 * Button-Designer von UAP Presskit, nicht UAP Bio. Fuer UAP Bio 1.4.9.95 ist
 * eine Kollision mit TESTUMGEBUNG-CUSTOM-CSS.css NICHT BEWIESEN: alle vier
 * Button-Bloecke dort (Zeile 99, 113, 123, 132) schliessen
 * .tooloon-bio-plugin und seine Nachkommen ausdruecklich per :not() aus, und
 * jeder BIO-Button liegt innerhalb von .tooloon-bio-plugin
 * (templates/bio.php:150, Buttons :213, :287, :308-310) - beide Regelsaetze
 * treffen also nie dasselbe Element. Fuer UAP Calendar selbst gilt die
 * eigene Messung vom 2026-09-19: ohne !important gewann die Custom CSS
 * (#A8A8B0 / #FF922E statt der eingestellten Werte), mit !important plus
 * ID-Anker kamen die eingestellten Werte an, real bestaetigt in einem
 * zweiten Lauf mit #123456 / #00ff00 / Hover-Overlay #ff00ff, identisch mit
 * und ohne Custom CSS.
 *
 * Deshalb tragen alle Regeln des Custom-Button-Designs sowohl den Anker
 * :not(#uap-cal-specificity-anchor) als auch !important auf jeder einzelnen
 * Deklaration. Das Element #uap-cal-specificity-anchor existiert nirgends,
 * die Regel trifft also genau dieselben Buttons wie ohne Anker. Nicht
 * entfernen, ohne die Spezifitaet UND die Kaskadenebene (!important) gegen
 * die Custom CSS der Zielseite neu zu rechnen und in beiden Zustaenden - mit
 * und ohne Custom CSS - real zu messen.
 *
 * Im Theme-Zustand (.uap-cal-buttons-theme-default) erzeugt das Plug-in fuer
 * die Buttons KEINE Gestaltungsregel - kein Rahmen, keine Farbe, kein Radius,
 * keine Schrift, kein !important. Nur Layout. Gleiches Prinzip wie UAP Bio
 * und UAP Presskit. Diese Custom-Design-Regeln setzen ausnahmslos voraus,
 * dass ein Vorfahre die Klasse .uap-cal-buttons-custom-design traegt; im
 * Theme-Zustand greift keine von ihnen.
 */

.uap-cal-scope {
	box-sizing: border-box;
}

.uap-cal-scope *,
.uap-cal-scope *::before,
.uap-cal-scope *::after {
	box-sizing: inherit;
}

.uap-cal-event {
	margin: 0 auto;
	max-width: var(--uap-cal-page-width, none);
}

.uap-cal-block {
	margin: 0 0 18px;
}

.uap-cal-block:last-child {
	margin-bottom: 0;
}

.uap-cal-event-title {
	margin: 0 0 10px;
}

.uap-cal-when {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: inherit;
}

.uap-cal-block[style*="center"] .uap-cal-when,
.uap-cal-block[style*="right"] .uap-cal-when {
	display: block;
}

.uap-cal-location,
.uap-cal-directions p {
	margin: 0 0 8px;
}

.uap-cal-lineup {
	margin: 0;
	padding: 0;
	list-style: none;
}

.uap-cal-lineup li {
	margin: 0 0 4px;
}

/* Fotos und Flyer */

.uap-cal-photos {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	justify-content: flex-start;
}

.uap-cal-block[style*="center"] .uap-cal-photos {
	justify-content: center;
}

.uap-cal-block[style*="right"] .uap-cal-photos {
	justify-content: flex-end;
}

.uap-cal-photo,
.uap-cal-flyer {
	margin: 0;
	max-width: 100%;
}

.uap-cal-photo img,
.uap-cal-flyer img {
	display: block;
	max-width: 100%;
	height: auto;
}

.uap-cal-flyer {
	display: inline-block;
}

/* Rahmen. Ohne die Zustandsklasse wird ein Rahmen aus dem Theme aktiv
 * unterdrueckt, damit der Schalter im Backend in beide Richtungen wirkt -
 * dasselbe Verfahren wie bei den Fenster- und Galerierahmen in UAP Gallery. */

.uap-cal-scope .uap-cal-photo,
.uap-cal-scope .uap-cal-flyer,
.uap-cal-scope .uap-cal-event,
.uap-cal-scope .uap-cal-list {
	border: 0;
}

.uap-cal-scope.has-photo-frame .uap-cal-photo {
	border: var(--uap-cal-photo-frame-width, 1px) solid var(--uap-cal-photo-frame-color, #ffffff);
	border-radius: var(--uap-cal-photo-frame-radius, 0);
	padding: var(--uap-cal-photo-frame-padding, 0);
}

.uap-cal-scope.has-flyer-frame .uap-cal-flyer {
	border: var(--uap-cal-flyer-frame-width, 1px) solid var(--uap-cal-flyer-frame-color, #ffffff);
	border-radius: var(--uap-cal-flyer-frame-radius, 0);
	padding: var(--uap-cal-flyer-frame-padding, 0);
}

.uap-cal-scope.has-page-frame .uap-cal-event {
	border: var(--uap-cal-page-frame-width, 1px) solid var(--uap-cal-page-frame-color, #ffffff);
	border-radius: var(--uap-cal-page-frame-radius, 0);
	padding: var(--uap-cal-page-frame-padding, 24px);
}

.uap-cal-scope.has-list-frame .uap-cal-list {
	border: var(--uap-cal-list-frame-width, 1px) solid var(--uap-cal-list-frame-color, #ffffff);
	border-radius: var(--uap-cal-list-frame-radius, 0);
	padding: var(--uap-cal-list-frame-padding, 0);
}

/* Uebersicht */

.uap-cal-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.uap-cal-list-item + .uap-cal-list-item {
	margin-top: 8px;
}

.uap-cal-list-link {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: baseline;
	text-decoration: none;
}

.uap-cal-list-date {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Teilen und Blaettern: nur Layout, in beiden Button-Zustaenden gleich. */

.uap-cal-share {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: inherit;
}

.uap-cal-share-buttons {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px;
}

.uap-cal-share-status:empty {
	display: none;
}

.uap-cal-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: inherit;
}

.uap-cal-block[style*="center"] .uap-cal-share,
.uap-cal-block[style*="center"] .uap-cal-nav {
	justify-content: center;
}

.uap-cal-block[style*="right"] .uap-cal-share,
.uap-cal-block[style*="right"] .uap-cal-nav {
	justify-content: flex-end;
}

/* Custom-Button-Design. Jede Regel mit ID-Anker, siehe Kopfkommentar. */

.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor) {
	all: unset !important;
	display: inline-block !important;
	box-sizing: border-box !important;
	position: relative !important;
	padding: 6px 12px !important;
	border: 1px solid var(--uap-cal-button-border, #ffffff) !important;
	border-radius: var(--uap-cal-button-radius, 4px) !important;
	background: var(--uap-cal-button-background, transparent) !important;
	background-color: var(--uap-cal-button-background, transparent) !important;
	background-image: none !important;
	background-clip: padding-box !important;
	color: var(--uap-cal-button-text, #ffffff) !important;
	cursor: pointer !important;
	font-family: inherit !important;
	font-size: 16px !important;
	font-style: normal !important;
	font-weight: 500 !important;
	line-height: 22px !important;
	letter-spacing: normal !important;
	text-align: center !important;
	text-decoration: none !important;
	text-transform: none !important;
	box-shadow: none !important;
	text-shadow: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	transition: background-color 160ms ease-in-out, border-color 160ms ease-in-out, color 160ms ease-in-out !important;
}

.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)::before,
.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)::after {
	content: none !important;
	display: none !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
}

/* Die Ueberlagerung wird als flache Farbe ueber den Hintergrund gelegt, damit
 * ein transparenter Grundzustand erhalten bleibt - identisch zum Verfahren in
 * UAP Bio 1.4.9.95. */

.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):hover,
.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):focus-visible {
	background-image: linear-gradient(
		var(--uap-cal-button-hover-overlay, transparent),
		var(--uap-cal-button-hover-overlay, transparent)
	) !important;
	border-color: var(--uap-cal-button-hover-border, var(--uap-cal-button-border, #ffffff)) !important;
	color: var(--uap-cal-button-hover-text, var(--uap-cal-button-text, #ffffff)) !important;
}

.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):active {
	background-image: linear-gradient(
		var(--uap-cal-button-active-overlay, transparent),
		var(--uap-cal-button-active-overlay, transparent)
	) !important;
	border-color: var(--uap-cal-button-active-border, var(--uap-cal-button-border, #ffffff)) !important;
	color: var(--uap-cal-button-active-text, var(--uap-cal-button-text, #ffffff)) !important;
}

.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):focus-visible {
	outline: 1px solid var(--uap-cal-button-border, #ffffff) !important;
	outline-offset: 2px !important;
}

/* Popup */

.uap-cal-overlay[hidden] {
	display: none;
}

.uap-cal-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: grid;
	place-items: center;
	padding: 20px;
}

.uap-cal-overlay-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.uap-cal-overlay-panel {
	position: relative;
	z-index: 1;
	width: min(640px, 100%);
	max-height: 80vh;
	overflow: auto;
	padding: 24px;
	background: #ffffff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.uap-cal-overlay-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 34px;
	height: 34px;
	border: 0;
	background: transparent;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

@media (max-width: 640px) {
	.uap-cal-photos {
		gap: 10px;
	}

	.uap-cal-overlay-panel {
		padding: 16px;
	}
}
