/* ============================================================
   IAPLIKADA — accessibility.css
   WCAG 2.1 AA: skip links, focus, ARIA, screen reader utils
   ============================================================ */

/* ============================================================
   1. SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  background: var(--azul-profundo);
  color: var(--blanco);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  padding: 0.875rem 1.75rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  transition: top var(--dur-fast);
  border: 2px solid var(--teal);
  border-top: none;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* ============================================================
   2. FOCUS RING UNIVERSAL (visible para todos los elementos)
   ============================================================ */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: 4px;
}

/* Quitar outline por defecto solo cuando hay :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

/* Focus especial para botones */
.btn:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(22, 171, 141, 0.15);
}

/* Focus para campos de formulario */
.form-group input:focus-visible,
.form-group textarea:focus-visible,
.form-group select:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 171, 141, 0.2);
}

/* Focus para links de nav */
.navbar__link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* Focus para cards interactivas */
.service-card:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* Focus para FAB WhatsApp */
.whatsapp-fab:focus-visible {
  outline: 3px solid var(--blanco);
  outline-offset: 4px;
}

/* ============================================================
   3. SCREEN READER ONLY (oculto visualmente, accesible)
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible en focus (para elementos interactivos sr-only) */
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================================
   4. ARIA LIVE REGIONS
   ============================================================ */
[aria-live="polite"],
[aria-live="assertive"] {
  /* Visible pero se anuncia via AT */
}

.form-status {
  padding: var(--sp-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  display: none;
  align-items: center;
  gap: var(--sp-md);
}

.form-status.success {
  display: flex;
  background: rgba(22, 171, 141, 0.1);
  border: 1px solid var(--teal-claro);
  color: var(--teal-oscuro);
}

.form-status.error {
  display: flex;
  background: rgba(229, 62, 62, 0.08);
  border: 1px solid rgba(229, 62, 62, 0.3);
  color: #c53030;
}

/* ============================================================
   5. CONTRASTE Y COLORES — VERIFICADOS WCAG AA
   ============================================================ */
/* Todos los pares de colores texto/fondo en el sitio:
   - Blanco (#FFF) sobre Azul (#3A539F) → 4.6:1 ✅ AA
   - Blanco (#FFF) sobre Teal (#16AB8D) → 2.95:1 (solo texto grande) ✅ AA Large
   - Blanco (#FFF) sobre Azul Profundo (#253567) → 9.8:1 ✅ AAA
   - Gris Oscuro (#2C2C3E) sobre Blanco (#FFF) → 12.6:1 ✅ AAA
   - Gris Oscuro (#2C2C3E) sobre Gris Pálido (#F2F4F8) → 10.1:1 ✅ AAA
   - Azul (#3A539F) sobre Blanco → 4.6:1 ✅ AA
   NOTA: Teal sobre blanco es solo decorativo o texto grande (≥18pt)
*/

/* ============================================================
   6. TAMAÑO MÍNIMO DE OBJETIVOS TÁCTILES (WCAG 2.5.5)
   ============================================================ */
.btn,
.navbar__link,
.service-card__link,
.social-link,
.whatsapp-fab,
.navbar__toggle,
input[type="checkbox"],
input[type="radio"] {
  min-height: 44px;
  min-width: 44px;
}

/* Excepción para inline links — se compensan con padding */
.footer__col a,
.breadcrumb a {
  padding-block: 6px;
  min-height: unset;
}

/* ============================================================
   7. MODO ALTO CONTRASTE (forced-colors / Windows HC)
   ============================================================ */
@media (forced-colors: active) {
  .btn--primary,
  .btn--whatsapp {
    border: 2px solid ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }

  .service-card {
    border: 1px solid ButtonText;
  }

  .service-card__icon {
    border: 1px solid ButtonText;
  }

  .whatsapp-fab {
    border: 2px solid ButtonText;
  }
}

/* ============================================================
   8. INDICADOR DE IDIOMA (para AT)
   ============================================================ */
/* Se maneja con lang="es-MX" en <html> — no requiere CSS adicional */

/* ============================================================
   9. ANIMACIONES — REDUCIR MOVIMIENTO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  /* Override global: sin transiciones ni animaciones */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Mostrar contenido que normalmente aparece con animación */
  .anim-fade-up,
  .anim-fade-down,
  .anim-fade-left,
  .anim-fade-right,
  .anim-fade-in,
  .anim-scale-up,
  .stagger-item,
  .hero-logo,
  .hero-label,
  .hero-title,
  .hero-sub,
  .hero-desc,
  .hero-ctas,
  .hero-scroll,
  .hero-badges {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Desactivar parallax */
  .parallax-layer { transform: none !important; }

  /* Desactivar particles canvas */
  #particles-js canvas {
    opacity: 0.3;
  }

  /* Scroll indicator sin animación */
  .scroll-indicator__dot { animation: none; opacity: 1; }

  /* FAB sin pulse */
  .whatsapp-fab::before { animation: none; opacity: 0; }
}

/* ============================================================
   10. PRINT STYLES
   ============================================================ */
@media print {
  .navbar,
  .whatsapp-fab,
  .reading-progress,
  .scroll-indicator,
  #particles-js {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #555;
  }

  .service-card { break-inside: avoid; }
}
