/* =========================================================
   Widget Aksesibilitas — PPID Landak
   File: public/assets/a11y/a11y.css

   PATCH WCAG AA:
   - --a11y-gray digelapkan: label seksi (#6b7280 pada #f4f6fb)
     hanya ~4.47:1, di bawah ambang 4.5:1 untuk teks kecil (1.4.3)
   - --a11y-focus baru untuk semua outline :focus-visible: gold asli
     (#d4a017) hanya ~2.38:1 di atas latar putih tombol, gagal
     ambang 3:1 untuk indikator UI non-teks (1.4.11). --a11y-gold
     asli tetap dipakai untuk elemen dekoratif (kbd, garis bantu
     baca) yang bukan indikator fokus.
   ========================================================= */

:root {
  --a11y-navy: #0b2a6b;
  --a11y-navy-dark: #071c47;
  --a11y-gold: #d4a017;
  --a11y-focus: #b8860b;
  --a11y-white: #ffffff;
  --a11y-gray: #5b6472;
  --a11y-radius: 14px;
}

/* ---------- Tombol pemicu (floating button) ---------- */
#a11y-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--a11y-navy);
  color: var(--a11y-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(11, 42, 107, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#a11y-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 42, 107, 0.45);
}
#a11y-trigger:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}
#a11y-trigger svg {
  width: 28px;
  height: 28px;
}

/* ---------- Overlay ---------- */
#a11y-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 28, 71, 0.45);
  z-index: 99997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#a11y-overlay.a11y-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Panel ---------- */
#a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 340px;
  max-width: 88vw;
  background: #f4f6fb;
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
}
#a11y-panel.a11y-open {
  transform: translateX(0);
}

.a11y-panel-header {
  background: linear-gradient(135deg, var(--a11y-navy), #1746b3);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.a11y-panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.a11y-panel-header kbd {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  padding: 1px 5px;
}
#a11y-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#a11y-close:hover { background: rgba(255, 255, 255, 0.28); }
#a11y-close:focus-visible { outline: 2px solid var(--a11y-focus); }

.a11y-panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.a11y-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--a11y-gray);
  margin: 18px 4px 8px;
}
.a11y-section-label:first-child { margin-top: 4px; }

.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.a11y-btn {
  background: #fff;
  border: 1.5px solid #e2e6f0;
  border-radius: var(--a11y-radius);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  font-size: 12.5px;
  font-weight: 600;
  color: #23272f;
  min-height: 88px;
}
.a11y-btn:hover {
  border-color: var(--a11y-navy);
  transform: translateY(-1px);
}
.a11y-btn:focus-visible {
  outline: 2px solid var(--a11y-focus);
  outline-offset: 1px;
}
.a11y-btn svg { width: 26px; height: 26px; color: var(--a11y-navy); flex-shrink: 0; }
.a11y-btn[aria-pressed="true"] {
  background: var(--a11y-navy);
  border-color: var(--a11y-navy);
  color: #fff;
}
.a11y-btn[aria-pressed="true"] svg { color: #fff; }

.a11y-btn-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 14px;
}

.a11y-panel-footer {
  padding: 14px 16px;
  border-top: 1px solid #e2e6f0;
  flex-shrink: 0;
}
#a11y-reset {
  width: 100%;
  background: #fff;
  border: 1.5px solid #e2e6f0;
  border-radius: 10px;
  padding: 10px;
  font-weight: 700;
  font-size: 13px;
  color: #b3261e;
  cursor: pointer;
}
#a11y-reset:hover { background: #fdecea; border-color: #f4c7c3; }
#a11y-reset:focus-visible { outline: 2px solid var(--a11y-focus); }

/* =========================================================
   Efek aksesibilitas — diterapkan ke <html>
   ========================================================= */

/* Perbesar / perkecil teks: diatur lewat inline font-size di <html> via JS */

/* Kontras tinggi */
html.a11y-contrast body {
  background: #000 !important;
  color: #fff !important;
}
html.a11y-contrast body * {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}
html.a11y-contrast a,
html.a11y-contrast button {
  color: #ffe066 !important;
}

/* Kejenuhan / grayscale */
html.a11y-grayscale { filter: grayscale(100%); }

/* Sembunyikan gambar */
html.a11y-hide-images img,
html.a11y-hide-images svg.a11y-content-svg,
html.a11y-hide-images [style*="background-image"] {
  visibility: hidden !important;
}

/* Rata tulisan (paksa rata kiri, lebih mudah dibaca) */
html.a11y-align-left body * {
  text-align: left !important;
}

/* Font ramah disleksia */
html.a11y-dyslexia body,
html.a11y-dyslexia body * {
  font-family: "Comic Sans MS", "Comic Sans", Verdana, sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.08em !important;
}

/* Tinggi garis */
html.a11y-line-height body,
html.a11y-line-height body p,
html.a11y-line-height body li {
  line-height: 2.1 !important;
}

/* Kursor besar */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24"><path fill="black" stroke="white" stroke-width="1" d="M4 2l14 8-6 2-2 6z"/></svg>') 4 4, auto !important;
}

/* Garis bantu baca (reading guide) */
#a11y-reading-guide {
  position: fixed;
  left: 0;
  width: 100%;
  height: 36px;
  background: rgba(212, 160, 23, 0.25);
  border-top: 2px solid var(--a11y-gold);
  border-bottom: 2px solid var(--a11y-gold);
  pointer-events: none;
  z-index: 99996;
  display: none;
}
html.a11y-reading-guide #a11y-reading-guide { display: block; }

/* Hormati preferensi reduced motion pengguna */
@media (prefers-reduced-motion: reduce) {
  #a11y-panel, #a11y-overlay, #a11y-trigger { transition: none; }
}

/* Responsif mobile */
@media (max-width: 480px) {
  #a11y-panel { width: 100vw; max-width: 100vw; }
  #a11y-trigger { bottom: 16px; left: 16px; }
}