/* ========== A11Y Widget UI ========== */
:root{
    --a11y-z: 2147483000;
    --a11y-radius: 14px;
    --a11y-shadow: 0 10px 30px rgba(0,0,0,.18);
    --a11y-border: 1px solid rgba(0,0,0,.12);
    --a11y-bg: #fff;
    --a11y-fg: #111;
    --a11y-muted: rgba(0,0,0,.6);
    --a11y-accent: #0a66ff;
}

html {
    font-size: calc(100% * var(--a11y-text-scale));
}
body {
    line-height: var(--a11y-line-height);
    letter-spacing: var(--a11y-letter-spacing);
}



#a11y-root{ position: fixed; z-index: var(--a11y-z); left: 16px; bottom: 16px; font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

/* =========================================================
   A11Y Floating Button – Icon bleibt fix, Label slidet rein
   ========================================================= */

#a11y-btn{
    position: relative;           /* für absolut positioniertes Label */
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;
    padding: 0;

    border: var(--a11y-border);
    border-radius: 999px;
    background: var(--a11y-bg);
    color: var(--a11y-fg);
    box-shadow: var(--a11y-shadow);
    cursor: pointer;

    overflow: hidden;
    white-space: nowrap;

    transition:
            width .34s cubic-bezier(.2, .9, .2, 1.15),
            padding .34s cubic-bezier(.2, .9, .2, 1.15);
}

/* Icon bleibt immer sichtbar & zentriert */
#a11y-btn svg{
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    fill: currentColor;
}

/* Label nimmt KEINEN Platz im Layout weg */
#a11y-btn .a11y-btn-label{
    position: absolute;
    left: 52px;                   /* startet direkt rechts neben dem runden Button */
    top: 50%;
    transform: translateY(-50%) translateX(250px);
    opacity: 0;

    pointer-events: none;
    font-weight: 600;
    white-space: nowrap;

    transition:
            opacity .18s ease,
            transform .34s cubic-bezier(.2, .9, .2, 1.2);
}

/* ===== Hover (Desktop) ===== */
@media (hover: hover) {
    #a11y-btn:hover{
        width: 210px;
        padding: 0 14px;
        justify-content: flex-start; /* nicht zwingend, aber fühlt sich gut an */
    }

    #a11y-btn:hover .a11y-btn-label{
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* ===== Tastatur-Fokus ===== */
#a11y-btn:focus-visible{
    outline: 3px solid var(--a11y-accent);
    outline-offset: 3px;

    width: 210px;
    padding: 0 14px;
    justify-content: flex-start;
}

#a11y-btn:focus-visible .a11y-btn-label{
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ===== Wenn Panel offen ist → dauerhaft expanded ===== */
#a11y-btn[aria-expanded="true"]{
    width: 210px;
    padding: 0 14px;
    justify-content: flex-start;
}

#a11y-btn[aria-expanded="true"] .a11y-btn-label{
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ===== Touch-Geräte: bleibt rund, kein Label ===== */
@media (hover: none) {
    #a11y-btn{
        width: 52px;
        padding: 0;
    }
    #a11y-btn .a11y-btn-label{
        display: none;
    }
}







#a11y-panel{
    width: 340px;
    max-height: 70vh;          /* 🔥 nie höher als Bildschirm */
    display: flex;
    flex-direction: column;

    overflow: hidden;


    border: var(--a11y-border);
    border-radius: var(--a11y-radius);
    background: var(--a11y-bg);
    color: var(--a11y-fg);
    box-shadow: var(--a11y-shadow);
}
#a11y-panel[hidden]{ display:none; }

#a11y-header{
    display:flex; align-items:center; justify-content:space-between;
    padding: 12px 12px 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
#a11y-title{ font-weight: 700; }
#a11y-close{
    border: none; background: transparent; cursor:pointer;
    padding: 8px; border-radius: 10px;
}
#a11y-close:focus{ outline: 3px solid var(--a11y-accent); outline-offset: 2px; }

#a11y-body{
    padding: 12px;
    display: grid;
    gap: 12px;

    overflow-y: auto;          /* 🔥 nur Inhalt scrollt */
    min-height: 0;
    flex: 1 1 auto;
}

