@import url("https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/open-dyslexic-regular.css");

/* =========================================================
   Widget Aksesibilitas — gaya scoped (prefix .a11y-)
   ========================================================= */

.a11y-widget {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 1030;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Tombol pemicu */
.a11y-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 10px 25px -4px rgba(27, 67, 50, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s ease, box-shadow 0.25s ease;
}

.a11y-toggle .bi {
    font-size: 1.65rem;
    line-height: 1;
}

.a11y-toggle:hover {
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 14px 28px -4px rgba(27, 67, 50, 0.52), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

.a11y-toggle:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 3px;
    border-radius: 50%;
}

/* Panel */
.a11y-panel {
    position: absolute;
    bottom: 4.5rem;
    left: 0;
    width: min(94vw, 470px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.04);
    transform-origin: bottom left;
    animation: a11yPanelIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes a11yPanelIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.a11y-panel[hidden] {
    display: none;
}

.a11y-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.125rem 1.25rem;
    color: #ffffff;
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.a11y-panel__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.a11y-panel__badge-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.a11y-panel__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.a11y-panel__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.a11y-pill {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.45rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.2);
    color: #d1fae5;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.a11y-panel__subtitle {
    margin: 0.125rem 0 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.82);
}

.a11y-panel__close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.a11y-panel__close:hover {
    background: rgba(255, 255, 255, 0.26);
    transform: scale(1.05);
}

.a11y-panel__close svg {
    width: 1.125rem;
    height: 1.125rem;
    display: block;
}

.a11y-panel__close:focus-visible,
.a11y-reset:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 2px;
}

.a11y-panel__body {
    padding: 1rem 1.125rem;
    max-height: 72vh;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.a11y-panel__body::-webkit-scrollbar {
    width: 6px;
}

.a11y-panel__body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

.a11y-panel__body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sections */
.a11y-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.a11y-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-group__title {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.a11y-group__title .bi {
    font-size: 0.8125rem;
    color: #2d6a4f;
}

/* Stepper grid (Font Scale) */
.a11y-stepper-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.a11y-btn--stepper {
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.a11y-btn--stepper:hover {
    background: #f0fdf4;
    border-color: #86efac;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.a11y-btn--stepper .a11y-btn__meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1;
}

.a11y-btn--stepper .a11y-btn__icon {
    margin-bottom: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
}

.a11y-btn--stepper .a11y-badge {
    margin-top: 0;
}

/* Card grids */
.a11y-card-grid {
    display: grid;
    gap: 0.5rem;
}

.a11y-card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.a11y-card-grid--4 {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 440px) {
    .a11y-card-grid--4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.a11y-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.5rem 0.625rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.a11y-card-btn:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px -2px rgba(15, 23, 42, 0.08);
}

.a11y-card-btn[aria-pressed="true"] {
    background: #f0fdf4;
    border-color: #10b981;
    box-shadow: 0 0 0 1px #10b981, 0 4px 12px rgba(16, 185, 129, 0.15);
}

.a11y-card-btn[aria-pressed="true"] .a11y-badge {
    background: #059669;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.a11y-btn:focus-visible {
    outline: 3px solid #2d6a4f;
    outline-offset: 2px;
}

.a11y-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: 0.375rem;
    border-radius: 0.625rem;
    font-weight: 900;
    font-size: 0.875rem;
    background: #dbeafe;
    color: #1d4ed8;
    transition: transform 0.2s ease;
}

.a11y-card-btn:hover .a11y-btn__icon {
    transform: scale(1.08);
}

.a11y-btn__icon .bi {
    font-size: 1.125rem;
    line-height: 1;
}

.a11y-btn__icon--alpha {
    background: #e8f5e9;
    color: #2e7d32;
}

.a11y-btn__icon--indigo {
    background: #e0e7ff;
    color: #4338ca;
}

.a11y-btn__icon--amber {
    background: #fef3c7;
    color: #b45309;
}

.a11y-btn__icon--purple {
    background: #f3e8ff;
    color: #7e22ce;
}

.a11y-btn__icon--emerald {
    background: #d1fae5;
    color: #047857;
}

.a11y-btn__icon--rose {
    background: #ffe4e6;
    color: #be123c;
}

.a11y-btn__icon--cyan {
    background: #cffafe;
    color: #0e7490;
}

.a11y-btn__icon--teal {
    background: #ccfbf1;
    color: #0f766e;
}

.a11y-btn__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.125rem;
    line-height: 1.25;
}

.a11y-btn__hint {
    font-size: 0.625rem;
    line-height: 1.25;
    color: #64748b;
}

.a11y-badge {
    margin-top: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border-radius: 9999px;
    border: 1px solid rgba(226, 232, 240, 0.7);
    transition: all 0.2s ease;
}

.a11y-panel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    font-size: 0.75rem;
}

