/**
 * GoQueer Accessibility Toolbar + Accessibility Modes (Frontend)
 */

/* ========== TOOLBAR CONTAINER ========== */
.gq-a11y-toolbar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    font-family: var(--gqrc-font-body, 'Work Sans', sans-serif);
    font-size: 13px;
    line-height: 1.4;
    /* Eigenen Stacking-Context sicherstellen */
    isolation: isolate;
}

/* ========== TOGGLE BUTTON ========== */
.gq-a11y-toolbar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-left: auto;
    background: var(--gqrc-accent-electric, #61FF70);
    color: #000;
    border: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.4);
    transition: background 0.15s ease;
    position: relative;
    z-index: 2;
}

.gq-a11y-toolbar__toggle:hover,
.gq-a11y-toolbar__toggle:focus-visible {
    background: #4de65d;
}

.gq-a11y-toolbar__toggle:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.gq-a11y-toolbar__toggle[aria-expanded="true"] {
    border-radius: 0;
}

/* ========== PANEL ========== */
.gq-a11y-toolbar__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 260px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    padding: 0;
    padding-right: 52px;
    color: #fff;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1;
}

.gq-a11y-toolbar__panel[hidden] {
    display: none !important;
}

/* ========== HEADER ========== */
.gq-a11y-toolbar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gq-a11y-toolbar__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.gq-a11y-toolbar__reset {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s ease;
}