/* schöner, schlanker Scrollbalken */
#a11y-body::-webkit-scrollbar { width: 6px; }
#a11y-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.2);
    border-radius: 6px;
}
#a11y-body { scrollbar-width: thin; }

.a11y-group-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--a11y-muted);
    margin-top: 6px;
}

.a11y-row{ display:flex; align-items:center; justify-content:space-between; gap: 12px; }
.a11y-row label{ font-weight: 600; }
.a11y-row .hint{ font-weight: 400; color: var(--a11y-muted); font-size: 12px; display:block; margin-top: 2px; }
.a11y-controls{ display:flex; gap: 8px; align-items:center; }

.a11y-btn-sm{
    border: var(--a11y-border);
    background: #f6f7f9;
    color: var(--a11y-fg);
    padding: 8px 10px;
    border-radius: 12px;
    cursor:pointer;
}
.a11y-btn-sm:focus{ outline: 3px solid var(--a11y-accent); outline-offset: 2px; }

.a11y-toggle{
    display:flex; align-items:center; gap: 10px; justify-content:space-between;
    border: var(--a11y-border);
    background: #f6f7f9;
    padding: 10px 12px;
    border-radius: 14px;
}
.a11y-toggle button{
    border: var(--a11y-border);
    background: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    cursor:pointer;
}
.a11y-toggle button[aria-pressed="true"]{
    border-color: rgba(10,102,255,.45);
    box-shadow: 0 0 0 3px rgba(10,102,255,.15);
}

/* ===== Pro UI polish ===== */
.a11y-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: var(--a11y-border);
    background: rgba(10,102,255,.08);
    color: var(--a11y-fg);
    margin-left: 8px;
}

.a11y-seg {
    display: inline-flex;
    border: var(--a11y-border);
    background: #fff;
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
}

.a11y-seg button {
    border: none;
    background: transparent;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.a11y-seg button[aria-pressed="true"]{
    background: rgba(10,102,255,.14);
    box-shadow: inset 0 0 0 1px rgba(10,102,255,.25);
}

.a11y-range {
    width: 100%;
    display: grid;
    gap: 6px;
}

.a11y-range-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
}

.a11y-range-value {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: var(--a11y-border);
    background: rgba(0,0,0,.04);
}

.a11y-range input[type="range"] {
    width: 100%;
    accent-color: var(--a11y-accent);
}

#a11y-footer{
    padding: 10px 12px 12px 12px;
    border-top: 1px solid rgba(0,0,0,.08);
    display:flex; gap: 10px; justify-content:space-between; align-items:center;
}

#a11y-header,
#a11y-footer{
    flex: 0 0 auto;
}

#a11y-reset{
    border: var(--a11y-border);
    background: transparent;
    padding: 8px 10px;
    border-radius: 12px;
    cursor:pointer;
}
#a11y-note{ font-size: 12px; color: var(--a11y-muted); }

/* ========== User Settings applied via HTML attributes ========== */
/* We apply settings to <html> so it's global */
html[data-a11y-font="dyslexic"] body,
html[data-a11y-font="dyslexic"] header #hero-text,
html[data-a11y-font="dyslexic"] header #hero-text h1,
html[data-a11y-font="dyslexic"] header #hero-text h2,
html[data-a11y-font="dyslexic"] button,
html[data-a11y-font="dyslexic"] input,
html[data-a11y-font="dyslexic"] select,
html[data-a11y-font="dyslexic"] textarea {
    font-family: "OpenDyslexic", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
}


html[data-a11y-contrast="high"]{
    filter: contrast(1.2);
}
html[data-a11y-colors="grayscale"]{
    filter: grayscale(1);
}
html[data-a11y-links="highlight"] a{
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    text-underline-offset: 3px !important;
}
html[data-a11y-focus="strong"] :focus {
    outline: 4px solid #0a66ff !important;
    outline-offset: 3px !important;
    border-radius: 6px;
}

html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    scroll-behavior: auto !important;
}

html[data-a11y-motion="reduce"] .hero {
    background-attachment: scroll !important;
}

