/* ============================================================
   +ingeni — ESTILOS MÓVIL
   Cargar DESPUÉS de styles_01.css
   Breakpoints: 1024px (tablet), 768px (móvil), 480px (móvil S)
   ============================================================ */

/* ============================================================
   BLOQUE 1: HERO para tablet horizontal + escritorio (≥ 769px)
   Reposiciona logo, vídeo y bullets igual que en iPad Pro
   ============================================================ */
@media (min-width: 769px) {

    :root {
        --header-h: 60px;
        --pad-top: 14px;
        --pad-bot: 20px;
        /* Recalculamos el vídeo para tablet y escritorio */
        --vid-h: min(670px, calc(100svh - var(--header-h) - var(--pad-top) - var(--pad-bot) - 80px)) !important;
        --vid-w: calc(var(--vid-h) * 754 / 983) !important;
    }

    section.hero {
        padding-top: calc(var(--header-h) + var(--pad-top)) !important;
        padding-bottom: var(--pad-bot) !important;
        min-height: 100svh !important;
        height: 100svh !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    section.hero .container {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: var(--vid-h) !important;
    }

    section.hero .hero-top {
        display: none !important;
    }

    /* Logo: posicionado absolutamente a la izquierda del vídeo centrado */
    section.hero .hero-logo-img {
        position: absolute !important;
        width: clamp(180px, calc(var(--vid-w) * 0.85), 320px) !important;
        right: calc(50% + var(--vid-w) / 2 + 40px) !important;
        left: auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        bottom: auto !important;
        height: auto !important;
        margin: 0 !important;
    }

    /* Bullets: a la derecha del vídeo */
    section.hero .hero-bullets {
        position: absolute !important;
        left: calc(50% + var(--vid-w) / 2 + 40px) !important;
        right: auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        bottom: auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
        width: auto !important;
    }

    section.hero .hero-bullets li {
        font-size: clamp(16px, calc(var(--vid-w) * 0.055), 28px) !important;
        font-weight: 500 !important;
        margin-top: -4px !important;
        white-space: nowrap !important;
    }
}

/* ============================================================
   BLOQUE 2: SOLO tablet horizontal (769–1366px)
   Ajustes de tamaños específicos de tablet (títulos, carruseles)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1366px) {

    .section-title {
        font-size: 56px;
    }

    .section-sub {
        font-size: 22px;
    }

    .carousel {
        height: 520px;
    }

    #diseno .carousel {
        height: 520px;
    }

    #hiperrealismo .carousel {
        height: 460px;
    }

    .grid-3 img {
        height: 420px;
    }

    .pres-slide img {
        width: 600px;
    }
}

/* ============================================================
   2. MÓVIL (≤ 768px) — reestructuración principal
   ============================================================ */
@media (max-width: 768px) {

    :root {
        --radius: 20px;
        --pad-top: 30px;
        --pad-bot: 50px;
        --header-h: 60px;
    }

    /* ---------- HEADER: solo logo + Contactar ---------- */
    .nav {
        padding: 14px 18px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-left {
        width: 100%;
        flex-wrap: wrap;
        gap: 0;
        justify-content: space-between;
        align-items: center;
    }

    .nav-links {
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px 14px;
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .logo img {
        display: none;
    }

    .nav-links button,
    .nav-links a {
        font-size: 13px;
        font-weight: 500;
        margin-top: -10px;
    }

    .nav-right {
        position: absolute;
        top: 14px;
        right: 18px;
    }

    .nav-contactar {
        display: none;
    }


    .hero-logo-img {
        content: url('assets/Logotipo_blanco.png');
    }


    header.site-header {
        display: block;
    }

    #pruebalo {
        display: none;
    }

    .foto-caption-demo {
        display: none;
    }

    #hiperrealismo {
        margin-top: -60px;
    }

    #electronica .grid-3 img:nth-child(1),
    #electronica .grid-3 img:nth-child(3) {
        display: none;
    }

    #electronica .grid-3 {
        grid-template-columns: 1fr;
    }

    #electronica .grid-3 img:nth-child(2) {
        height: auto;
        aspect-ratio: 3 / 4;
        object-fit: cover;
        width: 80%;
        margin: 0 auto;
    }

    footer.site-footer .footer-grid img {
        margin-left: 0 !important;
    }

    .copyright {
        margin-bottom: 3em;
    }

    #patentes .patentes-col p {
        font-size: 16px;
    }

    #patentes .patentes-grid {
        width: 90%;
        margin: 0 auto;
    }

    footer.site-footer .container {
        width: 90%;
    }

    /* Bullets: OCULTOS EN MÓVIL */
    section.hero .hero-bullets {
        display: none !important;
    }

    /* ---------- HERO: logo arriba, vídeo centrado, bullets abajo ---------- */
    .hero {
        padding-top: 70px;
        padding-bottom: 60px;
        min-height: auto;
    }

    .hero .container {
        gap: 24px;
    }

    .hero-top {
        display: none;
    }

    /* Reestructuración del hero-media: de posicionamiento absoluto a flujo vertical */
    .hero-media {
        width: 100%;
        max-width: 420px;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        height: auto;
    }

    /* Logo +ingeni: arriba centrado, ya no absoluto */
    .hero-logo-img {
        position: static;
        transform: none;
        width: 200px;
        max-width: 60vw;
        margin: 0 auto;
        display: block;
    }

    /* Vídeo: ancho controlado, centrado */
    .hero-video-wrap {
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
        aspect-ratio: 754 / 983;
        border-radius: 20px;
    }

    .video-play-btn svg {
        width: 64px;
        height: 64px;
    }

    /* Caption + autor: centrado debajo del vídeo */
    .hero-author {
        align-items: center;
        text-align: center;
        width: 100%;
    }

    .hero-video-caption {
        text-align: center;
        font-size: 11px;
    }

    .hero-author-name {
        font-size: 17px;
    }

    .hero-author-role {
        font-size: 14px;
    }

    /* Bullets: abajo, en fila con wrap, ya no absolutos */
    .hero-bullets {
        position: static;
        transform: none;
        left: auto;
        top: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 10px 16px;
        width: 100%;
        max-width: 500px;
        margin: 8px auto 0;
        padding: 0 10px;
    }

    .hero-bullets li {
        font-size: 15px;
        margin-top: 0;
        font-weight: 600;
        white-space: nowrap;
    }

    /* ---------- SECCIONES GENERALES ---------- */
    section.block {
        padding: 60px 0;
    }

    .section-title {
        font-size: 40px;
        line-height: 1.1;
    }

    .section-sub {
        font-size: 18px;
        margin: -10px auto 18px;
        padding: 0 10px;
    }

    .section-sub-sub {
        font-size: 13px;
        margin: -8px auto 20px;
        padding: 0 10px;
    }

    .btn-row {
        gap: 10px;
        margin-bottom: 30px;
    }

    .btn,
    .btn-2 {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* ---------- CARRUSELES: altura reducida y navegación ajustada ---------- */
    .carousel {
        height: 360px;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
    }

    .carousel-track {
        gap: 14px;
    }

    #diseno .carousel {
        height: 380px;
    }

    #hiperrealismo .carousel {
        height: 320px;
    }

    #presentaciones .carousel-track {
        gap: 24px;
    }

    .pres-slide {
        outline-width: 2px;
        outline-offset: 2px;
        border-radius: 28px;
    }

    .pres-slide img {
        width: 340px;
    }

    .pres-play-btn svg {
        width: 56px;
        height: 56px;
    }

    /* Flechas de navegación del carrusel más pequeñas y visibles */
    .carousel-nav {
        transform: translateY(-50%) scale(0.55);
        opacity: 0.75;
    }

    .carousel-nav:hover {
        transform: translateY(-50%) scale(0.7);
    }

    .carousel-nav-prev {
        left: 2px;
    }

    .carousel-nav-next {
        right: 2px;
    }

    .carousel-nav img {
        width: 44px;
    }

    /* ---------- GRID 3 COLUMNAS → 1 ---------- */
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .grid-3 img {
        height: 280px;
    }

    /* ---------- PATENTES ---------- */
    .patentes-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .patentes-col {
        padding: 26px 22px 30px;
    }

    .patentes-col h3 {
        font-size: 42px !important;
    }

    .patentes-col .sub {
        font-size: 15px;
        margin-bottom: 24px;
    }

    #patentes {
        padding-bottom: 120px;
    }

    /* ---------- PRUÉBALO: OCULTAR EMMERSON EN MÓVIL ---------- */
    /* El widget interactivo no funciona bien en pantallas pequeñas: lo ocultamos
       y mostramos en su lugar el vídeo demo como fallback. */
    .pruebalo-title-img-wrap {
        margin-top: 10px;
        margin-bottom: -30px;
    }

    .contenedor-metronomo,
    .menu-contenedor-flotante,
    .contenedor-3d {
        display: none !important;
    }

    .foto-caption-demo {
        margin-top: 30px;
    }

    /* Fallback móvil: bloque con imagen + texto que reemplaza al widget */
    .mobile-demo-fallback {
        display: block;
        max-width: 420px;
        margin: 40px auto 20px;
        padding: 0 16px;
        text-align: center;
    }

    .mobile-demo-fallback img {
        width: 100%;
        border-radius: 20px;
        margin-bottom: 16px;
    }

    .mobile-demo-fallback p {
        color: var(--text-dim);
        font-size: 14px;
        line-height: 1.6;
    }

    .mobile-demo-fallback strong {
        color: var(--accent-2);
        display: block;
        font-size: 15px;
        margin-bottom: 10px;
        font-weight: 600;
    }

    #pruebalo {
        margin-top: 0;
    }

    /* ---------- FOOTER ---------- */
    footer.site-footer {
        padding: 60px 0 30px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .footer-grid h2 {
        font-size: 22px;
    }

    .fci-row {
        font-size: 14px;
    }

    .fci-row em {
        font-size: 14px;
    }

    .copyright {
        font-size: 11px;
        margin-top: 40px;
        padding: 20px 10px 0;
    }

    /* ---------- MODALES ---------- */
    .modal {
        max-height: 90vh;
        border-radius: 20px;
    }

    #modalBody {
        padding: 40px 26px 30px;
    }

    .modal h2 {
        font-size: 24px;
    }

    .modal .modal-sub {
        font-size: 15px;
        margin-bottom: 20px;
    }

    .modal p {
        font-size: 14px;
    }

    .modal img {
        margin: 20px 0 !important;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        top: 14px;
        right: 14px;
        font-size: 16px;
    }

    /* Modales Emmerson ocultos (el widget no existe en móvil) */
    .panel-share-overlay,
    .modal-app-overlay,
    .modal-video-overlay,
    .modal-info-overlay {
        display: none !important;
    }

    /* Modal estado global: tamaño móvil */
    .status-modal-global-overlay .status-card {
        max-width: 300px;
        padding: 28px 22px;
    }

    /* ---------- FOTO CAPTIONS ---------- */
    .foto-caption {
        font-size: 11px;
        padding: 0 16px;
    }
}

