/* ===== CF7: экран благодарности ===== */

/* Форма и экран в одной ячейке: блок не прыгает по высоте */
.wpcf7.is-thanks {
    display: grid;
}

.wpcf7.is-thanks>form,
.wpcf7.is-thanks>.cf7-thanks {
    grid-area: 1 / 1;
}

.wpcf7.is-thanks>form {
    visibility: hidden;
    pointer-events: none;
}

/* В модалке форма убирается совсем: окно сжимается под «СПАСИБО» */
.modal .wpcf7.is-thanks>form {
    display: none;
}

/* Пока показан экран благодарности — заголовок формы прячем */
:is(.modal__dialog, .camp-stand__form, .site-footer__cta):has(.wpcf7.is-thanks) :is(.modal__title, .camp-stand__form-title, .site-footer__cta-title) {
    display: none;
}

/* Стандартное «Спасибо за Ваше сообщение…» не показываем никогда */
.wpcf7 .wpcf7-form.sent .wpcf7-response-output {
    display: none !important;
}

.cf7-thanks {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 1.25vw, 24px);
    padding: clamp(16px, 1.67vw, 32px) clamp(12px, 1.25vw, 24px) clamp(32px, 2.6vw, 50px);
    color: inherit;
    text-align: center;
    container-type: inline-size;
    animation: cf7-thanks-in 0.5s ease both;
}

/* «СПАСИБО» — табло. Всегда влезает по ширине блока */
.cf7-thanks__board {
    display: flex;
    justify-content: center;
    font-family: var(--font-accent);
    font-size: min(clamp(56px, 7.3vw, 140px), calc(88cqi / (var(--letters, 7) * 0.58)));
    line-height: 0.9;
    text-transform: uppercase;
    perspective: 600px;
}

.cf7-thanks__tile {
    display: inline-block;
    width: 0.58em;
    text-align: center;
    opacity: 0.3;
    transform-origin: 50% 60%;
}

.cf7-thanks__tile.is-set {
    opacity: 1;
    animation: cf7-thanks-flip 0.4s cubic-bezier(0.2, 0.7, 0.3, 1.3) both;
}

.cf7-thanks__tile.is-space {
    width: 0.3em;
}

/* Заголовок (если заполнен) */
.cf7-thanks__title {
    margin: 0;
    font-family: var(--font-accent);
    font-size: clamp(28px, 2.6vw, 50px);
    line-height: 1;
    text-transform: uppercase;
}

/* Приписка */
.cf7-thanks__text {
    max-width: 32em;
    margin: 0;
    font-family: var(--font-main);
    font-size: max(16px, 1.15vw);
    line-height: 1.45;
    opacity: 0.85;
    animation: cf7-thanks-in 0.5s ease 0.6s both;
}

.cf7-thanks__text:empty {
    display: none;
}

/* Кнопка скачивания */
.cf7-thanks__download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 0.83vw, 16px) clamp(24px, 2.08vw, 40px);
    border: 1px solid currentColor;
    border-radius: 999px;
    color: inherit;
    font-family: var(--font-main);
    font-size: max(15px, 0.94vw);
    text-decoration: none;
    transition: background-color 0.2s ease;
    animation: cf7-thanks-in 0.5s ease 0.8s both;
}

.cf7-thanks__download[hidden] {
    display: none;
}

.cf7-thanks__download:hover {
    background: color-mix(in srgb, currentColor 12%, transparent);
}

/* Полоска обратного отсчёта */
.cf7-thanks__timer {
    position: absolute;
    left: 50%;
    bottom: clamp(10px, 0.83vw, 16px);
    width: min(240px, 60%);
    height: 2px;
    border-radius: 2px;
    background: color-mix(in srgb, currentColor 18%, transparent);
    overflow: hidden;
    transform: translateX(-50%);
}

.cf7-thanks__timer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    transform-origin: left center;
    animation: cf7-thanks-timer var(--thanks-delay, 20s) linear forwards;
}

@keyframes cf7-thanks-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes cf7-thanks-flip {
    from {
        transform: rotateX(-90deg);
    }

    to {
        transform: rotateX(0);
    }
}

@keyframes cf7-thanks-timer {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}