/* ====================================================
   FKDC — accessibility.css
   Custom accessibility classes toggled via JS
   ==================================================== */

/* -------------------------------------------------------
   1. HIGH CONTRAST
   ------------------------------------------------------- */
/* -------------------------------------------------------
   1. CONTRAST LEVELS
   ------------------------------------------------------- */
body.acc-contrast-1 {
    filter: invert(1) hue-rotate(180deg) !important;
}
body.acc-contrast-1 img, 
body.acc-contrast-1 video {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.acc-contrast-2 {
    background-color: #000000 !important;
    color:            #ffffff !important;
}
body.acc-contrast-2 a                   { color: #ffff00 !important; }
body.acc-contrast-2 .btn-primary,
body.acc-contrast-2 .btn-success        { background: #ffff00 !important; color: #000 !important; border-color: #ffff00 !important; }
body.acc-contrast-2 .news-card,
body.acc-contrast-2 .dok-card           { background: #111 !important; border: 1px solid #fff !important; }
body.acc-contrast-2 .navbar,
body.acc-contrast-2 .site-header        { background: #000 !important; }
body.acc-contrast-2 .nav-link           { color: #ffffff !important; }
body.acc-contrast-2 .site-footer        { background: #111 !important; color: #fff !important; }
body.acc-contrast-2 .bg-light-green,
body.acc-contrast-2 .section-partners   { background: #111 !important; }

body.acc-contrast-3 {
    background-color: #ffffff !important;
    color:            #000000 !important;
}
body.acc-contrast-3 a { color: #0000ee !important; text-decoration: underline !important; }

/* -------------------------------------------------------
   2. HIGHLIGHT LINKS
   ------------------------------------------------------- */
body.highlight-links a {
    text-decoration:  underline dashed 2px !important;
    text-underline-offset: 3px !important;
    background:       rgba(255, 255, 0, 0.25) !important;
    padding:          0 3px !important;
    border-radius:    2px !important;
}

/* -------------------------------------------------------
   3. TEXT SIZE LEVELS
   ------------------------------------------------------- */
body.acc-font-size-1 { font-size: 1.2rem !important; }
body.acc-font-size-2 { font-size: 1.5rem !important; }
body.acc-font-size-3 { font-size: 1.8rem !important; }
body.acc-font-size-4 { font-size: 2rem !important; }

/* -------------------------------------------------------
   4. TEXT SPACING LEVELS
   ------------------------------------------------------- */
body.acc-spacing-1 p, body.acc-spacing-1 li, body.acc-spacing-1 span { letter-spacing: 0.05em !important; word-spacing: 0.1em !important; }
body.acc-spacing-2 p, body.acc-spacing-2 li, body.acc-spacing-2 span { letter-spacing: 0.1em !important; word-spacing: 0.2em !important; }
body.acc-spacing-3 p, body.acc-spacing-3 li, body.acc-spacing-3 span { letter-spacing: 0.2em !important; word-spacing: 0.4em !important; }

/* -------------------------------------------------------
   5. PAUSE ANIMATIONS
   ------------------------------------------------------- */
body.pause-animations *,
body.pause-animations *::before,
body.pause-animations *::after {
    animation:          none !important;
    transition:         none !important;
    transition-duration: 0.001ms !important;
    animation-duration:  0.001ms !important;
}

/* -------------------------------------------------------
   6. HIDE IMAGES
   ------------------------------------------------------- */
body.hide-images img {
    visibility: hidden !important;
    height:     0 !important;
}
body.hide-images .hero-bg__img {
    opacity: 0 !important;
}

/* -------------------------------------------------------
   7. DYSLEXIA FRIENDLY
   ------------------------------------------------------- */
body.dyslexia-friendly {
    font-family:    'OpenDyslexic', Arial, sans-serif !important;
}
body.dyslexia-friendly p { text-align: left !important; }

/* -------------------------------------------------------
   8. CURSOR & AIDS
   ------------------------------------------------------- */
body.acc-cursor-1,
body.acc-cursor-1 * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1.5' d='M4 2l18 12.5-8.5 1-4.5 8.5z'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* Reading Mask */
#acc-reading-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10000;
    display: none;
    background: rgba(0, 0, 0, 0.7);
    mask: linear-gradient(to bottom, black 0%, black var(--mask-top, 40%), transparent var(--mask-top, 40%), transparent var(--mask-bottom, 60%), black var(--mask-bottom, 60%), black 100%);
    -webkit-mask: linear-gradient(to bottom, black 0%, black var(--mask-top, 40%), transparent var(--mask-top, 40%), transparent var(--mask-bottom, 60%), black var(--mask-bottom, 60%), black 100%);
}

/* Reading Guide */
#acc-reading-guide {
    position: fixed;
    left: 0; right: 0;
    height: 4px;
    background: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10000;
    display: none;
    transform: translateY(-50%);
}

/* -------------------------------------------------------
   9. LINE HEIGHT LEVELS
   ------------------------------------------------------- */
body.acc-line-height-1 p, body.acc-line-height-1 li { line-height: 1.5 !important; }
body.acc-line-height-2 p, body.acc-line-height-2 li { line-height: 1.75 !important; }
body.acc-line-height-3 p, body.acc-line-height-3 li { line-height: 2 !important; }

/* -------------------------------------------------------
   10. TEXT ALIGN LEFT
   ------------------------------------------------------- */
body.text-align p, body.text-align li, body.text-align td {
    text-align: left !important;
}

/* -------------------------------------------------------
   11. LOW SATURATION
   ------------------------------------------------------- */
body.saturation {
    filter: saturate(0.3) !important;
}

/* -------------------------------------------------------
   12. SHOW TOOLTIPS (KETERANGAN ALAT)
   ------------------------------------------------------- */
body.show-tooltips [title]::after {
    content: " [" attr(title) "] ";
    background-color: #f8fafc !important;
    color: #0f172a !important;
    font-size: 0.85rem !important;
    padding: 0.15rem 0.35rem !important;
    margin-left: 0.3rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    display: inline-block !important;
    font-weight: 600 !important;
    font-family: Arial, sans-serif !important;
}

/* ====================================================
   ACCESSIBILITY WIDGET PANEL UI
   ==================================================== */
.acc-panel {
    position:   fixed;
    top:        80px;
    right:      -360px;  /* hidden by default */
    width:      340px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 16px 0 0 16px;
    box-shadow: -4px 0 40px rgba(0,0,0,.15);
    z-index:    9999;
    transition: right .35s cubic-bezier(.4,0,.2,1);
    border-left: 4px solid #2d8c4e;
}

.acc-panel.open {
    right: 0;
}

.acc-panel__header {
    display:      flex;
    align-items:  center;
    justify-content: space-between;
    background:   #2d8c4e;
    color:        #fff;
    padding:      1rem 1.25rem;
    font-weight:  700;
    font-size:    1rem;
    border-radius: 12px 0 0 0;
}

.acc-panel__close {
    background:  transparent;
    border:      none;
    color:       #fff;
    font-size:   1.1rem;
    cursor:      pointer;
    padding:     4px 8px;
    border-radius: 6px;
    transition:  background .2s;
    line-height: 1;
}
.acc-panel__close:hover { background: rgba(255,255,255,.2); }

.acc-panel__body { padding: 1.25rem; }

.acc-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   .65rem;
    margin-bottom:         1rem;
}

.acc-btn {
    background:    #f8faf9;
    border:        2px solid #e2e8f0;
    border-radius: 12px;
    padding:       .85rem .5rem;
    display:       flex;
    flex-direction: column;
    align-items:   center;
    gap:           .4rem;
    font-size:     .75rem;
    font-weight:   600;
    color:         #2d2d2d;
    cursor:        pointer;
    transition:    all .2s;
    text-align:    center;
    line-height:   1.2;
    position:      relative;
    overflow:      hidden;
}
.acc-btn i { font-size: 1.4rem; color: #2d8c4e; margin-bottom: 2px; }

/* Level Indicator Dots */
.acc-btn__levels {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}
.acc-btn__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e0;
    transition: background .2s;
}
.acc-btn.active .acc-btn__dot.filled {
    background: #fff;
}
.acc-btn:not(.active) .acc-btn__dot.filled {
    background: #2d8c4e;
}

.acc-btn:hover {
    background:   #e8f5ee;
    border-color: #2d8c4e;
    transform: translateY(-2px);
}
.acc-btn.active,
.acc-btn[aria-pressed="true"] {
    background:   #2d8c4e;
    border-color: #2d8c4e;
    color:        #fff;
    box-shadow: 0 4px 12px rgba(45, 140, 78, 0.3);
}
.acc-btn.active i { color: #fff; }

.acc-reset-btn {
    width:        100%;
    background:   #f5a623;
    border:       none;
    color:        #fff;
    padding:      .75rem;
    border-radius: 8px;
    font-weight:  700;
    font-size:    .9rem;
    cursor:       pointer;
    transition:   background .2s;
}
.acc-reset-btn:hover { background: #e0911a; }

.acc-overlay {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,.4);
    z-index:    9998;
}
.acc-overlay.show { display: block; }

/* -------------------------------------------------------
   Skip to Content (a11y)
   ------------------------------------------------------- */
.skip-link {
    position:    absolute;
    top:         -100%;
    left:        1rem;
    background:  #2d8c4e;
    color:       #fff;
    padding:     .75rem 1.5rem;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    z-index:     10000;
    transition:  top .15s;
}
.skip-link:focus { top: 0; color: #fff; }

/* ====================================================
   FLOATING ACCESSIBILITY BUTTON
   ==================================================== */
.btn-acc-floating {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    background: #2d8c4e;
    color: #fff;
    border: none;
    border-radius: 50px 0 0 50px;
    width: 50px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: -4px 0 15px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-left: 5px;
}

.btn-acc-floating:hover {
    width: 65px;
    background: #236d3d;
}

.btn-acc-floating i {
    transition: transform 0.3s;
}

.btn-acc-floating:hover i {
    transform: scale(1.1) rotate(10deg);
}

/* Responsive adjustment for mobile */
@media (max-width: 768px) {
    .btn-acc-floating {
        width: 45px;
        height: 55px;
        font-size: 1.4rem;
    }
}

/* Glassmorphism effect for the button when contrast is not high */
body:not(.acc-contrast-2):not(.acc-contrast-3) .btn-acc-floating {
    backdrop-filter: blur(5px);
    background: rgba(45, 140, 78, 0.9);
}

/* ====================================================
   LANGUAGE FLAG STYLES
   ==================================================== */
.lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
    background: #eee;
    padding: 0;
}

.lang-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lang-flag:hover {
    transform: scale(1.15);
    border-color: #2d8c4e;
    background: #fff;
}

.lang-flag.active {
    border-color: #2d8c4e;
    box-shadow: 0 0 8px rgba(45, 140, 78, 0.4);
    pointer-events: none;
    background: #fff;
}
