:root {
    --a11y-teal: #00a499;
    --a11y-orange: #e77500;
    --a11y-dark: #394049;
    --a11y-light: #cee8e8;
    --a11y-font-scale: 1;
}

html {
    font-size: calc(1em * var(--a11y-font-scale));
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../fonts/OpenDyslexic-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Filters applied to html to avoid double-applying to fixed elements */
html.a11y-contrast {
    filter: contrast(2);
}

html.a11y-invert {
    filter: invert(1);
}

/* Counter-filters so toolbar elements remain visually correct under html filters */
html.a11y-contrast .a11y-floating-btn,
html.a11y-contrast #a11y-toolbar-bar {
    filter: contrast(0.5);
}

html.a11y-invert .a11y-floating-btn,
html.a11y-invert #a11y-toolbar-bar {
    filter: invert(1);
}

html.a11y-dyslexia,
html.a11y-dyslexia *:not(.material-icons):not(.material-icons-outlined):not(.material-icons-round):not(.material-icons-sharp):not(.material-symbols-outlined):not(.material-symbols-rounded):not(.material-symbols-sharp):not(.dashicons):not(.genericon):not([class*="fa-"]):not([class*="glyphicon"]) {
    font-family: 'OpenDyslexic', sans-serif !important;
}

html.a11y-pause-anim *,
html.a11y-pause-anim *::before,
html.a11y-pause-anim *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0.001ms !important;
}

/* ============================================================
   FLOATING BUTTON
   ============================================================ */
.a11y-floating-btn {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 999999998;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background-color: var(--a11y-teal);
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
    transition: background-color 0.25s ease, transform 0.2s ease, bottom 0.4s ease;
}

.a11y-floating-btn:hover,
.a11y-floating-btn:focus {
    background-color: var(--a11y-orange);
    transform: scale(1.05);
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.a11y-floating-btn[aria-expanded="true"] {
    background-color: var(--a11y-orange);
    bottom: 65px;
}

.a11y-floating-btn svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   TOOLBAR BAR
   ============================================================ */
#a11y-toolbar-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999997;
    background-color: var(--a11y-dark);
    padding: 6px 10px;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s ease, visibility 0.3s ease;
}

#a11y-toolbar-bar.is-open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

/* ============================================================
   TOOLBAR INNER
   ============================================================ */
.a11y-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    gap: 4px;
}

/* ============================================================
   CONTROL BUTTONS
   ============================================================ */
.a11y-ctrl-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--a11y-light);
    cursor: pointer;
    padding: 6px 10px;
    min-width: 100px;
    height: 42px;
    white-space: nowrap;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.a11y-ctrl-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.a11y-ctrl-btn:focus {
    outline: 2px solid var(--a11y-teal);
    outline-offset: 2px;
}

.a11y-ctrl-btn.is-active {
    background-color: #424242;
    border-bottom: 2px solid var(--a11y-light);
    color: #fff;
}

.a11y-ctrl-btn.is-active .a11y-ctrl-label {
    color: #fff;
}

/* ============================================================
   ICONS
   ============================================================ */
.a11y-ctrl-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.a11y-ctrl-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* ============================================================
   LABELS
   ============================================================ */
.a11y-ctrl-label {
    font-size: 0.875rem;
    color: var(--a11y-light);
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .a11y-ctrl-btn {
        min-width: 70px;
        padding: 4px 6px;
        font-size: 0.75rem;
        height: 38px;
    }
    .a11y-ctrl-icon,
    .a11y-ctrl-icon svg {
        width: 22px;
        height: 22px;
    }
    .a11y-ctrl-label {
        font-size: 0.7rem;
    }
    .a11y-floating-btn {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 480px) {
    .a11y-ctrl-label {
        display: none;
    }
    .a11y-ctrl-btn {
        min-width: 44px;
        padding: 4px;
    }
}
