/* 
   HOME-MOBILE-OPTIMIZED.CSS
   Mejoras adicionales para imágenes y responsive en dispositivos móviles
   Fecha: Feb 7, 2026
*/

/* --- OPTIMIZACIONES GENERALES PARA MÓVIL --- */

/* Evitar scroll horizontal indeseado */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Remover márgenes y padding predeterminados */
* {
    box-sizing: border-box;
}

/* Imágenes responsivas */
img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* --- HERO SECTION OPTIMIZACIONES --- */

@media (max-width: 768px) {
    .hero-section {
        height: auto;
        min-height: 60vh;
    }
    
    /* Asegurar que las imágenes de fondo se vean bien */
    .hero-slide {
        background-attachment: fixed;
        background-size: cover;
        background-position: center;
    }
    
    .hero-content-wrapper {
        padding-bottom: 10vh;
    }
    
    .hero-texts {
        margin-bottom: 1.5rem;
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 2.5vw, 2rem);
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: clamp(0.8rem, 1.2vw, 1.2rem);
    }
}

/* --- OPTIMIZACIONES DE TARJETAS DE HABITACIONES --- */

@media (max-width: 768px) {
    /* Asegurar mejor visualización de imágenes */
    .room-bg {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    /* Evitar distorsión de imágenes */
    .room-image-box {
        aspect-ratio: 16 / 9;
    }
    
    /* Mejor padding en tarjetas */
    .room-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .room-image-box {
        min-height: 240px;
        aspect-ratio: 4 / 3;
    }
    
    .room-content h3 {
        font-size: 1rem;
    }
    
    .room-content p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}

/* --- OPTIMIZACIONES SECCIÓN DESTINOS --- */

@media (max-width: 768px) {
    /* Asegurar que las imágenes de destino se vean claras */
    .dest-bg {
        background-size: cover;
        background-position: center;
        background-attachment: scroll;
    }
    
    /* Mejor contraste en móvil */
    .dest-overlay {
        background: linear-gradient(to top, rgba(0,0,0,0.92), rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.05));
        opacity: 0.85;
    }
    
    .dest-content {
        min-height: 100px;
    }
}

/* --- OPTIMIZACIONES SKY BAR --- */

@media (max-width: 992px) {
    /* Imágenes de composición */
    .comp-img {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    .circle-img,
    .rect-img {
        background-attachment: scroll;
    }
}

/* --- MODAL OPTIMIZACIONES --- */

@media (max-width: 768px) {
    .modal-main-img {
        min-height: 250px;
        background-size: cover;
        background-position: center;
    }
    
    .modal-gallery {
        max-height: 50vh;
    }
    
    .modal-info {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- PREVENCIÓN DE ZINDEX STACKING ISSUES --- */

.hero-section {
    position: relative;
    z-index: 1;
}

.hero-overlay {
    will-change: transform;
}

/* --- PERFORMANCE: HARDWARE ACCELERATION --- */

.hero-slide,
.dest-bg,
.room-bg,
.comp-img,
.modal-main-img {
    will-change: background-position;
    transform: translate3d(0, 0, 0);
}

/* --- ANIMACIONES SUAVE EN MÓVIL --- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- OPTIMIZACIONES DE TEXTURA Y CONTRASTE --- */

@media (max-width: 768px) {
    /* Mejorar legibilidad en pantallas pequeñas */
    .section-title-main {
        font-size: clamp(1.8rem, 5vw, 2.5rem);
    }
    
    .section-desc {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .sub-title {
        font-size: 0.8rem;
    }
}

/* --- TOUCH FRIENDLY BUTTONS --- */

@media (max-width: 768px) {
    button,
    a.btn-gold-solid,
    a.btn-gold-outline,
    .premium-badge,
    a[class*="btn-"] {
        min-height: 44px; /* Apple's touch target size */
        padding: max(0.5rem, 1vh) max(1rem, 2vw);
    }
    
    .room-actions {
        gap: 10px;
    }
}

/* --- SCROLL BEHAVIOR --- */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* --- MEJORA DE FLEXIBILIDAD EN IMÁGENES --- */

@media (max-width: 480px) {
    .room-card-premium,
    .dest-card,
    .modal-container {
        border-radius: 12px;
    }
}

/* --- OPTIMIZACIÓN DE ESPACIOS EN PEQUEÑAS PANTALLAS --- */

@media (max-width: 640px) {
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-header .sub-title {
        margin-bottom: 0.5rem;
    }
    
    .section-header .section-title-main {
        margin-bottom: 1rem;
    }
}

/* --- CONTENEDORES CON OVERFLOW FIXES --- */

@media (max-width: 480px) {
    .hero-content-wrapper,
    .container,
    .container-fluid-sky,
    .main-catalog-container,
    .about-services-section {
        width: 100%;
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Asegurar que los grids no causen desbordamiento */
    .rooms-grid,
    .destinations-container,
    .services-grid,
    .features-grid {
        width: 100%;
        overflow: hidden;
    }
}

/* --- ASPECT RATIO FIXES PARA IMÁGENES --- */

@media (max-width: 480px) {
    /* Habitaciones */
    .room-bg,
    .room-image-box {
        aspect-ratio: 3 / 2;
    }
    
    /* Destinos */
    .dest-bg,
    .dest-card {
        aspect-ratio: auto;
    }
    
    /* Modal */
    .modal-main-img,
    .modal-gallery {
        aspect-ratio: 16 / 9;
    }
    
    /* Sky Bar */
    .comp-img {
        aspect-ratio: auto;
    }
}

/* --- FIX PARA IPHONE X Y NOTCH --- */

@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        body {
            padding-left: max(0px, env(safe-area-inset-left));
            padding-right: max(0px, env(safe-area-inset-right));
        }
        
        .hero-content-wrapper,
        .container,
        .container-fluid-sky {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }
    }
}

/* --- IMPROVED IMAGE LOADING --- */

img[loading="lazy"] {
    background-color: rgba(0, 0, 0, 0.05);
    background-image: linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.1) 25%,
        transparent 25%,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.1) 75%,
        transparent 75%,
        transparent
    );
    background-size: 10px 10px;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 10px 10px;
    }
}

