/* ============================================
   MEJORAS PARA EXPERIENCIA MÓVIL - MADERAS AMÉRICA
   ============================================ */

/* Variables para breakpoints móviles más específicos */
:root {
    --mobile-xs: 320px;
    --mobile-sm: 375px;
    --mobile-md: 414px;
    --tablet-sm: 768px;
    --tablet-md: 1024px;
}

/* ============================================
   OPTIMIZACIONES GENERALES MÓVILES
   ============================================ */

/* Prevenir zoom accidental en inputs en iOS */
@media screen and (max-width: 768px) {
    body input,
    body textarea,
    body select {
        font-size: 16px;
        transform: scale(1);
    }
    
    /* Mejorar el tap target size según guías de Material Design */
    button, .hero-btn, .nav-plank, .contact-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   HEADER Y NAVEGACIÓN MÓVIL MEJORADA
   ============================================ */

@media (max-width: 768px) {
    /* Header más compacto en móvil */
    body header {
        padding: 1rem;
        background: rgba(58, 99, 122, 0.95);
        backdrop-filter: blur(10px);
    }

    /* Logo más pequeño y centrado */
    body header img {
        height: 50px;
        max-height: 50px;
    }

    /* Menu toggle más accesible */
    body .menu-toggle-btn {
        width: 44px;
        height: 44px;
        padding: 8px;
        border-radius: 8px;
        background: rgba(255,255,255,0.1);
        backdrop-filter: blur(5px);
    }

    /* Navegación móvil optimizada */
    body .menu-container {
        padding: 1rem;
        justify-content: center;
        align-items: flex-start;
        padding-top: 100px;
    }

    body .nav-plank {
        width: 90vw;
        max-width: 350px;
        padding: 1rem 1.5rem;
        font-size: 1.2rem;
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* ============================================
   SECCIÓN HERO MÓVIL OPTIMIZADA
   ============================================ */

@media (max-width: 768px) {
    body .full-section {
        min-height: 100vh;
        padding: 2rem 1rem;
    }

    /* Título principal responsive */
    body .hero-section h1 {
        font-size: 2.5rem;
        line-height: 1.1;
        margin-bottom: 1rem;
        text-align: center;
    }

    /* Subtítulo más legible */
    body .hero-section p {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    /* Botones hero stack verticalmente */
    body .hero-buttons {
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        max-width: 320px;
    }

    body .hero-btn {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1rem;
        min-height: 56px;
    }
}

/* ============================================
   SECCIÓN MISIÓN Y VISIÓN MÓVIL
   ============================================ */

@media (max-width: 768px) {
    body #mission {
        padding: 4rem 1rem;
    }

    body #mission h2 {
        font-size: 2.2rem;
        line-height: 1.2;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    body .mission-card,
    body .vision-card {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    body .mission-card h3,
    body .vision-card h3 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    body .mission-card p,
    body .vision-card p {
        font-size: 1rem;
        line-height: 1.5;
    }

    body .mission-icon svg,
    body .vision-icon svg {
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* ============================================
   SECCIÓN CONTACTO MÓVIL
   ============================================ */

@media (max-width: 768px) {
    body #connect {
        padding: 3rem 1rem;
    }

    body #connect h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    body #connect p {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    /* Grid de contacto en una columna */
    body #connect .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 300px;
    }

    body .contact-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 56px;
        justify-content: center;
        flex-wrap: nowrap;
        white-space: normal;
    }

    body .contact-btn svg {
        width: 1.5rem;
        height: 1.5rem;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }

    /* Email button específico para móvil */
    body .email-btn {
        font-size: 0.85rem;
        padding: 1rem 0.75rem;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        line-height: 1.4;
    }
}

/* ============================================
   FOOTER MÓVIL OPTIMIZADO
   ============================================ */

@media (max-width: 768px) {
    body .footer {
        padding: 2rem 1rem;
    }

    body .footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    body .footer h4 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    body .footer ul {
        margin-bottom: 1.5rem;
    }

    body .footer img {
        height: 60px;
        margin-bottom: 1rem;
    }

    body .social-icon svg {
        width: 2rem;
        height: 2rem;
    }
}

/* ============================================
   WHATSAPP FAB MÓVIL
   ============================================ */

@media (max-width: 768px) {
    body .whatsapp-fab {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    }

    body .whatsapp-fab svg {
        width: 1.75rem;
        height: 1.75rem;
    }
}

/* ============================================
   SCROLL DOWN BUTTON MÓVIL
   ============================================ */

@media (max-width: 768px) {
    body .scroll-down-btn {
        bottom: 1rem;
    }

    body .scroll-down-btn svg {
        width: 2rem;
        height: 2rem;
    }
}

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

@media (hover: none) and (pointer: coarse) {
    /* Eliminar efectos hover en dispositivos táctiles */
    body .hero-btn:hover,
    body .nav-plank:hover,
    body .mission-card:hover,
    body .vision-card:hover,
    body .contact-btn:hover {
        transform: none;
        background: none;
    }
    
    /* Agregar estados de focus/active para dispositivos táctiles */
    .hero-btn:active, .nav-plank:active, .contact-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Focus visible para navegación por teclado */
    .hero-btn:focus-visible, .nav-plank:focus-visible, .contact-btn:focus-visible {
        outline: 3px solid var(--brand-orange);
        outline-offset: 2px;
    }
}

/* ============================================
   OPTIMIZACIONES PARA PANTALLAS PEQUEÑAS
   ============================================ */

@media (max-width: 375px) {
    /* Ajustes para móviles muy pequeños */
    body .hero-section h1 {
        font-size: 2rem;
    }

    body .hero-section p {
        font-size: 1rem;
        padding: 0 0.5rem;
    }

    body #mission h2 {
        font-size: 1.8rem;
    }

    body .nav-plank {
        width: 95vw;
        padding: 0.875rem 1rem;
        font-size: 1.1rem;
    }

    /* Email button para pantallas muy pequeñas - FIX word-break */
    body .email-btn {
        font-size: 0.8rem;
        padding: 0.875rem 0.75rem;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        line-height: 1.4;
    }

    body .contact-btn {
        padding: 0.875rem 1rem;
    }
}

/* ============================================
   ANIMACIONES REDUCIDAS PARA USUARIOS QUE LAS PREFIEREN
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}

/* ============================================
   MEJORAS ESPECÍFICAS PARA iOS SAFARI
   ============================================ */

@supports (-webkit-touch-callout: none) {
    /* Ajustar para la barra de navegación de Safari en iOS */
    .full-section {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    html {
        height: -webkit-fill-available;
    }
    
    /* Prevenir el comportamiento de bounce en iOS */
    body {
        position: fixed;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
    
    #page-container {
        overflow: auto;
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* ============================================
   MODO LANDSCAPE PARA MÓVILES
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    body .full-section {
        min-height: auto;
        padding: 1rem;
    }

    body .hero-section h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    body .hero-section p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    body .hero-buttons {
        flex-direction: row;
        gap: 1rem;
    }

    body .hero-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}
