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

/* Responsive Breakpoints & Mobile Enhancements */
@media(max-width:1024px){
    .grid-4{grid-template-columns:repeat(2,1fr)}
    .footer-grid{grid-template-columns:repeat(2,1fr)}
    .ai-grid,.product-hero,.service-hero,.sandbox-container{grid-template-columns:1fr}
    .hero-stats{gap:24px}
    .stats-grid{grid-template-columns:repeat(2,1fr)}
}

/* Mobile Bottom Navigation Bar (Global styles, hidden on desktop) */
.mobile-bottom-nav {
    position: fixed;
    bottom: -120px;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 9999;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 8px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
    gap: 3px;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.mobile-bottom-nav-item span {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-bottom-nav-item i {
    font-size: 1.25rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-bottom-nav-item:hover,
.mobile-bottom-nav-item.active {
    color: #818cf8; /* var(--primary) fallback */
}

.mobile-bottom-nav-item.active i {
    transform: translateY(-2px) scale(1.15);
    color: #818cf8;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}


/* Navigation Breakpoint for Drawer Menu (Tablet and below) */
@media(max-width:1250px){
    /* Mobile Drawer Menu styles (Left-aligned using transform to prevent viewport leaks) */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        width: 300px;
        height: 100vh;
        background: rgba(3, 7, 18, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 90px 24px 32px 24px;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        gap: 16px;
        z-index: 1000;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.7);
    }
    .nav-menu.active {
        transform: translateX(0);
    }
    .nav-menu li {
        width: 100%;
    }
    .nav-menu .nav-link {
        font-size: 1.05rem;
        font-weight: 700;
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.04);
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: all 0.3s ease;
        color: var(--text-secondary);
    }
    .nav-menu .nav-link:hover,
    .nav-menu .nav-link.active {
        background: rgba(99, 102, 241, 0.1);
        border-color: rgba(99, 102, 241, 0.2);
        color: var(--primary);
    }

    /* Left-aligned Navbar components */
    .nav-toggle {
        display: flex;
        order: 1;
    }
    .nav-logo {
        order: 2;
        margin-right: auto;
        margin-left: 12px;
    }
    .nav-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    .nav-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
        transform: scale(0);
    }
    .nav-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Accordion Dropdown Menu for Mobile */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(0, 0, 0, 0.2);
        margin-top: 8px;
        padding: 8px 16px;
        border-radius: var(--radius);
        display: none;
        width: 100%;
    }
    .nav-dropdown.open .dropdown-menu {
        display: block;
    }
    .dropdown-menu a {
        font-size: 0.95rem;
        font-weight: 600;
        padding: 10px 0;
        color: var(--text-secondary);
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
        display: block;
    }
    .dropdown-menu a:last-child {
        border-bottom: none;
    }
    .dropdown-menu a:hover {
        color: var(--primary);
    }
}

/* Intermediate Desktop Screen Adjustments (1251px - 1366px) */
@media (min-width: 1251px) and (max-width: 1366px) {
    .nav-link {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .nav-container {
        padding: 0 16px;
        max-width: 100%;
    }
    .nav-menu {
        gap: 1px;
    }
    .theme-toggle-btn {
        margin-left: 2px;
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

@media(max-width:768px){
    /* Body safety padding for bottom nav */
    body {
        padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Responsive Grids */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .footer-newsletter {
        flex-direction: column;
        text-align: center;
    }
    .newsletter-form {
        flex-direction: column;
        width: 100%;
    }
    .newsletter-form input {
        min-width: auto;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .hero-cta {
        flex-direction: column;
    }
    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }
    .hero-stats {
        flex-wrap: wrap;
        gap: 20px;
    }
    .hero-stat {
        flex: 1;
        min-width: 80px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .contact-form {
        grid-template-columns: 1fr;
    }
    .section {
        padding: 60px 0;
    }
    .page-banner {
        padding: 120px 0 60px;
    }
    .career-card {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    /* Glass card padding adjustment for smaller viewports */
    .glass-card {
        padding: 24px 20px;
    }

    /* Interactive Computer Vision Sandbox responsiveness */
    .sandbox-viewscreen {
        min-height: 260px;
    }

    /* Enable Mobile Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        bottom: 0;
    }

    /* Shift floating action buttons up so they don't cover bottom nav */
    .back-to-top {
        bottom: calc(148px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .whatsapp-float {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Constrain Three.js WebGL canvas size to prevent horizontal overflows */
    #three-canvas-container canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        overflow: hidden;
    }

    /* Constrain the AI Innovation Orbits on Mobile */
    .ai-visual {
        height: 300px;
        overflow: hidden; /* Prevent orbits from expanding the document width */
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .ai-visual .orbit:nth-child(1) {
        width: 180px;
        height: 180px;
    }
    .ai-visual .orbit:nth-child(2) {
        width: 260px;
        height: 260px;
    }
    .ai-visual .orbit:nth-child(3) {
        width: 320px;
        height: 320px;
    }
    .ai-visual .center-icon {
        font-size: 2.8rem;
    }

    /* Prevent CTA text compression by opening up spacing */
    .cta-section {
        margin: 0 16px;
        padding: 60px 24px;
    }

    /* Reclaim horizontal space on narrow screens for timeline readability */
    .timeline {
        padding-left: 30px;
    }
    .timeline::before {
        left: 10px;
    }
    .timeline-item {
        padding-left: 15px;
    }
    .timeline-item::before {
        left: -29px; /* Centered perfectly relative to line (10px + 1px) */
    }

    /* Premium style for blockquotes in blog-post-body */
    .blog-post-body blockquote {
        font-style: italic;
        border-left: 4px solid var(--primary);
        padding: 12px 16px;
        margin: 20px 0;
        background: rgba(79, 70, 229, 0.03);
        border-radius: 0 var(--radius) var(--radius) 0;
        color: var(--text);
        font-size: 0.95rem;
    }
}

@media(max-width:480px){
    .container{padding:0 16px}
    .stats-grid{grid-template-columns:1fr 1fr}
    .stat-item .stat-number{font-size:1.8rem}
    .hero-stats{justify-content:center}
    h1{font-size:1.8rem}
    h2{font-size:1.5rem}
}