/* Remover la animación cuando está cargada */
img[loading="lazy"][srcset] {
    animation: none;
    background-color: transparent;
    background-image: none;
}

/* --- OPTIMIZACIONES PARA PANTALLAS ULTRA-PEQUEÑAS (< 400px) --- */

@media (max-width: 400px) {
    /* Hero Section */
    .hero-section {
        min-height: 50vh;
    }
    
    .hero-title {
        font-size: clamp(1.3rem, 2vw, 1.8rem);
    }
    
    .hero-subtitle {
        font-size: clamp(0.75rem, 1vw, 1rem);
    }
    
    .premium-badge {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .badge-icon-box {
        width: 28px;
        height: 28px;
    }
    
    /* Habitaciones */
    .room-image-box {
        min-height: 200px;
        aspect-ratio: 3 / 2;
    }
    
    .room-content {
        padding: 15px;
    }
    
    .room-content h3 {
        font-size: 0.95rem;
        line-height: 1.2;
    }
    
    .room-content p {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }
    
    .room-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Sky Bar */
    .composition-wrapper {
        width: 95%;
        max-width: 280px;
        height: 280px;
    }
    
    .circle-img {
        width: 180px;
        height: 180px;
        top: 0;
    }
    
    .rect-img {
        width: 160px;
        height: 130px;
        bottom: 30px;
    }
    
    .glass-logo-card {
        width: 120px;
        height: 180px;
        padding: 15px;
    }
    
    .glass-logo-card img {
        width: 85%;
    }
    
    .title-large {
        font-size: 1.6rem;
    }
    
    .sky-bar-desc {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .feat-icon {
        width: 40px;
        height: 40px;
    }
    
    .feat-text strong {
        font-size: 0.8rem;
    }
    
    /* Destinos */
    .destinations-container {
        height: 320px;
        padding: 0 8px 12px 8px;
        gap: 8px;
    }
    
    .dest-card {
        flex: 0 0 95%;
        border-radius: 8px;
    }
    
    .dest-content {
        padding: 12px;
        min-height: 80px;
    }
    
    .dest-card h3 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }
    
    .dest-details p {
        font-size: 0.8rem;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .btn-link-gold {
        font-size: 0.65rem;
    }
    
    /* Modal */
    .modal-container {
        border-radius: 10px;
    }
    
    .modal-main-img {
        min-height: 180px;
    }
    
    .modal-info {
        padding: 12px;
    }
    
    .modal-info h2 {
        font-size: 1.1rem;
    }
    
    .modal-description {
        font-size: 0.8rem;
    }
    
    .modal-list li strong {
        font-size: 0.8rem;
    }
    
    .modal-list li span {
        font-size: 0.7rem;
    }
}

/* --- OPTIMIZACIONES PARA PANTALLAS PEQUEÑAS (350px - 400px) --- */

@media (max-width: 350px) {
    .room-image-box {
        min-height: 180px;
    }
    
    .room-content h3 {
        font-size: 0.9rem;
    }
    
    .room-content p {
        font-size: 0.7rem;
    }
    
    .title-large {
        font-size: 1.4rem;
    }
    
    .destinations-container {
        height: 280px;
    }
    
    .dest-card h3 {
        font-size: 1rem;
    }
    
    .dest-content {
        padding: 10px;
        min-height: 70px;
    }
}
