/* ══════════════════════════════════════
   globals/form-modal — CSS
   Clases .frm-* base vienen de S6/styles.css
   Clases propias: .lt-modal-* (sin colisión)
   Enqueue en WP en TODAS las páginas.
══════════════════════════════════════ */

/* ── Overlay ──────────────────────────────────── */
#frm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, .88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    padding: 1rem;
    overflow: hidden;
}

#frm-modal-overlay.is-open {
    pointer-events: auto;
}

/* ── Caja principal ────────────────────────────── */
#frm-modal-box {
    position: relative !important;
    display: flex;
    width: min(96vw, 1200px);
    height: min(90vh, 820px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .85);
    border: 1px solid rgba(255, 255, 255, .18);
    background: var(--color-modal-bg, #060C18);
    will-change: transform;
}

/* ── Botón de cierre ───────────────────────────── */
#frm-modal-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: background .2s, color .2s, border-color .2s;
    flex-shrink: 0;
}

#frm-modal-close svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

#frm-modal-close:hover {
    background: rgba(255, 255, 255, .14);
    color: var(--color-white, #fff);
    border-color: rgba(255, 255, 255, .25);
}

#frm-modal-close:focus-visible {
    outline: 2px solid var(--color-green, #39b54a);
    outline-offset: 2px;
}

/* ── Panel visual — izquierdo ─────────────────── */
.lt-modal-visual {
    flex: 0 0 42%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.8rem 2.4rem;
    background: var(--color-s6-detail);
    border-right: 1px solid rgba(255, 255, 255, .08);
}

/* Canvas hex slideshow */
#lt-hex-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}


/* ── Panel formulario — derecho ───────────────── */
.lt-modal-panel {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    border-left: 1px solid rgba(255, 255, 255, .05);
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.lt-modal-panel::-webkit-scrollbar { display: none; }

.lt-modal-panel-inner {
    padding: clamp(1.8rem, 4vh, 3rem) clamp(1.5rem, 3.5vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-height: 100%;
    justify-content: center;
}

/* ── Header del modal ─────────────────────────── */
.lt-modal-header { flex-shrink: 0; }

.lt-modal-title {
    font-family: var(--font-display, 'Bebas Neue', sans-serif);
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    line-height: .9;
    color: var(--color-white, #fff);
    margin: .3rem 0 0;
    white-space: normal;
}

.lt-modal-accent {
    color: var(--color-green, #39b54a);
}

/* ── Campos ───────────────────────────────────── */
.lt-modal-form-wrap {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.lt-modal-field-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

/* Nombre + Teléfono en fila */
.lt-modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
}

/* Chips ajustados al modal */
.lt-modal-chips {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: .4rem !important;
}

/* Submit */
.lt-modal-submit { align-self: flex-start; }

/* ── Success state ─────────────────────────────
   Sin position:absolute — fluye en el panel.
─────────────────────────────────────────────── */
.lt-modal-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.4rem;
    padding: 2.5rem 3rem;
}

.lt-modal-success.is-visible {
    display: flex;
}

.lt-modal-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--color-green, #39b54a);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(57, 181, 74, .08);
    box-shadow: 0 0 30px rgba(57, 181, 74, .15);
}

.lt-modal-success-icon svg {
    width: 34px;
    height: 34px;
}

.lt-modal-success-title {
    font-family: var(--font-display, 'Bebas Neue', sans-serif);
    font-size: clamp(2.4rem, 4vw, 3.5rem);
    color: var(--color-white, #fff);
    letter-spacing: .06em;
    line-height: 1;
}

.lt-modal-success-text {
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: .9rem;
    color: rgba(255, 255, 255, .55);
    line-height: 1.7;
    max-width: 340px;
}

.lt-modal-success-btn {
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-green, #39b54a);
    background: transparent;
    border: 1px solid rgba(57, 181, 74, .5);
    border-radius: 8px;
    padding: .7rem 1.8rem;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-top: .4rem;
}

.lt-modal-success-btn:hover {
    background: var(--color-green, #39b54a);
    color: var(--color-black, #000);
    border-color: var(--color-green, #39b54a);
}


/* ═══════════════════════════════════════════════
   ESTILOS BASE .frm-* DENTRO DEL MODAL
   S6/styles.css scopea todo con .lt-s6 — aquí
   redeclaramos solo lo necesario para el modal.
═══════════════════════════════════════════════ */

#frm-modal-box .frm-panel-label,
#frm-modal-box .frm-label {
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
    display: block;
    margin-bottom: .3rem;
}

#frm-modal-box .frm-input {
    width: 100%;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: .88rem;
    color: var(--color-white, #fff);
    outline: none;
    transition: border-color .2s, background .2s;
    box-sizing: border-box;
}

#frm-modal-box .frm-input::placeholder {
    color: rgba(255, 255, 255, .2);
}

#frm-modal-box .frm-input:focus {
    border-color: var(--color-blue, #0257d2);
    background: rgba(2, 87, 210, .06);
}

#frm-modal-box .frm-input.error {
    border-color: var(--color-error);
    background: rgba(224, 82, 82, .05);
}

#frm-modal-box textarea.frm-input {
    resize: none;
    min-height: clamp(4.5rem, 8vh, 7rem);
}

/* Chips */
#frm-modal-box .frm-chips {
    display: grid;
    gap: .4rem;
}

#frm-modal-box .frm-chip {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    padding: .55rem .7rem;
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: .78rem;
    color: rgba(255, 255, 255, .65);
    cursor: pointer;
    text-align: center;
    transition: background .2s, border-color .2s, color .2s;
    user-select: none;
}