.gq-a11y-toolbar__reset:hover,
.gq-a11y-toolbar__reset:focus-visible {
    color: var(--gqrc-accent-electric, #61FF70);
    border-color: var(--gqrc-accent-electric, #61FF70);
}

/* ========== GROUPS ========== */
.gq-a11y-toolbar__group {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gq-a11y-toolbar__label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

/* ========== BUTTON ROW ========== */
.gq-a11y-toolbar__row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gq-a11y-toolbar__btn {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

.gq-a11y-toolbar__btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.gq-a11y-toolbar__btn:focus-visible {
    outline: 2px solid var(--gqrc-accent-electric, #61FF70);
    outline-offset: 1px;
}

.gq-a11y-toolbar__btn--active {
    background: var(--gqrc-accent-electric, #61FF70) !important;
    color: #000 !important;
    border-color: var(--gqrc-accent-electric, #61FF70) !important;
}

.gq-a11y-toolbar__value {
    min-width: 44px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--gqrc-accent-electric, #61FF70);
}

/* ========== TOGGLE SWITCHES ========== */
.gq-a11y-toolbar__toggles {
    padding: 6px 14px;
}

.gq-a11y-toolbar__toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

.gq-a11y-toolbar__toggle-row:hover {
    color: #fff;
}

/* Custom checkbox switch */
.gq-a11y-toolbar__switch {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    transition: background 0.15s ease;
}

.gq-a11y-toolbar__switch::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.15s ease;
}

.gq-a11y-toolbar__switch:checked {
    background: var(--gqrc-accent-electric, #61FF70);
}

.gq-a11y-toolbar__switch:checked::before {
    transform: translateX(16px);
    background: #000;
}

.gq-a11y-toolbar__switch:focus-visible {
    outline: 2px solid var(--gqrc-accent-electric, #61FF70);
    outline-offset: 2px;
}

/* ========== FOOTER ========== */
.gq-a11y-toolbar__footer {
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.gq-a11y-toolbar__footer a {
    color: var(--gqrc-accent-electric, #61FF70);
    text-decoration: none;
    font-size: 12px;
}

.gq-a11y-toolbar__footer a:hover {
    text-decoration: underline;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .gq-a11y-toolbar__panel {
        width: 240px;
        max-height: 70vh;
    }

    .gq-a11y-toolbar__toggle {
        width: 46px;
        height: 46px;
    }

    .gq-a11y-toolbar__panel {
        padding-right: 46px;
    }
}

/* ===========================================================================
 * ACCESSIBILITY MODES — applied via body classes
 * Wichtig: Filter NICHT auf body anwenden, sonst bricht position:fixed!
 * Stattdessen auf direkte Kinder (ausser Toolbar) anwenden.
 * ===========================================================================*/

/* ---------- High Contrast ---------- */
body.gq-a11y-contrast-high > *:not(.gq-a11y-toolbar) {
    filter: contrast(1.4);
}

/* ---------- Inverted Contrast ---------- */
body.gq-a11y-contrast-inverted {
    background-color: #fff;
}

body.gq-a11y-contrast-inverted > *:not(.gq-a11y-toolbar) {
    filter: invert(1) hue-rotate(180deg);
}

/* ---------- Link & Interactive Element Highlighting ---------- */
body.gq-a11y-highlight-links a,
body.gq-a11y-highlight-links button,
body.gq-a11y-highlight-links [role="button"],
body.gq-a11y-highlight-links [role="link"],
body.gq-a11y-highlight-links input[type="submit"],
body.gq-a11y-highlight-links summary,
body.gq-a11y-highlight-links [tabindex="0"],
body.gq-a11y-highlight-links [onclick],
body.gq-a11y-highlight-links .gqrc-review-card,
body.gq-a11y-highlight-links .gqrc-related-card,
body.gq-a11y-highlight-links .gqrc-podcast-card,
body.gq-a11y-highlight-links .gqrc-card-image,
body.gq-a11y-highlight-links .gqrc-hero-btn-primary,
body.gq-a11y-highlight-links .episode-card,
body.gq-a11y-highlight-links [data-post-id] {
    outline: 3px solid #FFFF00 !important;
    outline-offset: 2px !important;
}

body.gq-a11y-highlight-links a:hover,
body.gq-a11y-highlight-links button:hover,
body.gq-a11y-highlight-links [role="button"]:hover,
body.gq-a11y-highlight-links [role="link"]:hover,
body.gq-a11y-highlight-links [tabindex="0"]:hover,
body.gq-a11y-highlight-links [onclick]:hover,
body.gq-a11y-highlight-links .gqrc-review-card:hover,
body.gq-a11y-highlight-links .gqrc-related-card:hover,
body.gq-a11y-highlight-links .gqrc-podcast-card:hover,
body.gq-a11y-highlight-links .gqrc-card-image:hover,
body.gq-a11y-highlight-links .gqrc-hero-btn-primary:hover,
body.gq-a11y-highlight-links .episode-card:hover,
body.gq-a11y-highlight-links [data-post-id]:hover {
    outline-color: #FFD700 !important;
    background-color: rgba(255, 255, 0, 0.15) !important;
}

/* Toolbar-Elemente ausnehmen */
.gq-a11y-toolbar a,
.gq-a11y-toolbar button,
.gq-a11y-toolbar input,
.gq-a11y-toolbar [role="button"] {
    outline: none !important;
    outline-offset: 0 !important;
}

/* ---------- Reduced Motion ---------- */
/* Toolbar von reduce-motion ausnehmen */
body.gq-a11y-reduce-motion > *:not(.gq-a11y-toolbar),
body.gq-a11y-reduce-motion > *:not(.gq-a11y-toolbar) *,
body.gq-a11y-reduce-motion > *:not(.gq-a11y-toolbar) *::before,
body.gq-a11y-reduce-motion > *:not(.gq-a11y-toolbar) *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

body.gq-a11y-reduce-motion .scanline,
body.gq-a11y-reduce-motion .vhs-overlay,
body.gq-a11y-reduce-motion .glitch {
    display: none !important;
}

/* ---------- Text Spacing ---------- */
/* Muss auf * angewendet werden, da viele Elemente eigene letter-spacing haben */
body.gq-a11y-text-spacing > *:not(.gq-a11y-toolbar),
body.gq-a11y-text-spacing > *:not(.gq-a11y-toolbar) * {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
    line-height: 1.8 !important;
}

/* Toolbar-Text nicht aendern */
.gq-a11y-toolbar,
.gq-a11y-toolbar * {
    letter-spacing: normal !important;
    word-spacing: normal !important;
    line-height: 1.4 !important;
}

/* ---------- Readable Font ---------- */
/* FontAwesome-Icons ausnehmen (.fa, .fas, .far, .fab, .fa-brands etc.) */
body.gq-a11y-readable-font > *:not(.gq-a11y-toolbar),
body.gq-a11y-readable-font > *:not(.gq-a11y-toolbar) *:not([class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.fal):not(.fad) {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* ---------- Big Cursor ---------- */
body.gq-a11y-big-cursor > *:not(.gq-a11y-toolbar),
body.gq-a11y-big-cursor > *:not(.gq-a11y-toolbar) * {
    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 2L8 40L16 30L26 44L32 40L22 26L34 26Z' fill='%2361FF70' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 8 2, auto !important;
}

/* ---------- Font Size via zoom ---------- */
/* zoom statt font-size, da Theme px-Werte nutzt die nicht erben */
body.gq-a11y-font-110 { zoom: 1.1; }
body.gq-a11y-font-120 { zoom: 1.2; }
body.gq-a11y-font-130 { zoom: 1.3; }
body.gq-a11y-font-140 { zoom: 1.4; }
body.gq-a11y-font-150 { zoom: 1.5; }

/* Toolbar-Groesse bei Zoom stabil halten */
body.gq-a11y-font-110 > .gq-a11y-toolbar { zoom: calc(1 / 1.1); }
body.gq-a11y-font-120 > .gq-a11y-toolbar { zoom: calc(1 / 1.2); }
body.gq-a11y-font-130 > .gq-a11y-toolbar { zoom: calc(1 / 1.3); }
body.gq-a11y-font-140 > .gq-a11y-toolbar { zoom: calc(1 / 1.4); }
body.gq-a11y-font-150 > .gq-a11y-toolbar { zoom: calc(1 / 1.5); }