/* ============================================================
   3. MÓVIL PEQUEÑO (≤ 480px) — afinado final
   ============================================================ */
@media (max-width: 480px) {

    .container {
        padding: 0 16px;
    }

    /* Hero aún más compacto */
    .hero {
        padding-top: 80px;
        padding-bottom: 40px;
    }

    .hero-logo-img {
        width: 170px;
    }

    .hero-video-wrap {
        max-width: 290px;
    }

    .hero-bullets {
        gap: 8px 12px;
    }

    .hero-bullets li {
        font-size: 13px;
    }

    .hero-author-name {
        font-size: 16px;
    }

    .hero-author-role {
        font-size: 13px;
    }

    /* Secciones */
    section.block {
        padding: 48px 0;
    }

    .section-title {
        font-size: 32px;
    }

    .section-sub {
        font-size: 16px;
    }

    .section-sub-sub {
        font-size: 12px;
    }

    /* Carruseles */
    .carousel {
        height: 300px;
    }

    #diseno .carousel {
        height: 320px;
    }

    #hiperrealismo .carousel {
        height: 260px;
    }

    .pres-slide img {
        width: 280px;
    }

    .grid-3 img {
        height: 220px;
    }

    /* Botones: que puedan caer en 2 líneas cómodamente */
    .btn,
    .btn-2 {
        padding: 7px 14px;
        font-size: 12px;
    }

    /* Patentes */
    .patentes-col h3 {
        font-size: 42px !important;
    }

    .patentes-col .sub {
        font-size: 14px;
    }

    .patentes-col p {
        font-size: 16px !important;
    }

    /* Modales */
    #modalBody {
        padding: 36px 20px 24px;
    }

    .modal h2 {
        font-size: 22px;
    }

    /* Footer */
    .footer-grid h2 {
        font-size: 20px;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 14px;
        padding: 12px 14px;
    }

    /* Ajustamos el contenedor de los botones de navegación */
    .nav-links {
        display: flex !important;
        justify-content: center !important;
        gap: 20px !important;
        margin-top: 20px !important;
        width: 100% !important;
    }

    /* Aumentamos el tamaño de los textos que quedan */
    .nav-links button,
    .nav-links a {
        font-size: 15px !important;
        font-weight: 600 !important;
    }

    /* OCULTAR "Perfil profesional" (asumiendo que es el tercer elemento) */
    .nav-links button:nth-child(3),
    .nav-links a:nth-child(3) {
        display: none !important;
    }
}