#frm-modal-box .frm-chip:hover {
    border-color: rgba(57, 181, 74, .4);
    color: rgba(255, 255, 255, .9);
}

#frm-modal-box .frm-chip.selected {
    background: rgba(57, 181, 74, .12);
    border-color: var(--color-green, #39b54a);
    color: var(--color-green, #39b54a);
}

/* Submit */
#frm-modal-box .frm-submit,
#frm-modal-box .lt-modal-submit {
    font-family: var(--font-display, 'Bebas Neue', sans-serif);
    font-size: 1rem;
    letter-spacing: .1em;
    color: var(--color-black, #000);
    background: var(--color-green, #39b54a);
    border: none;
    border-radius: 8px;
    padding: .85rem 2.2rem;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

#frm-modal-box .frm-submit:hover,
#frm-modal-box .lt-modal-submit:hover {
    opacity: .88;
    transform: translateY(-1px);
}

/* ── Responsive ────────────────────────────────── */

/* ─────────────────────────────────────────────────
   TABLET LANDSCAPE + DESKTOP MEDIO (821–1099px)
───────────────────────────────────────────────── */
@media (min-width: 821px) and (max-width: 1099px) {
    .lt-modal-visual { flex: 0 0 38%; padding: 1.5rem 1rem; }
    .lt-modal-title  { font-size: clamp(1.8rem, 2.8vw, 2.8rem); }
    .lt-modal-chips  { grid-template-columns: repeat(2, 1fr) !important; }

    /* Logos adaptados al panel más angosto */
    #lt-modal-logo  { width: 110px; bottom: 20px; left: 20px; }
    /* #lt-modal-brand ocultada globalmente */
}

/* ─────────────────────────────────────────────────
   TABLET PORTRAIT — iPad Air (820px) + iPad Mini (768px)
───────────────────────────────────────────────── */
@media (max-width: 820px) and (min-height: 601px) {
    #frm-modal-overlay {
        align-items: center;
        padding: 1.2rem;
    }

    #frm-modal-box {
        width: min(94vw, 720px);
        height: auto;
        max-height: 88svh;
        border-radius: 20px;
        flex-direction: row;
    }

    .lt-modal-visual {
        display: flex;
        flex: 0 0 35%;
        padding: 1.5rem 1.2rem;
    }

    /* Logos adaptados al panel más angosto en portrait */
    #lt-modal-logo  { width: 90px; bottom: 16px; left: 16px; }
    /* #lt-modal-brand ocultada globalmente */
    /* Gradientes más cortos en panel angosto */
    .lt-modal-visual::before,
    .lt-modal-visual::after { height: 110px; }

    .lt-modal-panel {
        border-left: 1px solid rgba(255, 255, 255, .06);
        border-top: none;
    }

    .lt-modal-panel-inner {
        padding: 1.8rem 1.4rem;
        gap: .9rem;
        justify-content: center;
    }

    .lt-modal-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }

    .lt-modal-row { grid-template-columns: 1fr 1fr; gap: .7rem; }

    .lt-modal-chips {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: .35rem !important;
    }

    .lt-modal-submit { align-self: flex-start; width: auto; }

    #frm-modal-close {
        top: .9rem;
        right: .9rem;
    }
}

