/* ============================================
   ETHNOS Mobile Optimizations
   Enhanced responsive design for all devices
   Version: Mobile-First Optimized
*/

/* ============================================
   1. BASE MOBILE ENHANCEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Improve readability on mobile */
    html {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }
    
    body {
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Better touch targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Remove 100vh issues on mobile */
    .hero-editorial,
    section[class*="hero"] {
        min-height: auto;
        padding: 60px 6% 40px;
    }
    
    /* Adjust font sizes for mobile */
    .hero-title-editorial {
        font-size: 32px !important;
        line-height: 1.15;
    }
    
    .hero-subtitle-editorial {
        font-size: 16px !important;
        line-height: 1.6;
    }
    
    .card-title {
        font-size: 20px !important;
    }
    
    .card-excerpt {
        font-size: 14px !important;
    }
}

/* ============================================
   2. IMPROVED CARD SYSTEM
   ============================================ */

@media (max-width: 768px) {
    .article-card {
        margin-bottom: 24px;
    }
    
    .article-card .card-image-wrapper {
        aspect-ratio: 16/10 !important;
        margin-bottom: 16px;
    }
    
    .article-card .card-image-wrapper img {
        object-position: center;
    }
    
    .card-category {
        font-size: 10px !important;
    }
}

/* ============================================
   3. BETTER NAVIGATION ON MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Header adjustments */
    header {
        padding: 12px 0;
    }
    
    .ethnos-logo img {
        height: 32px !important;
    }
    
    /* Mobile menu styling */
    .mobile-panel {
        padding: 0;
    }
    
    .mobile-panel nav {
        padding: 24px 20px;
    }
    
    .mobile-panel nav a {
        display: block;
        padding: 16px 0;
        font-size: 18px;
        font-weight: 500;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        text-align: left;
        width: 100%;
    }
    
    .mobile-panel nav a:last-child {
        border-bottom: none;
    }
    
    /* Language switcher in mobile */
    .mobile-language-switcher {
        padding: 20px;
        display: flex;
        gap: 16px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .mobile-language-switcher .lang-btn {
        font-size: 16px;
        padding: 8px 0;
    }
}

/* ============================================
   4. IMPROVED GRID LAYOUTS
   ============================================ */

@media (max-width: 640px) {
    .grid {
        gap: 16px !important;
    }
    
    /* Single column on very small screens */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    /* Better spacing */
    section {
        padding: 40px 0;
    }
    
    .featured-8m {
        padding: 20px !important;
        margin: 24px 0;
    }
    
    .featured-8m-title {
        font-size: 22px !important;
    }
}

/* ============================================
   5. IMPROVED FOOTER
   ============================================ */

@media (max-width: 768px) {
    footer {
        padding: 40px 20px !important;
    }
    
    footer .grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    footer nav {
        gap: 12px !important;
    }
    
    footer nav a {
        display: block;
        padding: 8px 0;
    }
}

/* ============================================
   6. BETTER FORMS ON MOBILE
   ============================================ */

@media (max-width: 768px) {
    input,
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 14px 16px !important;
    }
    
    button[type="submit"] {
        width: 100%;
        margin-top: 12px;
    }
}

/* ============================================
   7. LAUNCH BANNER MOBILE
   ============================================ */

@media (max-width: 768px) {
    .launch-banner {
        padding: 12px 16px;
    }
    
    .launch-banner-content {
        flex-direction: column;
        gap: 8px !important;
        text-align: center;
    }
    
    .launch-badge {
        font-size: 10px;
    }
    
    .launch-text {
        font-size: 13px;
    }
}

/* ============================================
   8. SECTION LINES
   ============================================ */

@media (max-width: 768px) {
    .section-line {
        margin: 40px auto;
    }
}

/* ============================================
   9. IMPROVED BUTTONS
   ============================================ */

@media (max-width: 768px) {
    .btn-micro {
        padding: 14px 24px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }
    
    .flex-wrap {
        flex-direction: column;
    }
    
    .flex-wrap.gap-4 a {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   10. SMOOTH ANIMATIONS FOR MOBILE
   ============================================ */

@media (max-width: 768px) {
    .reveal-item {
        transition: all 0.5s ease-out;
    }
    
    /* Reduce animation complexity on mobile */
    .article-card:hover {
        transform: translateY(-2px);
    }
    
    .article-card:hover .card-image-wrapper img {
        transform: scale(1.01);
    }
}

/* ============================================
   11. FIX FOR NOTCH DEVICES
   ============================================ */

@supports (padding: env(safe-area-inset-bottom)) {
    .fixed.bottom-0,
    footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .fixed.bottom-8 {
        bottom: calc(32px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   12. LANDSCAPE MODE OPTIMIZATIONS
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .hero-editorial {
        padding: 40px 6%;
    }
    
    .hero-title-editorial {
        font-size: 28px !important;
    }
    
    .hero-image-wrapper {
        max-height: 60vh;
    }
}

/* ============================================
   13. TABLET OPTIMIZATIONS
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .hero-title-editorial {
        font-size: 42px !important;
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   14. IMPROVED LOADING STATES
   ============================================ */

@media (max-width: 768px) {
    /* Skeleton loading for images */
    img[loading="lazy"] {
        background: linear-gradient(90deg, #F5F1EA 25%, #EFEAE3 50%, #F5F1EA 75%);
        background-size: 200% 100%;
        animation: shimmer-mobile 1.5s ease-in-out infinite;
    }
    
    @keyframes shimmer-mobile {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}