/**
 * Dinsos Pinrang Aksesibel - Gaya Panel Aksesibilitas
 * @version 1.0.0
 */

:root {
  --dsp-font-scale: 1;
  --dsp-primary: #14532d;
  --dsp-primary-hover: #166534;
  --dsp-surface: #ffffff;
  --dsp-text: #0f172a;
  --dsp-text-muted: #475569;
  --dsp-border: #e2e8f0;
  --dsp-focus-ring: #f59e0b;
}

/* Skala Teks Dinamis */
html[data-dsp-font-scale="1.1"] { font-size: 110% !important; }
html[data-dsp-font-scale="1.2"] { font-size: 120% !important; }
html[data-dsp-font-scale="1.3"] { font-size: 130% !important; }
html[data-dsp-font-scale="1.4"] { font-size: 140% !important; }

/* 1. Tombol Floating Trigger */
.dsp-trigger-btn {
  position: fixed;
  z-index: 99990;
  bottom: 24px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--dsp-primary);
  color: #ffffff !important;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dsp-trigger-btn.dsp-pos-left {
  right: auto;
  left: 24px;
}

.dsp-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  background-color: var(--dsp-primary-hover);
}

.dsp-trigger-btn:focus-visible {
  outline: 3px solid var(--dsp-focus-ring) !important;
  outline-offset: 3px !important;
}

.dsp-trigger-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: currentColor;
}

/* Penyesuaian Ruang pada Mobile agar tidak bertabrakan dengan .mobile-dock tema */
@media (max-width: 768px) {
  .dsp-trigger-btn {
    bottom: calc(78px + env(safe-area-inset-bottom, 12px));
    padding: 8px 12px;
    font-size: 13px;
  }
  .dsp-trigger-btn.dsp-pos-left {
    left: 14px;
  }
  .dsp-trigger-btn:not(.dsp-pos-left) {
    right: 14px;
  }
}

/* 2. Backdrop Dialog */
.dsp-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99995;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dsp-backdrop.dsp-open {
  opacity: 1;
  visibility: visible;
}

/* 3. Panel Drawer / Modal */
.dsp-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 410px;
  height: 100vh;
  height: 100dvh;
  background-color: var(--dsp-surface);
  color: var(--dsp-text);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  font-family: inherit;
  box-sizing: border-box;
}

.dsp-panel.dsp-pos-left {
  right: auto;
  left: 0;
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
}

.dsp-panel.dsp-open {
  transform: translateX(0);
}

.dsp-panel *,
.dsp-panel *::before,
.dsp-panel *::after {
  box-sizing: inherit;
}

/* Header Panel */
.dsp-panel-header {
  padding: 18px 20px;
  background-color: var(--dsp-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.dsp-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.dsp-panel-title svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.dsp-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dsp-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.dsp-close-btn:focus-visible {
  outline: 2px solid var(--dsp-focus-ring);
}

/* Isi Panel (Scrollable) */
.dsp-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dsp-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dsp-text-muted);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Grid Kartu Pengaturan */
.dsp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dsp-card-btn {
  background: #f8fafc;
  border: 1px solid var(--dsp-border);
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  color: var(--dsp-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
  width: 100%;
}

.dsp-card-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dsp-card-btn.dsp-active {
  background-color: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: inset 0 0 0 1px #10b981;
}

.dsp-card-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.dsp-card-btn:focus-visible {
  outline: 2px solid var(--dsp-focus-ring) !important;
  outline-offset: 2px !important;
}

/* Kontrol Ukuran Font Bersusun */
.dsp-font-stepper {
  grid-column: span 2;
  background: #f8fafc;
  border: 1px solid var(--dsp-border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dsp-font-stepper span {
  font-size: 13px;
  font-weight: 600;
  color: var(--dsp-text);
}

.dsp-stepper-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dsp-step-btn {
  background: #ffffff;
  border: 1px solid var(--dsp-border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dsp-text);
  transition: background-color 0.15s ease;
}

.dsp-step-btn:hover {
  background-color: #e2e8f0;
}

.dsp-step-val {
  min-width: 44px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--dsp-primary);
}

/* Bagian TTS di Dalam Panel */
.dsp-tts-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsp-tts-box p {
  margin: 0;
  font-size: 13px;
  color: #166534;
}

.dsp-tts-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--dsp-primary);
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dsp-tts-action-btn:hover {
  background-color: var(--dsp-primary-hover);
}

.dsp-tts-action-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Footer Panel */
.dsp-panel-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--dsp-border);
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dsp-reset-all-btn {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.dsp-reset-all-btn:hover {
  background-color: #fee2e2;
}

.dsp-statement-link {
  font-size: 12px;
  color: var(--dsp-primary);
  text-decoration: underline;
  font-weight: 500;
}

/* ==========================================================================
   4. KELAS MODIFIER VISUAL (DITERAPKAN KE HTML)
   ========================================================================== */

/* Kontras Tinggi (High Contrast) */
html.dsp-contrast-high,
html.dsp-contrast-high body {
  background-color: #000000 !important;
  color: #ffffff !important;
}

html.dsp-contrast-high *:not(#wpadminbar):not(#wpadminbar *):not(.dsp-panel):not(.dsp-panel *):not(.dsp-speech-bar):not(.dsp-speech-bar *) {
  background-color: #000000 !important;
  color: #ffffff !important;
  border-color: #ffff00 !important;
}

html.dsp-contrast-high a:not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *) {
  color: #ffff00 !important;
  text-decoration: underline !important;
}

html.dsp-contrast-high button:not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *) {
  background-color: #000000 !important;
  color: #ffff00 !important;
  border: 2px solid #ffff00 !important;
}

