.lang-toggle {
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.lang-toggle:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.lang-toggle:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 4px;
}

/* =========================================================
   RESPONSIVE OVERRIDES & FIXES
========================================================= */

/* A. BOX-SIZING & RESET MINIMO */
*, *::before, *::after { box-sizing: border-box; }

/* B. PREVENCION DE OVERFLOW HORIZONTAL */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* C. IMAGENES Y MEDIA RESPONSIVAS */
img, video, iframe {
    max-width: 100%;
    height: auto;
}
svg.lang-toggle-icon {
    /* Excluir el SVG del boton de idioma, que ya tiene size fijo */
}

/* D. TIPOGRAFIA FLUIDA (Fallback si no existe) */
h1 { font-size: clamp(2rem, 5vw, 4rem) !important; }
h2 { font-size: clamp(1.75rem, 4vw, 3rem) !important; }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem) !important; }
p, li { line-height: 1.6; }

/* E. CONTENEDOR LEGAL (Evitar desborde de texto largo) */
.about-text {
    max-width: 75ch !important;
    margin-inline: auto;
    padding-inline: 15px;
    word-break: break-word;
}

/* F. TABLAS RESPONSIVAS (Legal) */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 2rem;
    border: 1px solid var(--fx-border);
}
table {
    width: 100%;
    min-width: 600px; /* Force scroll on small if not stacked */
    border-collapse: collapse;
}

/* G. BOTONES ACCESIBLES */
a, button {
    min-height: 44px; /* Area tactil WCAG */
}
.lang-toggle {
    min-width: 44px;
    min-height: 44px;
}

/* =========================================================
   MEDIA QUERIES (Estandarizadas)
========================================================= */

/* --- TABLET / MOBILE LARGE (< 1024px) --- */
@media (max-width: 1024px) {
    .about-grid, .solutions-grid, .footer-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem;
    }
    .hero h1 {
        font-size: 3rem;
    }
}

/* --- MOBILE (< 768px) --- */
@media (max-width: 768px) {
    .main-nav {
        display: none !important; /* Ocultar nav de desktop */
    }
    .mobile-menu-button {
        display: flex !important; /* Mostrar hamburger */
    }
    
    .header-container {
        padding: 0 15px;
    }

    /* Grids a 1 columna */
    .about-grid, .solutions-grid, .footer-container {
        grid-template-columns: 1fr !important;
    }
    
    .hero-background {
        width: 100%;
        opacity: 0.4; /* Mejor contraste */
    }
    
    /* Boton de idioma al lado del hamburger */
    .header-controls {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Tablas legales a tarjetas apiladas */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr { border: 1px solid #ccc; margin-bottom: 1rem; }
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50% !important;
        text-align: right;
    }
    td:before {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
    }
}

/* --- MOBILE SMALL (< 480px) --- */
@media (max-width: 480px) {
    .hero-trust {
        flex-direction: column;
        position: relative;
    }
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    .legal-footer-links {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .legal-footer-links span {
        display: none; /* Hide the dots separator in mobile */
    }
}

/* Cookie banner: estilos canonicos en assets/styles/indstyles.css (seccion 29).
   Este archivo ya no define el banner para evitar divergencias. */

/* FIX IMÁGENES RECORTADAS EN MÓVIL */
@media (max-width: 768px) {
    /* El hero-background suele requerir 'cover' para llenar el contenedor, 
       pero si el contenedor es muy alto en móvil, recorta a los lados. 
       Ajustamos la altura mínima del Hero para que la imagen se vea más proporcionada. */
    .hero {
        min-height: 50vh !important;
        height: auto !important;
        padding-bottom: 2rem;
    }
    .hero-background {
        position: relative !important;
        width: 100% !important;
        height: 300px !important; /* Altura controlada en móvil */
    }
    
    /* El about-image forzaba 490px de alto, lo que recorta excesivamente en móvil */
    .about-image img {
        height: auto !important;
        aspect-ratio: 4/3; /* Mantiene una proporción sin recortes agresivos */
        object-fit: contain !important;
        background-color: var(--fx-off-white);
    }
    
    /* Carruseles y otras imágenes */
    .carousel-slide img {
        height: auto !important;
        max-height: 400px;
        object-fit: contain !important;
    }
}

/* =========================================================
   DARK MODE & CONTRAST FIXES
========================================================= */
@media (prefers-color-scheme: dark) {
    :root {
        --fx-white: #101820;
        --fx-off-white: #1a222a;
        --fx-gray-100: #202932;
        --fx-gray-200: #2a3540;
        --fx-gray-300: #3a4550;
        --fx-border: #2a3540;
        --fx-text: #e8ebef;
        --fx-text-light: #d8dde3;
        --fx-text-lighter: #a0abb6;
        --fx-dark: #ffffff;
    }
    
    body { background-color: var(--fx-white); color: var(--fx-text); }
    .site-header, .site-header.scrolled { background: rgba(16, 24, 32, 0.95); }
    .btn-secondary { color: var(--fx-text); border-color: var(--fx-border); }
    .btn-secondary:hover { background: var(--fx-gray-100); }
    img { opacity: 0.9; } /* Reduce glare */
}

/* =========================================================
   TIENDA PREVIEW SECTION
========================================================= */
.tienda-preview {
    padding: 32px 15px;
    background: var(--fx-off-white);
    border-top: 1px solid var(--fx-border);
}
@media (min-width: 768px) { .tienda-preview { padding: 64px 30px; } }
@media (min-width: 1024px) { .tienda-preview { padding: 96px 0; } }

.tienda-preview .container {
    width: min(100% - 2rem, 1200px);
    margin-inline: auto;
}
.tienda-preview img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    margin-inline: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
