/* =========================================================
 * Accesibilidad (panel + ajustes). Ver includes/accessibility.php
 * ========================================================= */

/* --- Foco visible al navegar con teclado (siempre activo) --- */
:is(a, button, [role="button"], summary, [tabindex]):focus-visible {
  outline: 3px solid #244B5A !important;
  outline-offset: 2px !important;
}

/* --- Tamano del texto: zoom del contenido. El mapa se compensa para que
       Mapbox no calcule mal los clics. --- */
html.lv-a11y-zoom-1 body { zoom: 1.1; }
html.lv-a11y-zoom-2 body { zoom: 1.2; }
html.lv-a11y-zoom-3 body { zoom: 1.3; }
html.lv-a11y-zoom-1 #lv-properties-map { zoom: 0.9091; }
html.lv-a11y-zoom-2 #lv-properties-map { zoom: 0.8333; }
html.lv-a11y-zoom-3 #lv-properties-map { zoom: 0.7692; }

/* --- Contraste y escala de grises (sobre <html>: al ser la raiz no
       rompe los elementos fijos como el header) --- */
html.lv-a11y-contrast { filter: contrast(1.35); }
html.lv-a11y-gray { filter: grayscale(1); }
html.lv-a11y-contrast.lv-a11y-gray { filter: contrast(1.35) grayscale(1); }

/* --- Resaltar enlaces --- */
html.lv-a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

/* --- Fuente legible (sin tocar iconos) --- */
html.lv-a11y-font body :not(i):not(svg):not(svg *):not([class*="icon"]):not([class*="dashicons"]):not([class*="fa-"]) {
  font-family: Verdana, Tahoma, Arial, sans-serif !important;
  letter-spacing: 0.02em !important;
  word-spacing: 0.08em !important;
}

/* --- Mas espacio entre lineas (solo texto corrido, no botones) --- */
html.lv-a11y-spacing body :is(p, li, dd, dt, blockquote, label, td, th) {
  line-height: 1.9 !important;
}

/* --- Detener animaciones (duraciones casi cero en vez de "none", para
       que el JS que espera el fin de una animacion siga funcionando) --- */
html.lv-a11y-noanim *,
html.lv-a11y-noanim *::before,
html.lv-a11y-noanim *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* --- Cursor grande --- */
html.lv-a11y-cursor,
html.lv-a11y-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 d='M4 2l15 8.5-6.5 1.8L10 19z' fill='black' stroke='white' stroke-width='1.5' stroke-linejoin='round'/></svg>") 4 2, auto !important;
}

/* =========================== Panel =========================== */
.lv-a11y-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9990;
  width: 44px !important;
  height: 48px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 10px 10px 0 !important;
  background: #244B5A !important;
  color: #fff !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.lv-a11y-toggle:hover { background: #1B3A46 !important; }
.lv-a11y-toggle svg { width: 26px; height: 26px; }

.lv-a11y-panel {
  position: fixed;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9991;
  width: 300px;
  max-width: calc(100vw - 72px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  color: #244B5A;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  padding: 18px;
  text-align: left;
  overflow-x: hidden;
  box-sizing: border-box;
}
.lv-a11y-panel[hidden] { display: none !important; }

.lv-a11y-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lv-a11y-title { margin: 0 !important; font-size: 17px !important; font-weight: 700 !important; line-height: 1.3 !important; color: #244B5A !important; }
.lv-a11y-close {
  width: 32px !important; height: 32px !important; padding: 0 !important; border: 0 !important;
  border-radius: 50% !important; background: #F1F2F3 !important; color: #244B5A !important;
  font-size: 20px !important; line-height: 1 !important; display: flex !important;
  align-items: center; justify-content: center; cursor: pointer;
}

.lv-a11y-size {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #F1F2F3; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px;
}
.lv-a11y-size-label { font-size: 14px; font-weight: 600; }
.lv-a11y-size-ctrl { display: flex; align-items: center; gap: 6px; }
.lv-a11y-size-btn {
  width: 34px !important; height: 34px !important; padding: 0 !important;
  border: 1px solid #D9D9D9 !important; border-radius: 8px !important;
  background: #fff !important; color: #244B5A !important;
  font-size: 15px !important; font-weight: 700 !important; line-height: 1 !important; cursor: pointer;
}
.lv-a11y-size-btn:disabled { opacity: 0.4; cursor: default; }
.lv-a11y-size-val { min-width: 44px; text-align: center; font-size: 13px; font-weight: 600; }

.lv-a11y-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.lv-a11y-opt {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 78px; padding: 10px 6px !important;
  border: 2px solid #E5E7EB !important; border-radius: 10px !important;
  background: #fff !important; color: #244B5A !important;
  font-size: 12.5px !important; font-weight: 600 !important; line-height: 1.25 !important;
  text-align: center; text-transform: none !important; letter-spacing: 0 !important; cursor: pointer;
  /* El tema pone white-space:nowrap a los botones: sin esto los textos
     largos estiran la cuadricula y se salen del panel. */
  white-space: normal !important; overflow-wrap: anywhere;
  width: 100% !important; min-width: 0 !important; box-sizing: border-box !important;
}
.lv-a11y-opt svg { width: 24px; height: 24px; flex: none; }
.lv-a11y-opt:hover { border-color: #ADC8CB !important; }
.lv-a11y-opt[aria-pressed="true"] { background: #244B5A !important; border-color: #244B5A !important; color: #fff !important; }
.lv-a11y-opt:last-child:nth-child(odd) { grid-column: span 2; }

.lv-a11y-reset {
  box-sizing: border-box !important; white-space: normal !important;
  width: 100% !important; padding: 10px !important;
  border: 1px solid #D9D9D9 !important; border-radius: 10px !important;
  background: #fff !important; color: #244B5A !important;
  font-size: 14px !important; font-weight: 600 !important; cursor: pointer;
}

@media (max-width: 480px) {
  .lv-a11y-toggle { width: 38px !important; height: 42px !important; }
  .lv-a11y-toggle svg { width: 22px; height: 22px; }
  .lv-a11y-panel { left: 8px; right: 8px; width: auto; max-width: none; top: auto; bottom: 12px; transform: none; max-height: calc(100vh - 24px); }
}