/* Tablet Landscape (1024px) */
@media (max-width: 1024px) {
    .hero {
        padding-top: 0; /* Remove since body now has padding-top */
    }
    
    .hero-container {
        grid-template-columns: 45% 55%;
        gap: 20px;
        text-align: left;
    }
    
    .hero-visual {
        order: 1;
        height: 400px;
        margin-bottom: 0;
    }
    
    .hero-content {
        padding: 40px 40px; /* Match desktop nav-container padding */
    }
    
    .hero-buttons {
        display: flex;
        gap: 24px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
    /* Typography - Medium reduction for tablet */
    h1 { font-size: clamp(2.5rem, 5.5vw, 4rem); }
    h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
    h3 { font-size: clamp(1.5rem, 2.75vw, 2rem); }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 85px;
        width: 100%;
        height: calc(100vh - 85px);
        background: rgba(28, 28, 30, 0.98);
        backdrop-filter: blur(20px);
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        border-top: 2px solid var(--secondary-color);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-list {
        flex-direction: column;
        padding: 50px 30px;
        gap: 24px;
        align-items: stretch;
    }
    
    .nav-link {
        font-size: 1.1rem;
        padding: 16px 20px;
        text-align: center;
        border-radius: 15px;
        margin-bottom: 8px;
    }
    
    .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 Section - Medium reduction for tablet */
    .hero {
        min-height: 100vh;
        padding-top: 0; /* Remove since body now has padding-top */
        padding-bottom: 50px;
    }
    
    .hero-content {
        padding: 30px 20px; /* Match nav-container mobile padding */
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .hero-text {
        order: 1; /* Text appears first on mobile */
        text-align: center;
    }
    
    .hero-visual {
        order: 2; /* Animation appears second on mobile */
        height: 350px;
        width: 100%;
    }
    
    .animation-content {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .animation-container {
        width: 100%;
        height: 100%;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

/* Mobile (480px) */
@media (max-width: 480px) {
    /* Typography - Scaled down for mobile */
    h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
    h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
    h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
    
    /* Navigation */
    .nav-container {
        padding: 0 20px;
        height: 75px;
    }
    
    .nav-logo {
        height: 38px;
    }
    
    .nav-text {
        font-size: 1.25rem;
    }
    
    /* Hero Section - Optimized for mobile */
    .hero {
        min-height: 100vh;
        padding-top: 75px; /* Match nav-container height for mobile */
        padding-bottom: 40px;
    }
    
    .hero-content {
        padding: 20px 15px; /* Reduced padding for mobile */
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero-text {
        order: 1; /* Text appears first on mobile */
        text-align: center;
        padding: 0 10px;
    }
    
    .hero-visual {
        order: 2; /* Animation appears second on mobile */
        height: 280px;
        width: 100%;
        overflow: visible;
    }
    
    .animation-content {
        width: 100%;
        height: 100%;
    }
    
    .hero-title {
        margin-bottom: 20px;
    }
    
    .hero-line {
        font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 25px;
        line-height: 1.5;
        padding: 0 10px;
    }
    
    .hero-buttons {
        display: flex;
        gap: 12px;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 0 20px;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 12px 24px;
        border-radius: 40px;
        width: auto;
        font-size: 0.9rem;
    }
    
    /* Sections */
    section {
        padding: 60px 0;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .section-header {
        margin-bottom: 40px;
    }
    
    /* Services */
    .service-card {
        padding: 30px 20px;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    /* CTA */
    .cta-buttons {
        flex-direction: column;
        width: 100%;
        align-items: center;
        justify-content: center;
    }
    
    .cta-buttons .btn {
        width: auto;
        max-width: 280px;
    }
    
    /* Newsletter */
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
    }
}

/* Small Mobile (320px) */
@media (max-width: 320px) {
    /* Typography - Maximum reduction for small mobile */
    h1 { font-size: clamp(1.75rem, 4.5vw, 3rem); }
    h2 { font-size: clamp(1.25rem, 3.5vw, 2rem); }
    h3 { font-size: clamp(1.125rem, 2.25vw, 1.5rem); }
    
    body {
        font-size: 0.875rem;
    }
    
    /* Navigation */
    .nav-text {
        display: none;
    }
    
    /* Hero - Optimized for tiny screens */
    .hero {
        min-height: 100vh;
        padding-top: 75px; /* Match nav-container height for small mobile */
        padding-bottom: 30px;
    }
    
    .hero-content {
        padding: 15px 10px; /* Minimal padding for small screens */
    }
    
    .hero-container {
        gap: 15px;
    }
    
    .hero-visual {
        height: 240px;
        width: 100%;
    }
    
    .hero-line {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
        padding: 0 5px;
    }
    
    .hero-buttons {
        gap: 10px;
        padding: 0 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    /* Buttons - Smaller for tiny screens */
    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
        gap: 6px;
    }
}

/* High Resolution Displays */
@media (min-width: 1440px) {
    .container,
    .nav-container,
    .hero-content,
    .footer-container {
        max-width: 1400px;
    }
    
    .hero-container {
        gap: 80px;
    }
    
    .services-grid {
        gap: 40px;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .nav-toggle,
    .scroll-indicator,
    .cta {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    section {
        page-break-inside: avoid;
    }
}

/* Hero Section Mobile Optimization */
@media (max-width: 768px) {
    .hero-bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .space-environment {
        transform: scale(1.2); /* Slightly scale up for better mobile view */
    }
    
    .scroll-indicator {
        display: none; /* Hide scroll indicator on mobile */
    }
}

/* Hover Effects - Touch Devices */
@media (hover: none) {
    .nav-link:hover::after {
        width: 0;
    }
    
    .service-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    .portfolio-overlay {
        opacity: 1;
        background: linear-gradient(to bottom, transparent 50%, rgba(15, 23, 42, 0.9) 100%);
    }
    
    .portfolio-info {
        transform: translateY(0);
    }
    
    .hover-lift:hover,
    .hover-grow:hover,
    .hover-shrink:hover {
        transform: none;
    }
}

/* 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;
    }
    
    .floating {
        animation: none;
    }
    
    .hero-particles {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #0f172a;
        --dark-color: #f8fafc;
        --border-color: #334155;
        --gray-color: #94a3b8;
    }
    
    body {
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .navbar {
        background: rgba(15, 23, 42, 0.95);
    }
    
    .nav-link {
        color: var(--dark-color);
    }
    
    .service-card,
    .hero-card {
        background: #1e293b;
    }
    
    .portfolio-overlay {
        background: linear-gradient(to bottom, transparent 0%, rgba(15, 23, 42, 0.95) 100%);
    }
}