/* =========================================================================
   Pusat Bantuan Aksesibilitas — JDIH ESDM
   Dirancang untuk penyandang disabilitas (tuna netra, low-vision, disleksia,
   motorik terbatas, sensitif cahaya/gerak) mengikuti WCAG 2.1 AA+.
   Font: Atkinson Hyperlegible — dirancang khusus oleh Braille Institute
         untuk meningkatkan keterbacaan bagi low-vision.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
    --a11y-ink: #0b1a36;
    --a11y-ink-soft: #3a4a6b;
    --a11y-muted: #6b7a94;
    --a11y-surface: #ffffff;
    --a11y-surface-alt: #f5f7fb;
    --a11y-border: #dde3ef;
    --a11y-border-strong: #b7c1d6;
    --a11y-accent: #0059d6;
    --a11y-accent-ink: #ffffff;
    --a11y-accent-soft: #e6efff;
    --a11y-warn: #b8560a;
    --a11y-warn-soft: #fff4e3;
    --a11y-gold: #ffb800;
    --a11y-success: #1f7a3a;
    --a11y-success-soft: #e3f5ea;
    --a11y-danger: #c43131;
    --a11y-shadow-lg: 0 24px 60px -12px rgba(7, 22, 56, 0.35);
    --a11y-shadow-md: 0 10px 24px -8px rgba(7, 22, 56, 0.22);
    --a11y-radius: 14px;
    --a11y-radius-sm: 10px;
    --a11y-focus: 0 0 0 3px #ffd94d, 0 0 0 5px #0b1a36;
}

/* =========================================================================
   1. SKIP TO MAIN CONTENT  (tombol utama untuk pengguna keyboard & screen reader)
   ========================================================================= */
.a11y-skip-link {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 5000;
    padding: 12px 20px;
    background: var(--a11y-ink);
    color: #fff;
    font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--a11y-shadow-md);
    transition: top 0.18s ease;
}

.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
    top: 0;
    outline: 3px solid var(--a11y-gold);
    outline-offset: 2px;
    color: #fff;
}

/* =========================================================================
   2. FLOATING ACTION BUTTON (FAB)
   ========================================================================= */
.a11y-fab {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 3000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px 0 12px;
    height: 60px;
    min-width: 60px;
    border: 2px solid var(--a11y-ink);
    border-radius: 999px;
    background: linear-gradient(135deg, #0b1a36 0%, #1d3a7a 100%);
    color: #fff;
    font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--a11y-shadow-md);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.a11y-fab:hover {
    transform: translateY(-2px);
    box-shadow: var(--a11y-shadow-lg);
    background: linear-gradient(135deg, #12244a 0%, #2550a0 100%);
}

.a11y-fab:focus-visible {
    outline: none;
    box-shadow: var(--a11y-focus), var(--a11y-shadow-md);
}

.a11y-fab__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    background: var(--a11y-gold);
    color: var(--a11y-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.a11y-fab__icon svg {
    width: 24px;
    height: 24px;
}

.a11y-fab__label {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.a11y-fab__label-main {
    font-size: 14px;
    letter-spacing: 0.01em;
}

.a11y-fab__label-shortcut {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}

/* =========================================================================
   3. OVERLAY & DRAWER
   ========================================================================= */
.a11y-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 22, 56, 0.55);
    backdrop-filter: blur(2px);
    z-index: 3100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.a11y-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.a11y-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: var(--a11y-surface);
    color: var(--a11y-ink);
    z-index: 99999;
    transform: translateX(-110%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--a11y-shadow-lg);
    font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.a11y-drawer.is-open {
    transform: translateX(0);
}

.a11y-drawer * {
    box-sizing: border-box;
}

.a11y-drawer__header {
    padding: 20px 22px 16px;
    background: var(--a11y-ink);
    color: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 4px solid var(--a11y-gold);
}

.a11y-drawer__heading {
    flex: 1;
    min-width: 0;
}

.a11y-drawer__eyebrow {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--a11y-gold);
    color: var(--a11y-ink);
    border-radius: 999px;
}

.a11y-drawer__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.a11y-drawer__subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.85);
}

