/* Enhanced viewport fix for smartphones with unusual screen sizes */

/* Fix viewport issues on tall and narrow screens */
@media (max-width: 400px) and (min-height: 700px) {
    /* Improve viewport calculation for projects section */
    .projects-container {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Ensure grid is laid out correctly */
    .projects-page {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        display: grid !important;
    }
    
    /* Force each project card to take correct width */
    .project-card {
        width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Remove horizontal scrollbar */
    .projects-carousel {
        overflow-x: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Fix specifically for Samsung Galaxy S23 and similar */
@media (width: 360px), (width: 375px), (width: 380px), (width: 390px) {
    /* Force specific grid layout */
    .projects-page {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-auto-flow: row !important;
        grid-template-areas: 
            "project1"
            "project2"
            "project3"
            "project4" !important;
    }
    
    /* Fix any Safari specific issues */
    @supports (-webkit-touch-callout: none) {
        .projects-page {
            display: flex !important;
            flex-direction: column !important;
        }
        
        .project-card {
            width: 100% !important;
            margin-bottom: 20px !important;
        }
    }
    
    /* Ensure correct height for container */
    .projects-container {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Fix for extremely narrow screens (old or small devices) */
@media (max-width: 320px) {
    .projects-page {
        padding: 0 8px !important;
    }
    
    .project-screenshot {
        height: 150px !important;
    }
    
    .project-title-text {
        font-size: 1rem !important;
    }
    
    .project-description {
        font-size: 0.8rem !important;
    }
}
