/* EmbChips — mobile & responsive support */

/* ── Layout grid (Bootstrap-style classes used in HTML) ── */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

.row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.align-items-center {
    align-items: stretch;
}

@media (min-width: 768px) {
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 992px) {
    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .align-items-center {
        align-items: center;
    }
}

/* ── Safe areas (notched phones) ── */
@supports (padding: max(0px)) {
    .navbar {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }

    .navbar-nav {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .whatsapp-chat {
        left: max(15px, env(safe-area-inset-left));
        bottom: max(20px, env(safe-area-inset-bottom));
    }

    .back-to-top {
        right: max(15px, env(safe-area-inset-right));
        bottom: max(20px, env(safe-area-inset-bottom));
    }

    .theme-toggle {
        right: max(75px, calc(60px + env(safe-area-inset-right)));
        bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ── Tablet & mobile (≤991px) ── */
@media (max-width: 991px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        overflow-x: hidden;
    }

    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding-top: 5.5rem;
        padding-bottom: 3rem;
    }

    .hero .row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero .col-lg-6:first-child {
        order: 2;
    }

    .hero .col-lg-6:last-child {
        order: 1;
    }

    .hero-content {
        max-width: 100%;
        text-align: center;
    }

    .hero-content .badge,
    .hero-content .hero-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.85rem;
        margin-bottom: 2.5rem !important;
    }

    .hero h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem) !important;
        line-height: 1.2;
    }

    .hero p {
        max-width: 100%;
        font-size: 1.05rem;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
        width: 100%;
    }

    .hero-buttons .btn-primary,
    .hero-buttons .btn-outline {
        flex: 1 1 auto;
        min-width: 140px;
        min-height: 48px;
    }

    .hero-stats {
        justify-content: center;
        gap: 1.25rem;
        padding-top: 1.5rem;
    }

    .hero-stat {
        flex: 1 1 30%;
        min-width: 90px;
        text-align: center;
    }

    .hero-stat h2,
    .hero-stat h3 {
        font-size: 1.75rem !important;
    }

    .hero-visual {
        margin: 0 auto 1rem;
        max-width: 520px;
        width: 100%;
    }

    .hero-image {
        max-height: 280px;
        object-fit: cover;
        width: 100%;
    }

    .floating-card {
        display: none !important;
    }

    /* Mobile navigation */
    .navbar-brand,
    .navbar-toggler {
        position: relative;
        z-index: 1002;
    }

    .navbar-toggler {
        display: flex !important;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
    }

    .navbar-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 5.5rem 1.25rem 2rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.25rem !important;
        background: rgba(4, 8, 15, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: none !important;
        box-shadow: none !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1001 !important;
    }

    .navbar-nav.active {
        transform: translateX(0) !important;
    }

    .nav-link {
        color: rgba(226, 232, 240, 0.95) !important;
        padding: 0.85rem 1rem !important;
        min-height: 48px;
        display: flex !important;
        align-items: center;
        font-size: 1.05rem !important;
        border-radius: 10px !important;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(91, 140, 255, 0.15) !important;
        color: #fff !important;
    }

    .nav-cta {
        margin-top: 1rem;
        width: 100%;
    }

    .nav-cta .btn {
        display: flex !important;
        width: 100%;
        min-height: 48px;
        justify-content: center;
        font-size: 1rem !important;
    }

    /* Services dropdown — accordion on mobile */
    .nav-item.dropdown {
        width: 100%;
    }

    .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .dropdown-toggle .fa-chevron-down {
        transition: transform 0.25s ease;
    }

    .nav-item.dropdown.open .dropdown-toggle .fa-chevron-down {
        transform: rotate(180deg);
    }

    .mega-dropdown {
        position: static !important;
        display: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.25rem 0 0.5rem 0.5rem !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .nav-item.dropdown.open .mega-dropdown {
        display: block !important;
    }

    .mega-dropdown .row {
        margin: 0;
    }

    .mega-dropdown a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.65rem 1rem !important;
        color: rgba(200, 215, 240, 0.9) !important;
    }

    /* Sections */
    section {
        padding: 3.5rem 0;
    }

    .section-header h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .section-header p {
        font-size: 1rem;
    }

    .services-grid,
    .industry-grid,
    .team-grid,
    .testimonial-grid,
    .tech-grid,
    .process-grid,
    .stats-grid,
    .footer-grid,
    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }

    .about-grid {
        gap: 2rem;
    }

    .about-image-wrapper {
        order: -1;
    }

    .about-image-wrapper img {
        width: 100%;
        height: auto;
    }

    /* Page headers (inner pages) */
    .page-header {
        padding: 6rem 0 2.5rem !important;
        text-align: center;
    }

    .page-header h1 {
        font-size: clamp(1.5rem, 5vw, 2.25rem) !important;
    }

    .breadcrumb {
        justify-content: center;
        flex-wrap: wrap;
        font-size: 0.875rem;
    }

    /* Cards */
    .service-card,
    .case-study-card,
    .industry-card,
    .contact-form-card,
    .contact-info-card {
        padding: 1.25rem;
    }

    .case-study-image img {
        width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: cover;
    }

    /* CTA */
    .cta-section .cta-content {
        text-align: center;
        padding: 0 0.5rem;
    }

    .cta-section .btn-light {
        width: 100%;
        max-width: 320px;
        min-height: 48px;
    }

    /* Footer */
    .footer-grid {
        text-align: center;
    }

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

    .footer-contact li {
        justify-content: center;
    }

    .newsletter-form .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .newsletter-form .form-control,
    .newsletter-form .btn {
        width: 100%;
        min-height: 48px;
    }

    /* Fixed action buttons — stack cleanly */
    .whatsapp-chat,
    .back-to-top,
    .theme-toggle {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Small phones (≤576px) ── */
@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero {
        padding-top: 5rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-buttons .btn-primary,
    .hero-buttons .btn-outline {
        width: 100%;
        max-width: none;
    }

    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .hero-stat {
        flex: none;
        width: 100%;
    }

    .hero-image {
        max-height: 220px;
    }

    .team-grid {
        grid-template-columns: 1fr !important;
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .tech-item {
        padding: 1rem 0.5rem;
    }

    .tech-item h3 {
        font-size: 0.8rem;
    }

    .job-card {
        padding: 1.25rem;
    }

    .job-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .page-header {
        padding-top: 5.5rem !important;
    }

    .btn-primary,
    .btn-outline,
    .btn-light,
    .btn {
        min-height: 48px;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .theme-toggle {
        right: 70px;
    }

    .back-to-top {
        right: 12px;
    }

    .whatsapp-chat {
        left: 12px;
    }
}

/* ── iOS: prevent zoom on input focus ── */
@media (max-width: 991px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="password"],
    select,
    textarea,
    .form-control {
        font-size: 16px !important;
    }
}

/* ── Touch devices: larger tap targets, no sticky hover ── */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .industry-card:hover,
    .case-study-card:hover {
        transform: none;
    }

    .nav-link,
    .btn,
    a {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
}

/* Light theme mobile menu */
@media (max-width: 991px) {
    [data-theme="light"] .navbar-nav {
        background: rgba(255, 255, 255, 0.98) !important;
    }

    [data-theme="light"] .nav-link {
        color: #1f2937 !important;
    }

    [data-theme="light"] .mega-dropdown a {
        color: #4b5563 !important;
    }
}
