/**
 * Barrierefreiheit: der Knopf, das Fenster, und was die Schalter tun.
 *
 * Die Wirkung haengt an Klassen am <html> — ambera-a11y-text, -contrast,
 * -links, -font, -motion, -focus. Sie muessen gegen alles gewinnen, was das
 * Theme sonst schreibt, darum !important: der Besucher hat es so verlangt.
 */

/* ------------------------------------------------------------ Der Knopf */

.ambera-access {
	position: fixed;
	bottom: 20px;
	z-index: 9000;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.3;
}

.ambera-access.is-right { right: 20px; }
.ambera-access.is-left { left: 20px; }

.ambera-access-open {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 48px;
	padding: 0 16px 0 12px;
	border: 0;
	border-radius: 999px;
	background: var(--ambera-accent, #e8720c);
	color: #fff;
	font: inherit;
	font-weight: 600;
	box-shadow: 0 6px 20px rgb(0 0 0 / 0.22);
	cursor: pointer;
}

.ambera-access-open:hover { filter: brightness(0.95); }

/*
 * Eingefahren: nur das Zeichen. Der Name faehrt aus, wenn die Maus darauf
 * liegt oder der Knopf den Fokus hat — ein Knopf, der dauernd
 * "Barrierefreiheit" sagt, steht der Seite im Weg; einer, der es auf
 * Nachfrage sagt, nicht. Fuer den Screenreader steht der Name immer da
 * (aria-label am Knopf); die Breite waechst weich, wer keine Bewegung
 * will, bekommt sie ohne Uebergang.
 */
.ambera-access-open { padding: 0 12px; }
.ambera-access-word {
	display: inline-block;
	max-width: 0;
	overflow: hidden;
	white-space: nowrap;
	opacity: 0;
	transition: max-width .25s ease, opacity .2s ease, margin .25s ease;
	margin-left: -8px;
}
.ambera-access-open:hover .ambera-access-word,
.ambera-access-open:focus-visible .ambera-access-word,
.ambera-access-open[aria-expanded="true"] .ambera-access-word {
	max-width: 14em;
	opacity: 1;
	margin-left: 0;
	margin-right: 4px;
}
@media (prefers-reduced-motion: reduce) {
	.ambera-access-word { transition: none; }
}

.ambera-access-open:focus-visible,
.ambera-access-panel button:focus-visible {
	outline: 3px solid #000;
	outline-offset: 2px;
}

.ambera-access-mark { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Auf dem Handy nur das Zeichen — der Name nimmt sonst die halbe Breite. */
@media (max-width: 600px) {
	.ambera-access-word { display: none; }
	.ambera-access-open { padding: 0 12px; }
}

/* ---------------------------------------------------------- Das Fenster */

.ambera-access-panel {
	position: absolute;
	bottom: 60px;
	width: 260px;
	padding: 8px;
	border-radius: 14px;
	background: #fff;
	color: #111;
	box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
}

.ambera-access.is-right .ambera-access-panel { right: 0; }
.ambera-access.is-left .ambera-access-panel { left: 0; }

.ambera-access-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 6px 8px 10px;
}

.ambera-access-close {
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 8px;
	background: #f0f0f0;
	color: #111;
	font: inherit;
	font-size: 18px;
	cursor: pointer;
}

.ambera-access-tool {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px;
	border: 0;
	border-radius: 9px;
	background: none;
	color: #111;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.ambera-access-tool:hover { background: #f5f5f5; }

.ambera-access-switch {
	position: relative;
	flex: none;
	width: 38px;
	height: 22px;
	border-radius: 999px;
	background: #ccc;
	transition: background .15s;
}

.ambera-access-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s;
}

.ambera-access-tool[aria-pressed="true"] .ambera-access-switch { background: var(--ambera-accent, #e8720c); }
.ambera-access-tool[aria-pressed="true"] .ambera-access-switch::after { transform: translateX(16px); }

.ambera-access-reset {
	display: block;
	width: 100%;
	margin-top: 6px;
	padding: 9px;
	border: 1px solid #ddd;
	border-radius: 9px;
	background: none;
	color: #333;
	font: inherit;
	cursor: pointer;
}

.ambera-access-reset:hover { background: #f5f5f5; }

/* --------------------------------------------------------- Die Wirkung */

/* Groessere Schrift: ein Viertel mehr, ueber die Wurzel — alles in rem
   waechst mit, und das ist im Theme alles. */
html.ambera-a11y-text { font-size: 125% !important; }

/* Mehr Kontrast: ueber den Filter, damit Bilder, Farben und Text
   gleichermassen anziehen — ohne jedes Element einzeln zu kennen. */
html.ambera-a11y-contrast { filter: contrast(1.35) saturate(0.85); }

html.ambera-a11y-links a { text-decoration: underline !important; text-underline-offset: 2px; }

html.ambera-a11y-font, html.ambera-a11y-font body, html.ambera-a11y-font * {
	font-family: Verdana, "Segoe UI", Arial, sans-serif !important;
	letter-spacing: 0.02em;
}

html.ambera-a11y-motion *,
html.ambera-a11y-motion *::before,
html.ambera-a11y-motion *::after {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}

html.ambera-a11y-focus :focus { outline: 3px solid #e8720c !important; outline-offset: 2px !important; }

/* Das eigene Fenster nimmt die Schrift nicht an: es bleibt lesbar, wie es ist. */
html.ambera-a11y-font .ambera-access, html.ambera-a11y-font .ambera-access * { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; }
html.ambera-a11y-text .ambera-access { font-size: 15px; }
