/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* ============================================
   MOBILE DEVICES (< 640px)
   ============================================ */

@media (max-width: 640px) {
    /* Typography */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    /* Navigation */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--surface);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-md);
        padding: var(--space-6) 0;
        gap: var(--space-4);
        margin: 0;
    }

    body.dark-mode .nav-menu {
        background-color: var(--dark-surface);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-link {
        padding: var(--space-4);
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(10px, 10px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .nav-actions {
        gap: var(--space-2);
    }

    .nav-actions .btn {
        display: none;
    }

    /* Dropdown Menu */
    .dropdown-menu {
        position: static;
        opacity: 0;
        visibility: hidden;
        transform: none;
        box-shadow: none;
        background-color: var(--surface-dark);
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
    }

    .nav-dropdown:hover .dropdown-menu,
    .nav-dropdown.active .dropdown-menu {
        opacity: 1;
        visibility: visible;
        max-height: 500px;
    }

    body.dark-mode .dropdown-menu {
        background-color: var(--dark-surface-light);
    }

    /* Hero Section */
    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .service-card {
        padding: var(--space-6);
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }

    .stat-item {
        padding: var(--space-8);
    }

    .stat-number {
        font-size: 2rem;
    }

    /* Technologies */
    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-4);
    }

    .tech-item {
        padding: var(--space-4);
    }

    .tech-item i {
        font-size: 1.75rem;
    }

    .tech-item span {
        font-size: 0.75rem;
    }

    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-card {
        height: 250px;
    }

    /* Testimonials */
    .testimonial-card {
        padding: var(--space-8);
    }

    .testimonial-text {
        font-size: 1rem;
    }

    /* Buttons */
    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: 0.9rem;
    }

    /* Newsletter Form */
    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form input {
        min-width: 100%;
    }

    .newsletter-form button {
        width: 100%;
    }

    /* CTA Section */
    .cta-buttons {
        flex-direction: column;
    }

    .cta-buttons .btn {
        width: 100%;
    }

    /* Back to Top */
    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: var(--space-4);
        right: var(--space-4);
        font-size: 1.1rem;
    }

    /* Section Padding */
    .services-preview,
    .why-choose,
    .technologies,
    .portfolio-preview,
    .testimonials {
        padding: var(--space-16) var(--space-6);
    }

    .section-header {
        margin-bottom: var(--space-12);
    }

    /* Container */
    .container {
        padding: 0 var(--space-4);
    }

    /* Footer */
    .footer-grid {
        gap: var(--space-8);
    }

    .footer-col {
        text-align: center;
    }

    .social-icons {
        justify-content: center;
    }
}

/* ============================================
   TABLET DEVICES (640px - 1024px)
   ============================================ */

@media (min-width: 640px) and (max-width: 1024px) {
    /* Typography */
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    /* Navigation */
    .nav-menu {
        gap: var(--space-6);
    }

    .nav-dropdown {
        position: relative;
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Technologies */
    .tech-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-6);
    }

    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Hero Buttons */
    .hero-buttons {
        gap: var(--space-3);
    }

    /* CTA Buttons */
    .cta-buttons {
        gap: var(--space-3);
    }

    .cta-buttons .btn {
        width: auto;
    }

    /* Footer Grid */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   DESKTOP DEVICES (> 1024px)
   ============================================ */

@media (min-width: 1024px) {
    /* Navigation */
    .hamburger {
        display: none;
    }

    .nav-menu {
        gap: var(--space-8);
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Technologies Grid */
    .tech-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    /* Portfolio Grid */
    .portfolio-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Footer Grid */
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* CTA Buttons */
    .cta-buttons {
        justify-content: center;
    }
}

/* ============================================
   LARGE SCREENS (> 1440px)
   ============================================ */

@media (min-width: 1440px) {
    .container {
        padding: 0 var(--space-8);
    }

    .hero-buttons {
        gap: var(--space-6);
    }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: calc(80px + var(--space-8)) var(--space-6) var(--space-8);
    }

    .page-hero {
        min-height: 200px;
        padding: calc(80px + var(--space-4)) var(--space-6) var(--space-4);
    }

    .scroll-indicator {
        display: none;
    }
}

/* ============================================
   TOUCH DEVICES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .btn:active {
        transform: scale(0.98);
    }

    .service-card:active,
    .feature-card:active,
    .portfolio-card:active,
    .tech-item:active {
        transform: scale(0.98);
    }

    /* Remove hover effects that don't work well on touch */
    .service-card:hover::after {
        content: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    .back-to-top,
    .newsletter,
    .cta-section,
    .testimonials-nav {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    .btn {
        border: 1px solid black;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

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

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: more) {
    :root {
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    }

    .btn {
        border-width: 2px;
    }

    .service-card,
    .feature-card,
    .portfolio-card {
        border-width: 2px;
    }
}

/* ============================================
   DARK MODE SPECIFIC RESPONSIVE
   ============================================ */

@media (prefers-color-scheme: dark) {
    body {
        --background: var(--dark-bg);
        --surface: var(--dark-surface);
        --text-primary: var(--dark-text-primary);
    }
}