/* ============================================================
   4. MÓVIL MUY PEQUEÑO (≤ 360px) — por si acaso
   ============================================================ */
@media (max-width: 360px) {

    .hero-video-wrap {
        max-width: 260px;
    }

    .section-title {
        font-size: 28px;
    }

    .pres-slide img {
        width: 240px;
    }
}

/* ============================================================
   5. AJUSTES PARA ORIENTACIÓN HORIZONTAL DE MÓVIL
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .hero {
        padding-top: 70px;
        padding-bottom: 30px;
    }

    .hero-video-wrap {
        max-width: 200px;
    }

    .hero-logo-img {
        width: 140px;
    }
}

/* ============================================================
   6. FALLBACK MÓVIL: ocultar en desktop
   ============================================================ */
.mobile-demo-fallback {
    display: none;
}

/* ============================================================
   7. MEJORAS TÁCTILES GENERALES
   ============================================================ */
@media (hover: none) and (pointer: coarse) {

    /* En dispositivos táctiles, la navegación del carrusel siempre visible */
    .carousel-nav {
        opacity: 0.85;
    }

    /* Hover effects neutralizados en táctil (evita estados "atascados") */
    .btn:hover,
    .btn-2:hover {
        background: transparent;
        color: var(--accent);
    }

    .btn-2:hover {
        color: var(--accent-2);
    }
}

