/**
 * mod_bfa11y - Barrierefreiheit-Toolbar (WCAG 2.1 / BITV 2.0)
 * Widget-Styles + Seiten-Effekte
 */

/* ---------------------------------------------------------------------------
 * 1. Widget (Launcher + Panel)
 * ------------------------------------------------------------------------ */

#bfa11y,
#bfa11y * {
	box-sizing: border-box;
	font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.35;
	letter-spacing: normal;
	word-spacing: normal;
}

#bfa11y {
	--bfa11y-color: #005ea8;
	--bfa11y-color-dark: #00416f;
	--bfa11y-z: 99990;
	--bfa11y-size: 40px;
	--bfa11y-off-x: 20px;
	--bfa11y-off-y: 20px;
	position: fixed;
	z-index: var(--bfa11y-z);
	inset: auto var(--bfa11y-off-x) var(--bfa11y-off-y) auto;
}

#bfa11y[data-position="bottom-left"] { inset: auto auto var(--bfa11y-off-y) var(--bfa11y-off-x); }
#bfa11y[data-position="top-right"]   { inset: var(--bfa11y-off-y) var(--bfa11y-off-x) auto auto; }
#bfa11y[data-position="top-left"]    { inset: var(--bfa11y-off-y) auto auto var(--bfa11y-off-x); }

.bfa11y-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.bfa11y-launcher {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--bfa11y-size);
	height: var(--bfa11y-size);
	border: 2px solid #ffffff;
	border-radius: 50%;
	background: var(--bfa11y-color);
	color: #ffffff;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease, background-color 0.15s ease;
	padding: 0;
}

.bfa11y-launcher:hover { background: var(--bfa11y-color-dark); transform: scale(1.06); }

.bfa11y-launcher svg {
	width: calc(var(--bfa11y-size) * 0.55);
	height: calc(var(--bfa11y-size) * 0.55);
	flex: 0 0 auto;
}

.bfa11y-launcher:focus-visible,
#bfa11y button:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

.bfa11y-panel {
	position: absolute;
	bottom: calc(var(--bfa11y-size) + 10px);
	right: 0;
	width: 320px;
	max-width: calc(100vw - 40px);
	max-height: min(76vh, 560px);
	overflow-y: auto;
	background: #ffffff;
	color: #16191d;
	border: 1px solid #e4e7eb;
	border-radius: 16px;
	box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
	font-size: 13px;
}

#bfa11y[data-position="bottom-left"] .bfa11y-panel { right: auto; left: 0; }
#bfa11y[data-position="top-right"] .bfa11y-panel   { bottom: auto; top: calc(var(--bfa11y-size) + 10px); }
#bfa11y[data-position="top-left"] .bfa11y-panel    { bottom: auto; top: calc(var(--bfa11y-size) + 10px); right: auto; left: 0; }

.bfa11y-head {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 14px 14px 8px;
	background: #ffffff;
	position: sticky;
	top: 0;
	z-index: 1;
}

.bfa11y-title {
	margin: 0;
	flex: 1;
	font-size: 16px;
	font-weight: 800;
	color: #16191d;
}

.bfa11y-iconbtn {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
}