/* Mode Gelap (Dark Mode Lembut) */
html.dsp-dark-mode,
html.dsp-dark-mode body {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}

html.dsp-dark-mode .site-header,
html.dsp-dark-mode .page-panel,
html.dsp-dark-mode .aside-card,
html.dsp-dark-mode .service-card,
html.dsp-dark-mode .footer-map-card {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

html.dsp-dark-mode h1,
html.dsp-dark-mode h2,
html.dsp-dark-mode h3,
html.dsp-dark-mode h4,
html.dsp-dark-mode strong {
  color: #f8fafc !important;
}

html.dsp-dark-mode p,
html.dsp-dark-mode span:not(.dsp-trigger-label):not(#wpadminbar *),
html.dsp-dark-mode li {
  color: #cbd5e1 !important;
}

html.dsp-dark-mode a:not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *):not(.button) {
  color: #38bdf8 !important;
}

/* Monokrom / Grayscale */
html.dsp-grayscale {
  filter: grayscale(100%) !important;
}

/* Garis Bawah Tautan */
html.dsp-underline-links a:not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *) {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

/* Font Ramah Keterbacaan / Disleksia (Kecualikan font icon dan admin bar) */
html.dsp-readable-font *:not(#wpadminbar):not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *):not(i):not(svg):not(path):not([class*="dashicons"]):not([class*="fa-"]):not(.dashicons) {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: 0.025em !important;
}

/* Jarak Huruf Diperluas */
html.dsp-spacing-expanded *:not(#wpadminbar):not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *):not(i):not(svg):not(path):not([class*="dashicons"]):not([class*="fa-"]):not(.dashicons) {
  letter-spacing: 0.08em !important;
  word-spacing: 0.16em !important;
}

/* Jarak Baris Longgar */
html.dsp-line-height-relaxed *:not(#wpadminbar):not(#wpadminbar *):not(.dsp-panel *):not(.dsp-speech-bar *) {
  line-height: 2 !important;
}

/* Kursor Besar (Kecualikan admin bar dan area input teks) */
html.dsp-big-cursor,
html.dsp-big-cursor *:not(#wpadminbar):not(#wpadminbar *):not(input):not(textarea):not(select) {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cpath fill='%23000000' stroke='%23ffffff' stroke-width='2' d='M6 3l16 16-6.5 1.5 5 10-3.5 1.5-5-10L6 26V3z'/%3E%3C/svg%3E"), auto !important;
}

/* Hentikan Animasi */
html.dsp-stop-animations *:not(#wpadminbar *),
html.dsp-stop-animations *:not(#wpadminbar *)::before,
html.dsp-stop-animations *:not(#wpadminbar *)::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Sorot Fokus Keyboard Tebal */
html.dsp-focus-visible :focus-visible:not(#wpadminbar):not(#wpadminbar *) {
  outline: 3px solid #f59e0b !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.75) !important;
}
