/* ===== MEJORAS ESPECÍFICAS PARA MÓVILES ===== */
/* Añadir al final del archivo estilo.css existente */

/* ===== MEJORAS PARA DISPOSITIVOS TÁCTILES ===== */

/* 1. Botones más grandes para dedos */
.btn, 
.nav-link,
.galeria-item,
.ruta-card {
    min-height: 44px;
    min-width: 44px;
}

/* 2. Mejorar espaciado táctil */
@media (max-width: 768px) {
    .btn {
        padding: 14px 28px;
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 12px 16px;
    }
    
    /* Incrementar área táctil */
    a, button, input, select, textarea {
        touch-action: manipulation;
    }
}

/* 3. Optimizar hero para móviles */
@media (max-width: 768px) {
    .hero {
        height: 70vh;
        min-height: 400px;
        background-attachment: scroll; /* Mejor rendimiento en móviles */
    }
    
    .hero-content {
        padding: 0 20px;
    }
    
    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
        margin-bottom: 15px;
    }
    
    .subtitle {
        font-size: 1.1rem;
        line-height: 1.4;
    }
}

/* 4. Menú hamburguesa para móviles */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        padding: 10px 0;
        display: flex;
        justify-content: space-around;
    }
    
    .main-nav .container {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-link {
        flex-direction: column;
        align-items: center;
        padding: 8px 12px;
        border-radius: 10px;
        transition: all 0.3s ease;
    }
    
    .nav-link.active {
        background: rgba(45, 90, 39, 0.1);
    }
    
    .nav-icon {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }
    
    .nav-text {
        font-size: 0.75rem;
        font-weight: 600;
    }
}

/* 5. Mejorar galería para móviles */
@media (max-width: 768px) {
    .galeria-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .galeria-item {
        aspect-ratio: 1/1;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .galeria-item img {
        transition: transform 0.3s ease;
    }
    
    .galeria-item:hover img {
        transform: scale(1.05);
    }
}

@media (max-width: 480px) {
    .galeria-grid {
        grid-template-columns: 1fr;
    }
}

/* 6. Optimizar tarjetas de rutas para móviles */
@media (max-width: 768px) {
    .rutas-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ruta-card {
        padding: 20px;
    }
    
    .ruta-meta {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .meta-item {
        flex: 1 1 calc(50% - 10px);
        min-width: 120px;
    }
}

/* 7. Mejorar formularios para móviles */
@media (max-width: 768px) {
    .contacto-form input,
    .contacto-form textarea,
    .contacto-form select {
        font-size: 16px; /* Evita zoom automático en iOS */
        padding: 14px;
        border-radius: 8px;
    }
    
    .contacto-form button {
        width: 100%;
        padding: 16px;
        font-size: 1.1rem;
    }
}

/* 8. Optimizar tipografía para móviles */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.2;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
}

/* 9. Mejorar footer para móviles */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-info,
    .footer-links,
    .footer-credits {
        text-align: center;
    }
    
    .footer-links a {
        display: inline-block;
        margin: 0 10px 10px 0;
    }
}

/* 10. Optimizar imágenes para móviles */
img {
    max-width: 100%;
    height: auto;
}

/* 11. Prevenir scroll horizontal */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        width: 100%;
        padding: 0 15px;
    }
}

/* 12. Mejorar animaciones para móviles */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 13. Soporte para modo oscuro en móviles */
@media (prefers-color-scheme: dark) {
    body {
        background: #121212;
        color: #e0e0e0;
    }
    
    .hero {
        background-blend-mode: multiply;
    }
    
    .ruta-card,
    .acerca-content > div {
        background: #1e1e1e;
        color: #e0e0e0;
    }
}

/* 14. Mejorar performance en móviles */
@media (max-width: 768px) {
    /* Reducir sombras para mejor rendimiento */
    .ruta-card,
    .galeria-item {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Optimizar transformaciones */
    .galeria-item img {
        will-change: transform;
    }
}

/* 15. Ajustes específicos para iOS */
@supports (-webkit-touch-callout: none) {
    .hero {
        height: -webkit-fill-available;
    }
    
    input, textarea {
        font-size: 16px; /* Evita zoom automático */
    }
}

/* 16. Ajustes específicos para Android */
@supports not (-webkit-touch-callout: none) {
    .hero {
        height: calc(100vh - 56px); /* Compensa la barra de navegación */
    }
}

/* 17. Mejorar accesibilidad táctil */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .nav-link:hover,
    .galeria-item:hover {
        transform: none;
    }
    
    .btn:active,
    .nav-link:active,
    .galeria-item:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* 18. Optimizar para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .rutas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .galeria-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .acerca-content {
        grid-template-columns: 1fr;
    }
}

