/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.md.
 *
 * @author    Comkeys
 * @copyright 2026 Comkeys
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

/* ===== WIDGET BUTTON ===== */
#accessibility-widget-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #e5000c;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 99999;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    color: #fff;
    filter: none !important;
}
#accessibility-widget-btn:hover { transform: scale(1.1); }
#accessibility-widget-btn .a11y-icon {
    display: block;
    width: 28px;
    height: 28px;
    fill: #fff;
    color: #fff;
    overflow: visible;
}

/* ===== PANEL ===== */
#accessibility-panel {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 99999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1b1f3b;
    filter: none !important;
}
#accessibility-panel.open { display: block; }
#accessibility-panel-header {
    background: #e5000c;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}
#accessibility-panel-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
#accessibility-panel-header .a11y-icon {
    width: 16px;
    height: 16px;
    fill: #fff;
    color: #fff;
    display: block;
    flex-shrink: 0;
}
#accessibility-panel-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}
#accessibility-panel-body { padding: 12px; }

/* ===== OPTIONS ===== */
.accessibility-option {
    padding: 10px 14px;
    background: #f4f7fa;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.accessibility-option:hover { background: #fde8e9; }
.accessibility-option .label { font-size: 13px; font-weight: 600; color: #1b1f3b; margin-left: 6px; }
.accessibility-option .icon { font-size: 14px; }

.accessibility-option.toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accessibility-option.toggle > div:first-child { display: flex; align-items: center; }
.accessibility-option.toggle.active {
    background: #fde8e9;
    border: 2px solid #e5000c;
    padding: 8px 12px;
}

.toggle-switch {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #ccc;
    position: relative;
    transition: background 0.2s;
}
.toggle-knob {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.accessibility-option.toggle.active .toggle-switch { background: #e5000c; }
.accessibility-option.toggle.active .toggle-knob { left: 21px; }

#opt-fontsize { cursor: default; }
#opt-fontsize .label { display: block; margin-bottom: 8px; margin-left: 6px; }
.font-controls { display: flex; gap: 6px; width: 100%; }
.font-btn {
    flex: 1;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #e3e8ef;
    background: #fff;
    font-weight: 700;
    font-size: 13px;
    color: #1b1f3b;
    cursor: pointer;
    text-align: center;
}
.font-btn.active { border: 2px solid #e5000c; background: #fde8e9; }

.accessibility-reset {
    text-align: center;
    font-size: 12px;
    color: #6c7a93;
    cursor: pointer;
    padding: 8px;
    margin-top: 4px;
}
.accessibility-reset:hover { color: #e5000c; }

/*
 * High contrast: NEVER apply filter on body — it breaks position:fixed
 * (widget / back-to-top disappear). Target page regions only.
 */
body.a11y-contrast #header,
body.a11y-contrast #wrapper,
body.a11y-contrast #footer {
    filter: contrast(1.45);
}
body.a11y-contrast #header *,
body.a11y-contrast #wrapper *,
body.a11y-contrast #footer * {
    border-color: currentColor;
}

body.a11y-dyslexia #header,
body.a11y-dyslexia #wrapper,
body.a11y-dyslexia #footer,
body.a11y-dyslexia #header *,
body.a11y-dyslexia #wrapper *,
body.a11y-dyslexia #footer * {
    font-family: OpenDyslexic, "Comic Sans MS", sans-serif !important;
}

body.a11y-keyboard *:focus {
    outline: 3px solid #e5000c !important;
    outline-offset: 2px !important;
}

body.a11y-no-animations,
body.a11y-no-animations * {
    animation: none !important;
    transition: none !important;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/woff/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
}