.a11y-drawer__close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.a11y-drawer__close:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.5);
}

.a11y-drawer__close:focus-visible {
    outline: none;
    box-shadow: var(--a11y-focus);
}

.a11y-drawer__close svg {
    width: 18px;
    height: 18px;
}

.a11y-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--a11y-border-strong) transparent;
}

.a11y-drawer__body::-webkit-scrollbar {
    width: 10px;
}

.a11y-drawer__body::-webkit-scrollbar-thumb {
    background: var(--a11y-border-strong);
    border-radius: 999px;
}

.a11y-drawer__footer {
    padding: 14px 22px;
    border-top: 1px solid var(--a11y-border);
    background: var(--a11y-surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* =========================================================================
   4. SECTIONS & CARDS
   ========================================================================= */
.a11y-section {
    margin-bottom: 22px;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-section__title {
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--a11y-ink-soft);
}

.a11y-section__title svg {
    width: 16px;
    height: 16px;
    color: var(--a11y-accent);
}

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

/* =========================================================================
   5. TOGGLE CARD  (card-style switch)
   ========================================================================= */
.a11y-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: var(--a11y-surface);
    border: 2px solid var(--a11y-border);
    border-radius: var(--a11y-radius-sm);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-family: inherit;
    color: var(--a11y-ink);
}

.a11y-toggle:hover {
    border-color: var(--a11y-border-strong);
    background: var(--a11y-surface-alt);
}

.a11y-toggle:focus-visible {
    outline: none;
    box-shadow: var(--a11y-focus);
}

.a11y-toggle[aria-pressed="true"] {
    border-color: var(--a11y-accent);
    background: var(--a11y-accent-soft);
}

.a11y-toggle__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.a11y-toggle__label {
    font-size: 15px;
    font-weight: 700;
    color: var(--a11y-ink);
}

.a11y-toggle__desc {
    font-size: 12px;
    font-weight: 400;
    color: var(--a11y-muted);
    line-height: 1.4;
}

.a11y-toggle__switch {
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--a11y-border-strong);
    position: relative;
    transition: background 0.18s ease;
}

.a11y-toggle__switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.a11y-toggle[aria-pressed="true"] .a11y-toggle__switch {
    background: var(--a11y-accent);
}

.a11y-toggle[aria-pressed="true"] .a11y-toggle__switch::after {
    transform: translateX(20px);
}

.a11y-toggle[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* =========================================================================
   6. SEGMENTED CONTROL  (e.g. ukuran teks, mode tampilan)
   ========================================================================= */
.a11y-card {
    padding: 12px 14px;
    background: var(--a11y-surface);
    border: 2px solid var(--a11y-border);
    border-radius: var(--a11y-radius-sm);
}

.a11y-card__label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--a11y-ink);
}

.a11y-card__desc {
    display: block;
    margin: -4px 0 10px;
    font-size: 12px;
    color: var(--a11y-muted);
    line-height: 1.4;
}

.a11y-segmented {
    display: grid;
    gap: 4px;
    padding: 4px;
    background: var(--a11y-surface-alt);
    border-radius: 10px;
    border: 1px solid var(--a11y-border);
}

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

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

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

.a11y-segmented__btn {
    padding: 8px 6px;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 7px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--a11y-ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.a11y-segmented__btn:hover {
    background: #fff;
    color: var(--a11y-ink);
}

.a11y-segmented__btn:focus-visible {
    outline: none;
    box-shadow: var(--a11y-focus);
}

.a11y-segmented__btn[aria-pressed="true"] {
    background: var(--a11y-accent);
    color: var(--a11y-accent-ink);
    border-color: var(--a11y-accent);
}

.a11y-segmented__btn .ix-size-xs {
    font-size: 11px;
}

.a11y-segmented__btn .ix-size-sm {
    font-size: 13px;
}

.a11y-segmented__btn .ix-size-md {
    font-size: 15px;
}

.a11y-segmented__btn .ix-size-lg {
    font-size: 18px;
}

/* =========================================================================
   7. TTS ACTION ROW
   ========================================================================= */
.a11y-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.a11y-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 14px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.a11y-btn:focus-visible {
    outline: none;
    box-shadow: var(--a11y-focus);
}

.a11y-btn[disabled],
.a11y-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.4);
    pointer-events: none;
}

