/* ============================================================================
 * LDR Accessibility — Frontend
 * AGENTUR LEDERER · https://lederer.nrw
 *
 * Alle Effekte haengen an Klassen/CSS-Variablen des <html>-Elements.
 * Keine externen Ressourcen, keine Webfont-Requests.
 * ========================================================================= */

:root {
	--ldr-a11y-schrift: 1;
	--ldr-a11y-zeile: 1;
	--ldr-a11y-zeichen: 0em;
	--ldr-a11y-wort: 0em;
	--ldr-a11y-zoom: 1;

	--ldr-a11y-akzent: #5e7a25;
	--ldr-a11y-akzent-dunkel: #46591b;
	--ldr-a11y-flaeche: #ffffff;
	--ldr-a11y-text: #333333;
	--ldr-a11y-gedaempft: #6b7066;
	--ldr-a11y-rand: #e1e4dc;
	--ldr-a11y-knopf-bg: #f4f5f1;
	--ldr-a11y-radius: 12px;
	--ldr-a11y-abstand: 20px;
	--ldr-a11y-groesse: 52px;
}

/* ==========================================================================
 * 1. Seiteneffekte
 * ======================================================================== */

/* --- Kontrast: Filter am Wurzelelement, Widget dreht zurueck --- */
html.ldr-a11y--k-invert       { filter: invert(100%) hue-rotate(180deg); background: #fff; }
html.ldr-a11y--k-mono         { filter: grayscale(100%); }
html.ldr-a11y--k-sat-niedrig  { filter: saturate(50%); }
html.ldr-a11y--k-sat-hoch     { filter: saturate(180%); }

html.ldr-a11y--k-invert img,
html.ldr-a11y--k-invert video,
html.ldr-a11y--k-invert iframe,
html.ldr-a11y--k-invert [style*="background-image"] {
	filter: invert(100%) hue-rotate(180deg);
}

html.ldr-a11y--k-invert .ldr-a11y {
	filter: invert(100%) hue-rotate(180deg);
}
html.ldr-a11y--k-mono .ldr-a11y        { filter: grayscale(0); }
html.ldr-a11y--k-sat-niedrig .ldr-a11y { filter: saturate(200%); }
html.ldr-a11y--k-sat-hoch .ldr-a11y    { filter: saturate(56%); }

/* --- Kontrast: harte Farbmodi --- */
html.ldr-a11y--k-dunkel body,
html.ldr-a11y--k-dunkel body *:not(.ldr-a11y):not(.ldr-a11y *) {
	background-color: #000 !important;
	color: #fff !important;
	border-color: #fff !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html.ldr-a11y--k-dunkel h1:not(.ldr-a11y *),
html.ldr-a11y--k-dunkel h2:not(.ldr-a11y *),
html.ldr-a11y--k-dunkel h3:not(.ldr-a11y *),
html.ldr-a11y--k-dunkel h4:not(.ldr-a11y *),
html.ldr-a11y--k-dunkel h5:not(.ldr-a11y *),
html.ldr-a11y--k-dunkel h6:not(.ldr-a11y *) { color: #6ee7b7 !important; }
html.ldr-a11y--k-dunkel a:not(.ldr-a11y *) { color: #ffe14d !important; text-decoration: underline !important; }

html.ldr-a11y--k-hell body,
html.ldr-a11y--k-hell body *:not(.ldr-a11y):not(.ldr-a11y *) {
	background-color: #fff !important;
	color: #000 !important;
	border-color: #000 !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html.ldr-a11y--k-hell h1:not(.ldr-a11y *),
html.ldr-a11y--k-hell h2:not(.ldr-a11y *),
html.ldr-a11y--k-hell h3:not(.ldr-a11y *),
html.ldr-a11y--k-hell h4:not(.ldr-a11y *),
html.ldr-a11y--k-hell h5:not(.ldr-a11y *),
html.ldr-a11y--k-hell h6:not(.ldr-a11y *) { color: #00008b !important; }
html.ldr-a11y--k-hell a:not(.ldr-a11y *) { color: #00008b !important; text-decoration: underline !important; }

/* --- Text --- */
html.ldr-a11y--schrift { font-size: calc(100% * var(--ldr-a11y-schrift)) !important; }

html.ldr-a11y--zeile body *:not(.ldr-a11y):not(.ldr-a11y *) {
	line-height: calc(1.5 * var(--ldr-a11y-zeile)) !important;
}
html.ldr-a11y--zeichen body *:not(.ldr-a11y):not(.ldr-a11y *) {
	letter-spacing: var(--ldr-a11y-zeichen) !important;
}
html.ldr-a11y--wort body *:not(.ldr-a11y):not(.ldr-a11y *) {
	word-spacing: var(--ldr-a11y-wort) !important;
}
html.ldr-a11y--zoom body > *:not(.ldr-a11y) {
	zoom: var(--ldr-a11y-zoom);
}
html.ldr-a11y--lesbar body *:not(.ldr-a11y):not(.ldr-a11y *) {
	font-family: var(--ldr-a11y-lesbare-schrift, Verdana, Tahoma, "DejaVu Sans", sans-serif) !important;
}
html.ldr-a11y--linksbuendig body *:not(.ldr-a11y):not(.ldr-a11y *) {
	text-align: left !important;
	hyphens: none !important;
}

/* --- Orientierung --- */
html.ldr-a11y--links a:not(.ldr-a11y *) {
	text-decoration: underline !important;
	text-underline-offset: 2px;
	outline: 2px solid #0b5fff;
	outline-offset: 1px;
	background: #fff8b3 !important;
	color: #002a6e !important;
}
html.ldr-a11y--ueberschriften :is(h1, h2, h3, h4, h5, h6):not(.ldr-a11y *) {
	outline: 2px dashed #b8330c;
	outline-offset: 3px;
	background: #fff3ee !important;
	color: #7a2107 !important;
}
html.ldr-a11y--cursor,
html.ldr-a11y--cursor body {
	cursor: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"%3E%3Cpath d="M6 2l30 18-13 3 7 14-6 3-7-14-11 8z" fill="black" stroke="white" stroke-width="2"/%3E%3C/svg%3E') 4 2, auto !important;
}
html.ldr-a11y--cursor a,
html.ldr-a11y--cursor button {
	cursor: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"%3E%3Ccircle cx="24" cy="24" r="15" fill="black" stroke="white" stroke-width="3"/%3E%3C/svg%3E') 24 24, pointer !important;
}
html.ldr-a11y--ruhig *:not(.ldr-a11y):not(.ldr-a11y *) {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}
html.ldr-a11y--ruhig video:not(.ldr-a11y *) { display: none !important; }
html.ldr-a11y--bilder :is(img, picture, svg, video, canvas):not(.ldr-a11y *):not(.ldr-a11y__oeffner svg) {
	visibility: hidden !important;
}
html.ldr-a11y--bilder [style*="background-image"]:not(.ldr-a11y *) {
	background-image: none !important;
}
html.ldr-a11y--hinweise [title]:not(.ldr-a11y *)::after,
html.ldr-a11y--hinweise [aria-label]:not(.ldr-a11y *)::after {
	content: attr(title) attr(aria-label);
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	font-size: 12px;
	line-height: 1.5;
	background: #12324f;
	color: #fff;
	border-radius: 4px;
	vertical-align: middle;
}
/* Bewusst nur semantische Bereiche ausblenden — ein Ausblenden aller
 * body-Kinder würde bei verschachtelten Themes (YOOtheme) die Seite leeren. */
html.ldr-a11y--lesemodus :is(aside, nav, footer, header, .uk-sticky, .tm-toolbar, [role="banner"], [role="navigation"], [role="complementary"], [role="contentinfo"]):not(.ldr-a11y *) {
	display: none !important;
}
html.ldr-a11y--lesemodus :is(main, #main, #content, [role="main"]):not(.ldr-a11y *) {
	max-width: 46rem;
	margin-left: auto !important;
	margin-right: auto !important;
	padding: 24px 18px !important;
	background: #fffdf7 !important;
}

/* --- Lesemaske --- */
.ldr-a11y-maske {
	position: fixed;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.62);
	z-index: 2147483000;
	pointer-events: none;
}
.ldr-a11y-maske--oben  { top: 0; height: 0; }
.ldr-a11y-maske--unten { top: 0; bottom: 0; }

/* ==========================================================================
 * 2. Widget
 * ======================================================================== */

.ldr-a11y,
.ldr-a11y * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
	letter-spacing: normal;
	word-spacing: normal;
}

.ldr-a11y {
	position: fixed;
	z-index: 2147483200;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	font-size: 15px;
	color: var(--ldr-a11y-text);
}

/* Öffnungsrichtung folgt der Position: unten verankert öffnet nach oben,
 * oben verankert nach unten — sonst läuft das Panel aus dem Sichtfeld. */
.ldr-a11y--pos-unten-rechts { right: var(--ldr-a11y-abstand); bottom: var(--ldr-a11y-abstand); align-items: flex-end;   flex-direction: column-reverse; }
.ldr-a11y--pos-unten-links  { left: var(--ldr-a11y-abstand);  bottom: var(--ldr-a11y-abstand); align-items: flex-start; flex-direction: column-reverse; }
.ldr-a11y--pos-oben-rechts  { right: var(--ldr-a11y-abstand); top: var(--ldr-a11y-abstand);    align-items: flex-end;   flex-direction: column; }
.ldr-a11y--pos-oben-links   { left: var(--ldr-a11y-abstand);  top: var(--ldr-a11y-abstand);    align-items: flex-start; flex-direction: column; }
.ldr-a11y--pos-mitte-rechts { right: var(--ldr-a11y-abstand); top: 50%; transform: translateY(-50%); align-items: flex-end;   flex-direction: column-reverse; }
.ldr-a11y--pos-mitte-links  { left: var(--ldr-a11y-abstand);  top: 50%; transform: translateY(-50%); align-items: flex-start; flex-direction: column-reverse; }

/* Sprunglink */
.ldr-a11y__sprung {
	position: absolute;
	left: -9999px;
	top: 0;
	padding: 10px 16px;
	background: var(--ldr-a11y-akzent-dunkel);
	color: #fff;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
	white-space: nowrap;
}
.ldr-a11y__sprung:focus {
	left: 0;
	transform: translateY(-120%);
	outline: 3px solid #000;
	outline-offset: 2px;
}

/* Oeffner */
.ldr-a11y__oeffner {
	width: var(--ldr-a11y-groesse);
	height: var(--ldr-a11y-groesse);
	min-width: 44px;
	min-height: 44px;
	border: 2px solid transparent;
	border-radius: 50%;
	background: var(--ldr-a11y-akzent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
	padding: 0;
	transition: transform 0.15s ease, background 0.15s ease;
}
.ldr-a11y__oeffner:hover  { background: var(--ldr-a11y-akzent-dunkel); transform: scale(1.05); }
.ldr-a11y__oeffner:focus-visible,
.ldr-a11y__oeffner:focus  { outline: 3px solid #000; outline-offset: 3px; }
.ldr-a11y__oeffner svg    { width: 60%; height: 60%; }

/* Panel */
.ldr-a11y__panel {
	width: min(340px, calc(100vw - 24px));
	max-height: min(78vh, 720px);
	overflow-y: auto;
	background: var(--ldr-a11y-flaeche);
	border: 1px solid var(--ldr-a11y-rand);
	border-radius: var(--ldr-a11y-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
	padding: 4px 0 0;
}
.ldr-a11y__panel[hidden] { display: none; }

.ldr-a11y__kopf {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--ldr-a11y-rand);
	position: sticky;
	top: 0;
	background: var(--ldr-a11y-flaeche);
	z-index: 1;
}
.ldr-a11y__titel {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--ldr-a11y-text);
}
.ldr-a11y__schliessen {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--ldr-a11y-gedaempft);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 44px;
}
.ldr-a11y__schliessen svg { width: 16px; height: 16px; }
.ldr-a11y__schliessen:hover { background: var(--ldr-a11y-knopf-bg); color: var(--ldr-a11y-text); }
.ldr-a11y__schliessen:focus-visible,
.ldr-a11y__schliessen:focus { outline: 3px solid var(--ldr-a11y-akzent-dunkel); outline-offset: -2px; }

.ldr-a11y__koerper { padding: 6px 14px 2px; }

.ldr-a11y__gruppe { margin-bottom: 14px; }
.ldr-a11y__gruppentitel {
	margin: 0 0 7px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ldr-a11y-gedaempft);
}
.ldr-a11y__liste {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
}

/* Umschalter */
.ldr-a11y__knopf {
	min-height: 46px;
	padding: 8px 10px;
	border: 1px solid var(--ldr-a11y-rand);
	border-radius: 9px;
	background: var(--ldr-a11y-knopf-bg);
	color: var(--ldr-a11y-text);
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.ldr-a11y__knopf:hover { border-color: var(--ldr-a11y-akzent); }
.ldr-a11y__knopf:focus-visible,
.ldr-a11y__knopf:focus { outline: 3px solid var(--ldr-a11y-akzent-dunkel); outline-offset: 2px; }
.ldr-a11y__knopf[aria-pressed="true"] {
	background: var(--ldr-a11y-akzent);
	border-color: var(--ldr-a11y-akzent-dunkel);
	color: #fff;
}
.ldr-a11y__knopf[aria-pressed="true"]::after {
	content: " \2713";
	font-weight: 700;
}

/* Stufen */
.ldr-a11y__stufe {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 5px 0;
}
.ldr-a11y__stufentext { font-size: 13px; font-weight: 600; }
.ldr-a11y__stufensteuerung { display: flex; align-items: center; gap: 4px; }
.ldr-a11y__stufenknopf {
	width: 44px;
	height: 44px;
	border: 1px solid var(--ldr-a11y-rand);
	border-radius: 9px;
	background: var(--ldr-a11y-knopf-bg);
	color: var(--ldr-a11y-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ldr-a11y__stufenknopf svg { width: 15px; height: 15px; }
.ldr-a11y__stufenknopf:hover:not(:disabled) { border-color: var(--ldr-a11y-akzent); }
.ldr-a11y__stufenknopf:focus-visible,
.ldr-a11y__stufenknopf:focus { outline: 3px solid var(--ldr-a11y-akzent-dunkel); outline-offset: 2px; }
.ldr-a11y__stufenknopf:disabled { opacity: 0.4; cursor: default; }
.ldr-a11y__stufenwert {
	min-width: 26px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--ldr-a11y-gedaempft);
}

/* Links */
.ldr-a11y__link {
	grid-column: 1 / -1;
	display: block;
	min-height: 44px;
	padding: 12px 10px;
	border-radius: 9px;
	background: var(--ldr-a11y-knopf-bg);
	color: var(--ldr-a11y-akzent-dunkel);
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
}
.ldr-a11y__link:hover { background: #e9ede0; }
.ldr-a11y__link:focus-visible,
.ldr-a11y__link:focus { outline: 3px solid var(--ldr-a11y-akzent-dunkel); outline-offset: 2px; }

/* Fuss */
.ldr-a11y__fuss {
	padding: 10px 14px 14px;
	border-top: 1px solid var(--ldr-a11y-rand);
}
.ldr-a11y__reset {
	width: 100%;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 1px solid var(--ldr-a11y-rand);
	border-radius: 9px;
	background: #fff;
	color: var(--ldr-a11y-text);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.ldr-a11y__reset svg { width: 15px; height: 15px; }
.ldr-a11y__reset:hover { background: var(--ldr-a11y-knopf-bg); }
.ldr-a11y__reset:focus-visible,
.ldr-a11y__reset:focus { outline: 3px solid var(--ldr-a11y-akzent-dunkel); outline-offset: 2px; }

.ldr-a11y__meldung {
	margin: 0;
	padding: 0 14px 10px;
	font-size: 12px;
	color: var(--ldr-a11y-gedaempft);
	min-height: 1em;
}

/* Dunkles Theme */
.ldr-a11y--theme-dunkel {
	--ldr-a11y-flaeche: #23262a;
	--ldr-a11y-text: #f4f5f1;
	--ldr-a11y-gedaempft: #b9bdb5;
	--ldr-a11y-rand: #3c4046;
	--ldr-a11y-knopf-bg: #2d3136;
}
.ldr-a11y--theme-dunkel .ldr-a11y__reset { background: #2d3136; }
.ldr-a11y--theme-dunkel .ldr-a11y__oeffner:focus,
.ldr-a11y--theme-dunkel .ldr-a11y__knopf:focus { outline-color: #fff; }

/* Leisten-Layout */
.ldr-a11y--leiste .ldr-a11y__panel { width: min(760px, calc(100vw - 24px)); }
.ldr-a11y--leiste .ldr-a11y__liste { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

@media (max-width: 782px) {
	.ldr-a11y { --ldr-a11y-abstand: 12px; }
	.ldr-a11y__liste { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.ldr-a11y__oeffner { transition: none; }
	.ldr-a11y__oeffner:hover { transform: none; }
}

@media print {
	.ldr-a11y, .ldr-a11y-maske { display: none !important; }
}

/* ==========================================================================
 * 3. Inline-Schalter (Shortcode / YOOtheme-Element)
 * ======================================================================== */

.ldr-a11y-schalter-wrap { margin: 0; }

.ldr-a11y-schalter {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border: 2px solid var(--ldr-a11y-schalter-akzent, var(--ldr-a11y-akzent));
	border-radius: 9px;
	background: var(--ldr-a11y-schalter-akzent, var(--ldr-a11y-akzent));
	color: var(--ldr-a11y-schalter-farbe, #fff);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.ldr-a11y-schalter:hover { filter: brightness(0.92); }
.ldr-a11y-schalter:focus-visible,
.ldr-a11y-schalter:focus {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}
.ldr-a11y-schalter__icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; }

.ldr-a11y-schalter--umriss {
	background: transparent;
	color: var(--ldr-a11y-schalter-farbe, var(--ldr-a11y-schalter-akzent, var(--ldr-a11y-akzent)));
}
.ldr-a11y-schalter--umriss:hover { background: rgba(0, 0, 0, 0.04); filter: none; }

.ldr-a11y-schalter--link {
	background: transparent;
	border-color: transparent;
	padding: 10px 2px;
	color: var(--ldr-a11y-schalter-farbe, var(--ldr-a11y-schalter-akzent, var(--ldr-a11y-akzent)));
	text-decoration: underline;
	text-underline-offset: 3px;
}
.ldr-a11y-schalter--link:hover { filter: none; text-decoration-thickness: 2px; }

.ldr-a11y-schalter--klein  { padding: 8px 14px; font-size: 0.875em; }
.ldr-a11y-schalter--gross  { padding: 14px 24px; font-size: 1.125em; }

.ldr-a11y-schalter__hinweis {
	margin: 8px 0 0;
	font-size: 13px;
	color: #8C857A;
	font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
	.ldr-a11y-schalter { transition: none; }
}
