/* Accessibility widget — native equivalent of a "WP One Tap"-style
   floating accessibility toolbar. Every feature toggles a class on
   <html>; nothing here talks to the server — it's a pure client-side
   reading/display preference, same category as a dark-mode toggle, so
   it's stored in localStorage rather than a user setting. See
   public/js/accessibility-widget.js for the panel logic and profiles.

   Das Panel nutzt ausschließlich die Design-Variablen der Seite
   (--p-primary, --p-surface, --p-border, --p-text …, siehe style.css und
   marketing.css) und folgt damit automatisch Hell/Dunkel sowie der im
   Admin eingestellten Akzentfarbe. Schriftgrößen im Panel sind bewusst in
   px (nicht rem), damit die Textgrößen-Stufen das Panel selbst nicht
   verformen. */

/* ---------- Floating trigger button ---------- */
/* Sitzt oberhalb des Hell/Dunkel-Umschalters (.theme-toggle-float in
   marketing.css, gleiche horizontale Position, 52px + 12px Abstand
   darunter). */
.a11y-trigger{position:fixed;bottom:84px;left:20px;z-index:2147483000;width:52px;height:52px;border-radius:50%;background:var(--p-primary,#0a0a0a);color:var(--p-on-primary,#fff);border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.25);transition:transform .15s ease}
.a11y-trigger:hover{transform:scale(1.07)}
.a11y-trigger:focus-visible{outline:3px solid var(--p-primary-ink,#312e81);outline-offset:3px}
.a11y-trigger svg{width:30px;height:30px}

/* ---------- Panel ---------- */
.a11y-panel{
 --a11y-accent:var(--p-primary,#4f46e5);
 --a11y-accent-ink:var(--p-primary-ink,#3730a3);
 --a11y-surface:var(--p-surface,#fff);
 --a11y-text:var(--p-text,#0f172a);
 --a11y-muted:var(--p-text-muted,#64748b);
 --a11y-border:var(--p-border,#e2e8f0);
 --a11y-border-strong:var(--p-border-strong,#cbd5e1);
 --a11y-soft:color-mix(in srgb,var(--a11y-text) 5%,var(--a11y-surface));
 --a11y-accent-soft:color-mix(in srgb,var(--a11y-accent) 11%,var(--a11y-surface));
 --a11y-focus:var(--p-primary-ink,#3730a3);
 --a11y-switch-off:var(--p-text-muted,#64748b);
 --a11y-danger:#b91c1c;
 --a11y-danger-soft:color-mix(in srgb,var(--a11y-danger) 9%,var(--a11y-surface));
 position:fixed;bottom:146px;left:20px;z-index:2147483000;width:440px;max-width:calc(100vw - 40px);max-height:min(760px,calc(100vh - 166px));
 display:flex;flex-direction:column;overflow:hidden;
 background:var(--a11y-surface);color:var(--a11y-text);border:1px solid var(--a11y-border);border-radius:var(--p-radius,16px);
 box-shadow:0 24px 60px -12px rgba(15,23,42,.35),0 8px 20px -8px rgba(15,23,42,.2);
 font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:13px;line-height:1.4;
 transform-origin:bottom left;transform:translateY(10px) scale(.98);opacity:0;pointer-events:none;transition:opacity .16s ease,transform .16s ease}
[data-theme="dark"] .a11y-panel{--a11y-danger:#fca5a5;--a11y-switch-off:#6b7280}
[data-theme="dark"] .a11y-profile-btn.active .a11y-switch{background:var(--a11y-accent-ink)}
[data-theme="dark"] .a11y-profile-btn.active .a11y-switch i{background:#0f1115}
.a11y-panel[hidden]{display:none}
.a11y-panel.open{transform:none;opacity:1;pointer-events:auto}
.a11y-panel,.a11y-panel *{box-sizing:border-box}
.a11y-panel h2,.a11y-panel h3,.a11y-panel p{margin:0}
.a11y-panel button{font:inherit;color:inherit;margin:0}
.a11y-panel button:focus-visible{outline:2px solid var(--a11y-focus);outline-offset:2px}

/* Kopfzeile */
.a11y-panel-head{flex:none;display:flex;align-items:center;gap:12px;padding:16px 14px 14px 18px;border-bottom:1px solid var(--a11y-border)}
.a11y-head-badge{flex:none;width:40px;height:40px;border-radius:12px;background:var(--a11y-accent);color:#fff;display:flex;align-items:center;justify-content:center}
.a11y-head-badge svg{width:24px;height:24px}
.a11y-head-text{flex:1;min-width:0}
.a11y-panel-head h2{font-size:16px;font-weight:700;letter-spacing:-.01em;line-height:1.25}
.a11y-panel-head p{margin-top:2px;font-size:12.5px;color:var(--a11y-muted)}
.a11y-panel-close{flex:none;width:36px;height:36px;border:none;border-radius:10px;background:transparent;color:var(--a11y-muted);cursor:pointer;display:flex;align-items:center;justify-content:center}
.a11y-panel-close:hover{background:var(--a11y-soft);color:var(--a11y-text)}

/* Scrollbereich */
.a11y-panel-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:18px 18px 4px;scrollbar-width:thin;scrollbar-color:var(--a11y-border-strong) transparent}
.a11y-section{margin:0 0 24px}
.a11y-group-title{margin:0 0 12px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--a11y-muted)}
.a11y-control{margin:0 0 16px}
.a11y-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:0 0 8px}
.a11y-section-title{font-size:13px;font-weight:650;color:var(--a11y-text)}
.a11y-section-value{font-size:12.5px;font-weight:600;color:var(--a11y-muted)}

/* Profile: Liste mit Schalter */
.a11y-profiles{display:flex;flex-direction:column;gap:6px}
.a11y-profile-btn{display:flex;align-items:center;gap:12px;width:100%;padding:9px 12px 9px 10px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-surface);text-align:left;cursor:pointer;transition:border-color .12s ease,background .12s ease}
.a11y-profile-btn:hover{border-color:var(--a11y-border-strong);background:var(--a11y-soft)}
.a11y-profile-ico{flex:none;width:36px;height:36px;border-radius:10px;background:var(--a11y-accent-soft);color:var(--a11y-accent-ink);display:flex;align-items:center;justify-content:center;transition:background .12s ease,color .12s ease}
.a11y-profile-text{flex:1;min-width:0;display:flex;flex-direction:column}
.a11y-profile-name{font-size:14px;font-weight:650;line-height:1.3}
.a11y-profile-desc{font-size:12px;color:var(--a11y-muted);line-height:1.35}
.a11y-switch{flex:none;position:relative;width:38px;height:22px;border-radius:999px;background:var(--a11y-switch-off);transition:background .15s ease}
.a11y-switch i{position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.3);transition:transform .15s ease}
.a11y-profile-btn.active{border-color:var(--a11y-accent);background:var(--a11y-accent-soft)}
.a11y-profile-btn.active .a11y-profile-ico{background:var(--a11y-accent);color:#fff}
.a11y-profile-btn.active .a11y-switch{background:var(--a11y-accent)}
.a11y-profile-btn.active .a11y-switch i{transform:translateX(16px)}
.a11y-profile-btn.active .a11y-profile-desc{color:var(--a11y-text)}

/* Textgröße */
.a11y-size{display:flex;align-items:center;gap:12px}
.a11y-size-btn{flex:none;width:44px;height:44px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-surface);font-size:15px;font-weight:700;cursor:pointer;transition:background .12s ease,border-color .12s ease}
.a11y-size-btn:hover:not(:disabled){background:var(--a11y-soft);border-color:var(--a11y-border-strong)}
.a11y-size-btn:disabled{opacity:.4;cursor:not-allowed}
.a11y-steps{flex:1;display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.a11y-steps i{height:6px;border-radius:3px;background:var(--a11y-border-strong);transition:background .15s ease}
.a11y-steps i.on{background:var(--a11y-accent)}

/* Textausrichtung: Segment-Schalter */
.a11y-seg{display:grid;grid-template-columns:repeat(4,1fr);gap:4px;padding:4px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-soft)}
.a11y-seg-btn{height:36px;border:none;border-radius:9px;background:transparent;color:var(--a11y-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .12s ease,color .12s ease}
.a11y-seg-btn:hover{color:var(--a11y-text);background:var(--a11y-surface)}
.a11y-seg-btn.active{background:var(--a11y-accent);color:#fff}

/* Werkzeug-Kacheln */
.a11y-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.a11y-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;min-height:90px;padding:14px 6px 10px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-surface);text-align:center;cursor:pointer;transition:background .12s ease,border-color .12s ease}
.a11y-tile svg{flex:none;width:24px;height:24px;color:var(--a11y-accent-ink)}
.a11y-tile-label{font-size:12px;font-weight:600;line-height:1.25;overflow-wrap:anywhere}
.a11y-tile:hover{border-color:var(--a11y-border-strong);background:var(--a11y-soft)}
.a11y-tile.active,.a11y-tile.active:hover{background:var(--a11y-accent);border-color:var(--a11y-accent);color:#fff}
.a11y-tile.active svg{color:#fff}
.a11y-tile-check{position:absolute;top:6px;right:6px;width:16px;height:16px;border-radius:50%;background:#fff;color:var(--a11y-accent);display:none;align-items:center;justify-content:center}
.a11y-tile-check svg{width:11px;height:11px;color:var(--a11y-accent)}
.a11y-tile.active .a11y-tile-check{display:flex}
.a11y-tile.active .a11y-tile-check svg{color:var(--a11y-accent)}

/* Fußzeile (bleibt beim Scrollen sichtbar) */
.a11y-panel-foot{flex:none;padding:12px 18px 14px;border-top:1px solid var(--a11y-border);background:var(--a11y-surface)}
.a11y-reset-btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;height:42px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-surface);color:var(--a11y-danger);font-size:14px;font-weight:650;cursor:pointer;transition:background .12s ease,border-color .12s ease}
.a11y-reset-btn:hover{background:var(--a11y-danger-soft);border-color:var(--a11y-danger)}
.a11y-panel-footer{margin-top:10px;text-align:center;font-size:12px;line-height:1.55;color:var(--a11y-muted)}
.a11y-panel-footer kbd{background:var(--a11y-soft);border:1px solid var(--a11y-border);border-radius:4px;padding:1px 5px;font-family:inherit;font-size:11.5px;color:var(--a11y-text)}

@media (prefers-reduced-motion:reduce){
 .a11y-panel,.a11y-trigger,.a11y-switch,.a11y-switch i,.a11y-steps i,.a11y-tile,.a11y-profile-btn{transition:none}
}

/* ---------- Applied effects (toggled on <html>) ---------- */

/* Text size steps */
html.a11y-size-1{font-size:107%}
html.a11y-size-2{font-size:116%}
html.a11y-size-3{font-size:130%}
html.a11y-size-4{font-size:150%}

html.a11y-line-height *:not(.a11y-panel):not(.a11y-panel *){line-height:1.9!important}
html.a11y-letter-spacing *:not(.a11y-panel):not(.a11y-panel *){letter-spacing:.06em!important}
html.a11y-readable-font, html.a11y-readable-font *:not(.a11y-panel):not(.a11y-panel *){font-family:'Lexend',Inter,ui-sans-serif,system-ui,sans-serif!important}

html.a11y-align-left body :not(.a11y-panel):not(.a11y-panel *){text-align:left!important}
html.a11y-align-center body :not(.a11y-panel):not(.a11y-panel *){text-align:center!important}
html.a11y-align-right body :not(.a11y-panel):not(.a11y-panel *){text-align:right!important}

html.a11y-highlight-links a:not(.a11y-panel a){background:#fef08a!important;color:#1e293b!important;text-decoration:underline!important;outline:1px solid #ca8a04}
html.a11y-highlight-headings h1:not(.a11y-panel h1),html.a11y-highlight-headings h2:not(.a11y-panel h2),html.a11y-highlight-headings h3:not(.a11y-panel h3){background:#dbeafe!important;color:#1e293b!important;box-shadow:0 0 0 4px #dbeafe}

html.a11y-high-contrast body{background:#000!important;color:#fff!important}
html.a11y-high-contrast body :not(.a11y-panel):not(.a11y-panel *){background-color:#000!important;color:#fff!important;border-color:#fff!important}
html.a11y-high-contrast a:not(.a11y-panel a){color:#ffff00!important;text-decoration:underline!important}
html.a11y-high-contrast img:not(.a11y-panel img){filter:grayscale(1) contrast(1.2)}

html.a11y-invert body{filter:invert(1) hue-rotate(180deg)}
html.a11y-invert img,html.a11y-invert video,html.a11y-invert .a11y-panel,html.a11y-invert .a11y-trigger,html.a11y-invert .a11y-reading-guide-bar{filter:invert(1) hue-rotate(180deg)}

html.a11y-grayscale body{filter:grayscale(1)}
html.a11y-low-saturation body{filter:saturate(.4)}

html.a11y-big-cursor,html.a11y-big-cursor *{cursor:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24"><path fill="black" stroke="white" stroke-width="1" d="M4 2l14 8-6 2-2 7-6-17z"/></svg>') 4 4,auto!important}

html.a11y-stop-animations *{animation-play-state:paused!important;animation-duration:0s!important;transition:none!important;scroll-behavior:auto!important}
html.a11y-stop-animations video,html.a11y-stop-animations audio{animation:none}

html.a11y-hide-images img:not(.a11y-panel img):not(.a11y-trigger img){visibility:hidden}

html.a11y-focus-highlight *:focus-visible{outline:4px solid #f59e0b!important;outline-offset:3px!important;box-shadow:0 0 0 8px rgba(245,158,11,.3)!important}

/* Reading guide bar, positioned by JS via --a11y-guide-y */
.a11y-reading-guide-bar{position:fixed;left:0;right:0;top:var(--a11y-guide-y,50%);height:36px;transform:translateY(-50%);background:rgba(250,204,21,.35);border-top:2px solid #eab308;border-bottom:2px solid #eab308;z-index:2147482999;pointer-events:none}

/* Mobil: Panel als Bottom-Sheet über die volle Breite */
@media(max-width:480px){
 .a11y-panel{left:0;right:0;bottom:0;width:100%;max-width:none;max-height:min(88vh,720px);border-radius:20px 20px 0 0;border-bottom:none}
 .a11y-trigger{left:12px;bottom:76px}
}


/* Teil 483: Auf dem Handy verdeckten zwei runde Knöpfe (Barrierefreiheit + Hell/Dunkel) unten links Inhalte.
   Dort bleibt nur der Barrierefreiheits-Knopf (kleiner); Hell/Dunkel steckt im Panel. */
.a11y-theme-btn{display:none;align-items:center;justify-content:center;gap:8px;width:100%;height:42px;margin-bottom:8px;border:1px solid var(--a11y-border);border-radius:12px;background:var(--a11y-surface);color:inherit;font-size:14px;font-weight:650;cursor:pointer}
@media (max-width:600px){
 .theme-toggle-float:not(.theme-toggle-inline){display:none!important}
 .a11y-theme-btn{display:flex}
 .a11y-trigger{width:44px;height:44px;left:12px;bottom:calc(12px + env(safe-area-inset-bottom))}
 body[data-mode="editor"] .a11y-trigger{bottom:calc(76px + env(safe-area-inset-bottom))}
}

/* Teil 496: Lesefreundliche Schrift (Lexend, SIL OFL 1.1, siehe /fonts/Lexend-OFL.txt) selbst gehostet –
   vorher von fonts.googleapis.com geladen (Verbindung zu Google ohne Einwilligung). Wird nur geladen, wenn die Option aktiv ist. */
@font-face{font-family:'Lexend';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/Lexend-400-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Lexend';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/Lexend-400-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Lexend';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/Lexend-600-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Lexend';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/Lexend-600-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
/* Teil 729: Sitzt der Hell/Dunkel-Schalter in der Kopfzeile, rückt der Barrierefreiheits-Knopf nach unten */
body:has(.theme-toggle-inline) .a11y-trigger{bottom:20px}
@media (max-width:600px){body:has(.theme-toggle-inline) .a11y-trigger{bottom:calc(12px + env(safe-area-inset-bottom))}body[data-mode="editor"]:has(.theme-toggle-inline) .a11y-trigger{bottom:calc(76px + env(safe-area-inset-bottom))}}

/* Teil 736: Am Handy steht Hell/Dunkel jetzt auch in der Kopfzeile (links neben dem Konto-Symbol, wie am Desktop).
   Nur im Editor auf sehr schmalen Bildschirmen ist dafür kein Platz – dort bleibt er im Barrierefreiheits-Panel. */
@media (max-width:400px){body[data-mode="editor"] .theme-toggle-inline,body[data-mode="wizard"] .theme-toggle-inline{display:none!important}}
