/* === Trigger Button === */
.a11y-trigger {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1565c0;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-trigger:hover,
.a11y-trigger:focus {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    outline: 2px solid #ffeb3b;
    outline-offset: 2px;
}

/* === Panel === */
.a11y-panel {
    position: fixed;
    top: 0;
    left: -360px;
    width: 320px;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    background: #fff;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.a11y-panel.open {
    left: 0;
}

.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1565c0;
    color: #fff;
}

.a11y-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.a11y-panel-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

.a11y-panel-close:focus {
    outline: 2px solid #ffeb3b;
}

.a11y-panel-body {
    padding: 16px;
    flex: 1;
}

.a11y-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
}

/* === Mobile === */
@media (max-width: 767px) {
    .a11y-panel {
        width: 100%;
        left: 0;
        top: auto;
        bottom: -100vh;
        height: 80vh;
        max-height: 80vh;
        transition: bottom 0.3s ease;
    }

    .a11y-panel.open {
        bottom: 0;
        left: 0;
    }

    .a11y-trigger {
        width: 48px;
        height: 48px;
        font-size: 20px;
        bottom: 80px;
    }
}

/* === Tombol Fitur === */
.a11y-feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.a11y-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    color: #333;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease;
    min-height: 80px;
}

.a11y-btn i {
    font-size: 20px;
    color: #1565c0;
}

.a11y-btn:hover,
.a11y-btn:focus {
    background: #e3f2fd;
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.a11y-btn[aria-pressed="true"] {
    background: #1565c0;
    color: #fff;
    border-color: #0d47a1;
}

.a11y-btn[aria-pressed="true"] i {
    color: #fff;
}

.a11y-btn[aria-pressed="true"]:hover,
.a11y-btn[aria-pressed="true"]:focus {
    background: #0d47a1;
    color: #fff;
}

.a11y-btn-reset {
    width: 100%;
    padding: 12px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.a11y-btn-reset:hover,
.a11y-btn-reset:focus {
    background: #b71c1c;
    outline: 2px solid #ffeb3b;
    outline-offset: 2px;
}

.a11y-btn-reset i {
    margin-right: 6px;
}

/* === Body Modifiers: Font Scale ===
   Pakai `zoom` di .a11y-content karena banyak elemen di template
   pakai font-size px hardcoded — `body { font-size: % }` tidak cascade
   ke selector spesifik. `zoom` scale konten visual + layout sekaligus.
   Browser support: Chrome/Edge/Safari (lama), Firefox 126+ (Mei 2024). */
body.a11y-font-1 .a11y-content { zoom: 1.15; }
body.a11y-font-2 .a11y-content { zoom: 1.30; }
body.a11y-font--1 .a11y-content { zoom: 0.90; }
body.a11y-font--2 .a11y-content { zoom: 0.80; }

/* === Body Modifiers: Kontras Tinggi === */
body.a11y-contrast,
body.a11y-contrast * {
    background-color: #000 !important;
    color: #ffeb3b !important;
    border-color: #ffeb3b !important;
}

body.a11y-contrast a,
body.a11y-contrast a * {
    color: #00e5ff !important;
}

body.a11y-contrast img {
    filter: contrast(1.2);
}

/* === Body Modifiers: Negatif & Grayscale ===
   Filter dipasang di .a11y-content (konten utama) dan .main-header (navbar)
   secara terpisah. Tidak dipasang di .page-wrapper karena `filter` di parent
   bikin stacking context baru yang patahkan position fixed/absolute child
   (navbar di home pakai position absolute + transform yg sensitif terhadap
   stacking context parent). Pasang filter langsung di navbar sendiri = aman
   karena navbar punya stacking context sendiri tanpa ancestor filter.
   Toolbar di LUAR .page-wrapper sehingga tidak ikut ter-filter. */
body.a11y-negative .a11y-content,
body.a11y-negative .main-header,
body.a11y-negative .a11y-trigger,
body.a11y-negative .a11y-panel {
    filter: invert(1) hue-rotate(180deg);
}

body.a11y-grayscale .a11y-content,
body.a11y-grayscale .main-header,
body.a11y-grayscale .a11y-trigger,
body.a11y-grayscale .a11y-panel {
    filter: grayscale(100%);
}

/* Saat kontras tinggi, override universal selector supaya toolbar
   tetap pakai warna brand sendiri (bukan hitam-kuning). */
body.a11y-contrast .a11y-trigger,
body.a11y-contrast .a11y-trigger *,
body.a11y-contrast .a11y-panel,
body.a11y-contrast .a11y-panel * {
    background-color: initial !important;
    color: initial !important;
    border-color: initial !important;
}

body.a11y-contrast .a11y-trigger {
    background: #1565c0 !important;
    color: #fff !important;
}

body.a11y-contrast .a11y-panel {
    background: #fff !important;
}

body.a11y-contrast .a11y-panel-header {
    background: #1565c0 !important;
    color: #fff !important;
}

body.a11y-contrast .a11y-btn {
    background: #f5f5f5 !important;
    color: #333 !important;
}

body.a11y-contrast .a11y-btn[aria-pressed="true"] {
    background: #1565c0 !important;
    color: #fff !important;
}

body.a11y-contrast .a11y-btn-reset {
    background: #d32f2f !important;
    color: #fff !important;
}

/* === Body Modifiers: Highlight Link === */
body.a11y-highlight-link a {
    background-color: #ffeb3b !important;
    color: #000 !important;
    text-decoration: underline !important;
    padding: 2px 4px;
    border-radius: 2px;
}

/* === Body Modifiers: Font Disleksia === */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('/assets/fonts/open-dyslexic/OpenDyslexic-Regular.woff2') format('woff2'),
         url('/assets/fonts/open-dyslexic/OpenDyslexic-Regular.woff') format('woff');
    font-display: swap;
}

body.a11y-dyslexia,
body.a11y-dyslexia * {
    font-family: 'OpenDyslexic', 'Arial', sans-serif !important;
    letter-spacing: 0.05em !important;
    line-height: 1.6 !important;
}

/* === Body Modifiers: Jeda Animasi === */
body.a11y-pause-anim *,
body.a11y-pause-anim *::before,
body.a11y-pause-anim *::after {
    animation-play-state: paused !important;
    transition-duration: 0s !important;
}

/* === Hormati prefers-reduced-motion === */
@media (prefers-reduced-motion: reduce) {
    .a11y-panel,
    .a11y-trigger {
        transition: none !important;
    }
}
