/* ==========================================================================
   Форма записи во всплывающем окне (#leadModal) + кнопка в мобильном меню
   Бренд: фон #0a0a0a / #111, акцент #E8003D, hover #ba0031, radius 0.
   ========================================================================== */

/* ---------- Окно ---------- */
.lead-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10050;            /* выше cookie-баннера (10000), липких панелей и мобильного меню */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--ff-body, 'Inter', sans-serif);
}
.lead-modal[hidden] { display: none; }
.lead-modal *,
.lead-modal *::before,
.lead-modal *::after { box-sizing: border-box; }

.lead-modal__overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .72);
    opacity: 0;
    transition: opacity .2s ease;
}
.lead-modal__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    background: #111;
    border: 1px solid #2a2a2a;
    border-top: 2px solid #E8003D;
    color: #fff;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
    outline: none;
}
.lead-modal.is-open .lead-modal__overlay { opacity: 1; }
.lead-modal.is-open .lead-modal__panel { opacity: 1; transform: none; }

.lead-modal__head {
    display: flex;
    flex: none;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 32px 32px 0;
}
.lead-modal__headtext { min-width: 0; }
.lead-modal__title {
    margin: 0 0 8px;
    font-family: 'PFDinDisplayPro', sans-serif;
    font-size: clamp(24px, 4vw, 30px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .01em;
    text-transform: uppercase;
    color: #fff;
}
.lead-dot { color: #E8003D; }
.lead-modal__sub {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #888;
}
.lead-modal__close {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -8px -12px 0 0;
    padding: 0;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    transition: color .2s ease;
}
.lead-modal__close:hover { color: #E8003D; }
.lead-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px 32px 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ---------- Поля ---------- */
.lead-form { margin: 0; }
.lead-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.lead-field { margin: 0 0 16px; }
.lead-label {
    display: block;
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #888;
}
.lead-req { color: #E8003D; }
.lead-input {
    display: block;
    width: 100%;
    height: 52px;
    padding: 0 16px;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 0;
    font-family: inherit;
    font-size: 16px;            /* 16px: iOS не увеличивает страницу при фокусе */
    line-height: 1.4;
    color: #fff;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .2s ease;
}
.lead-input::placeholder { color: #666; }
.lead-input:focus { outline: none; border-color: #E8003D; }
.lead-textarea {
    height: auto;
    min-height: 96px;
    padding: 14px 16px;
    resize: vertical;
}
.lead-select {
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23ffffff' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}
.lead-select option,
.lead-select optgroup { background: #111; color: #fff; }
.lead-date { min-width: 0; }
.lead-date::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.lead-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 16px;
}
.lead-row .lead-field { min-width: 0; }

/* поле «Что вас интересует» появляется плавно */
.lead-other {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .2s ease;
}
.lead-other[data-open="1"] { grid-template-rows: 1fr; }
.lead-other__inner { min-height: 0; overflow: hidden; }

/* ошибки */
.lead-field.is-invalid .lead-input { border-color: #E8003D; }
.lead-field.is-invalid .lead-check__box { border-color: #E8003D; }
.lead-err {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #ff4d78;
}
.lead-err[hidden],
.lead-formerr[hidden] { display: none; }
.lead-formerr {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-left: 2px solid #E8003D;
    background: rgba(232, 0, 61, .1);
    font-size: 14px;
    line-height: 1.5;
    color: #fff;
}
.lead-formerr a { color: #fff; text-decoration: underline; }

/* ---------- Чекбокс согласия ---------- */
.lead-field--consent { margin-bottom: 20px; }
.lead-check {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}
.lead-check input {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.lead-check__box {
    position: relative;
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    transition: background-color .2s ease, border-color .2s ease;
}
.lead-check input:checked + .lead-check__box {
    background-color: #E8003D;
    border-color: #E8003D;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M1 5.2l3.2 3.2L11 1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
.lead-check input:focus-visible + .lead-check__box { outline: 2px solid #fff; outline-offset: 2px; }
.lead-check__text {
    font-size: 13px;
    line-height: 1.5;
    color: #bbb;
}
.lead-check__text a { color: #fff; text-decoration: underline; }
.lead-check__text a:hover { color: #E8003D; }

/* ---------- Кнопка ---------- */
.lead-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    padding: 14px 20px;
    background: #E8003D;
    border: 0;
    border-radius: 0;
    font-family: 'PFDinDisplayPro', sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #fff;
    cursor: pointer;
    transition: background-color .2s ease;
}
.lead-submit:hover { background: #ba0031; }
.lead-submit:disabled { opacity: .6; cursor: default; background: #E8003D; }
.lead-note {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    color: #888;
}

/* ---------- Успех ---------- */
.lead-success { padding: 8px 0; text-align: left; }
.lead-success[hidden] { display: none; }
.lead-success__title {
    margin: 0 0 12px;
    padding-right: 56px;       /* запас справа под крестик */
    font-family: 'PFDinDisplayPro', sans-serif;
    font-size: clamp(24px, 4vw, 30px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .01em;
    text-transform: uppercase;
    color: #fff;
    outline: none;
}
.lead-success__title::after { content: '.'; color: #E8003D; }
/* В состоянии успеха заголовок и подзаголовок формы скрыты; остаются крестик и блок успеха по центру панели */
.lead-modal__panel.is-success .lead-modal__headtext { display: none; }
.lead-modal__panel.is-success .lead-modal__close { margin-left: auto; }
.lead-modal__panel.is-success .lead-modal__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.lead-success__text {
    margin: 0 0 28px;
    font-size: 16px;
    line-height: 1.5;
    color: #bbb;
}

/* ---------- Фокус ---------- */
.lead-modal__close:focus-visible,
.lead-submit:focus-visible,
.lead-formerr a:focus-visible,
.lead-check__text a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---------- Кнопка в мобильном меню ---------- */
.mobile-nav__lead-wrap { margin: auto 0 20px; padding-top: 24px; }
.mobile-nav__lead {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    background: #E8003D;
    font-family: 'PFDinDisplayPro', sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff;
    transition: background-color .2s ease;
}
.mobile-nav__lead:hover { background: #ba0031; color: #fff; }
.mobile-nav__lead:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Мобильный: окно снизу на всю ширину ---------- */
@media (max-width: 600px) {
    .lead-modal {
        align-items: flex-end;
        padding: 0;
    }
    .lead-modal__panel {
        max-width: none;
        max-height: 92vh;
        transform: translateY(24px);
    }
    .lead-modal__head { padding: 20px 20px 0; }
    .lead-modal__body { padding: 20px 20px 24px; }
    .lead-row { grid-template-columns: minmax(0, 1fr); }
}
@supports (height: 100dvh) {
    @media (max-width: 600px) {
        .lead-modal__panel { max-height: 92dvh; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .lead-modal__overlay,
    .lead-modal__panel,
    .lead-other { transition: none; }
    .lead-modal__panel { transform: none; }
}
