/* Perfect Responsive Design System */

/* Mobile First Approach - Base styles for mobile */

/* Typography Responsive Scale */
html {
    font-size: 16px;
}

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
    }
    
    /* Hero adjustments */
    .hero {
        margin-top: 60px;
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 4vw, 1.75rem) !important;
        line-height: 1.2;
        margin-bottom: 0.75rem;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    .hero-subtitle {
        font-size: clamp(0.8rem, 3vw, 0.875rem) !important;
        line-height: 1.4;
        padding: 0 10px;
    }
    
    .hero-subtitle br {
        display: none;
    }
    
    .hero-buttons {
        gap: 0.5rem;
        flex-direction: column;
        align-items: center;
        padding: 0 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.875rem;
        width: 100%;
        max-width: 260px;
        min-height: 44px;
    }
    
    /* Section spacing */
    .section {
        padding: 40px 0 !important;
    }
    
    .section-title {
        font-size: 1.75rem !important;
    }
    
    .section-subtitle {
        font-size: 0.875rem !important;
    }
    
    /* Navigation */
    .navbar {
        padding: 0.5rem 0;
        height: 60px;
    }
    
    .navbar .container {
        padding: 0 10px;
    }
    
    .nav-brand h1 {
        font-size: 1.25rem;
    }
    
    .nav-brand .subtitle {
        font-size: 0.75rem;
    }
    
    /* Mobile Menu Fix */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--white);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 2rem 0;
        transition: left 0.3s ease;
        z-index: 9999;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu .nav-link {
        padding: 1rem 2rem;
        font-size: 1.1rem;
        color: var(--text-dark);
        border-bottom: 1px solid var(--border-light);
        width: 90%;
        text-align: center;
    }
    
    .nav-toggle {
        display: flex !important;
        flex-direction: column;
        width: 30px;
        height: 24px;
        cursor: pointer;
        z-index: 10000;
    }
    
    .nav-toggle span {
        width: 100%;
        height: 3px;
        background: var(--text-dark);
        margin: 3px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }
    
    .nav-brand {
        flex-shrink: 0;
    }
    
    .nav-brand h1 {
        font-size: 1.1rem;
    }
    
    .nav-brand .subtitle {
        font-size: 0.6rem;
        display: block;
    }
    
    .logo-svg {
        width: 30px;
        height: 30px;
        margin-right: 8px;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        padding: 1.5rem 0;
        gap: 0;
    }
    
    .nav-link {
        display: block;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Cards and grids */
    .services-grid,
    .feature-grid,
    .tech-stack,
    .industry-grid,
    .testimonial-grid,
    .benefits-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 10px;
    }
    
    .service-card,
    .feature-card,
    .case-study,
    .position-card {
        padding: 1.25rem !important;
        margin: 0 auto;
        max-width: calc(100% - 20px);
    }
    
    .service-icon,
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Forms */
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Stats */
    .stat-number {
        font-size: 2rem !important;
    }
    
    /* Page headers */
    .page-header {
        padding: 80px 0 40px !important;
    }
    
    .page-title {
        font-size: 1.75rem !important;
        padding: 0 10px;
        word-wrap: break-word;
    }
    
    .breadcrumb {
        font-size: 0.75rem;
        padding: 0 10px;
    }
    
    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem 1.5rem;
    }
    
    /* Hide scroll indicator on mobile */
    .scroll-indicator {
        display: none;
    }
    
    /* Overflow prevention */
    body {
        overflow-x: hidden;
    }
    
    * {
        max-width: 100%;
    }
    
    /* Image responsiveness */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Horizontal scroll prevention */
    .hero-background,
    .video-container,
    #particles-js {
        overflow: hidden;
        max-width: 100vw;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    html {
        font-size: 15px;
    }
    
    .container {
        max-width: 540px;
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .section {
        padding: 50px 0 !important;
    }
    
    .services-grid {
        grid-template-columns: 1fr !important;
    }
    
    .feature-grid,
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    html {
        font-size: 15px;
    }
    
    .container {
        max-width: 720px;
    }
    
    .hero-title {
        font-size: 3rem !important;
    }
    
    .services-grid,
    .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .tech-stack {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .process-timeline {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Navigation should be visible */
    .nav-toggle {
        display: none !important;
    }
    
    .nav-menu {
        position: static !important;
        flex-direction: row !important;
        width: auto !important;
        background: transparent !important;
        padding: 0 !important;
        left: auto !important;
    }
    
    .nav-link {
        padding: 0 !important;
        font-size: 0.9rem;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    html {
        font-size: 17px;
    }
}

/* Landscape Mode Adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: calc(100vh - 60px);
    }
    
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1rem;
    }
    
    .scroll-indicator {
        bottom: 10px;
    }
}

/* Touch Device Adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover,
    .feature-card:hover,
    .case-study:hover,
    .position-card:hover {
        transform: none !important;
    }
    
    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .hero-video,
    .scroll-indicator,
    .nav-toggle,
    #particles-js {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: 100%;
    }
    
    .section {
        padding: 20px 0 !important;
        page-break-inside: avoid;
    }
}

/* Accessibility - 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;
    }
    
    .hero-video {
        display: none;
    }
    
    .hero {
        background: linear-gradient(135deg, #001a33 0%, #003366 50%, #004499 100%) !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Use higher resolution images for retina displays */
    .logo-svg {
        image-rendering: crisp-edges;
    }
}

/* Custom Breakpoint for Service Cards */
@media (min-width: 576px) and (max-width: 991.98px) {
    .service-detail {
        padding: 2rem !important;
    }
    
    .service-number {
        font-size: 2.5rem !important;
    }
}

/* Specific adjustments for very small screens (320px - 400px) */
@media (max-width: 400px) {
    html {
        font-size: 13px;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.8rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
    
    .stat-number {
        font-size: 1.5rem !important;
    }
    
    .nav-brand h1 {
        font-size: 1rem;
    }
    
    .logo-svg {
        width: 25px;
        height: 25px;
    }
}

/* Video Background Responsive */
@media (max-width: 768px) {
    .hero-video {
        transform: translate(-50%, -50%) scale(1.8);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-video {
        transform: translate(-50%, -50%) scale(1.3);
    }
}

/* Stats Section Responsive */
@media (max-width: 575.98px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        padding: 0 10px;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-label {
        font-size: 0.75rem !important;
    }
}

/* Table Responsive */
@media (max-width: 767.98px) {
    .info-table,
    .legal-table {
        font-size: 0.875rem;
        margin: 0 10px;
        width: calc(100% - 20px);
    }
    
    .info-table th,
    .info-table td,
    .legal-table th,
    .legal-table td {
        display: block;
        width: 100%;
        padding: 0.75rem !important;
    }
    
    .info-table th,
    .legal-table th {
        background: transparent;
        color: var(--text-muted);
        font-size: 0.75rem;
        border-bottom: none;
        padding-bottom: 0.25rem !important;
    }
    
    .info-table td,
    .legal-table td {
        padding-top: 0 !important;
        padding-bottom: 1.5rem !important;
        border-bottom: 1px solid var(--border-light);
    }
    
    .info-table tr:last-child td,
    .legal-table tr:last-child td {
        border-bottom: none;
    }
}

/* Form Responsive */
@media (max-width: 575.98px) {
    .form-group {
        margin-bottom: 1rem !important;
    }
    
    .contact-form {
        padding: 1.25rem !important;
        margin: 0 10px;
    }
    
    .contact-grid {
        padding: 0 !important;
    }
    
    .contact-info {
        padding: 0 10px;
    }
}

/* Timeline Responsive */
@media (max-width: 991.98px) {
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        width: 100% !important;
        padding-left: 60px !important;
        padding-right: 15px !important;
        text-align: left !important;
        left: 0 !important;
    }
    
    .timeline-marker {
        left: 10px !important;
        right: auto !important;
    }
    
    .timeline-content h3 {
        font-size: 1.25rem;
    }
}

/* Process Steps Responsive */
@media (max-width: 991.98px) {
    .process-steps {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .step-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
    
    .step {
        width: 100%;
        max-width: 300px;
    }
}

/* Particle.js Performance on Mobile */
@media (max-width: 768px) {
    #particles-js {
        display: none; /* Disable for better performance */
    }
}