/* 19. Ajustar altura de viewport móvil */
@media (max-width: 768px) {
    :root {
        --vh: 1vh;
    }
    
    .hero {
        height: calc(var(--vh, 1vh) * 100);
    }
}

/* 20. JavaScript helper class para altura viewport */
.js-vh-fix {
    height: calc(var(--vh, 1vh) * 100);
}

/* ===== MEJORAS FINALES ===== */

/* Smooth scrolling mejorado para móviles */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        scroll-padding-top: 80px; /* Compensa header fijo */
    }
}

/* Optimizar carga de fuentes */
@media (max-width: 768px) {
    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    
    .section-title {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
}

/* Reducir tamaño de imágenes de fondo en móviles */
@media (max-width: 768px) {
    .hero {
        background-image: linear-gradient(135deg, rgba(58, 123, 213, 0.4), rgba(45, 90, 39, 0.4)),
                          url('../img/fondos/fondo-optimizado.jpg');
        background-size: cover;
    }
}

/* Mejorar contraste para legibilidad en móviles */
@media (max-width: 768px) {
    .hero h1,
    .hero .subtitle,
    .hero .author {
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }
    
    .section-title {
        color: var(--verde-bosque);
        font-weight: 700;
    }
}

/* Añadir indicadores táctiles */
@media (max-width: 768px) {
    .btn:after {
        content: '';
        position: absolute;
        top: -10px;
        right: -10px;
        bottom: -10px;
        left: -10px;
    }
}

/* Optimizar para orientación landscape */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: 100vh;
        min-height: 300px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .main-nav {
        position: relative;
        bottom: auto;
        margin-top: 20px;
    }
}
/* ===== FIX: Compensar barra de navegación fija en móvil ===== */
@media (max-width: 768px) {
    /* Añadir padding al body para que el contenido no quede tapado */
    body {
        padding-bottom: 80px !important;
    }
    
    /* Asegurar que el hero section tenga espacio */
    .hero {
        min-height: calc(100vh - 80px) !important;
    }
    
    /* Ajustar secciones para que no queden tapadas */
    .section {
        scroll-margin-top: 20px;
    }
    
    /* Mejorar la navegación fija */
    .main-nav {
        height: 60px;
        padding: 5px 0;
    }
    
    .nav-link {
        padding: 6px 10px;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .nav-text {
        font-size: 0.7rem;
    }
}

/* ===== FIX ESPECÍFICO PARA VERTICAL ===== */
@media (max-width: 480px) and (orientation: portrait) {
    /* Más padding en vertical */
    body {
        padding-bottom: 70px !important;
    }
    
    .hero {
        min-height: calc(100vh - 70px) !important;
    }
    
    /* Reducir tamaño de navegación en vertical */
    .main-nav {
        height: 55px;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .nav-text {
        font-size: 0.65rem;
    }
}

/* ===== FIX PARA HORIZONTAL ===== */
@media (max-width: 768px) and (orientation: landscape) {
    /* Menos padding en horizontal (ya funciona mejor) */
    body {
        padding-bottom: 60px !important;
    }
    
    .hero {
        min-height: calc(100vh - 60px) !important;
    }
    
    /* Navegación más compacta en horizontal */
    .main-nav {
        height: 50px;
    }
    
    .nav-link {
        padding: 4px 8px;
    }
}

/* ===== COMPATIBILIDAD MULTI-NAVEGADOR ===== */

/* Safari iOS específico - soporte para viewport units */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .hero {
            min-height: -webkit-fill-available !important;
            min-height: calc(100vh - 80px) !important;
        }
    }
}

/* Firefox específico - mejor soporte para scroll */
@-moz-document url-prefix() {
    @media (max-width: 768px) {
        html {
            scroll-behavior: smooth;
        }
        
        .section {
            scroll-margin-top: 25px;
        }
    }
}

/* Chrome/Edge - optimizaciones */
@media (max-width: 768px) {
    /* Mejorar rendimiento en Chrome */
    .main-nav {
        will-change: transform;
        backface-visibility: hidden;
    }
}

/* ===== FIX PARA SAFARI VIEWPORT BUG ===== */
/* Safari tiene problemas con 100vh en móvil */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .hero {
            min-height: -webkit-fill-available;
            min-height: calc(var(--vh, 1vh) * 100 - 80px);
        }
    }
}

/* ===== CLEAR CACHE HINT (para desarrollo) ===== */
/* Los cambios CSS pueden necesitar limpiar caché del navegador */

/* Estilos para imágenes verticales en galería */
.gallery-item.vertical img {
    object-fit: contain !important;
    background-color: #f8f9fa;
    padding: 10px;
}

/* Para lightbox */
.lightbox-content.vertical img {
    max-height: 85vh;
    max-width: 85vw;
    object-fit: contain;
}

