/* =========================================================
   Aksesibilitas global Intranet PDSI
   Dimuat di <head> semua halaman (termasuk auth, error, vcard)
   supaya preferensi pengguna berlaku menyeluruh, bukan hanya
   di halaman yang memuat topbar.
   Kelas dipasang di <html> oleh pre-paint script di head.
   ========================================================= */

/* ---------------------------------------------------------
   0. Lewati ke konten (WCAG 2.4.1 Bypass Blocks)
   --------------------------------------------------------- */
/* fixed, bukan absolute: kalau halaman sudah tergulir jauh, skip link
   yang absolute akan muncul di puncak dokumen dan tidak terlihat. */
.intra-skip-links {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100001;
}

.intra-skip-link {
    position: fixed;
    top: 0;
    left: 0;
    display: inline-block;
    padding: .65rem 1.1rem;
    margin: .5rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    color: #fff;
    background: #0b3fa8;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
    transform: translateY(-150%);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
}

.intra-skip-link:focus,
.intra-skip-link:focus-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
    color: #fff;
}

/* Kedua skip link boleh menempati titik yang sama: yang tidak berfokus
   selalu tergeser keluar layar, dan hanya satu yang bisa fokus. */

/* Di bawah breakpoint sidebar, menunya off-canvas sehingga melompat ke
   sana tidak ada gunanya. */
@media (max-width: 1199.98px) {
    .intra-skip-link[href="#intra-nav"] {
        display: none;
    }
}

/* Target skip-link tidak boleh menampilkan ring fokus permanen */
[id="intra-main"]:focus,
[id="intra-nav"]:focus {
    outline: none;
}

/* ---------------------------------------------------------
   0b. Region pengumuman untuk pembaca layar
   --------------------------------------------------------- */
