/**
 * Модальные формы (объект / посёлок с менеджером, обратный звонок без менеджера)
 * и разметка анонсов со ссылками-карточками.
 */

/* Выше шапки: .header z-index:10000, .inner-page .header z-index:1000000 (style.css) */
.modal-callback-overlay.webform-modal-overlay {
    z-index: 1000001;
    isolation: isolate;
}

.webform-modal-overlay .modal-callback-overlay__backdrop {
    background: rgba(27, 38, 22, 0.72);
}

/* Низкий экран: модалка прижата к верху, без внутренней прокрутки */
@media (max-height: 720px) {
    .modal-callback-overlay.webform-modal-overlay {
        align-items: flex-start;
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }
    .modal-callback__form {
        gap: 10px;
    }
    .webform-modal__alert {
        display: none;
    }
}

/* -------------------------------------------------------------------------
 * Модальные окна: сброс старой сетки .modal-callback из style.css + размеры
 * ------------------------------------------------------------------------- */
.webform-modal-overlay .modal-callback.webform-modal {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    grid-template-rows: unset;
    max-width: 420px;
    width: calc(100% - 32px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    margin: auto;
    padding: 40px 20px 16px;
    overflow: visible;
    background: #FFF0DA;
    box-shadow: none;
    border-radius: 27px;
}

.webform-modal-overlay .modal-callback.webform-modal--with-manager {
    max-width: 600px;
    width: calc(100% - 32px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    padding: 40px 16px 12px;
    background: transparent;
}

.webform-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #1c1c1e;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.webform-modal__close:hover {
    background: #fff;
}

/* ——— С менеджером (макет 28) ——— */
/* Фон окна прозрачный: «дыра» между карточками и отступы показывают оверлей за модалкой */
.webform-modal--with-manager {
    background: transparent;
    border-radius: 24px;
    padding: 28px 24px 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.webform-modal__shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 2px;
    overflow: visible;
}

/* 8px сквозной разрыв: виден backdrop (затемнение) под модальным окном */
.webform-modal__between {
    flex-shrink: 0;
    width: 100%;
    height: 8px;
    min-height: 8px;
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
}

.webform-modal__manager {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 14px;
    padding: 16px 18px;
    background: #f9f1e0;
    border-radius: 16px;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 0;
}

.webform-modal__manager-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 1 auto;
    max-width: min(46%, 200px);
    min-width: 0;
}

.webform-modal__manager-photo {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.webform-modal__manager-name {
    margin: 0;
    font-family: Forum, 'Times New Roman', serif;
    font-weight: 400;
    font-style: normal;
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: -0.04em;
    color: #a62a36;
}

.webform-modal__manager-role {
    margin: 6px 0 0;
    font-family: 'Inter Tight', Manrope, sans-serif;
    font-weight: 300;
    font-style: normal;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0;
    color: #3a3a3a;
}

.webform-modal__bubble {
    flex: 1 1 200px;
    min-width: min(100%, 180px);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    align-self: stretch;
}

.webform-modal__bubble-text {
    margin: 0;
    font-family: Forum, Georgia, 'Times New Roman', serif;
    font-weight: 400;
    font-style: normal;
    font-size: clamp(1.1rem, 4.2vw, 1.85rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #1c1c1e;
}

@media (max-width: 520px) {
    .webform-modal__bubble-text {
        letter-spacing: -0.02em;
    }
}

.webform-modal__body {
    flex-shrink: 0;
    margin: 0;
    padding: 16px 18px 18px;
    background: #f9f1e0;
    border-radius: 16px;
    position: relative;
    z-index: 0;
}

.webform-modal__form .webform-modal__field {
    margin-bottom: 4px;
}

.webform-modal__label {
    display: block;
    margin-bottom: 8px;
}

.webform-modal__label-text {
    display: block;
    font-family: Manrope, sans-serif;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: #777;
    margin-bottom: 2px;
}

.webform-modal__input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid rgba(28, 28, 30, 0.22);
    background: transparent;
    padding: 6px 0 6px;
    font-family: Manrope, sans-serif;
    font-size: 14px;
    color: #1c1c1e;
    border-radius: 0;
}

.webform-modal__input::placeholder {
    color: #9a9a9a;
}

.webform-modal__input:focus {
    outline: none;
    border-bottom-color: #a62a36;
}

textarea.webform-modal__input {
    min-height: 48px;
    max-height: 90px;
    resize: none;
    line-height: 1.35;
}

.webform-modal__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: Manrope, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: #444;
    margin: 12px 0 8px;
    cursor: pointer;
}

.webform-modal__check input {
    margin-top: 3px;
    flex-shrink: 0;
}

.webform-modal__file {
    display: block;
    margin-bottom: 12px;
    font-family: Manrope, sans-serif;
    font-size: 13px;
}

.webform-modal__submit {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px 20px;
    border: none;
    border-radius: 999px;
    background: #a62a36;
    color: #fff;
    font-family: Forum, Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.15s ease;
}

.webform-modal__submit:hover {
    filter: brightness(1.06);
}

