/**
 * Home — mejoras móvil (≤968px)
 * Carga al final del head en index.php.
 */

@media (max-width: 968px) {
    html {
        overflow-x: clip;
        max-width: 100%;
    }

    body.page-home {
        --home-mobile-x: 1rem;
        --home-shell-pad: 1rem;
        --hs-pad: 1rem;
        overflow-x: clip;
        max-width: 100%;
        /* Solo variables exclusivas del home (la escala base viene de :root en base.css) */
        --hs-title: var(--cw-title-section);
        --home-title-hero: var(--cw-title-hero);
        --home-title-section: var(--cw-title-section);
    }

    /* Misma columna: banner y soluciones usan solo --home-mobile-x */
    body.page-home .home-intro-bridge,
    body.page-home .home-flow {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: clip;
        box-sizing: border-box;
    }

    body.page-home .home-intro-bridge {
        margin: 0 !important;
        padding-left: var(--home-mobile-x) !important;
        padding-right: var(--home-mobile-x) !important;
    }

    body.page-home .home-hero-zone {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0.15rem !important;
        margin-bottom: 0.5rem !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }

    body.page-home .home-hero-zone .container {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }

    body.page-home .home-hero-zone .content-section {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0.35rem 0 0.25rem !important;
        text-align: center;
        align-items: center !important;
        box-sizing: border-box;
    }

    body.page-home .home-hero-zone .visual-section {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    body.page-home .home-flow__services,
    body.page-home .home-flow__services.cards-section--bridge,
    body.page-home .home-flow__services.cards-section--solutions,
    body.page-home .cards-section--bridge,
    body.page-home .cards-section--solutions {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: var(--home-mobile-x) !important;
        padding-right: var(--home-mobile-x) !important;
        box-sizing: border-box !important;
        /* Misma atmósfera que el resto: sin caja / panel cortado */
        background: transparent !important;
        background-image: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    body.page-home .home-flow__services.cards-section--solutions {
        margin-top: 1.35rem !important;
        margin-bottom: 1.5rem !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        padding-left: clamp(1.05rem, 4.5vw, 1.4rem) !important;
        padding-right: clamp(1.05rem, 4.5vw, 1.4rem) !important;
        position: relative;
        z-index: 1;
    }

    body.page-home .cards-section--bridge::after,
    body.page-home .cards-section--solutions::before,
    body.page-home .home-intro-bridge::before {
        display: none !important;
        content: none !important;
    }

    body.page-home .cards-container--rail .card p {
        display: block !important;
        -webkit-line-clamp: unset !important;
        line-clamp: unset !important;
        overflow: visible !important;
    }

    body.page-home .cards-section__eyebrow,
    body.page-home .cards-section--bridge:not(.mx-geo-related) .section-title,
    body.page-home .cards-section:not(.mx-geo-related) .section-subtitle,
    body.page-home .cards-container--rail {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: none !important;
        width: 100%;
        box-sizing: border-box;
    }

    body.page-home .visual-section {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }

    /* Hero más corto y legible */
    /* H1 blanco del banner */
    body.page-home .home-intro-bridge .hero-title,
    body.page-home .content-section .hero-title {
        font-size: var(--cw-title-hero) !important;
        color: #fff !important;
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
        text-shadow: none !important;
    }

    body.page-home .hero-title {
        font-size: var(--cw-title-hero) !important;
        line-height: 1.18 !important;
        letter-spacing: 0.2px !important;
        margin-bottom: 0.55rem !important;
        text-wrap: balance;
    }

    body.page-home .hero-copy-stack {
        gap: 0.45rem;
        margin-bottom: 0.9rem;
        align-items: stretch;
        width: 100%;
    }

    body.page-home .hero-brand-tagline {
        font-size: 1rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.01em !important;
        line-height: 1.35 !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        max-width: 100%;
        color: rgba(255, 255, 255, 0.95) !important;
    }

    body.page-home .badge,
    body.page-home .badge-mexico {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        align-self: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
        gap: 0.55rem !important;
        font-size: 0.72rem !important;
        padding: 0.42rem 0.8rem !important;
        margin-bottom: 0.55rem !important;
    }

    body.page-home .badge-mexico {
        font-size: 0.7rem !important;
        padding: 0.38rem 0.75rem !important;
    }

    body.page-home .badge i,
    body.page-home .badge-mexico i {
        flex-shrink: 0;
        margin: 0 !important;
    }

    body.page-home .hero-subtitle {
        font-size: 0.98rem !important;
        line-height: 1.55 !important;
        margin-bottom: 0 !important;
        max-width: 100%;
        color: rgba(255, 255, 255, 0.76) !important;
    }

    /* CTA principal: WhatsApp a ancho completo */
    body.page-home .hero-cta-stack {
        width: 100%;
        gap: 0.75rem !important;
        margin-bottom: 0.95rem !important;
    }

    body.page-home .hero-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.55rem !important;
        width: 100%;
    }

    body.page-home .hero-btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
        font-size: 0.92rem !important;
        padding: 0.85rem 1rem !important;
        border-radius: 14px;
    }

    body.page-home .hero-btn--primary {
        order: -1;
        box-shadow: 0 10px 28px rgba(37, 211, 102, 0.28);
    }

    body.page-home .hero-showcase-cta {
        width: 100%;
        border-radius: 16px;
        min-height: 64px;
        text-align: left !important;
        align-self: stretch !important;
    }

    body.page-home .hero-cta-stack {
        align-items: stretch !important;
        align-self: stretch !important;
        width: 100% !important;
    }

    body.page-home .hero-showcase-cta__copy,
    body.page-home .hero-showcase-cta__copy strong,
    body.page-home .hero-showcase-cta__copy span {
        text-align: left !important;
        align-items: flex-start !important;
    }

    body.page-home .hero-showcase-cta__copy strong {
        font-size: 0.9rem;
        line-height: 1.25;
    }

    body.page-home .hero-showcase-cta__copy span {
        font-size: 0.75rem;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Trust chips: una sola fila cómoda */
    body.page-home .hero-trust {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.4rem !important;
        width: 100%;
        margin: 0.2rem 0 0.75rem !important;
    }

    body.page-home .hero-trust__item {
        padding: 0.65rem 0.3rem !important;
        border-radius: 12px !important;
        min-height: 76px;
    }

    body.page-home .hero-trust__copy span {
        max-width: none !important;
        font-size: 0.62rem !important;
        line-height: 1.25 !important;
    }

    body.page-home .hero-proof-note {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
        margin-top: 0.15rem !important;
    }

    /* Nexus: recortar efectos 3D dentro del viewport (sin scroll horizontal) */
    body.page-home .home-hero-zone,
    body.page-home .home-hero-zone .container {
        overflow-x: clip !important;
        overflow-y: visible;
        max-width: 100%;
    }

    body.page-home .visual-section,
    body.page-home .home-hero-zone .visual-section {
        min-height: clamp(300px, 72vw, 420px) !important;
        max-height: none !important;
        height: auto !important;
        padding: 1.25rem 0 1.75rem !important;
        margin-top: 0.35rem !important;
        margin-bottom: 0.85rem !important;
        overflow: hidden !important;
        position: relative;
        z-index: 2;
        max-width: 100%;
        contain: layout paint;
    }

    body.page-home .visual-section .nexus-system {
        overflow: hidden !important;
        width: 100%;
        max-width: 100%;
        min-height: inherit;
        display: flex;
        align-items: center;
        justify-content: center;
        perspective: clamp(680px, 120vw, 1500px);
    }

    body.page-home .quantum-orb {
        width: clamp(200px, 58vw, 320px) !important;
        height: clamp(200px, 58vw, 320px) !important;
        max-width: 100%;
    }

    body.page-home .quantum-orb .ring-1 { width: 118% !important; height: 118% !important; }
    body.page-home .quantum-orb .ring-2 { width: 104% !important; height: 104% !important; }
    body.page-home .quantum-orb .ring-3 { width: 90% !important; height: 90% !important; }
    body.page-home .quantum-orb .core-outer { width: 86% !important; height: 86% !important; }
    body.page-home .quantum-orb .core-middle { width: 60% !important; height: 60% !important; }
    body.page-home .quantum-orb .core-inner { width: 34% !important; height: 34% !important; }

    body.page-home .visual-section .hologram-text {
        font-size: clamp(0.72rem, 2.8vw, 1rem) !important;
        letter-spacing: 2px !important;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.page-home .visual-section .data-stream {
        height: clamp(120px, 38vw, 180px) !important;
    }

    /* Servicios: encabezado (conserva alineación centrada del diseño base) */
    body.page-home .cards-section--bridge:not(.mx-geo-related) .section-title,
    body.page-home .home-flow__services .section-title {
        font-size: var(--cw-title-section) !important;
        line-height: 1.3 !important;
        letter-spacing: 0.5px !important;
        margin: 0 0 0.55rem !important;
        padding: 0 !important;
        max-width: 100% !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.page-home .cards-section:not(.mx-geo-related) .section-subtitle,
    body.page-home .home-flow__services .section-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin: 0 0 1.1rem !important;
        max-width: 100% !important;
    }

    body.page-home .cards-section__eyebrow,
    body.page-home .home-flow__services .cards-section__eyebrow {
        display: block !important;
        margin: 0 auto 0.5rem !important;
        letter-spacing: 0.1em !important;
        line-height: 1.3 !important;
    }

    /* Cards: icono al lado del título (grid 2×2 en móvil) */
    body.page-home .cards-container--rail .card-svc__title-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.55rem !important;
        width: 100%;
        min-width: 0;
    }

    body.page-home .cards-container--rail .card-svc .card-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
        margin: 0 !important;
        flex-shrink: 0;
        position: relative !important;
        z-index: 1;
    }

    body.page-home .cards-container--rail .card-svc__heading {
        width: 100%;
        min-width: 0;
    }

    body.page-home .cards-container--rail .card-svc__tag {
        margin-bottom: 0.25rem !important;
        font-size: 0.55rem !important;
        padding: 0.12rem 0.4rem !important;
        line-height: 1.2 !important;
    }

    /* H3 blancos de las cards de servicios (inicio) */
    body.page-home .home-flow__services .cards-container--rail .card-svc__heading h3,
    body.page-home .home-flow__services .cards-container--rail .card h3,
    body.page-home .cards-section--bridge .cards-container--rail .card-svc__heading h3,
    body.page-home .cards-section--bridge .cards-container--rail .card h3 {
        font-size: var(--cw-title-card-intro) !important;
    }

    body.page-home .cards-container--rail .card-svc__heading h3,
    body.page-home .cards-container--rail .card h3 {
        font-family: Inter, system-ui, sans-serif !important;
        font-size: var(--cw-title-card-intro) !important;
        font-weight: 700 !important;
        line-height: 1.3 !important;
        letter-spacing: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        color: rgba(255, 255, 255, 0.96) !important;
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
    }

    body.page-home .cards-container--rail > .card-svc {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100%;
        position: relative !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        isolation: isolate;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: none !important;
    }

    /* Línea superior de acento (estilo menú corporativo) */
    body.page-home .cards-container--rail > .card-svc::before {
        content: '' !important;
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        border-radius: 16px 16px 0 0;
        background: linear-gradient(
            90deg,
            transparent,
            var(--card-svc-accent),
            transparent
        ) !important;
        opacity: 0.7 !important;
        z-index: 2;
    }

    body.page-home .cards-container--rail .card-svc .card-content {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        gap: 0.55rem !important;
        min-width: 0;
        padding: 0.95rem 0.85rem 0.9rem !important;
    }

    body.page-home .cards-container--rail .card p {
        font-size: clamp(0.74rem, 2.7vw, 0.84rem) !important;
        line-height: 1.45 !important;
        margin: 0 0 0.35rem !important;
        overflow-wrap: anywhere;
    }

    body.page-home .cards-container--rail .card-button,
    body.page-home .cards-container--rail .modern-button {
        margin-top: auto;
        min-height: 44px !important;
        font-size: 0.72rem !important;
        padding: 0.5rem 0.55rem !important;
        border-radius: 999px !important;
        letter-spacing: 0.04em !important;
        white-space: normal !important;
        line-height: 1.25 !important;
        text-align: center;
    }

    body.page-home .home-flow__why,
    body.page-home .home-flow__deliver,
    body.page-home .home-flow__benefits {
        padding-left: var(--home-mobile-x) !important;
        padding-right: var(--home-mobile-x) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    body.page-home .home-flow__trust {
        padding-left: var(--home-mobile-x) !important;
        padding-right: var(--home-mobile-x) !important;
    }
}

/* ——— Teléfonos: cards servicios a 1 columna (card completo) ——— */
@media (max-width: 560px) {
    body.page-home .cards-container--rail {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    body.page-home .cards-container--rail > .card-svc {
        padding: 0 !important;
    }

    body.page-home .cards-container--rail .card-svc .card-content {
        padding: 1rem 0.95rem 0.95rem !important;
    }

    body.page-home .cards-container--rail .card-svc__heading h3,
    body.page-home .cards-container--rail .card h3 {
        font-size: clamp(1.44rem, 6.24vw, 1.64rem) !important;
    }
}

@media (max-width: 480px) {
    body.page-home .cards-container--rail .card p {
        font-size: 0.875rem !important;
        line-height: 1.52 !important;
    }

    body.page-home .cards-container--rail .card-button,
    body.page-home .cards-container--rail .modern-button {
        min-height: 44px !important;
        font-size: 0.72rem !important;
    }

    body.page-home .cards-container--rail .card-svc__title-row {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.65rem !important;
    }

    body.page-home .cards-container--rail .card-svc .card-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }

    body.page-home .badge-mexico {
        display: none !important;
    }

    body.page-home .hero-proof-note {
        display: none !important;
    }

    body.page-home .hero-showcase-cta__arrow {
        display: none;
    }

    body.page-home .visual-section,
    body.page-home .home-hero-zone .visual-section {
        min-height: clamp(280px, 78vw, 380px) !important;
        max-height: none !important;
        padding: 1.1rem 0 1.5rem !important;
    }

    body.page-home .quantum-orb {
        width: clamp(180px, 54vw, 280px) !important;
        height: clamp(180px, 54vw, 280px) !important;
    }
}

@media (max-width: 400px) {
    body.page-home .hero-trust__item {
        min-height: 70px;
        padding: 0.55rem 0.2rem !important;
    }

    body.page-home .hero-trust__icon {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.76rem !important;
    }

    body.page-home .hero-trust__copy strong {
        font-size: 0.88rem !important;
    }
}

/* ——— Home móvil: títulos de sección (hereda escala global) ——— */
@media (max-width: 968px) {
    body.page-home :is(
        .home-flow .section-title,
        .home-benefits__title,
        .home-why__title,
        .cw-home-deliver__title,
        .home-demos-section__title,
        .home-flow .faq-title,
        .home-flow .ia-title,
        .home-flow .integrations-title,
        .home-flow__trust .reviews-title,
        .home-flow .personal-consult-module h3,
        .hero-pillars-label,
        .home-flow .home-benefits__intro h2
    ) {
        font-size: var(--cw-title-section) !important;
        line-height: 1.22 !important;
    }

    body.page-home :is(
        .home-benefits__card-title,
        .home-why__item-title,
        .cw-home-deliver__title-row h3,
        .home-benefits__pillar h3,
        .ia-highlight h4,
        .home-flow .integration-card h3,
        .home-flow .home-benefits__title-row h3
    ) {
        font-size: var(--cw-title-card) !important;
        line-height: 1.32 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.page-home .hero-btn--primary {
        box-shadow: none;
    }
}