.a11y-btn--primary {
    background: var(--a11y-accent);
    color: var(--a11y-accent-ink);
    border-color: var(--a11y-accent);
}

.a11y-btn--primary:hover {
    background: #0049b3;
    border-color: #0049b3;
}

.a11y-btn--ghost {
    background: var(--a11y-surface);
    color: var(--a11y-ink);
    border-color: var(--a11y-border-strong);
}

.a11y-btn--ghost:hover {
    background: var(--a11y-surface-alt);
    border-color: var(--a11y-ink-soft);
}

.a11y-btn--danger {
    background: transparent;
    color: var(--a11y-danger);
    border-color: var(--a11y-danger);
}

.a11y-btn--danger:hover {
    background: var(--a11y-danger);
    color: #fff;
}

.a11y-btn svg {
    width: 16px;
    height: 16px;
}

/* =========================================================================
   8. BADGE / STATUS
   ========================================================================= */
.a11y-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.a11y-badge--info {
    background: var(--a11y-accent-soft);
    color: var(--a11y-accent);
}

.a11y-badge--warn {
    background: var(--a11y-warn-soft);
    color: var(--a11y-warn);
}

/* =========================================================================
   9. READING GUIDE (garis panduan baca yang mengikuti kursor)
   ========================================================================= */
.a11y-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 60px;
    pointer-events: none;
    z-index: 2900;
    background: linear-gradient(to bottom,
            rgba(11, 26, 54, 0.35) 0%,
            rgba(11, 26, 54, 0) 40%,
            rgba(11, 26, 54, 0) 60%,
            rgba(11, 26, 54, 0.35) 100%);
    display: none;
    transform: translateY(-50%);
}

.a11y-mode-reading-guide .a11y-reading-guide {
    display: block;
}

/* =========================================================================
   10. GLOBAL MODE CLASSES (diterapkan pada <html>)
   ========================================================================= */

/* --- Ukuran teks --- */
html.a11y-text-md {
    font-size: 115%;
}

html.a11y-text-lg {
    font-size: 130%;
}

html.a11y-text-xl {
    font-size: 150%;
}

/* --- Jarak baris --- */
html.a11y-spacing-wide body,
html.a11y-spacing-wide body p,
html.a11y-spacing-wide body li {
    line-height: 1.85 !important;
}

html.a11y-spacing-widest body,
html.a11y-spacing-widest body p,
html.a11y-spacing-widest body li {
    line-height: 2.15 !important;
    letter-spacing: 0.03em !important;
    word-spacing: 0.12em !important;
}

/* --- Font ramah disleksia (scope ke main-wrapper agar tidak menimpa drawer) --- */
html.a11y-dyslexia .main-wrapper,
html.a11y-dyslexia .main-wrapper * {
    font-family: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif !important;
    letter-spacing: 0.04em !important;
    word-spacing: 0.08em !important;
}

/* --- Mode tampilan ---
   PENTING: efek mode diterapkan ke `.main-wrapper` (header + main + footer),
   BUKAN ke `<body>` secara langsung.

   Alasannya: properti `filter` pada sebuah elemen menjadikan elemen tersebut
   containing block baru untuk semua descendants `position: fixed`. Bila
   filter diterapkan ke body, FAB aksesibilitas (position:fixed) akan
   ter-anchor ke body yang lebih tinggi dari viewport — FAB "hilang" ke ujung
   bawah dokumen saat mode kontras/monokrom aktif. Dengan scope `.main-wrapper`,
   widget (yang disuntik sebagai direct child body, di LUAR main-wrapper)
   tidak pernah terdampak. Rujukan:
   https://www.w3.org/TR/filter-effects-1/#FilterProperty */