.a11y-panel__note {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #64748b;
    font-weight: 500;
    font-size: 0.6875rem;
}

.a11y-panel__note .bi {
    color: #059669;
    font-size: 0.875rem;
}

.a11y-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #fecdd3;
    background: #fff1f2;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    color: #e11d48;
    font-weight: 700;
    font-size: 0.6875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-reset:hover {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fda4af;
    transform: translateY(-1px);
}

.a11y-reset .bi {
    font-size: 0.75rem;
}

/* =========================================================
   Kelas efek yang dipasang ke <html>
   ========================================================= */

/* Kejenuhan: monokrom pada konten, widget tetap berwarna.
   Footer dikecualikan karena memuat modal penilaian ber-position: fixed. */
html.a11y-saturation main,
html.a11y-saturation header {
    filter: grayscale(1);
}

/* Kontras tinggi / latar gelap */
html.a11y-contrast body {
    background: #000 !important;
    color: #fff !important;
}

html.a11y-contrast main,
html.a11y-contrast section,
html.a11y-contrast header,
html.a11y-contrast footer,
html.a11y-contrast .topbar,
html.a11y-contrast .navbar-custom,
html.a11y-contrast .page-header,
html.a11y-contrast .card,
html.a11y-contrast .list-group,
html.a11y-contrast .custom-list-group-item,
html.a11y-contrast .modal-content,
html.a11y-contrast .accordion-item,
html.a11y-contrast .dropdown-menu,
html.a11y-contrast .offcanvas {
    background-color: #0a0a0a !important;
    color: #f8fafc !important;
    border-color: #64748b !important;
}

html.a11y-contrast .card-body,
html.a11y-contrast .card-header,
html.a11y-contrast .list-group-item,
html.a11y-contrast .table,
html.a11y-contrast .table th,
html.a11y-contrast .table td,
html.a11y-contrast .table thead,
html.a11y-contrast .table tbody,
html.a11y-contrast .table tfoot {
    background-color: #0a0a0a !important;
    color: #f8fafc !important;
    border-color: #64748b !important;
}

html.a11y-contrast .text-muted,
html.a11y-contrast .text-secondary,
html.a11y-contrast small {
    color: #cbd5e1 !important;
}

html.a11y-contrast .text-dark,
html.a11y-contrast h1,
html.a11y-contrast h2,
html.a11y-contrast h3,
html.a11y-contrast h4,
html.a11y-contrast h5,
html.a11y-contrast h6 {
    color: #ffffff !important;
}

html.a11y-contrast a {
    color: #fde047 !important;
}

html.a11y-contrast .bg-light,
html.a11y-contrast .bg-white {
    background-color: #0a0a0a !important;
}

html.a11y-contrast .form-control,
html.a11y-contrast .form-select {
    background-color: #111 !important;
    color: #fff !important;
    border-color: #94a3b8 !important;
}

html.a11y-contrast .table-light {
    background-color: #1e293b !important;
    color: #fff !important;
}

/* Kontras tinggi untuk widget & panel aksesibilitas */
html.a11y-contrast .a11y-toggle {
    background: #000000 !important;
    border: 2px solid #facc15 !important;
    color: #facc15 !important;
}

