/*
 * 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.
 *
 * NACHTRAG 0.2.0: Optionale Automatik-Selektoren (.uap-cal-buttons-auto-contrast,
 * siehe weiter unten) tragen denselben ID-Anker und ebenfalls durchgehend
 * !important, zusaetzlich zur eigenen Klasse. Neu berechnete Spezifitaet
 * dieser Selektoren, weil sie neu sind und dieselbe Kaskadenebene wie oben
 * treffen muessen:
 *   Ruhezustand   .uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design
 *                 .uap-cal-button:not(#anchor)                    = (1,3,0)
 *   :hover/:focus-visible/:active (je +1 Pseudoklasse)             = (1,4,0)
 *   ::before davon (je +1 Pseudoelement)                           = (1,4,1)
 * Alle liegen wie die bestehenden Custom-Design-Selektoren mit der 1 an der
 * ID-Stelle ueber jedem (0,x,y)-Wert der Custom CSS, unabhaengig von deren x.
 */

/* Zweitpruefung 0.2.1 vom 2026-09-21: bei 1100-1400px Breite ueberdeckte ein
 * rein dekoratives Element des Themes (Twenty Fourteen: `#page::before`,
 * `position:absolute; z-index:2; background:#000; width:222px`, ueber die
 * volle Seitenhoehe) reale Bedienelemente dieses Plug-ins (den
 * Liste/Kacheln-Umschalter der Uebersicht UND die Uebersichts-Links selbst),
 * real mit Playwright gemessen: `elementFromPoint()` an der sichtbaren
 * Position des Umschalters lieferte `#page`, ein echter Klick lief in einen
 * Timeout. `#page` selbst ist `position:relative` mit `z-index:auto` und
 * eroeffnet damit KEINEN eigenen Stapelkontext - das Pseudo-Element mit
 * `z-index:2` stapelt deshalb im naechsten eroeffnenden Vorfahren (praktisch
 * der Wurzel-Stapelkontext), oberhalb jedes normalen, nicht positionierten
 * Inhalts irgendwo auf der Seite, unabhaengig vom Theme des jeweiligen
 * Nutzers. `.uap-cal-scope` bekommt deshalb selbst einen eigenen
 * Stapelkontext mit einer bequemen Sicherheitsmarge ueber diesen
 * gemessenen Wert - real erneut mit Playwright bestaetigt: `elementFromPoint()`
 * liefert danach an derselben Position den Button selbst, ein echter
 * Klick trifft. */
.uap-cal-scope {
	box-sizing: border-box;
	position: relative;
	z-index: 3;
}

.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-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;
	height: auto;
}

/* Reine Breitensteuerung, Seitenverhaeltnis bleibt immer erhalten: nur
 * max-width wird gesetzt, nie width oder object-fit, height bleibt auto. Der
 * Default (100%, kein px-Limit) ist wortgleich mit dem vorherigen fest
 * codierten max-width:100% oben, das Erscheinungsbild aendert sich also ohne
 * eigene Einstellung nicht. */

.uap-cal-photo-image {
	max-width: var(--uap-cal-photo-max-width, 100%);
}

.uap-cal-flyer-image {
	max-width: var(--uap-cal-flyer-max-width, 100%);
}

