/* ============================================================
   CITICED — Widget de Accesibilidad Web (Nativo, sin dependencias externas)
   ============================================================ */

/* Botón flotante disparador (esquina inferior izquierda, evita choque con #scrollTopBtn) */
#a11yTriggerBtn {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  z-index: 100002;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #0044ff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 68, 255, 0.42);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

#a11yTriggerBtn:hover,
#a11yTriggerBtn:focus-visible {
  background: #0033cc;
  transform: scale(1.07);
  box-shadow: 0 8px 26px rgba(0, 68, 255, 0.55);
  outline: 3px solid rgba(0, 68, 255, 0.35);
  outline-offset: 2px;
}

#a11yTriggerBtn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Panel principal de accesibilidad */
#a11yPanel {
  position: fixed;
  top: 14px;
  left: 14px;
  bottom: 14px;
  width: 340px;
  max-width: calc(100vw - 28px);
  z-index: 100005;
  background: #f1f4f9;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  text-align: left !important;
  color: #111827 !important;
  transform: translateX(-120%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, visibility 0.22s ease, width 0.22s ease;
}

#a11yPanel.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#a11yPanel.a11y-panel-large {
  width: 440px;
}

/* Cabecera azul */
.a11y-header {
  background: #0044ff;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.a11y-header-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin: 0;
  line-height: 1.3 !important;
}

.a11y-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Cuerpo con scroll */
.a11y-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: #0044ff #e2e8f0;
}

.a11y-body::-webkit-scrollbar {
  width: 6px;
}

.a11y-body::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 4px;
}

.a11y-body::-webkit-scrollbar-thumb {
  background: #0044ff;
  border-radius: 4px;
}

/* Fila switch "Widget de gran tamaño" */
.a11y-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 4px 2px;
  font-weight: 600;
  font-size: 13.5px;
  color: #111827;
}

.a11y-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.a11y-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.a11y-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #25334a;
  border-radius: 34px;
  transition: background-color 0.2s ease;
}

.a11y-switch-slider::before {
  content: "✕";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  color: #25334a;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.a11y-switch input:checked + .a11y-switch-slider {
  background-color: #0044ff;
}

.a11y-switch input:checked + .a11y-switch-slider::before {
  content: "✓";
  color: #0044ff;
  transform: translateX(22px);
}

/* Grid de tarjetas de opciones */
.a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.a11y-card {
  position: relative;
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center !important;
  gap: 8px;
  cursor: pointer;
  color: #111827 !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease, background-color 0.16s ease;
  min-height: 98px;
}

.a11y-card:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 68, 255, 0.1);
}

.a11y-card.active {
  border-color: #0044ff;
  background: #f5f8ff;
}

.a11y-card-icon {
  font-size: 23px !important;
  line-height: 1 !important;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
}

.a11y-card.active .a11y-card-icon {
  color: #0044ff;
}

.a11y-card-label {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: #111827 !important;
}

.a11y-card-sub {
  font-size: 10.5px !important;
  font-weight: 600 !important;
  color: #0044ff !important;
  margin-top: -4px;
}

.a11y-card-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0044ff;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
}

.a11y-card.active .a11y-card-badge {
  display: inline-flex;
}

/* Indicador de niveles (barritas abajo cuando tiene múltiples pasos) */
.a11y-dots {
  display: flex;
  gap: 4px;
  margin-top: -2px;
}

.a11y-dot {
  width: 14px;
  height: 4px;
  border-radius: 4px;
  background: #cbd5e1;
}

.a11y-dot.on {
  background: #0044ff;
}

/* Pie del panel */
.a11y-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.a11y-reset-btn {
  background: #0044ff;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.a11y-reset-btn:hover {
  background: #0033cc;
}

.a11y-brand-mark {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #475569 !important;
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 575.98px) {
  #a11yTriggerBtn {
    bottom: 1.25rem;
    left: 1rem;
    width: 46px;
    height: 46px;
  }

  #a11yPanel,
  #a11yPanel.a11y-panel-large {
    top: 10px;
    left: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

/* ============================================================
   CLASES DE EFECTOS DE ACCESIBILIDAD APLICADAS AL SITIO
   ============================================================ */

