/* Модалка просмотра изображения. */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Обязательно после display: flex — иначе он перебьёт атрибут hidden. */
.lightbox[hidden] {
    display: none;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: var(--shadow-backdrop);
    cursor: pointer;
}

.lightbox__body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 100%;
}

.lightbox__img {
    display: block;
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 16px;
    object-fit: contain;
}

.lightbox__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-blue);
    color: var(--text-white);
    cursor: pointer;
}

.lightbox__btn svg {
    width: 24px;
    height: 24px;
}

.lightbox__btn:hover {
    background: var(--brand-primary);
}

.lightbox__btn--close {
    top: -56px;
    right: 0;
}

.lightbox__btn--prev {
    top: 50%;
    left: -60px;
    transform: translateY(-50%);
}

.lightbox__btn--next {
    top: 50%;
    right: -60px;
    transform: translateY(-50%);
}

.lightbox__counter {
    color: var(--text-on-dark);
}

.lightbox__counter:empty {
    display: none;
}

/* Страница за открытой модалкой не скроллится. */
.is-locked,
.is-locked body {
    overflow: hidden;
}

@media (max-width: 1080px) {

    .lightbox {
        padding: 16px;
    }

    .lightbox__img {
        max-height: 70vh;
    }

    /* На узком экране стрелки не помещаются по бокам — уводим их под картинку. */
    .lightbox__btn--prev,
    .lightbox__btn--next {
        top: auto;
        bottom: -60px;
        transform: none;
    }

    .lightbox__btn--prev {
        left: 0;
    }

    .lightbox__btn--next {
        right: 0;
    }

    .lightbox__counter {
        margin-bottom: 60px;
    }
}

/* Модалки заявки и «спасибо». Открытие ведёт main.js классом .open. */

.modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--shadow-backdrop);
    overflow-y: auto;
}

.modal.open {
    display: flex;
}

/* Блокировка скролла без JS — тем же приёмом сделано мобильное меню. */
html:has(.modal.open) {
    overflow: hidden;
}

.modal__window {
    position: relative;
    display: grid;
    grid-template-columns: 2fr 1.5fr;
    width: 100%;
    max-width: 820px;
    margin: auto;
    overflow: hidden;
    border-radius: 16px;
    background: var(--bg);
}

.modal--narrow .modal__window {
    display: block;
    max-width: 480px;
}

.modal__main {
    padding: 32px;
}

.modal__side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px;
    background: var(--bg-gray);
}

.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 100px;
    background: var(--bg-cards);
    color: var(--text-secondary);
    cursor: pointer;
}

.modal__close svg {
    width: 14px;
    height: 14px;
}

.modal__close:hover {
    background: var(--brand-primary);
    color: var(--text-white);
}

.modal__badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    height: 32px;
    margin-bottom: 16px;
    padding: 0 12px;
    border-radius: 100px;
    background: var(--bg-cards);
}

.modal__badge-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    color: var(--brand-primary);
}

.modal__text {
    margin-top: 12px;
    color: var(--text-secondary);
}

.modal__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.modal__methods {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.modal__method {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 32px;
    border: 1px solid var(--border-on-light);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    flex: 1;
}

.modal__method.is-active {
    border-color: var(--brand-primary);
}

.modal__method-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.modal__submit {
    width: 100%;
}

.modal__image-img {
    display: block;
    width: 100%;
    height: auto;
}

.modal__side-title {
    margin-top: 12px;
    text-align: center;
}

.modal__side-text {
    margin-top: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.modal__side-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 60px;
}

.modal__side-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-secondary);
}

.modal__side-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--brand-primary);
}

.modal__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px;
    text-align: center;
}

.modal__success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--brand-primary);
    color: var(--text-white);
}

.modal__success-icon svg {
    width: 32px;
    height: 32px;
}

.modal__success .modal__text {
    margin-top: 0;
}

.modal__note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-on-dark);
}

.modal__note-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--state-success-2);
}

@media (max-width: 1080px) {

    .modal {
        padding: 16px;
    }

    .modal__window {
        grid-template-columns: 1fr;
    }

    .modal__main,
    .modal__side,
    .modal__success {
        padding: 24px;
    }

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

    .modal__side {
        display: none;
    }
}