/* ─────────────────────────────────────────────────
   MOBILE PORTRAIT — filosofía: todo cabe en pantalla, sin scroll.
   El box tiene max-height:92svh y comprime su contenido.
   En pantallas muy cortas (≤680px) se aprieta más agresivamente.
   Dispositivos cubiertos: iPhone SE (375×667), Galaxy S8+ (360×740),
   iPhone 12/13/14 (390×844), Galaxy A54 (360×800), etc.
───────────────────────────────────────────────── */
@media (max-width: 480px) and (orientation: portrait) {
    /* Overlay: centrado — el box cabe en pantalla */
    #frm-modal-overlay {
        align-items: center;
        justify-content: center;
        padding: .75rem;
        overflow: hidden;
    }

    /* Box: crece hasta 92svh, luego su panel interno scrollea */
    #frm-modal-box {
        width: 100%;
        height: auto;
        max-height: 92svh;
        border-radius: 20px;
        flex-direction: column;
        overflow: hidden;
    }

    /* Sin mapa */
    .lt-modal-visual { display: none; }

    /* Panel: scrollea internamente si el contenido no cabe */
    .lt-modal-panel {
        flex: 1;
        height: auto;
        border-left: none;
        border-top: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lt-modal-panel-inner {
        padding: 1.4rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom, 10px));
        gap: .6rem;
        justify-content: flex-start;
        min-height: unset;
    }

    .lt-modal-title { font-size: clamp(1.6rem, 9.5vw, 2rem); line-height: 1.0; }

    .lt-modal-chips {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: .28rem !important;
    }
    #frm-modal-box .frm-chip  { font-size: .72rem; padding: .42rem .3rem; }
    #frm-modal-box .frm-label { font-size: .7rem; margin-bottom: .15rem; }
    #frm-modal-box .frm-input { font-size: .85rem; padding: .55rem .8rem; }
    #frm-modal-box textarea.frm-input { min-height: 3.5rem; }

    .lt-modal-row { grid-template-columns: 1fr 1fr; gap: .5rem; }

    .lt-modal-form-wrap { gap: .6rem; }

    .lt-modal-submit {
        align-self: stretch;
        width: 100%;
        min-height: 46px;
        font-size: .9rem;
    }

    #frm-modal-close {
        top: .8rem;
        right: .8rem;
        width: 34px;
        height: 34px;
    }
}

/* ─────────────────────────────────────────────────
   MOBILE PORTRAIT CORTO — pantallas ≤ 680px de alto
   iPhone SE (667px), Galaxy S8+ (740→con barra ~680px útil)
   Compresión extra para que todo entre sin scroll.
───────────────────────────────────────────────── */
@media (max-width: 480px) and (orientation: portrait) and (max-height: 680px) {
    .lt-modal-panel-inner {
        padding: 1rem .9rem calc(1rem + env(safe-area-inset-bottom, 8px));
        gap: .4rem;
    }

    .lt-modal-title { font-size: clamp(1.35rem, 8.5vw, 1.7rem); }

    #frm-modal-box .frm-chip  { font-size: .67rem; padding: .35rem .25rem; }
    #frm-modal-box .frm-input { font-size: .82rem; padding: .45rem .7rem; }
    #frm-modal-box textarea.frm-input { min-height: 2.8rem; }

    .lt-modal-form-wrap { gap: .45rem; }

    .lt-modal-submit { min-height: 42px; font-size: .85rem; }
}

