/* ==========================================
   PA RANTAUPRAPAT ACCESSIBILITY WIDGET
========================================== */

:root {
    --a11y-text-scale: 1;
    --a11y-letter-spacing: 0px;
    --a11y-line-height: normal;
}

/* Tombol mengambang */
#a11y-toggle {
    position: fixed;
    right: 0;
    top: 45%;
    z-index: 99998;
    width: 48px;
    height: 52px;
    border: none;
    border-radius: 12px 0 0 12px;
    background: #056e4f;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .25s ease;
}

#a11y-toggle:hover {
    background: #034d37;
    width: 54px;
}

#a11y-toggle svg {
    width: 27px;
    height: 27px;
}

/* Panel utama */
#a11y-panel {
    position: fixed;
    top: 50%;
    right: 60px;
    transform: translateY(-50%);
    width: 320px;
    max-width: calc(100vw - 80px);
    max-height: 85vh;
    overflow-y: auto;
    z-index: 99999;
    background: #ffffff;
    color: #24352e;
    border: 1px solid #dce8e2;
    border-radius: 16px;
    box-shadow: 0 10px 35px rgba(0,0,0,.22);
    font-family: Arial, sans-serif;
    display: none;
}

#a11y-panel.open {
    display: block;
    animation: a11yFade .2s ease;
}

@keyframes a11yFade {
    from {
        opacity: 0;
        transform: translateY(-48%);
    }
    to {
        opacity: 1;
        transform: translateY(-50%);
    }
}

/* Header */
.a11y-header {
    background: linear-gradient(135deg, #056e4f, #034d37);
    color: white;
    padding: 17px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-header h3 {
    margin: 0;
    font-size: 17px;
    color: #ffffff;
}

#a11y-close {
    border: none;
    background: transparent;
    color: white;
    font-size: 25px;
    cursor: pointer;
    line-height: 1;
}

/* Isi panel */
.a11y-content {
    padding: 15px;
}

.a11y-section-title {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    color: #056e4f;
    letter-spacing: .5px;
    margin: 5px 0 10px;
}

.a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.a11y-button {
    min-height: 43px;
    border: 1px solid #dce8e2;
    background: #f7faf8;
    color: #263c33;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: .2s;
}

.a11y-button:hover {
    border-color: #056e4f;
    background: #e6f3ef;
}

.a11y-button.active {
    background: #056e4f;
    color: #ffffff;
    border-color: #056e4f;
}

.a11y-button.wide {
    grid-column: 1 / -1;
}

.a11y-divider {
    border: 0;
    border-top: 1px solid #e6ece8;
    margin: 14px 0;
}

/* Reset */
#a11y-reset {
    width: 100%;
    background: #fff4e5;
    border: 1px solid #ff9900;
    color: #734600;
    font-weight: bold;
}

#a11y-reset:hover {
    background: #ff9900;
    color: #ffffff;
}

/* Pengaturan aksesibilitas halaman */
html.a11y-grayscale {
    filter: grayscale(100%);
}

html.a11y-high-contrast {
    filter: contrast(150%);
}

html.a11y-negative {
    filter: invert(100%) hue-rotate(180deg);
}

html.a11y-negative img,
html.a11y-negative video {
    filter: invert(100%) hue-rotate(180deg);
}

html.a11y-light-background {
    background: #ffffff !important;
}

html.a11y-light-background body,
html.a11y-light-background main,
html.a11y-light-background section,
html.a11y-light-background article {
    background-color: #ffffff !important;
    color: #000000 !important;
}

html.a11y-highlight-links a {
    background: #ffeb3b !important;
    color: #000000 !important;
    outline: 2px solid #000000 !important;
    text-decoration: underline !important;
}

html.a11y-dyslexia,
html.a11y-dyslexia body,
html.a11y-dyslexia body * {
    font-family: Arial, Verdana, sans-serif !important;
}

html.a11y-spacing,
html.a11y-spacing body,
html.a11y-spacing body * {
    letter-spacing: 2px !important;
    word-spacing: 4px !important;
}

html.a11y-line-height body,
html.a11y-line-height body * {
    line-height: 1.8 !important;
}

html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: crosshair !important;
}

html.a11y-stop-animation *,
html.a11y-stop-animation *::before,
html.a11y-stop-animation *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* Ukuran teks */
html.a11y-text-large body {
    font-size: 1.15em !important;
}

html.a11y-text-larger body {
    font-size: 1.30em !important;
}

/* Mobile */
@media (max-width: 600px) {
    #a11y-toggle {
        top: 40%;
        width: 42px;
        height: 48px;
    }

    #a11y-panel {
        right: 52px;
        width: 300px;
        max-width: calc(100vw - 65px);
        max-height: 80vh;
    }

    .a11y-button {
        font-size: 12px;
        min-height: 40px;
    }
}

/* Teks lebih kecil */
html.a11y-text-small body {
    font-size: 0.9em !important;
}

/* Memastikan panel widget tidak ikut berubah ukuran */
#a11y-panel,
#a11y-panel * {
    font-size: initial;
}

#a11y-panel .a11y-header h3 {
    font-size: 17px;
}

#a11y-panel .a11y-button {
    font-size: 13px;
}

/* PEMBACA LAYAR */

#a11y-read-page {
    background: #056e4f;
    color: white;
    border-color: #056e4f;
    font-weight: bold;
}

#a11y-read-page:hover {
    background: #034d37;
}

#a11y-pause {
    background: #fff4e5;
    border-color: #ff9900;
}

#a11y-stop {
    background: #fff0f0;
    border-color: #dc3545;
    color: #b42332;
}

#a11y-read-selection {
    background: #e6f3ef;
    border-color: #056e4f;
}
