/*
 * Correção final do layout mobile da homepage Netsearch.
 * Este ficheiro é carregado depois de todos os restantes para neutralizar
 * larguras mínimas, grelhas de desktop e posicionamentos que causavam
 * sobreposição ou conteúdo demasiado encostado em ecrãs pequenos.
 */

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
}

body,
main,
section,
header,
footer,
.container,
.page-hero-grid,
.page-hero-copy,
.ai-stack,
.crm-grid,
.crm-bonus-box,
.split-grid,
.funds-grid,
.funds-content-layout,
.inquiry-wrap,
.footer-top,
.footer-bottom {
    min-width: 0 !important;
}

@media (max-width: 1024px) {
    :root {
        --mobile-side-space: 18px;
    }

    .container,
    .page-hero .container,
    .section .container,
    .site-footer .container,
    #automacao .container.ai-stack {
        width: calc(100% - (var(--mobile-side-space) * 2)) !important;
        max-width: none !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    /* Cabeçalho */
    .site-header,
    .site-header.scrolled {
        height: 80px !important;
    }

    .header-inner {
        width: calc(100% - 28px) !important;
        gap: 12px !important;
    }

    .brand {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: calc(100% - 58px) !important;
    }

    .brand img,
    .site-header.scrolled .brand img {
        width: min(70vw, 260px) !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 62px !important;
        object-fit: contain !important;
        object-position: left center !important;
    }

    .header-cta {
        display: none !important;
    }

    .menu-toggle {
        display: block !important;
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
    }

    .nav-wrap {
        position: fixed !important;
        z-index: 1001 !important;
        inset: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        min-width: 0 !important;
        padding: 100px 24px 40px !important;
        overflow-y: auto !important;
        background: rgba(3, 20, 32, .98) !important;
    }

    .main-nav,
    .home-strategic-nav {
        display: grid !important;
        width: 100% !important;
        max-width: 440px !important;
        gap: 8px !important;
        margin: 0 auto !important;
    }

    .main-nav a,
    .home-strategic-nav a {
        width: 100% !important;
        padding: 13px 4px !important;
        color: #fff !important;
        font-size: 1rem !important;
    }

    /* Hero */
    .home-hero,
    .home-hero .page-hero-grid {
        min-height: auto !important;
    }

    .home-hero .page-hero-grid {
        display: block !important;
        width: calc(100% - 32px) !important;
        padding-top: 112px !important;
        padding-bottom: 48px !important;
    }

    .home-hero .page-hero-copy {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .home-hero .page-hero-copy > * {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .home-hero .page-hero-copy > .eyebrow {
        margin: 0 0 18px !important;
        font-size: .78rem !important;
        line-height: 1.45 !important;
        letter-spacing: .11em !important;
    }

    .home-hero .page-hero-copy > h1,
    #hero-title {
        margin: 0 0 24px !important;
        font-size: clamp(2.45rem, 10.8vw, 4rem) !important;
        line-height: 1.025 !important;
        letter-spacing: -.045em !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }

    .home-hero .page-hero-copy > p {
        margin: 0 0 24px !important;
        font-size: 1rem !important;
        line-height: 1.62 !important;
    }

    .home-hero .hero-pillar-list {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 13px !important;
        width: 100% !important;
        margin: 0 0 28px !important;
        padding: 0 !important;
    }

    .home-hero .hero-pillar-list li {
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        padding: 0 0 0 27px !important;
        font-size: .96rem !important;
        line-height: 1.45 !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }

    .home-hero .hero-pillar-list li::before {
        top: .48em !important;
        transform: none !important;
    }

    .home-hero .hero-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .home-hero .hero-actions .btn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 52px !important;
    }

    .home-hero .enterprise-visual {
        display: none !important;
    }

    /* Indicadores */
    .stats-strip {
        margin-top: 0 !important;
        padding: 14px 0 !important;
    }

    .stats-strip-inner {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: calc(100% - 28px) !important;
        min-height: 0 !important;
        padding: 8px !important;
    }

    .stat-item {
        min-width: 0 !important;
        min-height: 92px !important;
        padding: 15px 12px !important;
    }

    .stat-item strong {
        font-size: 1rem !important;
        line-height: 1.2 !important;
    }

    .stat-item span {
        font-size: .75rem !important;
        line-height: 1.35 !important;
    }

    /* Espaçamento geral das secções */
    .section,
    .ai-lab,
    .crm-section,
    .crm-bonus,
    .funds-section,
    .inquiry-section {
        padding-top: 68px !important;
        padding-bottom: 68px !important;
    }

    .section-heading {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 36px !important;
    }

    .section-heading h2,
    .split-panel h2,
    .crm-section h2,
    .crm-bonus h2,
    .funds-section h2,
    .inquiry-section h2 {
        max-width: 100% !important;
        font-size: clamp(2.05rem, 8vw, 3.25rem) !important;
        line-height: 1.08 !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }

    /* Soluções */
    .solution-grid,
    .cards-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 16px !important;
    }

    .solution-card,
    .feature-card {
        width: 100% !important;
        min-width: 0 !important;
        padding: 24px 20px !important;
    }

    /* Automação */
    #automacao .container.ai-stack,
    #automacao .ai-stack {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: calc(100% - 32px) !important;
        max-width: none !important;
        gap: 32px !important;
    }

    #automacao .ai-stack > .reveal:first-child {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #automacao .ai-stack > .reveal:first-child > .section-kicker,
    #automacao .ai-stack > .reveal:first-child > h2,
    #automacao .ai-stack > .reveal:first-child > p {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    #automacao .ai-stack > .reveal:first-child > h2 {
        margin: 0 !important;
        font-size: clamp(2.25rem, 9vw, 3.4rem) !important;
        line-height: 1.065 !important;
    }

    #automacao .ai-stack > .reveal:first-child > p {
        margin: 24px 0 0 !important;
        font-size: .98rem !important;
        line-height: 1.62 !important;
    }

    #automacao .automation-content-panel {
        width: 100% !important;
        max-width: 100% !important;
        padding: 22px 18px !important;
        background: rgba(3, 22, 35, .90) !important;
        border: 1px solid rgba(121,201,66,.22) !important;
        border-radius: 20px !important;
    }

    #automacao .automation-content-list {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        margin-bottom: 24px !important;
    }

    #automacao .automation-content-list li {
        width: 100% !important;
        min-height: 0 !important;
        padding-left: 25px !important;
        font-size: .92rem !important;
        line-height: 1.45 !important;
    }

    #automacao .automation-benefits {
        padding-top: 20px !important;
    }

    #automacao .automation-benefits p {
        font-size: .9rem !important;
        line-height: 1.5 !important;
    }

    /* CRM */
    .crm-grid,
    .crm-bonus-box {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 30px !important;
    }

    .crm-grid > *,
    .crm-bonus-box > * {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .crm-section .crm-panel {
        width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        aspect-ratio: 3 / 2 !important;
        background-size: 100% 100%, contain, contain !important;
        background-position: center, center, center !important;
        background-repeat: no-repeat !important;
    }

    .crm-metrics,
    .crm-body,
    .bonus-features {
        grid-template-columns: 1fr !important;
    }

    /* SEO & Websites */
    #seo-websites .split-grid,
    .split-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 18px !important;
    }

    #seo-websites .split-panel,
    .split-panel {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 32px 22px !important;
    }

    #seo-websites .split-panel.light h2 br {
        display: none !important;
    }

    .pill-list {
        gap: 9px !important;
    }

    /* Fundos */
    .funds-section .funds-grid {
        display: block !important;
        width: 100% !important;
    }

    .funds-section .funds-grid > .funds-content-layout,
    .funds-section .funds-content-layout {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 36px !important;
        margin: 0 !important;
    }

    .funds-left-column,
    .funds-right-column {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .funds-left-column h2,
    .funds-left-column p {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    .funds-left-column p {
        font-size: .98rem !important;
        line-height: 1.6 !important;
    }

    .funds-left-column .fund-logos,
    .funds-section .fund-logos {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 14px !important;
        margin: 28px 0 0 !important;
    }

    .funds-left-column .fund-logo,
    .funds-section .fund-logo {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 112px !important;
        padding: 14px !important;
        background: #fff !important;
        border-radius: 16px !important;
    }

    .funds-left-column .fund-logo img,
    .funds-section .fund-logo img {
        display: block !important;
        width: 100% !important;
        height: 76px !important;
        max-height: 76px !important;
        padding: 6px !important;
        object-fit: contain !important;
        background: #fff !important;
        border-radius: 8px !important;
    }

    .funds-right-column {
        padding-top: 0 !important;
    }

    .funds-right-column .fund-checks,
    .funds-section .fund-checks {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 14px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .funds-right-column .fund-checks li,
    .funds-section .fund-checks li {
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        padding: 0 0 0 27px !important;
        font-size: .96rem !important;
        line-height: 1.5 !important;
    }

    .funds-right-column .fund-checks li::before,
    .funds-section .fund-checks li::before {
        top: .5em !important;
        transform: none !important;
    }

    .funds-right-column .funds-actions,
    .funds-section .funds-actions {
        width: 100% !important;
        margin-top: 28px !important;
    }

    .funds-right-column .funds-actions .btn,
    .funds-section .funds-actions .btn {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .funds-section .funds-visual {
        display: none !important;
    }

    /* Contactos e formulário */
    .inquiry-section .section-heading h2,
    .inquiry-section .section-heading p {
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
    }

    .inquiry-wrap {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 18px !important;
        padding: 14px !important;
    }

    .inquiry-section .contact-form,
    .inquiry-section .next-steps-panel {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 22px 17px !important;
    }

    .inquiry-section .contact-form .form-grid,
    .contact-form .form-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }

    .form-group,
    .form-group.full {
        width: 100% !important;
        grid-column: auto !important;
    }

    .form-control,
    input,
    select,
    textarea {
        max-width: 100% !important;
    }

    /* Footer */
    .site-footer .footer-top {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: calc(100% - 32px) !important;
        gap: 32px !important;
        padding-top: 52px !important;
        padding-bottom: 42px !important;
    }

    .site-footer .footer-brand,
    .site-footer .footer-column {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .site-footer .footer-brand img {
        width: min(82vw, 280px) !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 74px !important;
    }

    .site-footer .footer-brand p {
        max-width: 100% !important;
        font-size: .96rem !important;
        line-height: 1.6 !important;
    }

    .site-footer .footer-bottom {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: calc(100% - 32px) !important;
        gap: 12px !important;
        padding-top: 24px !important;
        padding-bottom: 28px !important;
    }

    .site-footer .footer-legal {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 14px !important;
    }
}

@media (max-width: 520px) {
    :root {
        --mobile-side-space: 14px;
    }

    .home-hero .page-hero-grid,
    #automacao .container.ai-stack,
    #automacao .ai-stack,
    .site-footer .footer-top,
    .site-footer .footer-bottom {
        width: calc(100% - 24px) !important;
    }

    .brand img,
    .site-header.scrolled .brand img {
        width: min(68vw, 225px) !important;
    }

    .home-hero .page-hero-copy > h1,
    #hero-title {
        font-size: clamp(2.1rem, 10.6vw, 2.85rem) !important;
    }

    .stats-strip-inner {
        grid-template-columns: 1fr !important;
    }

    .stat-item {
        min-height: 76px !important;
    }

    .section,
    .ai-lab,
    .crm-section,
    .crm-bonus,
    .funds-section,
    .inquiry-section {
        padding-top: 54px !important;
        padding-bottom: 54px !important;
    }

    .section-heading h2,
    .split-panel h2,
    .crm-section h2,
    .crm-bonus h2,
    .funds-section h2,
    .inquiry-section h2,
    #automacao .ai-stack > .reveal:first-child > h2 {
        font-size: clamp(1.9rem, 9vw, 2.65rem) !important;
    }

    #automacao .automation-content-panel,
    .inquiry-section .contact-form,
    .inquiry-section .next-steps-panel,
    #seo-websites .split-panel,
    .split-panel {
        padding: 20px 15px !important;
    }

    .funds-left-column .fund-logo,
    .funds-section .fund-logo {
        min-height: 100px !important;
    }

    .funds-left-column .fund-logo img,
    .funds-section .fund-logo img {
        height: 68px !important;
        max-height: 68px !important;
    }
}
