/*
 * Bulvar Mall — модалки как боковые панели.
 * На десктопе и планшете модалка каталога (.modal) и модалка организации (.org-modal) выезжают справа
 * на всю высоту экрана: сверху фирменная полоска из четырёх цветов, фото, заголовок, чип категории,
 * описание и список «Этаж / Режим работы / Контакты» строками. На телефоне остаётся выезд снизу.
 */

/* фон под модалками и меню: чуть темнее и с лёгким размытием */
.overlay,
.org-modal__backdrop {
    background: rgba(30, 31, 34, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

@media screen and (min-width: 769px) {
    /* ---------- модалка каталога, акций и услуг ---------- */
    .modal {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(560px, 100vw);
        max-width: none;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        border-style: solid;
        border-width: 4px 0 0;
        border-image: linear-gradient(90deg,
                var(--brand-green) 0 25%,
                var(--brand-blue) 25% 50%,
                var(--brand-orange) 50% 75%,
                var(--brand-purple) 75% 100%) 1;
        box-shadow: -24px 0 64px rgba(35, 36, 39, 0.18);
        opacity: 1;
        visibility: hidden;
        transform: translateX(105%);
        transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.5s;
    }

    .modal.active {
        visibility: visible;
        transform: none;
        transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
    }

    .modal .modal-close {
        top: 16px;
        right: 16px;
        height: 40px;
        padding: 0 14px;
        gap: 6px;
        font-size: 15px;
        color: var(--brand-graphite);
        border: 1px solid var(--filters-border-color);
        box-shadow: none;
        transition: background-color 0.2s, border-color 0.2s;
    }

    .modal .modal-close i {
        font-size: 13px;
    }

    .modal .modal-close:hover {
        background: var(--template-page-bg);
    }

    .modal .modal__images {
        height: 320px;
        min-height: 320px;
    }

    /* без фото заголовок не должен залезать под кнопку «Закрыть» */
    .modal .modal__header + .modal__content {
        padding-top: 76px;
    }

    .modal__content {
        gap: 20px;
        padding: 28px 32px 40px;
    }

    .modal__content .modal__content-top {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px 16px;
    }

    .modal__content .modal-title {
        flex: 1 1 auto;
        font-size: 30px;
        line-height: 1.15;
        color: var(--brand-graphite);
    }

    /* перенос строки: заголовок и соцсети сверху, чип категории — под ними */
    .modal__content .modal__content-top::after {
        content: "";
        order: 2;
        flex-basis: 100%;
        height: 0;
    }

    /* категория — чип-параллелограмм в оттенке раздела */
    .modal__content .modal-subtitle {
        order: 3;
        width: max-content;
        padding: 4px 16px;
        font-size: 14px;
        font-weight: 500;
        color: var(--brand-graphite);
        background: var(--section-tint);
        clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 10px 100%);
    }

    .modal__content .modal-desc {
        font-size: 16px;
        font-weight: 400;
        line-height: 1.6;
        color: #4A4B50;
    }

    .modal__content .modal-desc p + p {
        margin-top: 10px;
    }

    .modal__content .content-info {
        gap: 0;
        border-top: 1px solid var(--filters-border-color);
    }

    .modal__content .content-info:empty {
        display: none;
    }

    .modal__content .content-info__item {
        display: grid;
        grid-template-columns: 150px minmax(0, 1fr);
        gap: 16px;
        padding: 14px 0;
        border-bottom: 1px solid var(--filters-border-color);
    }

    .modal__content .content-info__item span {
        font-size: 14px;
        font-weight: 500;
        color: #6B6C72;
        opacity: 1;
    }

    .modal__content .content-info__item p {
        font-size: 16px;
        font-weight: 600;
        color: var(--brand-graphite);
    }

    /* ---------- модалка организации (схема ТЦ, «Услуги») ---------- */
    .org-modal {
        align-items: stretch;
        justify-content: flex-end;
        padding: 0;
    }

    .org-modal__dialog {
        width: min(560px, 100vw);
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        border-style: solid;
        border-width: 4px 0 0;
        border-image: linear-gradient(90deg,
                var(--brand-green) 0 25%,
                var(--brand-blue) 25% 50%,
                var(--brand-orange) 50% 75%,
                var(--brand-purple) 75% 100%) 1;
        box-shadow: -24px 0 64px var(--om-shadow);
        opacity: 1;
        transform: translateX(105%);
        transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .org-modal.is-open .org-modal__dialog {
        transform: none;
    }

    .org-modal__close {
        top: 16px;
        right: 16px;
    }

    .org-modal__close:hover {
        transform: none;
        background: var(--om-surface-2);
    }
}

/* содержимое появляется следом за панелью */
@media screen and (min-width: 769px) and (prefers-reduced-motion: no-preference) {
    .modal.active .modal__content > *,
    .org-modal.is-open .org-modal__content > * {
        animation: bm-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    }

    .modal.active .modal__content > :nth-child(1),
    .org-modal.is-open .org-modal__content > :nth-child(1) { animation-delay: 0.15s; }
    .modal.active .modal__content > :nth-child(2),
    .org-modal.is-open .org-modal__content > :nth-child(2) { animation-delay: 0.21s; }
    .modal.active .modal__content > :nth-child(3),
    .org-modal.is-open .org-modal__content > :nth-child(3) { animation-delay: 0.27s; }
    .modal.active .modal__content > :nth-child(n+4),
    .org-modal.is-open .org-modal__content > :nth-child(n+4) { animation-delay: 0.33s; }
}

@media (prefers-reduced-motion: reduce) {
    .modal,
    .modal.active,
    .org-modal__dialog {
        transition: none;
    }
}
