/* ===================================
   Hero & About Mobile Fix
   Arregla las secciones Hero y About que se cortan en móvil
   =================================== */

/* ===== RESET GENERAL MÓVIL ===== */
@media (max-width: 768px) {
    /* Prevenir cortes en el viewport */
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        width: 100% !important;
        min-height: 100vh !important;
    }

    /* Main container sin restricciones */
    .main-container {
        overflow: visible !important;
        width: 100% !important;
        padding: 0 !important;
        min-height: 100vh !important;
    }
}

/* ===== HERO SECTION MÓVIL FIX ===== */
@media (max-width: 768px) {
    /* Hero container principal */
    #home,
    .hero-section,
    .modern-hero {
        min-height: 100vh !important;
        padding: 100px 20px 80px 20px !important; /* Top padding aumentado para el header fijo */
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        overflow: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Hero content wrapper */
    .hero-content {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    /* Hero title - "Hello, I'm Emilio Cruz" */
    .hero-title,
    h1.hero-title {
        font-size: clamp(2rem, 7vw, 2.5rem) !important;
        line-height: 1.3 !important;
        margin: 0 0 20px 0 !important;
        padding: 0 10px !important;
        width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        display: block !important;
    }

    /* Hero subtitle */
    .hero-subtitle,
    .hero-role {
        font-size: clamp(1rem, 4vw, 1.2rem) !important;
        line-height: 1.4 !important;
        margin: 0 0 15px 0 !important;
        padding: 0 10px !important;
        width: 100% !important;
        display: block !important;
    }

    /* Hero description */
    .hero-description,
    .hero-text {
        font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
        line-height: 1.6 !important;
        margin: 0 0 30px 0 !important;
        padding: 0 15px !important;
        width: 100% !important;
        max-width: 500px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }

    /* Hero buttons container */
    .hero-buttons,
    .hero-cta {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        width: 100% !important;
        max-width: 300px !important;
        margin: 30px auto 0 !important;
        padding: 0 20px !important;
    }

    /* Hero individual buttons */
    .hero-btn,
    .btn-primary,
    .btn-secondary {
        width: 100% !important;
        min-height: 48px !important;
        padding: 14px 30px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Hero info/stats */
    .hero-info,
    .hero-stats {
        margin-top: 40px !important;
        padding: 20px !important;
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 20px !important;
    }

    /* Scroll indicator */
    .scroll-indicator {
        position: absolute !important;
        bottom: 30px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: none !important; /* Ocultar en móvil para ahorrar espacio */
    }

    /* iPhone/Device showcase en Hero */
    .hero-iphone,
    .iphone-container {
        margin-top: 40px !important;
        max-width: 200px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        height: auto !important;
    }
}

/* ===== ABOUT SECTION MÓVIL FIX ===== */
@media (max-width: 768px) {
    /* About container principal */
    #about,
    .about-section,
    .unified-about-section {
        padding: 60px 15px !important;
        overflow: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* About header */
    .about-header,
    .section-header {
        margin-bottom: 30px !important;
        text-align: center !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* About title */
    .about-header h2,
    .about-title,
    h2.section-title {
        font-size: clamp(1.8rem, 6vw, 2.2rem) !important;
        line-height: 1.3 !important;
        margin: 0 0 15px 0 !important;
        padding: 0 10px !important;
        word-wrap: break-word !important;
        width: 100% !important;
    }

    /* About subtitle */
    .about-subtitle {
        font-size: clamp(0.95rem, 3.5vw, 1.1rem) !important;
        line-height: 1.5 !important;
        margin: 0 0 20px 0 !important;
        padding: 0 15px !important;
        width: 100% !important;
    }

    /* About content wrapper */
    .about-content {
        width: 100% !important;
        padding: 20px !important;
        border-radius: 12px !important;
        background: rgba(0, 0, 0, 0.3) !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    /* Profile section */
    .about-profile,
    .profile-container {
        margin-bottom: 30px !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    /* Profile image */
    .profile-pic,
    .profile-image,
    .about-image img {
        width: 120px !important;
        height: 120px !important;
        border-radius: 50% !important;
        margin: 0 auto 20px !important;
        display: block !important;
        object-fit: cover !important;
        border: 3px solid var(--accent) !important;
    }

    /* About bio/description */
    .about-description,
    .about-bio,
    .bio-section {
        font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
        line-height: 1.7 !important;
        padding: 15px !important;
        margin-bottom: 25px !important;
        width: 100% !important;
        background: rgba(139, 92, 246, 0.05) !important;
        border-radius: 10px !important;
        border-left: 3px solid var(--accent) !important;
        box-sizing: border-box !important;
    }

    /* About grid */
    .about-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }

    /* Skills container */
    .skills-container,
    .about-skills {
        width: 100% !important;
        overflow: visible !important;
    }

    /* Skills grid */
    .skills-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* Individual skill items */
    .skill-item {
        padding: 12px 15px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
        background: rgba(139, 92, 246, 0.05) !important;
        border: 1px solid rgba(139, 92, 246, 0.2) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    /* About info cards */
    .about-info-card {
        padding: 20px !important;
        margin-bottom: 15px !important;
        border-radius: 10px !important;
        background: rgba(0, 0, 0, 0.4) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* About stats */
    .about-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        margin-top: 25px !important;
        width: 100% !important;
    }

    .stat-item {
        padding: 15px !important;
        text-align: center !important;
        background: rgba(139, 92, 246, 0.05) !important;
        border-radius: 10px !important;
        border: 1px solid rgba(139, 92, 246, 0.2) !important;
    }

    .stat-number {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: var(--accent) !important;
        display: block !important;
    }

    .stat-label {
        font-size: 0.85rem !important;
        color: var(--text-secondary) !important;
        margin-top: 5px !important;
        display: block !important;
    }
}

/* ===== ESPACIADO Y MÁRGENES MÓVIL ===== */
@media (max-width: 768px) {
    /* Espacio para navegación fija superior */
    body {
        padding-top: 0 !important; /* El padding lo maneja cada sección */
    }

    /* Primera sección con más espacio superior */
    section:first-of-type,
    .section:first-of-type {
        padding-top: 80px !important;
    }

    /* Espaciado entre secciones */
    section + section,
    .section + .section {
        margin-top: 0 !important;
    }

    /* Padding consistente para todas las secciones */
    section,
    .section {
        padding: 60px 15px !important;
        min-height: auto !important;
    }
}

/* ===== NAVEGACIÓN FIJA MÓVIL ===== */
@media (max-width: 768px) {
    /* Header/Navigation space */
    .header-spacer,
    .nav-spacer {
        height: 70px !important;
    }

    /* Fixed navigation adjustments */
    .kombo-logo,
    .experience-mode-btn,
    .theme-toggle {
        position: fixed !important;
        z-index: 1100 !important;
    }

    /* Asegurar que el contenido no se oculte detrás de la navegación */
    #home {
        scroll-margin-top: 70px !important;
    }

    #about {
        scroll-margin-top: 70px !important;
    }
}

/* ===== PANTALLAS MUY PEQUEÑAS (<375px) ===== */
@media (max-width: 375px) {
    /* Hero adjustments */
    #home,
    .hero-section {
        padding: 90px 15px 60px 15px !important;
    }

    .hero-title {
        font-size: 1.8rem !important;
    }

    .hero-subtitle {
        font-size: 0.95rem !important;
    }

    .hero-description {
        font-size: 0.85rem !important;
    }

    /* About adjustments */
    .about-header h2 {
        font-size: 1.6rem !important;
    }

    .about-description {
        font-size: 0.85rem !important;
    }

    /* Buttons */
    .hero-btn {
        font-size: 0.9rem !important;
        padding: 12px 20px !important;
    }
}

/* ===== LANDSCAPE MÓVIL ===== */
@media (max-width: 812px) and (orientation: landscape) {
    /* Hero landscape */
    #home,
    .hero-section {
        min-height: auto !important;
        padding: 60px 30px 40px 30px !important;
    }

    .hero-content {
        max-width: 600px !important;
        margin: 0 auto !important;
    }

    .hero-buttons {
        flex-direction: row !important;
        max-width: 400px !important;
    }

    /* About landscape */
    #about,
    .about-section {
        padding: 40px 30px !important;
    }

    .about-grid {
        flex-direction: row !important;
        gap: 40px !important;
    }

    .profile-pic {
        width: 100px !important;
        height: 100px !important;
    }
}

/* ===== SAFE AREAS iOS ===== */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        #home,
        .hero-section {
            padding-top: calc(100px + env(safe-area-inset-top)) !important;
        }

        #about,
        .about-section {
            padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
        }
    }
}

/* ===== THEME ADJUSTMENTS ===== */
@media (max-width: 768px) {
    /* Light theme mobile */
    [data-theme="light"] .hero-content {
        color: #1a1a2e !important;
    }

    [data-theme="light"] .about-content {
        background: rgba(255, 255, 255, 0.9) !important;
    }

    [data-theme="light"] .skill-item {
        background: rgba(139, 92, 246, 0.05) !important;
        border-color: rgba(139, 92, 246, 0.3) !important;
    }
}

/* ===== DEBUG (DESCOMENTAR PARA VER LÍMITES) ===== */
/*
@media (max-width: 768px) {
    #home,
    .hero-section {
        border: 2px solid red !important;
    }

    .hero-content {
        border: 2px solid blue !important;
    }

    #about,
    .about-section {
        border: 2px solid green !important;
    }

    .about-content {
        border: 2px solid yellow !important;
    }
}
*/