.bfa11y-resetbtn { background: #f0f2f5; color: #444a52; }
.bfa11y-resetbtn:hover { background: #e2e6eb; }
.bfa11y-resetbtn svg { width: 16px; height: 16px; }

.bfa11y-close {
	background: var(--bfa11y-color);
	color: #ffffff;
	font-size: 19px;
	line-height: 1;
}

.bfa11y-close:hover { background: var(--bfa11y-color-dark); }

.bfa11y-body { padding: 6px 14px 14px; }

.bfa11y-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

/* Toggle-Pill: Icon links, Label rechts */
.bfa11y-pill {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 46px;
	padding: 7px 9px;
	border: 1px solid #e4e7eb;
	border-radius: 11px;
	background: #f6f7f9;
	color: #16191d;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.12s ease, background-color 0.12s ease;
}

.bfa11y-pill:hover { border-color: var(--bfa11y-color); background: #eef4fa; }

.bfa11y-pill[aria-pressed="true"] {
	background: var(--bfa11y-color);
	border-color: var(--bfa11y-color-dark);
	color: #ffffff;
}

.bfa11y-pill-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
}

.bfa11y-pill-icon svg { width: 20px; height: 20px; }

.bfa11y-pill-label { line-height: 1.2; }

/* Stepper-Zeilen */
.bfa11y-steppers { margin-top: 8px; }

.bfa11y-stepper {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 5px 8px;
	border: 1px solid #e4e7eb;
	border-radius: 11px;
	background: #f6f7f9;
	margin-bottom: 8px;
}

.bfa11y-stepper-label {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 12px;
	font-weight: 600;
	color: #16191d;
	overflow-wrap: break-word;
	hyphens: auto;
}

.bfa11y-stepper-bar {
	flex: 0 0 44px;
	height: 5px;
	border-radius: 3px;
	background: #dde1e6;
	overflow: hidden;
}

.bfa11y-stepper-fill {
	display: block;
	height: 100%;
	width: 30%;
	border-radius: 3px;
	background: var(--bfa11y-color);
	transition: width 0.15s ease;
}

.bfa11y-stepper-value {
	flex: 0 0 40px;
	text-align: right;
	font-size: 11.5px;
	font-weight: 700;
	color: #444a52;
	white-space: nowrap;
}

.bfa11y-step {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: 1px solid #dde1e6;
	border-radius: 9px;
	background: #ffffff;
	color: #16191d;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.bfa11y-step:hover { border-color: var(--bfa11y-color); color: var(--bfa11y-color); }

.bfa11y-note {
	margin: 6px 0 0;
	font-size: 10.5px;
	color: #6a7077;
}

@media (prefers-reduced-motion: reduce) {
	#bfa11y * { transition: none !important; }
}

/* ---------------------------------------------------------------------------
 * 2. Skip-Link (WCAG 2.4.1 Bloecke umgehen)
 * ------------------------------------------------------------------------ */

.bfa11y-skiplink {
	position: fixed;
	top: -100px;
	left: 12px;
	z-index: 2147483646;
	padding: 12px 20px;
	background: #003054;
	color: #ffffff !important;
	font-size: 16px;
	font-weight: 700;
	border-radius: 0 0 8px 8px;
	text-decoration: underline;
	transition: top 0.15s ease;
}

.bfa11y-skiplink:focus {
	top: 0;
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * 3. Seiten-Effekte (per Klasse auf <html>)
 * ------------------------------------------------------------------------ */

/* Zeilenhoehe (WCAG 1.4.12) - Faktor kommt als CSS-Variable vom JS */
html.bfa11y-lh body *:not(#bfa11y):not(#bfa11y *) {
	line-height: var(--bfa11y-lh, 1.5) !important;
}

/* Buchstaben-/Wortabstand (WCAG 1.4.12) */
html.bfa11y-ls body *:not(#bfa11y):not(#bfa11y *) {
	letter-spacing: var(--bfa11y-ls, 0.05em) !important;
	word-spacing: calc(var(--bfa11y-ls, 0.05em) * 1.4) !important;
}

/* Gut lesbare Schrift */
html.bfa11y-readable body *:not(#bfa11y):not(#bfa11y *) {
	font-family: Verdana, Arial, Helvetica, sans-serif !important;
	font-style: normal !important;
}

/* Links hervorheben (WCAG 1.4.1 - nicht nur Farbe) */
html.bfa11y-links body a:not(#bfa11y a) {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 2px !important;
	font-weight: 700 !important;
	outline: 1px dashed currentColor;
	outline-offset: 1px;
}

/* Hoher Kontrast dunkel (WCAG 1.4.3 / 1.4.6)
   Hinweis: der body-Hintergrund wird zusaetzlich per Inline-Style vom JS
   gesetzt, weil manche Templates ihn mit hoeherer Prioritaet ueberschreiben. */
html.bfa11y-contrast-dark body,
html.bfa11y-contrast-dark body *:not(#bfa11y):not(#bfa11y *):not(img):not(video):not(svg):not(svg *):not(picture):not(iframe) {
	background-color: #000000 !important;
	background-image: none !important;
	color: #ffffff !important;
	border-color: #ffffff !important;
	text-shadow: none !important;
	box-shadow: none !important;
}

html.bfa11y-contrast-dark body a:not(#bfa11y a),
html.bfa11y-contrast-dark body a:not(#bfa11y a) * {
	color: #ffd500 !important;
	text-decoration: underline !important;
}

html.bfa11y-contrast-dark body button:not(#bfa11y button),
html.bfa11y-contrast-dark body input,
html.bfa11y-contrast-dark body select,
html.bfa11y-contrast-dark body textarea {
	background-color: #000000 !important;
	color: #ffffff !important;
	border: 2px solid #ffffff !important;
}

/* Hoher Kontrast hell */
html.bfa11y-contrast-light body,
html.bfa11y-contrast-light body *:not(#bfa11y):not(#bfa11y *):not(img):not(video):not(svg):not(svg *):not(picture):not(iframe) {
	background-color: #ffffff !important;
	background-image: none !important;
	color: #000000 !important;
	border-color: #000000 !important;
	text-shadow: none !important;
	box-shadow: none !important;
}

html.bfa11y-contrast-light body a:not(#bfa11y a),
html.bfa11y-contrast-light body a:not(#bfa11y a) * {
	color: #0000d0 !important;
	text-decoration: underline !important;
}

html.bfa11y-contrast-light body button:not(#bfa11y button),
html.bfa11y-contrast-light body input,
html.bfa11y-contrast-light body select,
html.bfa11y-contrast-light body textarea {
	background-color: #ffffff !important;
	color: #000000 !important;
	border: 2px solid #000000 !important;
}

/* Graustufen / Invertieren via Backdrop-Filter-Overlay
   (zerstoert kein position:fixed der Seite) */
.bfa11y-filter {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 2147483600;
	display: none;
}

html.bfa11y-grayscale .bfa11y-filter {
	display: block;
	-webkit-backdrop-filter: grayscale(1);
	backdrop-filter: grayscale(1);
}

html.bfa11y-invert .bfa11y-filter {
	display: block;
	-webkit-backdrop-filter: invert(1) hue-rotate(180deg);
	backdrop-filter: invert(1) hue-rotate(180deg);
}

/* Animationen stoppen (WCAG 2.2.2 / 2.3.3) */
html.bfa11y-noanim *,
html.bfa11y-noanim *::before,
html.bfa11y-noanim *::after {
	animation-duration: 0.001s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001s !important;
	scroll-behavior: auto !important;
}

/* Bilder ausblenden */
html.bfa11y-hideimg body img:not(#bfa11y img),
html.bfa11y-hideimg body picture,
html.bfa11y-hideimg body video,
html.bfa11y-hideimg body figure,
html.bfa11y-hideimg body svg:not(#bfa11y svg) {
	visibility: hidden !important;
}

html.bfa11y-hideimg body *:not(#bfa11y):not(#bfa11y *) {
	background-image: none !important;
}

/* Grosser Cursor */
html.bfa11y-cursor,
html.bfa11y-cursor body,
html.bfa11y-cursor body *:not(#bfa11y):not(#bfa11y *) {
	cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'><path d='M6 2l0 34 9-9 6 13 6-3-6-13 12 0z' fill='black' stroke='white' stroke-width='2.5'/></svg>") 4 2, auto !important;
}

/* Sichtbarer Tastaturfokus verstaerken (WCAG 2.4.7) */
html.bfa11y-focus body *:focus {
	outline: 4px solid #ffbf00 !important;
	outline-offset: 2px !important;
	border-radius: 2px;
}

/* Lesemaske */
.bfa11y-mask-top,
.bfa11y-mask-bottom {
	position: fixed;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.6);
	pointer-events: none;
	z-index: 2147483620;
	display: none;
}

html.bfa11y-mask .bfa11y-mask-top,
html.bfa11y-mask .bfa11y-mask-bottom {
	display: block;
}