html.a11y-contrast .a11y-panel {
    background: #000000 !important;
    border: 2px solid #facc15 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 0 1px #facc15 !important;
}

html.a11y-contrast .a11y-panel__header {
    background: #111111 !important;
    border-bottom: 2px solid #facc15 !important;
}

html.a11y-contrast .a11y-panel__badge-icon {
    background: #000000 !important;
    border-color: #facc15 !important;
    color: #facc15 !important;
}

html.a11y-contrast .a11y-panel__title,
html.a11y-contrast .a11y-panel__subtitle {
    color: #ffffff !important;
}

html.a11y-contrast .a11y-pill {
    background: #000000 !important;
    color: #facc15 !important;
    border: 1px solid #facc15 !important;
}

html.a11y-contrast .a11y-panel__body {
    background: #0a0a0a !important;
}

html.a11y-contrast .a11y-group__title {
    color: #facc15 !important;
}

html.a11y-contrast .a11y-btn {
    background: #121212 !important;
    border-color: #64748b !important;
    color: #ffffff !important;
}

html.a11y-contrast .a11y-btn:hover {
    border-color: #facc15 !important;
    background: #1e1e1e !important;
}

html.a11y-contrast .a11y-btn[aria-pressed="true"] {
    background: #1e1e1e !important;
    border: 2px solid #facc15 !important;
}

html.a11y-contrast .a11y-btn__label {
    color: #ffffff !important;
}

html.a11y-contrast .a11y-btn__hint {
    color: #cbd5e1 !important;
}

html.a11y-contrast .a11y-badge {
    background: #121212 !important;
    color: #ffffff !important;
    border-color: #64748b !important;
}

html.a11y-contrast .a11y-btn[aria-pressed="true"] .a11y-badge {
    background: #facc15 !important;
    color: #000000 !important;
    border-color: #facc15 !important;
}

html.a11y-contrast .a11y-panel__footer {
    background: #111111 !important;
    border-top: 2px solid #facc15 !important;
}

html.a11y-contrast .a11y-panel__note {
    color: #cbd5e1 !important;
}

html.a11y-contrast .a11y-reset {
    background: #000000 !important;
    border: 1px solid #ef4444 !important;
    color: #f87171 !important;
}

/* Ramah disleksia */
html.a11y-dyslexia body,
html.a11y-dyslexia body h1,
html.a11y-dyslexia body h2,
html.a11y-dyslexia body h3,
html.a11y-dyslexia body h4,
html.a11y-dyslexia body h5,
html.a11y-dyslexia body h6,
html.a11y-dyslexia body p,
html.a11y-dyslexia body a,
html.a11y-dyslexia body li,
html.a11y-dyslexia body span,
html.a11y-dyslexia body td,
html.a11y-dyslexia body th,
html.a11y-dyslexia body button,
html.a11y-dyslexia body input,
html.a11y-dyslexia body select,
html.a11y-dyslexia body textarea,
html.a11y-dyslexia body .btn {
    font-family: "OpenDyslexicRegular", "Comic Sans MS", Verdana, sans-serif !important;
    letter-spacing: 0.02em;
}

/* Tinggi garis */
html.a11y-line-height body,
html.a11y-line-height body p,
html.a11y-line-height body li,
html.a11y-line-height body td,
html.a11y-line-height body th {
    line-height: 1.9 !important;
}

/* Spasi teks */
html.a11y-spacing body {
    letter-spacing: 0.06em;
    word-spacing: 0.16em;
}

/* Garis bawah semua link */
html.a11y-underline body a {
    text-decoration: underline !important;
}

/* Kursor besar */
html.a11y-cursor,
html.a11y-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 32 32'%3E%3Cpath d='M4 2 L4 26 L11 19 L15 30 L20 28 L16 17 L26 17 Z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 2, auto !important;
}

@media (prefers-reduced-motion: reduce) {
    .a11y-toggle,
    .a11y-btn,
    .a11y-panel__close {
        transition: none;
    }
}

@media print {
    .a11y-widget {
        display: none;
    }
}