.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-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, #cccccc) !important;
	border-radius: var(--uap-cal-button-radius, 6px) !important;
	background: var(--uap-cal-button-background, #ffffff) !important;
	background-color: var(--uap-cal-button-background, #ffffff) !important;
	background-image: none !important;
	background-clip: padding-box !important;
	color: var(--uap-cal-button-text, #000000) !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, #cccccc)) !important;
	color: var(--uap-cal-button-hover-text, var(--uap-cal-button-text, #000000)) !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, #cccccc)) !important;
	color: var(--uap-cal-button-active-text, var(--uap-cal-button-text, #000000)) !important;
}

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

/* Zweitpruefung 0.2.1 (dritte Pruefung), real gemessen 2026-09-21: the
 * overview list/tiles toggle's PERSISTENT "pressed" state
 * ([aria-pressed="true"], set whenever a button represents the currently
 * active mode) is new with Phase B and has no equivalent in the earlier,
 * purely momentary :hover/:active states above. Computed styles showed
 * TESTUMGEBUNG-CUSTOM-CSS.css winning without this rule: its own
 * ":is(button, .button, input[type=submit], input[type=button], .btn,
 * .wp-block-button__link):not(...):is(.active, [aria-pressed=\"true\"])"
 * rule (the file's own header comment there states specificity (0,4,0),
 * plus !important on every declaration) painted the button
 * background:#FF922E regardless of this plugin's own button colours.
 *
 * Specificity of the rule below, calculated the same way as every other
 * rule in this file (see the file's own top comment): one class
 * (.uap-cal-buttons-custom-design) + one class (.uap-cal-button) + the
 * attribute selector [aria-pressed="true"] (counts as a class) = (0,3,0)
 * from the selector itself, PLUS the #uap-cal-specificity-anchor ID inside
 * :not() = (1,3,0) total. That already beats (0,4,0) purely on the ID
 * digit, independent of the exact class count on either side - same
 * reasoning as every other custom-design button rule in this file. Reuses
 * the SAME --uap-cal-button-active-* variables as the momentary :active
 * state above on purpose: a toggle's "pressed" look and a normal button's
 * "just clicked" look are the same visual concept in this design, and this
 * avoids a new, separate settings field for one specific button.
 */
.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)[aria-pressed="true"] {
	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, #cccccc)) !important;
	color: var(--uap-cal-button-active-text, var(--uap-cal-button-text, #000000)) !important;
}

/* Optionale Automatik "Farbe automatisch an den Hintergrund anpassen",
 * standardmaessig aus. Nach dem Muster von UAP Bio 1.4.9.95
 * (tooloon_bio_button_design_css(), Parameter $auto_contrast):
 * mix-blend-mode:difference im Ruhezustand passt Text- und Rahmenfarbe an den
 * jeweiligen Hintergrund an. Hover und Aktiv setzen den Mischmodus bewusst
 * zurueck auf normal, weil eine Akzentfarbe (die Ueberlagerung) unter
 * "difference" eine unpassende Farbe ergeben wuerde (z.B. Orange auf Weiss
 * wird Blau) - siehe BIO tooloon-bio.php um Zeile 2006-2018. Der Rahmen bleibt
 * dort trotzdem automatisch lesbar, weil er auf einer eigenen ::before-Ebene
 * liegt, die weiterhin "difference" traegt (BIO tooloon-bio.php:2087-2099).
 * Zuverlaessig nur, wenn Rahmen- und Textfarbe oben weiss oder schwarz sind
 * (gleiche Einschraenkung wie in BIO, dort im Code benannt bei Zeile 2058). */

.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor) {
	mix-blend-mode: difference !important;
}

.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):hover,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):focus-visible,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):active,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)[aria-pressed="true"] {
	mix-blend-mode: normal !important;
	border-color: transparent !important;
}

.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):hover::before,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):focus-visible::before,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor):active::before,
.uap-cal-buttons-auto-contrast.uap-cal-buttons-custom-design .uap-cal-button:not(#uap-cal-specificity-anchor)[aria-pressed="true"]::before {
	content: "" !important;
	display: block !important;
	position: absolute !important;
	inset: -1px !important;
	border: 1px solid var(--uap-cal-button-border, #cccccc) !important;
	border-radius: inherit !important;
	mix-blend-mode: difference !important;
	pointer-events: none !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);
}

/* Schliessen-Kreuz (Popup und Pop-up fuer das naechste Event, dieselbe
 * Klasse). Zwei reale Befunde 2026-11-03:
 *  1. Ohne Custom CSS fing h2.uap-cal-next-title die Klicks ab: .uap-cal-scope
 *     hat position:relative und z-index:3 (siehe oben) und steht im DOM NACH
 *     dem Kreuz, ein Stapelkontext mit z-index 3 malt ueber ein positioniertes
 *     Element mit z-index:auto. Deshalb z-index:5 am Kreuz (beide liegen im
 *     Stapelkontext des Panels).
 *  2. Mit Custom CSS traf die Button-Basisregel der Custom CSS (Selektor
 *     :is(button, .button, ...):not(.tooloon-bio-plugin, ... .navbar-toggle *),
 *     Spezifitaet (0,2,0), !important) das <button> des Kreuzes: position:
 *     relative, 1px-Rahmen, Padding, Margin und Farbe #A8A8B0, im Hover
 *     (0,6,0) Farbe #FF922E. Das Kreuz traegt deshalb den Anker
 *     :not(#uap-cal-specificity-anchor) und !important auf jeder Deklaration:
 *     Grundzustand (1,1,0), :hover/:focus-visible/:active (1,2,0), beide ueber
 *     jedem (0,x,y) der Custom CSS. Das Plug-in-Kreuz nutzt bewusst keine der
 *     :not()-Ausschlussklassen der Custom CSS (.tooloon-bio-plugin,
 *     .navbar-toggle, .sb-search-button-*), das waeren fremde Klassen. */
