.hm-modal-overlay[hidden] {
    display: none !important;
}

.hm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    padding: 1.5rem;
    place-items: center;
    opacity: 0;
    background: rgba(0, 0, 0, .76);
    backdrop-filter: blur(5px);
    transition: opacity .18s ease;
}

.hm-modal-overlay.is-open {
    opacity: 1;
}

.hm-modal {
    width: 100%;
    max-width: 760px;
    max-height: min(90vh, 620px);
    display: grid;
    gap: 1.35rem;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--border-red);
    border-radius: var(--hm-card-radius, 10px);
    background: linear-gradient(135deg, #181818, #090909);
    box-shadow: 0 32px 80px rgba(0, 0, 0, .72);
    overflow-y: auto;
    transform: translateY(12px) scale(.985);
    transition: transform .18s ease;
}

.hm-modal-overlay.is-open .hm-modal {
    transform: translateY(0) scale(1);
}

.hm-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.hm-modal-header h2 {
    margin: 0 0 .35rem;
    color: #fff;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.hm-modal-header p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hm-close-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    font-size: 1.4rem;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.hm-close-btn:hover {
    border-color: var(--brand-red);
    color: #fff;
    background: rgba(204, 51, 51, .12);
}

.hm-modal-body .hm-search-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .65rem;
}

.hm-modal-body .search-submit {
    min-width: 110px;
}

@media (max-width: 560px) {
    .hm-modal-overlay {
        padding: 1rem;
        align-items: start;
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .hm-modal {
        max-height: calc(100vh - 2rem);
    }

    .hm-modal-body .hm-search-wrapper {
        grid-template-columns: 1fr;
    }

    .hm-modal-body .search-submit {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-modal-overlay,
    .hm-modal {
        transition-duration: .01ms;
    }
}