/* Text scaling & spacing controlled by CSS variables */
html{
    --a11y-text-scale: 1;
    --a11y-line-height: 1.5;
    --a11y-letter-spacing: 0px;
    --a11y-mask-band: 140px; /* default */
}
body{
    font-size: calc(100% * var(--a11y-text-scale));
    line-height: var(--a11y-line-height);
    letter-spacing: var(--a11y-letter-spacing);
}

/* Optional: Dark mode for page + widget (simple, safe-ish approach) */
html[data-a11y-theme="dark"] body {
    background: #0b0c0f !important;
    color: #f2f4f8 !important;
}

html[data-a11y-theme="dark"] .section-pad,
html[data-a11y-theme="dark"] .card,
html[data-a11y-theme="dark"] .accordion-item,
html[data-a11y-theme="dark"] .modal-content {
    background: #151821 !important;
    color: #f2f4f8 !important;
}

html[data-a11y-theme="dark"] a {
    color: #8ab4ff !important;
}

/* ========== Reading Mask (Lesemaske) ========== */
#a11y-mask {
    position: fixed;
    inset: 0;
    z-index: calc(var(--a11y-z) - 10); /* unter dem Widget, über der Seite */
    pointer-events: none;             /* blockt keine Klicks */
    display: none;
}

/* Zwei dunkle "Vorhänge" + ein transparenter Streifen in der Mitte */
#a11y-mask::before,
#a11y-mask::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

/* Oben: von 0 bis maskTop */
#a11y-mask::before {
    top: 0;
    height: var(--a11y-mask-top, 40%);
}

/* Unten: ab maskBottom bis Ende */
#a11y-mask::after {
    top: var(--a11y-mask-bottom, 60%);
    bottom: 0;
}

/* Optional: feine Linie für die Lesespur */
#a11y-mask-line {
    position: fixed;
    left: 0;
    width: 100%;
    top: var(--a11y-mask-line, 50%);
    height: 2px;
    background: rgba(255,255,255,.55);
    mix-blend-mode: overlay;
    z-index: calc(var(--a11y-z) - 9);
    pointer-events: none;
    display: none;
}

html[data-a11y-mask="on"] #a11y-mask,
html[data-a11y-mask="on"] #a11y-mask-line {
    display: block;
}

html[data-a11y-maskfocus="on"] .a11y-paragraph-focus {
    outline: 3px solid rgba(10,102,255,.55);
    outline-offset: 6px;
    border-radius: 10px;
    background: rgba(10,102,255,.06);
    transition: outline-color .2s ease, background .2s ease;
}



/* ===== Collapsible section ===== */
.a11y-collapse {
    border: var(--a11y-border);
    background: #f6f7f9;
    border-radius: 14px;
    /*overflow: hidden;*/
}

.a11y-collapse__btn{
    width: 100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.a11y-collapse__btn{
    background: #f6f7f9 !important;
    color: var(--a11y-fg) !important;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.a11y-collapse__btn:focus{
    outline: 3px solid var(--a11y-accent);
    outline-offset: 2px;
}

.a11y-collapse__chev{
    transition: transform .2s ease;
    font-size: 14px;
    opacity: .8;
}

.a11y-collapse[aria-expanded="true"] .a11y-collapse__chev{
    transform: rotate(180deg);
}

.a11y-collapse__content{
    padding: 0 12px 12px 12px;
    display: grid;
    gap: 12px;
}

.a11y-collapse[aria-expanded="false"] .a11y-collapse__content{
    display: none;
}


/* ===== Cursor Größen ===== */

/* Basis: nichts ändern */
html[data-a11y-cursor="normal"] * {
    cursor: auto !important;
}

html[data-a11y-cursor="large"] * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'%3E%3Cpath d='M4 2 L20 18 L14 20 L16 28 L12 30 L10 22 L4 24 Z' fill='white' stroke='black' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 3 3, auto !important;
}

html[data-a11y-cursor="xlarge"] * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 32 32'%3E%3Cpath d='M4 2 L20 18 L14 20 L16 28 L12 30 L10 22 L4 24 Z' fill='white' stroke='black' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 3 3, auto !important;
}