.webform-modal__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.webform-modal__alert {
    min-height: 1.25em;
    margin-top: 10px;
    font-family: Manrope, sans-serif;
    font-size: 13px;
    color: #b00020;
}

.webform-modal__legal {
    margin: 10px 0 0;
    font-family: Manrope, sans-serif;
    font-size: 11px;
    line-height: 1.45;
    color: #666;
    text-align: center;
}

.webform-modal__legal--after-submit {
    margin: 14px 0 0;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
    color: #6e6e6e;
    text-align: center;
}

.webform-modal__legal a {
    color: #a62a36;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.webform-modal__subscribe {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0;
    cursor: pointer;
    font-family: Manrope, sans-serif;
    font-size: 11px;
    line-height: 1.45;
    color: #555;
}

.webform-modal__subscribe-input {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: #a62a36;
    cursor: pointer;
}

.webform-modal__subscribe-text {
    flex: 1;
    min-width: 0;
}

@media (max-width: 560px) {
    .webform-modal__manager-profile {
        flex: 1 1 100%;
        max-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px 14px;
    }

    .webform-modal__manager-photo {
        margin-bottom: 0;
    }

    .webform-modal__manager-profile .webform-modal__manager-name,
    .webform-modal__manager-profile .webform-modal__manager-role {
        flex: 1 1 140px;
        min-width: 0;
    }

    .webform-modal__bubble {
        flex: 1 1 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .webform-modal-overlay .modal-callback.webform-modal--with-manager {
        padding: 36px 12px 10px;
    }

    .webform-modal--with-manager {
        padding: 16px 12px 12px;
    }

    .webform-modal__manager,
    .webform-modal__body {
        padding: 14px 14px;
    }
}

/* Низкий экран: ещё плотнее, без прокрутки внутри модалки */
@media (max-height: 700px) {
    .webform-modal-overlay .modal-callback.webform-modal {
        padding: 34px 14px 10px;
    }

    .webform-modal-overlay .modal-callback.webform-modal--with-manager {
        padding: 34px 12px 8px;
    }

    .webform-modal__between {
        height: 4px;
        min-height: 4px;
    }

    .webform-modal__manager {
        padding: 12px 14px;
        gap: 8px 10px;
    }

    .webform-modal__manager-photo {
        width: 56px;
        height: 56px;
    }

    .webform-modal__body {
        padding: 12px 14px 14px;
    }

    .webform-modal__lead {
        margin-bottom: 14px;
    }

    .webform-modal__heading {
        margin-bottom: 6px;
    }
}

@media (max-height: 560px) {
    .webform-modal__bubble-text {
        font-size: 1rem;
        line-height: 1.15;
    }

    .webform-modal__submit {
        margin-top: 8px;
        padding: 10px 16px;
        font-size: 15px;
    }
}

/* ——— Без менеджера (макет 11) ——— */
.webform-modal-overlay .modal-callback.webform-modal.webform-modal--simple {
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    overflow: visible;
    padding: 40px 18px 14px;
}

.webform-modal--simple {
    background: #fff9f0;
    border-radius: 26px;
    padding: 24px 22px 20px;
    max-width: 420px;
    width: calc(100% - 32px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.webform-modal__simple-inner {
    padding-top: 2px;
    overflow: visible;
}

.webform-modal__heading {
    margin: 0 0 10px;
    font-family: Forum, 'Times New Roman', serif;
    font-size: clamp(1.5rem, 4vw, 1.85rem);
    font-weight: 400;
    text-align: center;
    color: #1c1c1e;
    line-height: 1.2;
}

.webform-modal__lead {
    margin: 0 0 16px;
    font-family: Manrope, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    color: #6e6e6e;
}

@media (max-width: 480px) {
    .webform-modal__lead {
        margin-bottom: 12px;
        font-size: 12px;
    }

    .webform-modal-overlay .modal-callback.webform-modal.webform-modal--simple {
        padding: 36px 14px 12px;
    }
}

.webform-modal__form--simple .webform-modal__field {
    margin-bottom: 4px;
}

.webform-modal__legal--simple {
    margin-top: 18px;
}

/* ——— Модалка «Получить консультацию» (форма 216, screen 10) ——— */
.webform-modal--office-consult .webform-modal__heading {
    max-width: 18em;
    margin-left: auto;
    margin-right: auto;
}

.webform-modal__form--office-consult .webform-modal__field {
    margin-bottom: 6px;
}

/* -------------------------------------------------------------------------
 * Анонсы: ссылка на карточке, стрелки слайдера поверх
 * ------------------------------------------------------------------------- */
.listing-card__gallery-link {
    display: block;
    position: relative;
    z-index: 1;
    color: inherit;
    text-decoration: none;
}

.listing-card__body-link {
    display: block;
    position: relative;
    z-index: 1;
    color: inherit;
    text-decoration: none;
}

.listing-card__slider .listing-card__arrow {
    z-index: 4;
}

.listing-card__btn--text {
    pointer-events: none;
}
