/* Mobile First Approach - Base styles are mobile, then scale up */

/* Extra Small Devices (Portrait Phones) */
@media (max-width: 575.98px) {
    /* Typography adjustments */
    :root {
        --text-5xl: 2.5rem;      /* 40px */
        --text-4xl: 2rem;        /* 32px */
        --text-3xl: 1.75rem;     /* 28px */
        --text-2xl: 1.375rem;    /* 22px */
        --text-xl: 1.125rem;     /* 18px */
    }
    
    /* Container */
    .container {
        padding: 0 var(--space-sm);
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: var(--space-3xl);
        transition: left var(--transition-base);
        z-index: var(--z-modal);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        font-size: var(--text-lg);
        padding: var(--space-lg) 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero */
    .hero-content {
        padding: var(--space-lg);
    }
    
    .hero-title {
        font-size: clamp(var(--text-3xl), 12vw, var(--text-5xl));
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: var(--text-lg);
        margin-bottom: var(--space-xl);
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: var(--space-md);
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    /* Sections */
    section {
        padding: var(--space-3xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--space-2xl);
    }
    
    /* About */
    .about-stats {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .rocket-diagram {
        width: 150px;
        height: 225px;
        margin: var(--space-xl) auto;
    }
    
    /* Mission */
    .mission-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .mission-card {
        padding: var(--space-xl);
    }
    
    .card-icon {
        width: 60px;
        height: 60px;
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .project-card {
        padding: var(--space-xl);
    }
    
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    /* Community */
    .community-links {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .community-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-xl);
    }
    
    /* Contact */
    .contact-form {
        padding: var(--space-xl);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }
    
    .footer-brand {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

/* Small Devices (Landscape Phones) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Hero */
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        width: auto;
        min-width: 160px;
    }
    
    /* About */
    .about-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Mission */
    .mission-grid {
        grid-template-columns: 1fr;
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    /* Community */
    .community-links {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium Devices (Tablets) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation */
    .nav-container {
        padding: 0 var(--space-lg);
    }
    
    /* Hero */
    .hero-content {
        max-width: 700px;
    }
    
    /* About */
    .about-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2xl);
        align-items: center;
    }
    
    .about-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Mission */
    .mission-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Community */
    .community-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2xl);
    }
    
    .community-links {
        grid-template-columns: 1fr;
    }
    
    /* Contact */
    .contact-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2xl);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 2fr;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Devices (Small Desktops) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Mission */
    .mission-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Community */
    .community-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra Large Devices (Large Desktops) */
@media (min-width: 1200px) {
    /* Container */
    .container {
        max-width: 1200px;
        padding: 0 var(--space-xl);
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Community */
    .community-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Height-based Media Queries for Short Screens */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: var(--space-xl) 0;
    }
    
    .hero-content {
        padding: var(--space-lg);
    }
    
    .hero-title {
        font-size: var(--text-4xl);
        margin-bottom: var(--space-md);
    }
    
    .hero-subtitle {
        font-size: var(--text-base);
        margin-bottom: var(--space-lg);
    }
    
    .hero-buttons {
        gap: var(--space-md);
    }
    
    section {
        padding: var(--space-2xl) 0;
    }
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .navbar,
    .nav-toggle,
    .hero-background,
    .floating-elements,
    .contact-form,
    .footer {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .section-header {
        margin-bottom: 1rem;
    }
    
    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .mission-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .btn {
        display: none;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .stars {
        animation: none;
    }
    
    .rocket-icon {
        animation: none;
    }
    
    .rocket-parts > * {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #f5f5f5;
        --primary-light: #fafafa;
        --accent-color: #00ff88;
        --white: #ffffff;
        --gray-300: #cccccc;
        --gray-400: #999999;
        --bg-primary: #000000;
        --bg-secondary: #111111;
        --bg-tertiary: #222222;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .mission-card,
    .project-card,
    .community-card,
    .contact-form {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* Dark Mode Override (if user prefers light) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme as it's part of the design */
    /* This could be extended if a light mode is desired */
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        padding: var(--space-md) var(--space-xl);
    }
    
    .nav-link {
        padding: var(--space-lg) var(--space-md);
    }
    
    .community-card,
    .project-card,
    .mission-card {
        padding: var(--space-xl);
    }
    
    /* Remove hover effects that don't work on touch */
    .btn:hover,
    .mission-card:hover,
    .project-card:hover,
    .community-card:hover,
    .stat-item:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
    }
    
    .mission-card:active,
    .project-card:active,
    .community-card:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Landscape orientation adjustments for mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: auto;
        padding: var(--space-2xl) 0;
    }
    
    .hero-title {
        font-size: var(--text-3xl);
        margin-bottom: var(--space-sm);
    }
    
    .hero-subtitle {
        font-size: var(--text-base);
        margin-bottom: var(--space-lg);
    }
    
    .section-header {
        margin-bottom: var(--space-xl);
    }
    
    section {
        padding: var(--space-2xl) 0;
    }
}

/* Focus styles for accessibility */
@media (prefers-reduced-motion: no-preference) {
    .btn:focus,
    .nav-link:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* Utilities for responsive design */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
    
    .hide-desktop {
        display: none;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Text alignment utilities for different screen sizes */
@media (max-width: 767.98px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
}

/* Spacing utilities for mobile */
@media (max-width: 767.98px) {
    .mb-mobile-lg {
        margin-bottom: var(--space-lg) !important;
    }
    
    .mt-mobile-lg {
        margin-top: var(--space-lg) !important;
    }
    
    .p-mobile-sm {
        padding: var(--space-sm) !important;
    }
    
    .p-mobile-md {
        padding: var(--space-md) !important;
    }
}
