/* Hero Section - Versión Oscura Corregida */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-sand-dark) 0%, var(--primary-dark) 100%);
    padding-top: 80px; /* Padding para compensar el header fijo */
    padding-bottom: 60px; /* Espacio para el scroll indicator */
    box-sizing: border-box; /* Importante para que el padding no afecte las dimensiones */
}

/* Método 2: Background-image con múltiples fuentes y formatos */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(
            rgba(15, 26, 43, 0.9),
            rgba(20, 30, 46, 0.85)
        ),
        url('../img/hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 0;
    animation: heroBackground 20s ease-in-out infinite;
}

/* Fallback si la imagen no carga */
.hero-section.no-bg-image::before {
    background-image: 
        linear-gradient(
            135deg,
            #0F1A2B 0%,
            #1A2A3A 50%,
            #141E2E 100%
        );
}

/* Overlay para mejorar contraste */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(15, 26, 43, 0.279) 0%,
        rgba(20, 30, 46, 0.177) 50%,
        rgba(212, 165, 94, 0.2) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Contenedor de contenido */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 1s ease-out;
}

/* Título principal */
.hero-title {
    font-size: clamp(2.5rem, 5vw, 3.8rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #FFFFFF;
    line-height: 1.2;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 0, 0, 0.3);
    animation: slideInDown 0.8s ease-out 0.3s both;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.hero-title span {
    color: var(--accent-gold);
    position: relative;
    display: inline-block;
}

.hero-title span::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), transparent);
    opacity: 0.7;
}

/* Subtítulo */
.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 300;
    margin-bottom: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.5s both;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Botones */
.hero-btns {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 2.5rem;
    animation: fadeInUp 0.8s ease-out 0.7s both;
    flex-wrap: wrap;
}

/* Indicador de scroll */
.hero-scroll-indicator {
    position: absolute;
    bottom: 20px; /* Reducido de 40px */
    left: 50%;
    transform: translateX(-50%);
    color: #FFFFFF;
    font-size: 1.5rem;
    z-index: 2;
    cursor: pointer;
    animation: bounce 2s infinite 2s;
    transition: all 0.3s ease;
}

.hero-scroll-indicator:hover {
    color: var(--accent-gold);
    transform: translateX(-50%) translateY(5px);
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    40% {
        transform: translateY(-10px) translateX(-50%);
    }
    60% {
        transform: translateY(-5px) translateX(-50%);
    }
}

@keyframes heroBackground {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* SOLUCIÓN 1: Ajuste de altura para móviles */
@media (max-width: 992px) {
    .hero-section {
        min-height: calc(100vh - 80px); /* Resta la altura del header */
        height: auto;
        padding-top: 80px; /* Asegura espacio para el header */
        padding-bottom: 40px;
    }
    
    .hero-section::before {
        background-attachment: scroll;
    }
    
    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .hero-title {
        margin-top: 0;
        padding-top: 0;
    }
}

/* SOLUCIÓN 2: Ajustes específicos para pantallas pequeñas */
@media (max-width: 768px) {
    .hero-section {
        min-height: calc(100vh - 70px);
        padding-top: 70px;
        padding-bottom: 30px;
    }
    
    .hero-content {
        padding: 15px;
        margin-top: 0;
    }
    
    .hero-title {
        font-size: clamp(1.8rem, 4vw, 2.5rem); /* Más flexible */
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: clamp(0.95rem, 2vw, 1.2rem);
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }
    
    .hero-btns {
        margin-top: 1.5rem;
        gap: 10px;
    }
    
    .hero-scroll-indicator {
        bottom: 15px;
        font-size: 1.3rem;
    }
}

/* SOLUCIÓN 3: Para móviles muy pequeños en orientación horizontal */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        height: auto;
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .hero-btns {
        margin-top: 1rem;
    }
}

/* SOLUCIÓN 4: Para dispositivos con altura muy limitada */
@media (max-width: 480px) {
    .hero-section {
        min-height: calc(100vh - 60px);
        padding-top: 60px;
        padding-bottom: 20px;
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 3.5vw, 2rem);
        margin-bottom: 0.8rem;
    }
    
    .hero-subtitle {
        font-size: clamp(0.85rem, 1.8vw, 1rem);
        margin-bottom: 1.2rem;
    }
    
    .hero-btns {
        margin-top: 1.2rem;
    }
    
    .hero-scroll-indicator {
        bottom: 10px;
        font-size: 1.2rem;
    }
}

/* SOLUCIÓN 5: Para iPhone SE y dispositivos muy pequeños */
@media (max-width: 375px) and (max-height: 667px) {
    .hero-section {
        min-height: calc(100vh - 50px);
        padding-top: 50px;
        padding-bottom: 15px;
    }
    
    .hero-title {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }
    
    .hero-btns {
        margin-top: 1rem;
        gap: 8px;
    }
    
    .hero-btns .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* SOLUCIÓN 6: Para evitar que el texto se salga en móviles muy pequeños */
@media (max-width: 320px) {
    .hero-title {
        font-size: 1.3rem;
        word-break: keep-all;
    }
    
    .hero-subtitle {
        font-size: 0.8rem;
    }
    
    .hero-btns .btn {
        min-width: 200px;
    }
}

/* Para tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero-section {
        min-height: calc(100vh - 80px);
        padding-top: 80px;
    }
    
    .hero-title {
        font-size: clamp(2.2rem, 4vw, 3rem);
    }
}

/* Optimización para carga */
.hero-section {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Preloader para la imagen */
.hero-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0F1A2B 0%, #1A2A3A 100%);
    z-index: 0;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.hero-section.bg-loaded::after {
    opacity: 0;
    pointer-events: none;
}

/* SOLUCIÓN 7: Asegurar que el contenido siempre sea visible */
.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 140px); /* Altura viewport menos header y márgenes */
}

/* SOLUCIÓN 8: Para Safari iOS que tiene problemas con vh */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}

/* SOLUCIÓN 9: JavaScript fallback - clase que se puede agregar dinámicamente */
.hero-section.mobile-adjusted {
    padding-top: 70px !important;
    min-height: calc(100vh - 70px) !important;
}

/* SOLUCIÓN 10: Asegurar que los botones no sean demasiado grandes */
@media (max-width: 768px) {
    .hero-btns .btn {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
}