html.a11y-view-contrast .main-wrapper {
    filter: contrast(1.25) saturate(1.1);
}

html.a11y-view-contrast .main-wrapper a {
    text-decoration: underline !important;
}

html.a11y-view-dark body {
    background: #0b1a36;
}

html.a11y-view-dark .main-wrapper {
    background: #0b1a36;
    color: #f4f6fb;
}

html.a11y-view-dark .main-wrapper *:not(img):not(video):not(svg):not(iframe):not(canvas) {
    background-color: transparent !important;
    color: inherit !important;
    border-color: #2a3a5f !important;
}

html.a11y-view-dark .main-wrapper a {
    color: #ffd94d !important;
}

html.a11y-view-dark .main-wrapper input,
html.a11y-view-dark .main-wrapper select,
html.a11y-view-dark .main-wrapper textarea {
    background: #12244a !important;
    color: #f4f6fb !important;
    border: 1px solid #2a3a5f !important;
}

html.a11y-view-mono .main-wrapper {
    filter: grayscale(1) contrast(1.05);
}

/* --- Highlight tautan (hanya di dalam konten utama, skip widget sendiri) --- */
html.a11y-highlight-links .main-wrapper a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 2px !important;
    outline: 2px solid var(--a11y-gold) !important;
    outline-offset: 1px !important;
    background-color: rgba(255, 184, 0, 0.12) !important;
}

/* --- Highlight judul (hanya di dalam konten utama, skip widget sendiri) --- */
html.a11y-highlight-headings .main-wrapper :is(h1, h2, h3, h4, h5, h6) {
    outline: 2px dashed var(--a11y-accent) !important;
    outline-offset: 4px !important;
    background-color: rgba(0, 89, 214, 0.06) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
}

/* --- Kursor besar (SVG inline, ~48px) — scope ke main-wrapper --- */
html.a11y-big-cursor .main-wrapper,
html.a11y-big-cursor .main-wrapper * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path fill='%23ffffff' stroke='%230b1a36' stroke-width='2' stroke-linejoin='round' d='M8 4 L8 38 L16 30 L22 42 L28 39 L22 27 L34 27 Z'/></svg>") 4 4, auto !important;
}

html.a11y-big-cursor .main-wrapper a,
html.a11y-big-cursor .main-wrapper button,
html.a11y-big-cursor .main-wrapper [role="button"],
html.a11y-big-cursor .main-wrapper input[type="submit"],
html.a11y-big-cursor .main-wrapper label {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path fill='%23ffb800' stroke='%230b1a36' stroke-width='2' stroke-linejoin='round' d='M20 4 L28 4 L28 22 L40 22 L24 44 L8 22 L20 22 Z'/></svg>") 24 24, pointer !important;
}

/* --- Kurangi animasi --- */
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

/* =========================================================================
   11. LIVE STATUS ANNOUNCEMENT (for screen readers)
   ========================================================================= */
.a11y-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================================
   12. RESPONSIVE
   ========================================================================= */
@media (max-width: 640px) {
    .a11y-fab {
        left: 12px;
        bottom: 12px;
        padding: 0;
        width: 56px;
        height: 56px;
        min-width: 56px;
        justify-content: center;
    }

    .a11y-fab__label {
        display: none;
    }

    .a11y-fab__icon {
        background: transparent;
        color: #fff;
    }

    .a11y-fab__icon svg {
        width: 28px;
        height: 28px;
    }

    .a11y-drawer {
        width: 100%;
    }

    .a11y-drawer__header {
        padding: 18px 16px 14px;
    }

    .a11y-drawer__title {
        font-size: 20px;
    }

    .a11y-drawer__body {
        padding: 16px;
    }

    .a11y-drawer__footer {
        padding: 12px 16px;
    }
}

/* --- Respect prefers-reduced-motion without manual toggle --- */
@media (prefers-reduced-motion: reduce) {

    .a11y-drawer,
    .a11y-overlay,
    .a11y-fab,
    .a11y-toggle__switch,
    .a11y-toggle__switch::after {
        transition-duration: 0.001ms !important;
    }
}