@media (max-width: 768px) {
    #desktop-notice-banner {
        display: block;
    }
}

/* ============================================================
   FIX CENTRADO: Modal de estado global (formulario)
   — iPad, móvil iOS/Android
   ============================================================ */

/* Base: asegurar posicionamiento correcto en todos los contextos */
.status-modal-global-overlay {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 30000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    /* Fix Safari/iOS fixed+scroll bug */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: opacity;
}

.status-modal-global-overlay.activo {
    opacity: 1;
    pointer-events: auto;
}

.status-modal-global-overlay .status-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0 auto;
    width: 90%;
    max-width: 340px;
}

.status-modal-global-overlay.activo .status-card {
    transform: scale(1);
}

/* Tablet (iPad) — centrado más fino */
@media (min-width: 768px) and (max-width: 1024px) {
    .status-modal-global-overlay {
        align-items: center;
        padding: 0;
    }

    .status-modal-global-overlay .status-card {
        max-width: 360px;
        margin: auto;
    }
}

/* Móvil — asegurar que el teclado no empuje la tarjeta fuera de pantalla */
@media (max-width: 767px) {
    .status-modal-global-overlay {
        /* En iOS, cuando el teclado está abierto, 100vh puede quedar
           por encima del viewport real. interactive-widget lo ancla. */
        height: 100%;
        align-items: center;
        padding: 0 16px;
    }

    .status-modal-global-overlay .status-card {
        width: 100%;
        max-width: 320px;
        padding: 30px 22px;
        margin: auto;
        border-radius: 20px;
    }
}

/* Móvil pequeño */
@media (max-width: 390px) {
    .status-modal-global-overlay .status-card {
        max-width: 280px;
        padding: 26px 18px;
    }
}

/* ============================================================
   FIX SCROLL: Bloquear body cuando hay modal abierto
   — iOS Safari / iPad bug con position: fixed
   ============================================================ */

body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    /* Preserva la posición del scroll para no saltar al top */
    left: 0;
    right: 0;
}

/* ============================================================
   FIX SCROLL HORIZONTAL: Evitar arrastre lateral de la página
   en iPad / iOS Safari
   ============================================================ */

html,
body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Fix Safari: overflow-x:hidden en html+body no siempre basta,
   hay que anclar también con position */
html {
    position: relative;
}