/* эТОИР — модальная форма «Связаться с нами».
   Живёт в base_marketing и доступна с любой страницы, поэтому стили вынесены
   из blog.css (он грузится только на блоге и /demo/). */

/* Форма живёт в модальном диалоге: showModal() даёт фокус-трап, ESC и ::backdrop
   без единой строки на это. Панель не скроллится сама — скроллится содержимое,
   иначе кнопка закрытия уезжает вверх на длинной форме. */
/* Центрируем руками: UA-центрирование модального <dialog> держится на margin:auto,
   а глобальный сброс `*{margin:0}` в landing.css его стирает — диалог прилипает
   к левому верхнему углу. Крестик внутри цепляется за fixed-контейнер. */
.demo-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(1060px, calc(100vw - 32px));
    max-height: min(90dvh, 940px);
    flex-direction: column;
    overflow: hidden;
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    color: var(--text);
}
/* display задаём только открытому: `display:flex` на самом .demo-dialog перебил бы
   UA-правило dialog:not([open]){display:none} — форма висела бы на странице всегда. */
.demo-dialog[open] { display: flex; }
.demo-dialog:focus { outline: none; }   /* панель получает фокус программно, кольцо тут лишнее */
.demo-dialog::backdrop { background: rgba(10, 15, 26, 0.6); }
.demo-dialog .demo-split-inner { overflow-y: auto; gap: 48px; }
/* Внутри диалога карточка формы не нужна — карточка уже сам диалог */
.demo-dialog .demo-form-card {
    background: transparent; border: none; box-shadow: none;
    padding: 0; min-height: 0;
}
.demo-dialog .demo-form-card::before { content: none; }   /* синяя полоска карточки */
/* rows=4 у виджета даёт ~200px, и кнопка «Отправить» уезжает за нижний край
   диалога на ноутбучном экране. Комментарий не обязателен — ему хватит трёх строк. */
.demo-dialog .demo-form-card form textarea { height: 88px; min-height: 88px; }
.demo-dialog-close {
    position: absolute; top: 14px; right: 14px; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border: none; border-radius: 10px;
    background: transparent; color: var(--text-secondary); cursor: pointer;
}
.demo-dialog-close:hover { background: var(--primary-light); color: var(--primary); }
@media (max-width: 700px) {
    .demo-dialog {
        inset: 0; width: 100vw; max-width: none;
        height: 100dvh; max-height: 100dvh;
        margin: 0; border: none; border-radius: 0;
        padding: 64px 16px 24px;
    }
    /* Диалог открыт — решение уже принято; пролистывать до полей четыре пункта
       «чем поможем» на телефоне не нужно. Остаются заголовок и форма. */
    .demo-dialog .demo-pitch-list,
    .demo-dialog .demo-trust-list { display: none; }
    .demo-dialog .demo-pitch h2:not(.demo-pitch-title) { display: none; }
    .demo-dialog .demo-split-inner { gap: 24px; }
}

.demo-split-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
}

@media (max-width: 900px) {
    .demo-split-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

.demo-pitch {
    padding-top: 8px;
}

/* Заголовок блока формы. Был h1, стал h2: h1 страницы /demo/ теперь у стенда
   выше по документу, а второго h1 на странице быть не должно. */
.demo-pitch-title {
    font-size: clamp(32px, 4.5vw, 44px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 16px;
}

.demo-pitch-intro {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.demo-pitch h2:not(.demo-pitch-title) {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 20px;
}

.demo-pitch-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 36px;
}

.demo-pitch-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.demo-pitch-item strong {
    color: var(--text);
}

.demo-pitch-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-top: 2px;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.demo-trust-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.demo-trust-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.demo-trust-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
}

.demo-form-card {
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 40px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.demo-form-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.demo-form-card form p {
    margin-bottom: 18px;
}

.demo-form-card form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

/* Звёздочка обязательного поля — из состояния самого поля (`required`), а не из
   разметки метки: одно правило держит все формы карточки в согласии с формой на
   сервере. Скринридеру её не читаем — он объявляет «обязательно» по атрибуту. */
.demo-form-card form p:has(> input[type="text"][required],
                           > input[type="email"][required],
                           > input[type="tel"][required],
                           > textarea[required]) label::after {
    content: "*";
    color: var(--stop);
    margin-left: 4px;
}

.demo-form-card form input[type="text"],
.demo-form-card form input[type="email"],
.demo-form-card form input[type="tel"],
.demo-form-card form textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.demo-form-card form input[type="text"]:focus,
.demo-form-card form input[type="email"]:focus,
.demo-form-card form input[type="tel"]:focus,
.demo-form-card form textarea:focus {
    outline: none;
    background: var(--card-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.demo-form-card form textarea {
    min-height: 96px;
    resize: vertical;
}

.demo-form-card form p:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.demo-form-card form p:has(input[type="checkbox"]) label {
    margin-bottom: 0;
    font-weight: 500;
    order: 2;
}

.demo-form-card form p:has(input[name="consent_marketing"]) label {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-light);
}

.demo-form-card form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    order: 1;
}

.demo-form-card form button[type="submit"] {
    width: 100%;
    justify-content: center;
    margin-top: 14px;
    background: var(--primary);
    border: none;
    transition: transform var(--transition), box-shadow var(--transition);
}

.demo-form-card form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.demo-success {
    text-align: center;
    margin: auto 0;
}

.demo-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.demo-success h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
}

.demo-success p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
