/*
 * Klarsicht A11y: Wirkung der Bedienhilfen auf die Seite.
 * Die Klassen setzt toolbar.js am <html>-Element. Die Leiste selbst (#klarsicht-host)
 * liegt in einem Shadow DOM und ist von allen Regeln ausgenommen.
 */

/* Größer darstellen */
html.ks-zoom body > *:not(#klarsicht-host) {
	zoom: var(--ks-zoom, 1);
}

/*
 * Größer darstellen, lesbare Schrift, Textabstände: Text braucht dann mehr Platz.
 * Lange Wörter, Adressen und Tabellen dürfen umbrechen, sonst wird die Seite auf schmalen
 * Bildschirmen breiter als das Fenster.
 */
html:is(.ks-zoom, .ks-font, .ks-spacing) body :not(:where(#klarsicht-host, pre, code, kbd, samp)) {
	overflow-wrap: anywhere !important;
	-webkit-hyphens: auto !important;
	hyphens: auto !important;
}
html:is(.ks-zoom, .ks-font, .ks-spacing) body :is(pre, code, kbd, samp) {
	white-space: pre-wrap !important;
	overflow-wrap: anywhere !important;
}
html:is(.ks-zoom, .ks-font, .ks-spacing) body :is(img, video, iframe, canvas, svg, table, input, select, textarea) {
	max-width: 100% !important;
}

/* Kontrast dunkel */
html.ks-contrast-dark body:not([data-ks-probe]),
html.ks-contrast-dark body :not(:where(img, picture, video, canvas, iframe, svg, svg *, #klarsicht-host, [data-ks-probe])) {
	background-color: #000 !important;
	background-image: none !important;
	color: #fff !important;
	border-color: #fff !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html.ks-contrast-dark body a,
html.ks-contrast-dark body a :not(:where(img, svg, svg *)) {
	color: #ffe600 !important;
	text-decoration: underline !important;
}
html.ks-contrast-dark body :is(input, select, textarea, button) {
	border: 1px solid #fff !important;
}

/* Kontrast hell */
html.ks-contrast-light body:not([data-ks-probe]),
html.ks-contrast-light body :not(:where(img, picture, video, canvas, iframe, svg, svg *, #klarsicht-host, [data-ks-probe])) {
	background-color: #fff !important;
	background-image: none !important;
	color: #000 !important;
	border-color: #000 !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html.ks-contrast-light body a,
html.ks-contrast-light body a :not(:where(img, svg, svg *)) {
	color: #00308f !important;
	text-decoration: underline !important;
}
html.ks-contrast-light body :is(input, select, textarea, button) {
	border: 1px solid #000 !important;
}

/*
 * Kontrast, beide Varianten: Sonderfälle. toolbar.js markiert leere Elemente:
 *   data-ks="clear"  Überlagerung ohne Inhalt (Abdunkelung hinter Dialogen, Klickflächen): durchsichtig,
 *                    sonst würde sie einfarbig und verdeckte die ganze Seite.
 *   data-ks="edge"   Fläche mit eigener Hintergrundfarbe und Inhalt (Schaltfläche, Karte, fixierte Leiste):
 *                    bekommt einen Umriss, weil ihre Farbe als Abgrenzung wegfällt.
 *   data-ks="ink"    kleine Form, die nur aus ihrer Hintergrundfarbe besteht (Menü-Striche, Punkte):
 *                    bekommt die Textfarbe, sonst verschwände sie im Hintergrund.
 * Übergänge sind abgeschaltet, damit der Wechsel sofort greift und toolbar.js echte Farben misst.
 */
html[class*="ks-contrast-"] body *,
html[class*="ks-contrast-"] body *::before,
html[class*="ks-contrast-"] body *::after {
	transition: none !important;
}
html[class*="ks-contrast-"] body [data-ks="clear"] {
	background-color: transparent !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}
html.ks-contrast-dark body [data-ks="ink"] {
	background-color: #fff !important;
}
html.ks-contrast-light body [data-ks="ink"] {
	background-color: #000 !important;
}
html.ks-contrast-dark body [data-ks="edge"]:not(:focus-visible) {
	outline: 1px solid #fff !important;
	outline-offset: -1px !important;
}
html.ks-contrast-light body [data-ks="edge"]:not(:focus-visible) {
	outline: 1px solid #000 !important;
	outline-offset: -1px !important;
}
/* Dialoge behalten einen sichtbaren Rand, wenn Fläche und Seite dieselbe Farbe bekommen. */
html.ks-contrast-dark body :is(dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]) {
	outline: 2px solid #fff !important;
}
html.ks-contrast-light body :is(dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]) {
	outline: 2px solid #000 !important;
}
/* Elementor legt Abdunkelungen über Hintergründe als Pseudo-Element. */
html[class*="ks-contrast-"] body :is(.e-con, .e-con-inner, .elementor-section, .elementor-column-wrap, .elementor-widget-wrap)::before,
html[class*="ks-contrast-"] body :is(.e-con, .e-con-inner, .elementor-section, .elementor-column-wrap, .elementor-widget-wrap)::after {
	background-color: transparent !important;
	background-image: none !important;
}

/* Graustufen. Ein Filter am Wurzelelement lässt fest positionierte Elemente an ihrem Platz. */
html.ks-gray {
	filter: grayscale(1);
}

/* Links hervorheben */
html.ks-links body a {
	text-decoration: underline !important;
	text-decoration-thickness: 0.15em !important;
	text-underline-offset: 0.15em !important;
	outline: 2px solid currentColor !important;
	outline-offset: 2px !important;
}

/* Gut lesbare Schrift. Symbolschriften bleiben unberührt. */
html.ks-font body,
html.ks-font body *:not(i):not(.fa):not(.fas):not(.far):not(.fab):not(.dashicons):not([class*="icon"]):not([class*="fa-"]):not(#klarsicht-host) {
	font-family: Verdana, "Segoe UI", system-ui, Arial, sans-serif !important;
}

/* Textabstände nach WCAG 1.4.12 */
html.ks-spacing body *:not(#klarsicht-host) {
	line-height: 1.6 !important;
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}
html.ks-spacing body p {
	margin-bottom: 2em !important;
}

/* Animationen anhalten */
html.ks-motion,
html.ks-motion *,
html.ks-motion *::before,
html.ks-motion *::after {
	animation-duration: 0.001ms !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}

/* Tastaturfokus hervorheben. Zwei Farben, damit der Rahmen auf jedem Untergrund sichtbar ist. */
html.ks-focus body :focus {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 7px #000 !important;
}

/* Großer Mauszeiger */
html.ks-cursor,
html.ks-cursor body *:not(#klarsicht-host) {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4v34l9-8 6 14 6-3-6-13h13z' fill='%23000' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
}