/* 1. Contraste + */
html.a11y-contrast-dark body {
  background: #0a0a0a !important;
  color: #ffffff !important;
}

html.a11y-contrast-dark main,
html.a11y-contrast-dark section,
html.a11y-contrast-dark .card,
html.a11y-contrast-dark .axis-card,
html.a11y-contrast-dark .session-card,
html.a11y-contrast-dark .promo-pricing-card,
html.a11y-contrast-dark .academic-stats-card,
html.a11y-contrast-dark .bg-light,
html.a11y-contrast-dark .bg-light-section,
html.a11y-contrast-dark .bg-white {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #444444 !important;
}

html.a11y-contrast-dark h1,
html.a11y-contrast-dark h2,
html.a11y-contrast-dark h3,
html.a11y-contrast-dark h4,
html.a11y-contrast-dark h5,
html.a11y-contrast-dark h6,
html.a11y-contrast-dark p,
html.a11y-contrast-dark span:not(#a11yPanel *),
html.a11y-contrast-dark li,
html.a11y-contrast-dark label,
html.a11y-contrast-dark .text-dark,
html.a11y-contrast-dark .text-muted {
  color: #f8fafc !important;
}

html.a11y-contrast-dark a:not(#a11yPanel *) {
  color: #ffd700 !important;
}

html.a11y-contrast-invert {
  filter: invert(1) hue-rotate(180deg);
}

html.a11y-contrast-invert img,
html.a11y-contrast-invert video,
html.a11y-contrast-invert #a11yPanel,
html.a11y-contrast-invert #a11yTriggerBtn {
  filter: invert(1) hue-rotate(180deg);
}

/* 2. Resaltar enlaces */
html.a11y-highlight-links a:not(#a11yPanel *) {
  outline: 2px solid #ff9900 !important;
  outline-offset: 2px !important;
  text-decoration: underline !important;
  background-color: rgba(255, 230, 0, 0.22) !important;
}

/* 3. Agrandar texto */
html.a11y-text-1 { font-size: 112% !important; }
html.a11y-text-2 { font-size: 125% !important; }
html.a11y-text-3 { font-size: 140% !important; }

/* 4. Espaciado de texto */
html.a11y-spacing-1 body *:not(#a11yPanel):not(#a11yPanel *) {
  letter-spacing: 0.06em !important;
  word-spacing: 0.14em !important;
}
html.a11y-spacing-2 body *:not(#a11yPanel):not(#a11yPanel *) {
  letter-spacing: 0.12em !important;
  word-spacing: 0.28em !important;
}

/* 5. Detener animaciones */
html.a11y-stop-animations *,
html.a11y-stop-animations *::before,
html.a11y-stop-animations *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

html.a11y-stop-animations .logo-marquee-track {
  animation-play-state: paused !important;
}

/* 6. Ocultar imágenes */
html.a11y-hide-images img,
html.a11y-hide-images video,
html.a11y-hide-images picture {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* 7. Apto para dislexia */
html.a11y-dyslexia body *:not(.bi):not([class*="bi-"]):not(#a11yPanel):not(#a11yPanel *) {
  font-family: 'Verdana', 'Tahoma', 'Arial', sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.12em !important;
}

/* 8. Cursor grande */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 32 32'%3E%3Cpath d='M4 2 L4 26 L10 20 L15 29 L19 27 L14 18 L22 18 Z' fill='%23000000' stroke='%23ffffff' stroke-width='2'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* 9. Altura de línea */
html.a11y-line-1 body *:not(#a11yPanel):not(#a11yPanel *) { line-height: 1.75 !important; }
html.a11y-line-2 body *:not(#a11yPanel):not(#a11yPanel *) { line-height: 2.05 !important; }
html.a11y-line-3 body *:not(#a11yPanel):not(#a11yPanel *) { line-height: 2.35 !important; }

/* 10. Texto alineado */
html.a11y-align-left body *:not(#a11yPanel):not(#a11yPanel *) { text-align: left !important; }
html.a11y-align-center body *:not(#a11yPanel):not(#a11yPanel *) { text-align: center !important; }
html.a11y-align-right body *:not(#a11yPanel):not(#a11yPanel *) { text-align: right !important; }
html.a11y-align-justify body *:not(#a11yPanel):not(#a11yPanel *) { text-align: justify !important; }
