/**
 * PONTE IA - Mobile Optimized
 * Performance e Layout Perfeito para Mobile
 */

/* ========================================
   OTIMIZAÇÕES DE PERFORMANCE MOBILE
   ======================================== */

/* Reduzir repaints e reflows */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Hardware acceleration para animações */
.nav,
.nav-menu,
.nav-toggle,
.btn,
.card-3d,
.solution-card {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Otimizar fontes para mobile */
@media (max-width: 767px) {
    body {
        font-size: 16px; /* Prevenir zoom no iOS */
        -webkit-text-size-adjust: 100%;
        text-rendering: optimizeSpeed;
    }
}

/* ========================================
   NAVEGAÇÃO MOBILE APRIMORADA
   ======================================== */

@media (max-width: 767px) {
    /* Nav fixa otimizada */
    .nav {
        height: 70px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 1000;
        will-change: transform;
    }

    .nav-content {
        height: 70px;
        padding: 0 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Logo mobile otimizada */
    .nav-logo {
        z-index: 1001;
    }

    .nav-logo img {
        height: 38px;
        width: auto;
    }

    /* Hamburger menu aprimorado */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 48px;
        height: 48px;
        padding: 12px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1001;
        position: relative;
    }

    .nav-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        background: #ffffff;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
    }

    /* Animação hamburger -> X */
    .nav-toggle.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .nav-toggle.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Menu mobile full screen */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        height: calc(100dvh - 70px); /* Dynamic viewport height */
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: 2rem 1rem;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    /* Links mobile otimizados */
    .nav-menu li {
        width: 100%;
        max-width: 340px;
        margin: 0.5rem 0;
    }

    .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        width: 100%;
        min-height: 56px;
        padding: 1rem 1.5rem;
        font-size: 1.25rem;
        font-weight: 600;
        color: #ffffff !important;
        text-align: center;
        text-decoration: none;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        transition: all 0.3s ease;
    }

    .nav-link:active {
        background: rgba(153, 244, 67, 0.2);
        transform: scale(0.98);
    }

    .cta-nav {
        background: #99F443;
        color: #000000 !important;
        font-weight: 700;
    }

    .cta-nav:active {
        background: #7FCF39;
        transform: scale(0.98);
    }

    /* Prevenir scroll quando menu aberto */
    body.no-scroll {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }
}

/* ========================================
   HERO SECTION MOBILE
   ======================================== */

@media (max-width: 767px) {
    .hero {
        min-height: calc(100vh - 70px);
        min-height: calc(100dvh - 70px);
        padding: 100px 20px 60px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

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

    .hero-title {
        font-size: clamp(1.875rem, 7vw, 2.75rem);
        line-height: 1.15;
        margin-bottom: 1.5rem;
    }

    .hero-subtitle {
        font-size: clamp(1rem, 4vw, 1.25rem);
        line-height: 1.6;
        margin-bottom: 2rem;
    }

    .hero-ctas {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
    }

    .hero-ctas .btn {
        width: 100%;
        min-height: 56px;
        font-size: 1.125rem;
        padding: 1rem 1.5rem;
    }
}

/* ========================================
   SECTIONS MOBILE
   ======================================== */

@media (max-width: 767px) {
    .section {
        padding: 3rem 0;
        scroll-margin-top: 80px;
    }

    .section-header {
        margin-bottom: 2rem;
        text-align: center;
    }

    .section-title {
        font-size: clamp(2rem, 8vw, 2.5rem);
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .section-subtitle {
        font-size: clamp(1rem, 4vw, 1.125rem);
        line-height: 1.6;
    }

    /* Container mobile */
    .container {
        padding: 0 20px;
        max-width: 100%;
    }
}

/* ========================================
   QUEM SOMOS - MOBILE OTIMIZADO
   ======================================== */

@media (max-width: 767px) {
    #quem-somos .container > div {
        max-width: 100% !important;
    }

    #quem-somos .container > div > div {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
        grid-template-columns: 1fr !important;
    }

    #quem-somos img {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 12px !important;
        margin: 0 auto;
    }

    #quem-somos p {
        text-align: center;
        font-size: clamp(1rem, 4vw, 1.125rem) !important;
    }
}

/* ========================================
   CARDS E SOLUÇÕES MOBILE
   ======================================== */

@media (max-width: 767px) {
    .solution-card,
    .team-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }

    /* Grid responsivo */
    [style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    /* Cards full width mobile */
    .solution-card,
    .team-card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ========================================
   BOTÕES MOBILE OTIMIZADOS
   ======================================== */

@media (max-width: 767px) {
    .btn {
        min-height: 48px;
        min-width: 48px;
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
        border-radius: 999px;
        font-weight: 600;
        touch-action: manipulation;
        user-select: none;
    }

    .btn-lg {
        min-height: 56px;
        font-size: 1.125rem;
        padding: 1rem 2rem;
    }

    /* Feedback tátil */
    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
}

/* ========================================
   FOOTER MOBILE
   ======================================== */

@media (max-width: 767px) {
    .footer {
        padding: 2.5rem 20px 1.5rem;
        text-align: center;
    }

    .footer img {
        height: 50px;
        margin-bottom: 1.5rem;
    }

    .footer p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .footer [style*="display: flex"] {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }
}

/* ========================================
   SCROLL TO TOP MOBILE
   ======================================== */

@media (max-width: 767px) {
    .scroll-to-top {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 1.25rem;
    }
}

/* ========================================
   OTIMIZAÇÕES DE VELOCIDADE
   ======================================== */

/* Lazy load images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Reduzir motion em low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Otimizar para conexões lentas */
@media (prefers-reduced-data: reduce) {
    .global-particles,
    .floating-shape,
    video,
    [style*="background-image"] {
        display: none !important;
    }
}

/* ========================================
   LANDSCAPE MOBILE
   ======================================== */

@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 20px 40px;
    }

    .nav-menu {
        height: calc(100vh - 70px);
        padding: 1rem;
        justify-content: flex-start;
        padding-top: 2rem;
    }

    .nav-link {
        min-height: 48px;
        font-size: 1.125rem;
        padding: 0.75rem 1.25rem;
    }

    .section {
        padding: 2.5rem 0;
    }
}

/* ========================================
   SMALL PHONES (< 375px)
   ======================================== */

@media (max-width: 374px) {
    .container {
        padding: 0 16px;
    }

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

    .btn {
        font-size: 0.9375rem;
        padding: 0.75rem 1.25rem;
    }

    .nav-logo img {
        height: 34px;
    }
}

/* ========================================
   iOS SAFE AREA
   ======================================== */

@supports (padding-top: env(safe-area-inset-top)) {
    .nav {
        padding-top: env(safe-area-inset-top);
        height: calc(70px + env(safe-area-inset-top));
    }

    .nav-menu {
        top: calc(70px + env(safe-area-inset-top));
        height: calc(100vh - 70px - env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }

    .hero {
        padding-top: calc(100px + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }
}