/* ─────────────────────────────────────────────────
   LANDSCAPE MOBILE — iPhones / Android en horizontal.
   El OVERLAY scrollea — Lenis se destruye al abrir
   para liberar los eventos touch (ver form.js).
───────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 959px) {
    #frm-modal-overlay {
        align-items: flex-start;
        justify-content: center;
        padding: 1rem .6rem 2rem;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: none;
    }

    #frm-modal-box {
        width: 100%;
        height: auto;
        min-height: min-content;
        max-height: none;
        border-radius: 18px;
        flex-direction: column;
        overflow: visible;
        position: relative;
        flex-shrink: 0;
        margin-top: .5rem;
    }

    .lt-modal-visual { display: none; }

    .lt-modal-panel {
        flex: none;
        width: 100%;
        height: auto;
        min-height: 0;
        border-left: none;
        border-top: none;
        overflow: visible;
    }

    .lt-modal-panel-inner {
        padding: 2.8rem 1.1rem 1.2rem;
        gap: .5rem;
        justify-content: flex-start;
        min-height: unset;
    }

    .lt-modal-header  { display: flex; flex-direction: column; gap: .15rem; }
    .lt-modal-eyebrow { font-size: .62rem; }
    .lt-modal-title   { font-size: clamp(1.25rem, 4vw, 1.7rem); line-height: 1.05; }

    .lt-modal-row { grid-template-columns: 1fr 1fr; gap: .5rem; }

    .lt-modal-chips {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: .28rem !important;
    }

    #frm-modal-box .frm-chip    { padding: .35rem .45rem; font-size: .73rem; }
    #frm-modal-box .frm-label   { font-size: .7rem; margin-bottom: .1rem; }
    #frm-modal-box .frm-input   { padding: .45rem .75rem; font-size: .82rem; }
    #frm-modal-box textarea.frm-input { min-height: 2.8rem; }

    .lt-modal-submit {
        align-self: stretch;
        width: 100%;
        min-height: 44px;
        padding: .6rem 1.5rem;
        font-size: .88rem;
    }

    #frm-modal-close {
        position: absolute;
        top: .7rem;
        right: .85rem;
        width: 32px;
        height: 32px;
        z-index: 10;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #frm-modal-overlay,
    #frm-modal-box { transition: none !important; }
    #lt-hex-canvas { transition: none !important; }
}
/* ── Logo panel visual ─────────────────────────── */
#lt-modal-logo {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 80px;
    height: auto;
    z-index: 4;
    opacity: 0.60;
    pointer-events: none;
    filter: brightness(0) invert(1);
}

/* ── Gradiente superior — legibilidad logo marca ── */
.lt-modal-visual::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 160px;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.72) 0%,
        rgba(0,0,0,0) 100%);
    z-index: 3;
    pointer-events: none;
}

/* ── Gradiente inferior — legibilidad logo Level ── */
.lt-modal-visual::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 160px;
    background: linear-gradient(to top,
        rgba(0,0,0,0.75) 0%,
        rgba(0,0,0,0) 100%);
    z-index: 3;
    pointer-events: none;
}

/* ── Logo Level Tech — bottom left ─────────────── */
#lt-modal-logo {
    position: absolute;
    bottom: 28px;
    left: 28px;
    width: 150px;
    height: auto;
    z-index: 4;
    opacity: 0.92;
    pointer-events: none;
    filter: brightness(0) invert(1);
}

/* ── Marca del slide — OCULTA (solo queda logo bottom-left) ── */
#lt-modal-brand { display: none !important; }