/* Mobile Optimizations CSS */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Smooth scrolling for all devices */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly interactions */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Mobile-first responsive breakpoints */
@media screen and (max-width: 1440px) {
    .container {
        max-width: 95%;
    }
}

@media screen and (max-width: 1200px) {
    .container {
        max-width: 90%;
        padding: 0 20px;
    }
}

@media screen and (max-width: 992px) {
    .container {
        max-width: 95%;
        padding: 0 15px;
    }
    
    /* Adjust grid layouts */
    .students-grid,
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media screen and (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    /* Mobile navigation improvements */
    .navbar {
        top: 5px;
        width: calc(100% - 10px);
    }
    
    /* Hero section mobile optimization */
    .hero {
        min-height: 100vh;
        padding-top: 80px;
    }
    
    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    /* Grid adjustments */
    .students-grid,
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    /* Card sizing */
    .flip-card,
    .project-card-modern {
        max-width: 100%;
    }
    
    /* Typography adjustments */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    .hero-name {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

@media screen and (max-width: 600px) {
    /* Further mobile optimizations */
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Button improvements */
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .cta-button {
        width: 100%;
        max-width: 250px;
        padding: 12px 20px;
        text-align: center;
    }
    
    /* Social links */
    .social-links {
        justify-content: center;
        gap: 15px;
    }
    
    /* Table responsiveness */
    .course-table-modern {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 8px;
    }
    
    /* Ultra-mobile optimizations */
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-name {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    /* Grid for very small screens */
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Card adjustments */
    .flip-card {
        height: 250px;
    }
    
    .project-card-modern {
        padding: 12px;
    }
    
    /* Mission section */
    .mission-text h2 {
        font-size: 22px;
    }
    
    .mission-note {
        font-size: 13px;
    }
    
    .mission-photo img {
        width: 180px;
        height: 180px;
    }
}

@media screen and (max-width: 360px) {
    /* Extra small screens */
    .students-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .flip-card {
        max-width: 100%;
        height: 280px;
    }
    
    .hero-name {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
}

/* Landscape orientation optimizations */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 20px 50px;
    }
    
    .hero-content {
        gap: 1rem;
    }
    
    .hero-name {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-bg {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}


/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .navbar,
    .hero-bg,
    .scroll-indicator,
    .announcement-float-btn,
    #scrollTopBtn {
        display: none !important;
    }
    
    .hero {
        height: auto;
        background: white;
    }
    
    .hero-content {
        color: black;
    }
}

/* Focus improvements for accessibility */
@media (max-width: 768px) {
    button:focus,
    a:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #2563eb;
        outline-offset: 2px;
    }
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Smooth transitions for responsive changes */
.container,
.hero-content,
.students-grid,
.projects-grid,
.courses-grid {
    transition: all 0.3s ease;
}

/* Ensure proper stacking context */
.navbar {
    z-index: 1000;
}

.hero {
    z-index: 1;
}

.announcement-float-btn,
#scrollTopBtn {
    z-index: 999;
}