/* ========================================
   MEJORAS DE ACCESIBILIDAD WCAG 2.1 AA
   Bodega Pedro Pelayo Valero
   ======================================== */

/* ====== INDICADORES DE FOCO MEJORADOS ====== */
/* Mejora la visibilidad del foco para navegación por teclado */
:focus {
    outline: 3px solid #0066CC !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 8px rgba(0, 102, 204, 0.5) !important;
}

/* Enlaces con mejor foco visible */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: 3px solid #0066CC !important;
    outline-offset: 2px !important;
}

/* Botones con mejor contraste en foco */
.u-btn:focus,
.u-button-style:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.5) !important;
    transform: scale(1.02);
}

/* ====== MEJORAS DE CONTRASTE DE COLOR ====== */
/* Asegurar contraste mínimo de texto */
body {
    color: #1a1a1a !important; /* Negro casi puro para máximo contraste */
}

/* Texto sobre fondos claros */
.u-grey-5 {
    background-color: #f8f9fa !important;
    color: #1a1a1a !important;
}

/* Enlaces con mejor contraste */
a,
a:visited {
    color: #003a99 !important; /* Azul oscuro (ratio 8.5:1) */
    text-decoration: underline !important;
}

a:hover,
a:active {
    color: #001f59 !important; /* Azul más oscuro en hover */
    text-decoration: underline !important;
}

/* Enlaces en encabezados y botones */
.u-btn a,
button a {
    color: #ffffff !important;
    text-decoration: none !important;
}

.u-btn a:hover,
button a:hover {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Mejora contraste en textos pequeños */
.u-small-text,
.u-text-variant {
    font-size: 14px !important; /* Tamaño mínimo recomendado */
    color: #1a1a1a !important; /* Negro casi puro */
    font-weight: 500 !important;
}

/* Párrafos con contraste adecuado */
p {
    color: #1a1a1a !important;
    line-height: 1.5 !important;
}

/* Encabezados con máximo contraste */
h1, h2, h3, h4, h5, h6 {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* ====== NAVEGACIÓN MEJORADA ====== */
/* Enlaces de salto para lectores de pantalla */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100000;
}

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

/* ====== FORMULARIOS ACCESIBLES ====== */
/* Labels más visibles */
label {
    font-weight: 600 !important;
    color: #212529 !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

/* Campos de formulario con mejor contraste */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    border: 2px solid #495057 !important;
    padding: 0.5rem !important;
    font-size: 16px !important; /* Evita zoom en móviles */
}

/* Estado de error en formularios */
input:invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

input:invalid:focus {
    outline-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

/* Mensajes de error con buen contraste */
.u-form-send-error {
    background-color: #f8d7da !important;
    border: 2px solid #dc3545 !important;
    color: #721c24 !important;
    padding: 1rem !important;
    margin-top: 0.5rem !important;
}

/* Mensajes de éxito con buen contraste */
.u-form-send-success {
    background-color: #d4edda !important;
    border: 2px solid #28a745 !important;
    color: #155724 !important;
    padding: 1rem !important;
    margin-top: 0.5rem !important;
}

/* ====== BOTONES ACCESIBLES ====== */
/* Tamaño mínimo de área táctil (44x44px) */
.u-btn,
button,
input[type="submit"],
input[type="button"] {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.75rem 1.5rem !important;
}

/* ====== TEXTO PARA LECTORES DE PANTALLA ====== */
/* Clase para ocultar visualmente pero mantener para lectores */
.sr-only,
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ====== MEJORAS PARA IMÁGENES ====== */
/* Asegurar que las imágenes decorativas no interfieran */
img[alt=""] {
    role: presentation;
}

/* ====== NAVEGACIÓN POR TECLADO ====== */
/* Eliminar outline en click del mouse pero mantener en teclado */
[data-focus-visible-added] {
    outline: 3px solid #0066CC !important;
    outline-offset: 2px !important;
}

/* ====== MEDIA QUERIES PARA RESPONSIVE ====== */
@media (max-width: 768px) {
    /* Aumentar tamaño de fuente en móviles */
    body {
        font-size: 16px !important;
    }

    /* Aumentar área táctil en móviles */
    .u-btn,
    a.u-btn {
        padding: 1rem 2rem !important;
    }
}

/* ====== MODO ALTO CONTRASTE ====== */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    a {
        text-decoration: underline !important;
    }
}

/* ====== REDUCIR MOVIMIENTO ====== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====== MEJORAS ESPECÍFICAS DEL SITIO ====== */
/* Mejorar contraste en testimonios */
.u-text-palette-1-base {
    color: #003a99 !important; /* Azul oscuro con mejor contraste */
}

/* Mejorar contraste en botones */
.u-btn,
.u-button-style {
    background-color: #003a99 !important;
    color: #ffffff !important;
    border-color: #003a99 !important;
}

.u-btn:hover,
.u-button-style:hover {
    background-color: #001f59 !important;
    border-color: #001f59 !important;
    color: #ffffff !important;
}

/* Mejorar contraste en botones de paleta */
.u-palette-1-base,
.u-palette-1-light-1 {
    background-color: #003a99 !important;
    color: #ffffff !important;
}

/* Mejorar visibilidad de iconos */
.u-icon-circle {
    border: 2px solid currentColor !important;
}

/* Footer con mejor contraste */
.u-footer.u-grey-80 {
    background-color: #343a40 !important; /* Gris más oscuro */
}

.u-footer.u-grey-80 * {
    color: #ffffff !important;
}

.u-footer.u-grey-80 a {
    color: #ffffff !important;
    text-decoration: underline !important;
}

.u-footer.u-grey-80 a:hover {
    color: #ffc107 !important; /* Amarillo con buen contraste */
}

/* Mejorar contraste en secciones grises */
.u-grey-5 {
    background-color: #f8f9fa !important;
    color: #1a1a1a !important;
}

.u-grey-10 {
    background-color: #e9ecef !important;
    color: #1a1a1a !important;
}

/* Secciones con fondos oscuros */
.u-grey-80,
.u-black {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
}

.u-grey-80 p,
.u-black p,
.u-grey-80 span,
.u-black span {
    color: #ffffff !important;
}

/* ====== CORRECCIÓN ESPECÍFICAS ====== */
/* Corregir tabindex negativos que no deberían estar */
[tabindex="-1"]:not([aria-hidden="true"]) {
    tabindex: 0 !important;
}

/* Asegurar que el menú hamburguesa sea accesible */
.u-hamburger-link {
    min-width: 44px !important;
    min-height: 44px !important;
}