.intra-a11y-announcer {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------
   1. Kontras Tinggi
   --------------------------------------------------------- */
html.intra-a11y-high-contrast.light-style {
    --bs-body-color: #000000;
    --bs-body-color-rgb: 0, 0, 0;
    --bs-secondary-color: #1a1a1a;
    --bs-secondary-color-rgb: 26, 26, 26;
    --bs-border-color: #000000;
    --bs-border-color-rgb: 0, 0, 0;
    --bs-link-color: #0000ee;
    --bs-link-hover-color: #6611ee;
    --bs-heading-color: #000000;
}

html.intra-a11y-high-contrast.light-style body {
    color: #000 !important;
}

html.intra-a11y-high-contrast.light-style .text-muted,
html.intra-a11y-high-contrast.light-style small.text-muted,
html.intra-a11y-high-contrast.light-style .text-secondary {
    color: #1a1a1a !important;
}

html.intra-a11y-high-contrast.light-style .card,
html.intra-a11y-high-contrast.light-style .dropdown-menu,
html.intra-a11y-high-contrast.light-style .form-control,
html.intra-a11y-high-contrast.light-style .form-select,
html.intra-a11y-high-contrast.light-style .modal-content,
html.intra-a11y-high-contrast.light-style .input-group-text {
    border: 2px solid #000 !important;
}

html.intra-a11y-high-contrast.light-style a:not(.btn) {
    color: #0000ee !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

html.intra-a11y-high-contrast.light-style a:not(.btn):visited {
    color: #6611ee !important;
}

html.intra-a11y-high-contrast.light-style .btn-primary,
html.intra-a11y-high-contrast.light-style .bg-primary {
    background-color: #003399 !important;
    border-color: #003399 !important;
}

html.intra-a11y-high-contrast.dark-style {
    --bs-body-color: #ffffff;
    --bs-body-color-rgb: 255, 255, 255;
    --bs-secondary-color: #f0f0f0;
    --bs-secondary-color-rgb: 240, 240, 240;
    --bs-border-color: #ffffff;
    --bs-border-color-rgb: 255, 255, 255;
    --bs-link-color: #80b3ff;
    --bs-link-hover-color: #b3d1ff;
    --bs-heading-color: #ffffff;
}

html.intra-a11y-high-contrast.dark-style body {
    color: #fff !important;
}

html.intra-a11y-high-contrast.dark-style .text-muted,
html.intra-a11y-high-contrast.dark-style small.text-muted,
html.intra-a11y-high-contrast.dark-style .text-secondary {
    color: #f0f0f0 !important;
}

html.intra-a11y-high-contrast.dark-style .card,
html.intra-a11y-high-contrast.dark-style .dropdown-menu,
html.intra-a11y-high-contrast.dark-style .form-control,
html.intra-a11y-high-contrast.dark-style .form-select,
html.intra-a11y-high-contrast.dark-style .modal-content,
html.intra-a11y-high-contrast.dark-style .input-group-text {
    border: 2px solid #fff !important;
}

html.intra-a11y-high-contrast.dark-style a:not(.btn) {
    color: #80b3ff !important;
    text-decoration: underline !important;
}

html.intra-a11y-high-contrast :focus-visible {
    outline: 3px solid currentColor !important;
    outline-offset: 2px !important;
}

/* ---------------------------------------------------------
   2. Teks Lebih Besar (toggle lama, tetap didukung)
   --------------------------------------------------------- */
html.intra-a11y-large-text {
    font-size: 17.5px;
}

/* ---------------------------------------------------------
   3. Tebalkan Teks
   --------------------------------------------------------- */
html.intra-a11y-bold-text body {
    font-weight: 500;
}

html.intra-a11y-bold-text small,
html.intra-a11y-bold-text .text-muted {
    font-weight: 500 !important;
}

html.intra-a11y-bold-text .fw-light {
    font-weight: 500 !important;
}

html.intra-a11y-bold-text .fw-normal {
    font-weight: 600 !important;
}

html.intra-a11y-bold-text .fw-medium {
    font-weight: 700 !important;
}

html.intra-a11y-bold-text .fw-semibold {
    font-weight: 800 !important;
}

html.intra-a11y-bold-text .fw-bold {
    font-weight: 900 !important;
}

html.intra-a11y-bold-text strong,
html.intra-a11y-bold-text b {
    font-weight: 800 !important;
}

html.intra-a11y-bold-text h1,
html.intra-a11y-bold-text h2,
html.intra-a11y-bold-text h3 {
    font-weight: 900 !important;
}

html.intra-a11y-bold-text h4,
html.intra-a11y-bold-text h5,
html.intra-a11y-bold-text h6 {
    font-weight: 800 !important;
}

/* ---------------------------------------------------------
   4. Spasi Baca (WCAG 1.4.12 Text Spacing)
   --------------------------------------------------------- */
html.intra-a11y-reading-spacing p,
html.intra-a11y-reading-spacing li,
html.intra-a11y-reading-spacing td,
html.intra-a11y-reading-spacing th,
html.intra-a11y-reading-spacing label,
html.intra-a11y-reading-spacing small,
html.intra-a11y-reading-spacing .dropdown-item,
html.intra-a11y-reading-spacing .card-body,
html.intra-a11y-reading-spacing blockquote {
    line-height: 1.7 !important;
    letter-spacing: 0.04em !important;
    word-spacing: 0.08em !important;
}

html.intra-a11y-reading-spacing p {
    margin-bottom: 1.4em !important;
}

/* ---------------------------------------------------------
   5. Sorot Fokus (WCAG 2.4.7 / 2.4.11)
   --------------------------------------------------------- */
html.intra-a11y-enhanced-focus *:focus-visible {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(255, 191, 71, 0.30) !important;
    border-radius: 4px !important;
}

html.intra-a11y-enhanced-focus.dark-style *:focus-visible {
    outline-color: #ffd166 !important;
    box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.40) !important;
}

/* ---------------------------------------------------------
   6. Garis Bawah Tautan
   --------------------------------------------------------- */
html.intra-a11y-underline-links a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not([class*="lt-"]):not(.stretched-link) {
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

/* ---------------------------------------------------------
   7. Mode Ringkas
   --------------------------------------------------------- */
html.intra-a11y-compact body {
    font-size: 0.82rem;
    line-height: 1.4;
}

html.intra-a11y-compact .card-body {
    padding: 0.55rem 0.7rem !important;
}

html.intra-a11y-compact .card-header {
    padding: 0.5rem 0.75rem !important;
}

html.intra-a11y-compact .card-footer {
    padding: 0.5rem 0.75rem !important;
}

html.intra-a11y-compact .container-xxl,
html.intra-a11y-compact .container-fluid {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
}

html.intra-a11y-compact .row {
    --bs-gutter-y: 0.5rem;
}

html.intra-a11y-compact .gy-3,
html.intra-a11y-compact .gy-4,
html.intra-a11y-compact .gy-5 {
    --bs-gutter-y: 0.5rem !important;
}

html.intra-a11y-compact .my-3,
html.intra-a11y-compact .my-4 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

html.intra-a11y-compact .py-3,
html.intra-a11y-compact .py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

html.intra-a11y-compact .mb-3,
html.intra-a11y-compact .mb-4 {
    margin-bottom: 0.5rem !important;
}

html.intra-a11y-compact .dropdown-item {
    padding: 0.35rem 0.75rem !important;
}

html.intra-a11y-compact .btn:not(.btn-icon) {
    padding: 0.32rem 0.7rem !important;
    font-size: 0.8rem;
}

html.intra-a11y-compact .form-control,
html.intra-a11y-compact .form-select {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

html.intra-a11y-compact h1 {
    font-size: 1.6rem !important;
}

html.intra-a11y-compact h2 {
    font-size: 1.35rem !important;
}

html.intra-a11y-compact h3 {
    font-size: 1.15rem !important;
}

html.intra-a11y-compact h4 {
    font-size: 1rem !important;
}

html.intra-a11y-compact h5 {
    font-size: 0.9rem !important;
}

html.intra-a11y-compact h6 {
    font-size: 0.82rem !important;
}

/* ---------------------------------------------------------
   8. Kurangi Gerak (WCAG 2.3.3)
   --------------------------------------------------------- */
html.intra-a11y-reduce-motion *,
html.intra-a11y-reduce-motion *::before,
html.intra-a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
}

/* ---------------------------------------------------------
   9. Kurangi Transparansi
   --------------------------------------------------------- */
html.intra-a11y-reduce-transparency *,
html.intra-a11y-reduce-transparency *::before,
html.intra-a11y-reduce-transparency *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.intra-a11y-reduce-transparency.light-style .dropdown-menu,
html.intra-a11y-reduce-transparency.light-style .modal-content,
html.intra-a11y-reduce-transparency.light-style .toast,
html.intra-a11y-reduce-transparency.light-style .popover,
html.intra-a11y-reduce-transparency.light-style .glasskeun {
    background: #ffffff !important;
}

html.intra-a11y-reduce-transparency.dark-style .dropdown-menu,
html.intra-a11y-reduce-transparency.dark-style .modal-content,
html.intra-a11y-reduce-transparency.dark-style .toast,
html.intra-a11y-reduce-transparency.dark-style .popover,
html.intra-a11y-reduce-transparency.dark-style .glasskeun {
    background: #1a2333 !important;
}

/* Overlay pergantian tema mengandalkan blur; tanpa blur latarnya terlalu
   tembus pandang, jadi kepekatannya dinaikkan sebagai gantinya. */
html.intra-a11y-reduce-transparency .intra-theme-fx {
    background: rgba(15, 23, 42, 0.92) !important;
}

/* ---------------------------------------------------------
   10. Skala Abu
   --------------------------------------------------------- */
/* Filter dipasang di elemen akar, bukan di .layout-page/.content-wrapper.
   Elemen selain akar yang punya filter menjadi containing block bagi
   keturunan position:fixed, sehingga modal Bootstrap di dalam konten
   akan terpaku ke kotak konten alih-alih ke viewport. Akar dikecualikan
   dari aturan itu oleh spesifikasi Filter Effects. */
html.intra-a11y-grayscale {
    filter: grayscale(1);
}

/* ---------------------------------------------------------
   11. Batas Gambar
   --------------------------------------------------------- */
html.intra-a11y-image-outline img:not(.xprofile-frame):not(.xprofile-picture):not([class*="logo"]):not([class*="frame"]):not([class*="icon"]):not([class*="avatar"]) {
    outline: 3px solid rgba(15, 23, 42, 0.75);
    outline-offset: 2px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.95);
}

html.intra-a11y-image-outline.dark-style img:not(.xprofile-frame):not(.xprofile-picture):not([class*="logo"]):not([class*="frame"]):not([class*="icon"]):not([class*="avatar"]) {
    outline-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
}

/* ---------------------------------------------------------
   12. Jeda Media
   --------------------------------------------------------- */
html.intra-a11y-pause-media img,
html.intra-a11y-pause-media svg,
html.intra-a11y-pause-media canvas {
    animation-play-state: paused !important;
}

html.intra-a11y-pause-media video,
html.intra-a11y-pause-media iframe[src*="youtube"],
html.intra-a11y-pause-media iframe[src*="vimeo"] {
    opacity: 0.6;
    filter: grayscale(0.5);
}

html.intra-a11y-pause-media [data-app-light-img],
html.intra-a11y-pause-media [data-app-dark-img],
html.intra-a11y-pause-media .animate__animated {
    animation-play-state: paused !important;
}

/* =========================================================
   FITUR TAMBAHAN
   ========================================================= */

/* ---------------------------------------------------------
   13. Ukuran Teks bertingkat (WCAG 1.4.4 Resize Text)
   Ditaruh sesudah .intra-a11y-large-text supaya menang
   pada spesifisitas yang sama kalau keduanya aktif.
   --------------------------------------------------------- */
html[data-a11y-text="105"] {
    font-size: 16.8px;
}

html[data-a11y-text="110"] {
    font-size: 17.6px;
}

html[data-a11y-text="115"] {
    font-size: 18.4px;
}

html[data-a11y-text="120"] {
    font-size: 19.2px;
}

html[data-a11y-text="125"] {
    font-size: 20px;
}

html[data-a11y-text="130"] {
    font-size: 20.8px;
}

html[data-a11y-text="140"] {
    font-size: 22.4px;
}

html[data-a11y-text="150"] {
    font-size: 24px;
}

/* Perbesaran besar gampang bikin teks terpotong di kartu sempit */
html[data-a11y-text="140"] body,
html[data-a11y-text="150"] body {
    overflow-wrap: break-word;
}

/* ---------------------------------------------------------
   14. Font Mudah Dibaca (Atkinson Hyperlegible)
   Berkas fontnya baru diunduh saat opsi ini dinyalakan.
   --------------------------------------------------------- */
html.intra-a11y-readable-font body,
html.intra-a11y-readable-font .card,
html.intra-a11y-readable-font .btn,
html.intra-a11y-readable-font .form-control,
html.intra-a11y-readable-font .form-select,
html.intra-a11y-readable-font .dropdown-menu,
html.intra-a11y-readable-font .modal-content,
html.intra-a11y-readable-font h1,
html.intra-a11y-readable-font h2,
html.intra-a11y-readable-font h3,
html.intra-a11y-readable-font h4,
html.intra-a11y-readable-font h5,
html.intra-a11y-readable-font h6 {
    font-family: "Atkinson Hyperlegible", "Segoe UI", Tahoma, Verdana, sans-serif !important;
}

/* Ikon webfont tidak perlu dikecualikan: .ti/.ri sudah mendeklarasikan
   font-family sendiri dengan !important dan .mdi lewat ::before, jadi
   nilai warisan dari body tidak pernah menyentuhnya. Menambah aturan
   pengecualian di sini justru mematikan ikon yang dipasang sebagai
   <span class="tf-icons ti ti-edit"> alih-alih <i>. */

/* ---------------------------------------------------------
   15. Sorot Tautan
   --------------------------------------------------------- */
html.intra-a11y-highlight-links a:not(.btn):not(.dropdown-item):not(.nav-link):not(.page-link):not(.stretched-link):not(.intra-skip-link) {
    background: #ffe680 !important;
    color: #14213d !important;
    box-shadow: 0 0 0 2px #ffe680;
    border-radius: 2px;
}

html.intra-a11y-highlight-links a:not(.btn):not(.dropdown-item):not(.nav-link):not(.page-link):not(.stretched-link):not(.intra-skip-link):hover {
    background: #ffd11a !important;
}

html.intra-a11y-highlight-links button:not(.btn-close),
html.intra-a11y-highlight-links [role="button"]:not(a) {
    outline: 2px dashed rgba(11, 63, 168, .7);
    outline-offset: 1px;
}

/* ---------------------------------------------------------
   16. Kursor Besar
   --------------------------------------------------------- */
/* Berkas PNG, bukan SVG inline: Safari mengabaikan kursor SVG sama sekali
   sehingga opsi ini diam-diam tidak berefek di sana. */
html.intra-a11y-big-cursor,
html.intra-a11y-big-cursor body {
    cursor: url("../../../img/a11y/cursor-arrow.png") 3 3, auto !important;
}

html.intra-a11y-big-cursor a,
html.intra-a11y-big-cursor button,
html.intra-a11y-big-cursor [role="button"],
html.intra-a11y-big-cursor label,
html.intra-a11y-big-cursor select,
html.intra-a11y-big-cursor summary,
html.intra-a11y-big-cursor .btn {
    cursor: url("../../../img/a11y/cursor-pointer.png") 18 5, pointer !important;
}

/* ---------------------------------------------------------
   17. Target Sentuh Besar (WCAG 2.2 - 2.5.8 Target Size)
   --------------------------------------------------------- */
html.intra-a11y-large-targets a:not(.stretched-link),
html.intra-a11y-large-targets button,
html.intra-a11y-large-targets [role="button"],
html.intra-a11y-large-targets .btn,
html.intra-a11y-large-targets .page-link,
html.intra-a11y-large-targets .dropdown-item,
html.intra-a11y-large-targets .form-check-input,
html.intra-a11y-large-targets summary {
    min-width: 24px;
    min-height: 24px;
}

html.intra-a11y-large-targets .btn-icon,
html.intra-a11y-large-targets .btn-sm,
html.intra-a11y-large-targets .btn-xs {
    min-width: 32px;
    min-height: 32px;
}

html.intra-a11y-large-targets .form-check-input {
    width: 1.35em;
    height: 1.35em;
}

/* ---------------------------------------------------------
   18. Saturasi Rendah
   --------------------------------------------------------- */
html.intra-a11y-low-saturation {
    filter: saturate(0.45);
}

/* Kalau keduanya menyala, skala abu yang menang, bukan yang terakhir ditulis */
html.intra-a11y-grayscale.intra-a11y-low-saturation {
    filter: grayscale(1);
}

/* ---------------------------------------------------------
   19. Panduan Baca (garis pemandu mengikuti kursor)
   --------------------------------------------------------- */
.intra-a11y-guide {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 2.6rem;
    z-index: 99999;
    pointer-events: none;
    border-top: 2px solid rgba(11, 63, 168, .9);
    border-bottom: 2px solid rgba(11, 63, 168, .9);
    background: rgba(255, 214, 10, .16);
    display: none;
}

html.intra-a11y-reading-guide .intra-a11y-guide {
    display: block;
}

html.dark-style .intra-a11y-guide {
    border-color: rgba(255, 209, 102, .95);
    background: rgba(255, 209, 102, .14);
}

/* Panduan baca ikut mengikuti "kurangi gerak" */
html.intra-a11y-reduce-motion .intra-a11y-guide {
    transition: none !important;
}