.uap-cal-overlay-close:not(#uap-cal-specificity-anchor),
.uap-cal-overlay-close:not(#uap-cal-specificity-anchor):hover,
.uap-cal-overlay-close:not(#uap-cal-specificity-anchor):focus-visible,
.uap-cal-overlay-close:not(#uap-cal-specificity-anchor):active {
	position: absolute !important;
	top: 8px !important;
	right: 8px !important;
	left: auto !important;
	z-index: 5 !important;
	display: block !important;
	width: 34px !important;
	height: 34px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	background-image: none !important;
	color: #1d2327 !important;
	font-family: inherit !important;
	font-size: 24px !important;
	font-weight: 400 !important;
	line-height: 1 !important;
	text-align: center !important;
	text-decoration: none !important;
	cursor: pointer !important;
	transition: none !important;
	mix-blend-mode: normal !important;
}

/* Text, Titel und Links im Popup-Panel (0.3.2). Nur aktiv, wenn die jeweilige
 * Farbe gesetzt ist (Klassen has-popup-text / has-popup-link am Panel); leer =
 * Theme, dann erzeugt das Plug-in hier nichts. Buttons (.button, .uap-cal-button)
 * sind ausgenommen. Links: Anker :not(#uap-cal-specificity-anchor) und
 * !important, Spezifitaet (1,4,1) bzw. (1,5,1) gegen die Link-Regeln der Custom
 * CSS (0,9,1) bzw. (0,10,1), beide !important: die ID entscheidet. */
.uap-cal-overlay-panel.has-popup-text,
.uap-cal-overlay-panel.has-popup-text :is(h1, h2, h3, h4, h5, h6) {
	color: var(--uap-cal-popup-text);
}

.uap-cal-overlay-panel.has-popup-link a:not(.button):not(.uap-cal-button):not(#uap-cal-specificity-anchor) {
	color: var(--uap-cal-popup-link) !important;
}

.uap-cal-overlay-panel.has-popup-link a:not(.button):not(.uap-cal-button):not(#uap-cal-specificity-anchor):hover,
.uap-cal-overlay-panel.has-popup-link a:not(.button):not(.uap-cal-button):not(#uap-cal-specificity-anchor):focus-visible {
	color: var(--uap-cal-popup-link-hover, var(--uap-cal-popup-link)) !important;
}

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

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

/* Layout rows (0.3.0): a row holding two or three columns
 * (UAP_Calendar_Render::render_event() only emits this wrapper when a row has
 * more than one column with content). The columns are of equal width, the
 * modules inside a column stand one below the other. Below 640px every row
 * stacks into one column, the first column on top. Layout only - no colour,
 * border or font of its own, so the Custom CSS of the website has nothing to
 * collide with here (selector specificity: .uap-cal-row (0,1,0),
 * .uap-cal-row > .uap-cal-col (0,2,0), .uap-cal-col > .uap-cal-block (0,2,0),
 * .uap-cal-col > .uap-cal-block:last-child (0,3,0)). */

.uap-cal-row {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	margin: 0 0 18px;
}

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

.uap-cal-row > .uap-cal-col {
	flex: 1 1 0;
	min-width: 0;
}

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

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

/* Below 640px everything stands in one column, in a fixed reading order
 * that does not depend on which column a module was placed in (so layouts
 * built in the editor carry it too): title, flyer, the details (date/time/
 * location, directions, tickets, line-up), the text, then everything else
 * (photos, share, navigation) - each group in the order of the layout.
 * Reason: the flyer is the visual lead, the facts come before the long text.
 * Done in CSS without a second HTML output: the article becomes a flex
 * column, rows and columns are display:contents (plain divs without role,
 * name or focus, so nothing an assistive technology exposes is removed), and
 * every module gets an order value by its data-uap-cal-module. Visual order
 * then differs from the source order (source: left column before right
 * column); the only focusable modules (ticket link, share, navigation) keep
 * their relative order. Specificity: .uap-cal-event .uap-cal-block and
 * .uap-cal-event [data-uap-cal-module] are (0,2,0), no !important. */
@media (max-width: 640px) {
	.uap-cal-event {
		display: flex;
		flex-direction: column;
		gap: 18px;
	}

	.uap-cal-row,
	.uap-cal-row > .uap-cal-col {
		display: contents;
	}

	.uap-cal-event .uap-cal-block {
		order: 4;
		margin: 0;
	}

	.uap-cal-event [data-uap-cal-module="title"] {
		order: 0;
	}

	.uap-cal-event [data-uap-cal-module="flyer"] {
		order: 1;
	}

	.uap-cal-event [data-uap-cal-module="when"],
	.uap-cal-event [data-uap-cal-module="directions"],
	.uap-cal-event [data-uap-cal-module="tickets"],
	.uap-cal-event [data-uap-cal-module="lineup"] {
		order: 2;
	}

	.uap-cal-event [data-uap-cal-module="text"] {
		order: 3;
	}
}

/* Phase B (B3, Auftrag vom 2026-09-21): every overview entry always shows a
 * thumbnail (flyer, falling back to the first photo, falling back to a
 * neutral placeholder that still shows the date), with date and title below
 * it, one link per event. List and tiles differ only in arrangement. */

.uap-cal-list-link {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	text-decoration: none;
	max-width: 100%;
}

.uap-cal-list-thumb {
	display: block;
	width: 100%;
	max-width: 220px;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: 4px;
	background: #f0f0f1;
}

.uap-cal-list-thumb-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.uap-cal-list-thumb-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #646970;
	font-size: 13px;
	text-align: center;
	padding: 8px;
	box-sizing: border-box;
}

.uap-cal-list-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* List mode (default, pixel-identical in spirit to the pre-Phase-B markup:
 * a plain vertical list, now with a thumbnail added per B3). */

.uap-cal-overview-mode-list .uap-cal-list-item + .uap-cal-list-item {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.uap-cal-overview-mode-list .uap-cal-list-link {
	flex-direction: row;
	align-items: center;
	flex: 1 1 260px;
	min-width: 0;
}

.uap-cal-overview-mode-list .uap-cal-list-thumb {
	max-width: 120px;
	flex: 0 0 auto;
}

/* 0.3.0 compact main view: the entry is a row - flyer on the left, the
 * details (name, date and time, location) on the right, the ticket button
 * as a sibling link beside them; the name stands out. */

.uap-cal-overview-mode-list .uap-cal-list-item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
}

.uap-cal-list-name {
	font-weight: 600;
}

/* Short highlight of the entry a summary link (#uap-cal-event-<id>) leads to. */
.uap-cal-list-item {
	transition: background-color 0.4s;
}

.uap-cal-list-item.is-highlighted {
	background-color: var(--uap-cal-highlight, rgba(255, 146, 46, 0.2));
}

/* Tiles mode: a responsive grid of cards. */

.uap-cal-overview-mode-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 20px;
}

.uap-cal-overview-mode-tiles .uap-cal-list-item {
	margin: 0;
}

.uap-cal-overview-mode-tiles .uap-cal-list-thumb {
	max-width: 100%;
}

/* Zweitpruefung 0.2.1 (dritte Pruefung, 2026-09-21): layout only here, no
 * colour/border/background of its own - GLEICHHEITSREGEL, the toggle button
 * is the same "button" module class as the ticket/share/nav buttons and
 * follows the same theme-vs-custom-design source
 * (UAP_Calendar_Render::button_classes()) now instead of a separate,
 * always-on visual style. In the theme state it therefore correctly gets NO
 * plugin styling at all, exactly like every other button - the protected
 * "pressed" look further below only ever applies in the custom-design
 * state. */
.uap-cal-overview-toggle {
	display: flex;
	gap: 8px;
	margin: 0 0 14px;
}

/* Summary list [uap_calendar_list] (0.3.0): one line per event, date and name. */

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

.uap-cal-summary-item {
	margin: 0 0 6px;
}

.uap-cal-summary-date {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	margin-right: 6px;
}

/* Navigation arrows in the full view. */
.uap-cal-nav-arrow {
	display: inline-block;
}

/* Next-event pop-up (0.3.0). Layout only, the overlay itself is the existing
 * .uap-cal-overlay. */

.uap-cal-next-card {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-start;
}

.uap-cal-next-thumb {
	flex: 0 0 auto;
	width: 160px;
	max-width: 100%;
}

.uap-cal-next-image {
	display: block;
	width: 100%;
	height: auto;
}

.uap-cal-next-body {
	flex: 1 1 200px;
	min-width: 0;
}

.uap-cal-next-title {
	margin: 0 0 8px;
	padding-right: 40px;
}

.uap-cal-next-date,
.uap-cal-next-location,
.uap-cal-next-more {
	margin: 0 0 6px;
}

.uap-cal-next-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-top: 16px;
}

/* Below 640px: flyer on top, details below (overview entry and the pop-up
 * card), same principle as the event page. */
@media (max-width: 640px) {
	.uap-cal-overview-mode-list .uap-cal-list-link {
		flex-direction: column;
		align-items: flex-start;
	}

	.uap-cal-overview-mode-list .uap-cal-list-thumb {
		max-width: 240px;
	}

	.uap-cal-next-card {
		flex-direction: column;
	}
}
