/* ============================================================
   LEMEX Downloads - Modal (v2)
   Only styles the modal shell. The form itself is WPForms and
   keeps the site's WPForms styling. Adjust --ld-primary to the
   LEMEX brand colour.
   ============================================================ */

:root {
    --ld-primary:       #003a8c; /* LEMEX blue - adjust if needed */
    --ld-primary-hover: #002a6a;
    --ld-radius:        6px;
    --ld-shadow:        0 24px 64px rgba(0, 0, 0, 0.35);
}

/* ---- Overlay ---- */

#lemex-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
}

#lemex-modal[aria-hidden="false"] {
    display: block;
}

.ld-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    animation: ld-fade-in 0.2s ease;
}

/* ---- Box ---- */

.ld-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: var(--ld-radius);
    padding: 44px 40px 40px;
    width: 90%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--ld-shadow);
    animation: ld-slide-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ld-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ld-slide-in {
    from { transform: translate(-50%, -46%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

/* ---- Close button ---- */

.ld-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}

.ld-close:hover { color: #333; }

/* ---- Typography ---- */

.ld-box h2 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
    color: #1a1a1a;
}

.ld-intro {
    margin: 0 0 24px;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Light brand polish on the embedded WPForms form ---- */
/* Scoped to #lemex-modal so the standalone contact form is untouched. */

#lemex-modal .wpforms-container {
    margin: 0;
}

#lemex-modal .wpforms-form .wpforms-field {
    padding: 8px 0;
}

#lemex-modal .wpforms-form button[type="submit"] {
    background: var(--ld-primary);
    border-color: var(--ld-primary);
    transition: background 0.2s, border-color 0.2s;
}

#lemex-modal .wpforms-form button[type="submit"]:hover {
    background: var(--ld-primary-hover);
    border-color: var(--ld-primary-hover);
}

/* ---- Mobile ---- */

@media (max-width: 520px) {
    .ld-box {
        padding: 36px 20px 28px;
    }
}

/* ---- Keep the close button pinned in every state ---- */
/* Some themes restyle button:focus / :active (position + background).
   That made the close button jump to the top-left and turn blue when
   clicked, so the click never completed and the modal needed a second
   click to close. These overrides keep it fixed top-right and plain. */

#lemex-modal .ld-close,
#lemex-modal .ld-close:hover,
#lemex-modal .ld-close:focus,
#lemex-modal .ld-close:focus-visible,
#lemex-modal .ld-close:active {
    position: absolute !important;
    top: 14px !important;
    right: 18px !important;
    left: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}
