/* ==========================================================================
   Отзывы, статьи, FAQ, форма заявки.
   ========================================================================== */

.community { background: var(--color-surface-2); }

/* ---------- Отзывы ---------- */
.reviews {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 48px 0 32px;
    background: var(--color-white);
}

.reviews__title { padding-inline: var(--gutter); }

.reviews__stage { display: contents; }

/* Сноска под отзывами: серым, мелко. На мобильном и планшете идёт в потоке после слайдера */
.reviews__note {
    padding-inline: var(--gutter);
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: var(--tracking);
    color: var(--color-text-5);
}

.reel, .reel-meta { display: none; }

.review-slider { --slider-gap: 12px; --slider-pad: var(--card-inset); }

/* слайдер отодвинут от заголовка: к зазору секции (24px) добавлено ещё 24px */
.reviews__mobile { margin-top: 24px; }

.review { width: min(320px, 85.4%); }

.review__video {
    position: relative;
    isolation: isolate;
    aspect-ratio: 320 / 400;
    border-radius: var(--card-radius);
    overflow: clip;
}

.review__video { cursor: pointer; }
.review__video > .media--fill { z-index: -1; }
.review .video-play { background: var(--color-white); }

.review__name {
    margin-top: 20px;
    padding-inline: 12px;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: var(--tracking-heading);
    font-weight: 500;
}

.review__flow {
    padding-inline: 12px;
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.3;
    letter-spacing: var(--tracking-heading);
    color: rgba(12, 10, 31, 0.3);
    font-weight: 500;
}

.video-time {
    position: absolute;
    top: 24px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    color: var(--color-white);
    font-size: 14px;
}

.video-play {
    position: absolute;
    left: 24px;
    bottom: 24px;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-lime);
    color: var(--color-navy);
}

.video-play .icon { width: 22px; height: 22px; }

/* Видео запускается прямо в карточке (main.js): <video> или <iframe> поверх фото */
.video-player {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
    background: #000;
    object-fit: cover;
}

.is-playing > :is(.video-time, .video-play) { opacity: 0 !important; pointer-events: none; }

/* Ролики вертикальные (9:16), а карточки почти квадратные: плеер-iframe растягиваем так, чтобы кадр закрывал карточку по всей
   ширине без чёрных полей (лишнее сверху и снизу обрезается; размеры — от самой карточки, она контейнер: cqw / cqh).
   Полный кадр виден в полноэкранном режиме. На мобильном плеер прижат к низу карточки: там остаются родные кнопки плеера
   (пауза, во весь экран); на десктопе — по центру, а «развернуть» — наша кнопка в углу. */
.review__video,
.reel__item { container-type: size; }

iframe.video-player {
    inset: auto;
    left: 50%;
    top: 100%;
    translate: -50% -100%;
    width: max(100cqw, calc(100cqh * 9 / 16));
    height: max(100cqh, calc(100cqw * 16 / 9));
    border-radius: 0;
}

/* Полный экран: разворачивается вся карточка (плеер + наша кнопка), а не iframe — тогда выйти можно нашей же кнопкой «свернуть»
   и Esc (кнопка внутри плеера о нашем полноэкранном режиме ничего не знает). Размер и положение задаёт браузер (position: fixed;
   inset: 0; width/height: 100%), наши сдвиги, радиус и прозрачность карточки в этом режиме сбрасываем. Класс .is-fullscreen
   ставит main.js на fullscreenchange (так не нужны селекторы с префиксом Safari). */
.is-fullscreen {
    translate: none !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    background: #000 !important;
}

.is-fullscreen > iframe.video-player {
    inset: 0;
    translate: none;
    width: 100%;
    height: 100%;
}

.video-expand {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    color: var(--color-white);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.video-expand .icon { width: 20px; height: 20px; }
.video-expand .icon--collapse,
.is-fullscreen .video-expand .icon--expand { display: none; }
.is-fullscreen .video-expand .icon--collapse { display: block; }

@media (hover: hover) {
    .video-expand:hover { background: var(--color-white); color: var(--color-navy); }
}

@media (min-width: 1200px) {
    iframe.video-player { top: 50%; translate: -50% -50%; }

    .video-expand { display: grid; top: 24px; right: 24px; width: 52px; height: 52px; }
}

.reviews__bar,
.blog__bar { padding-inline: var(--gutter); }

/* индикатор и стрелки отзывов опущены на 30px ниже */
.reviews__bar { margin-top: 30px; }

.dots--sm { --dot-w: 24px; gap: 4px; }

/* ---------- Статьи ---------- */
.blog {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 48px 0 32px;
    border-top: 1px solid var(--color-line);
    background: var(--color-white);
}

.blog__title { padding-inline: var(--gutter); }

.blog__list { --slider-gap: 12px; --slider-pad: var(--card-inset); }

.article { width: min(320px, 85.4%); }

.article__link { display: grid; gap: 16px; }

.article__thumb {
    position: relative;
    isolation: isolate;
    display: block;
    height: 202px;
    border-radius: var(--card-radius);
    overflow: clip;
    margin-bottom: 8px;
}

.article__thumb > .media--fill { z-index: -1; }

.article__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-inline: 12px;
    color: var(--color-text-5);
    font-size: 12px;
}

.article__stat { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.article__stat .icon { width: 16px; height: 16px; }

.article__sep {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d9d9d9;
}

.article__tags { display: flex; gap: 8px; padding-inline: 12px; }

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-size: 12px;
}

.article__title {
    padding-inline: 12px;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: var(--tracking-heading);
}

/* ---------- FAQ ---------- */
.faq__inner { padding-block: 48px; }

.faq__title { margin-bottom: 40px; }

.faq__item { border-bottom: 1px solid var(--color-line); }

.faq__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0 20px;
    list-style: none;
    cursor: pointer;
}

.faq__item:first-child .faq__summary { padding-top: 0; }

.faq__summary::-webkit-details-marker { display: none; }

.faq__q {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: var(--tracking-heading);
}

.faq__toggle {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(12, 10, 31, 0.06);
}

.faq__toggle .icon { width: 20px; height: 20px; }
.faq__minus { display: none; }
.faq__item[open] .faq__plus { display: none; }
.faq__item[open] .faq__minus { display: block; }
.faq__item[open] .faq__toggle { background: var(--color-lime); }

.faq__summary:hover .faq__toggle { background: rgba(12, 10, 31, 0.12); }
.faq__item[open] .faq__summary:hover .faq__toggle { background: var(--color-lime); }

.faq__a {
    padding: 0 0 20px;
    max-width: 882px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    color: var(--color-text-3);
}

.faq__a a {
    color: var(--color-navy);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.faq__a a:hover { text-decoration-thickness: 2px; }

/* ---------- Форма заявки ---------- */
.contact { padding-bottom: 24px; }

.contact__inner { display: flex; flex-direction: column; width: 100%; }

.contact__photo {
    position: relative;
    order: -1;
    aspect-ratio: 359 / 230;
    margin: var(--card-inset) var(--card-inset) 0;
    border-radius: var(--card-radius);
    overflow: hidden;
}

.contact__form-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px 20px 0;
}

.contact__head { display: flex; flex-direction: column; gap: 16px; }

.contact__lead { font-size: 14px; font-weight: 500; letter-spacing: var(--tracking-heading); }

.lead-form { display: flex; flex-direction: column; gap: 27px; }

.lead-form__fields { display: flex; flex-direction: column; gap: 8px; }

.field { display: block; }

.field__input {
    width: 100%;
    height: 60px;
    padding: 0 24px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-size: 14px;
    font-weight: 500;
}

.field__input::placeholder { color: var(--color-navy); opacity: 1; }

/* Фокус поля — лаймовое свечение (в motion.css оно ещё и плавно проявляется), без тёмного контура общего :focus-visible:
   у текстовых полей этот псевдокласс срабатывает и на клик мышью. Свечение тут же, чтобы оно было и без анимаций. */
.field__input:focus-visible {
    outline: none;
    background: var(--color-white);
    box-shadow: 0 0 0 5px rgba(202, 255, 1, 0.45);
}

.lead-form__submit { display: flex; flex-direction: column; gap: 24px; }

/* Два согласия друг под другом (формы на главной и в поп-апе): второе — рекламные материалы, необязательное */
.consents { display: flex; flex-direction: column; gap: 12px; }

.consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--color-muted);
    font-size: 12px;
    cursor: pointer;
}

/* Ссылки в согласиях всегда подчёркнуты: без подчёркивания их не видно среди обычного текста */
.consent a,
.consents__offer a {
    color: var(--color-navy);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.consent a:hover,
.consents__offer a:hover { text-decoration-thickness: 2px; }

/* Оферта строкой под кнопкой (как на продуктовом лендинге): отдельной галочки нет, согласие — нажатием на кнопку */
.consents__offer {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: var(--tracking-heading);
    text-align: left;
    text-wrap: pretty;
}

/* Где хватает ширины — строка целиком в одну линию (на узком телефоне она переносится: в 335px не помещается) */
@media (min-width: 600px) {
    .consents__offer { white-space: nowrap; }
}

/* узкий десктоп: колонка формы ~350px, строка уходит за неё, и 12px у самого фото — берём 11px */
@media (min-width: 1200px) and (max-width: 1299.98px) {
    .consents__offer { font-size: 11px; }
}

.lead-form__submit .consents__offer { margin-top: -8px; }


.consent__box {
    position: relative;
    flex: none;
    width: 28px;
    height: 28px;
    margin: 4px 0 0;
    border-radius: 50%;
    background: #e6e7ec;
    appearance: none;
    cursor: pointer;
}

.consent__box:checked { background: var(--color-lime); }

.consent__box:checked::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 6px;
    width: 6px;
    height: 12px;
    border: solid var(--color-navy);
    border-width: 0 2px 2px 0;
    rotate: 45deg;
}

.consent__text { padding-top: 0; text-wrap: balance; }

/* ==========================================================================
   Промежуточный режим 768–1199
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .faq__inner { max-width: 656px; margin-inline: auto; }

    .contact__form-col { width: min(100%, 656px); margin-inline: auto; padding-inline: 0; }

    .review, .article { width: 360px; }
}

/* ==========================================================================
   Десктоп ≥1200
   ========================================================================== */
@media (min-width: 1200px) {
    .community { background: var(--color-surface-2); }

    /* Отзывы: секция «залипает» на весь экран, пока листаются карточки. main.js ставит .is-pinned (высота = экран + шаги
       по ~70% экрана), двигает карточки и меняет текст справа. Без JS — обычный экран с первой карточкой. */
    .reviews {
        --k: 1;
        --vh: 100vh;
        display: block;
        gap: 0;
        height: max(var(--vh), 680px);
        padding: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .reviews.is-pinned { height: calc(max(var(--vh), 680px) * (1 + var(--steps, 4) * 0.7)); }

    .reviews__stage {
        position: sticky;
        top: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) calc(430px * var(--k)) minmax(0, 1fr);
        align-items: center;
        height: max(var(--vh), 680px);
        /* боковые поля = как у остальных блоков (проценты считаются от ширины секции) */
        padding-inline: max(var(--gutter), calc((100% - var(--container-max)) / 2));
        overflow: clip;
    }

    .reviews__title {
        grid-column: 1;
        grid-row: 1;
        width: 360px;
        padding: 0;
    }

    .reviews__mobile { display: none; }

    .reviews__note {
        position: absolute;
        z-index: 2;
        left: max(var(--gutter), calc((100% - var(--container-max)) / 2));
        bottom: 44px;
        max-width: 340px;   /* не заходит под ленту видео по центру */
        padding: 0;
        font-size: 13px;
    }

    .reel {
        display: block;
        grid-column: 2;
        grid-row: 1;
        position: relative;
        align-self: stretch;
    }

    /* Размеры и позиции карточек задаёт main.js за скроллом; это запасная раскладка (без JS): главная + две полоски */
    .reel__item {
        --w: 430; --h: 451; --y: -225.5; --r: 48;
        position: absolute;
        left: 50%;
        top: 50%;
        isolation: isolate;
        overflow: clip;
        cursor: grab;
        width: calc(var(--w) * var(--k) * 1px);
        height: calc(var(--h) * var(--k) * 1px);
        border-radius: calc(var(--r) * var(--k) * 1px);
        translate: -50% calc(var(--y) * var(--k) * 1px);
        background: #14141f;
    }

    .reel__item > .media--fill { z-index: -1; }
    .reel__item .media__img { object-position: 50% 26%; pointer-events: none; -webkit-user-drag: none; }

    /* Ленту можно «взять» мышью и потянуть вверх/вниз (main.js). Центральная карточка — «играть», остальные — «взять» */
    .reel { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
    .reel__item.is-current { cursor: pointer; }
    .reel.is-dragging,
    .reel.is-dragging * { cursor: grabbing !important; }

    .reel__item[data-o="1"] { --w: 356; --h: 89; --y: 237.5; --r: 32; }
    .reel__item[data-o="2"] { --w: 280; --h: 70; --y: 338.5; --r: 25; }
    .reel__item[data-o="3"] { --w: 220; --h: 56; --y: 424; --r: 20; opacity: 0; }

    .reel__item .video-time {
        top: 32px;
        left: 32px;
        height: 39px;
        padding: 0 14.6px;
        font-size: 17px;
        line-height: 1.4;
    }

    .reel__item .video-play { left: 32px; bottom: 32px; width: 76px; height: 76px; }
    .reel__item .video-play .icon { width: 30px; height: 30px; }
    .reel__item :is(.video-time, .video-play) { opacity: var(--m, 0); }
    .reel__item[data-o="0"] { --m: 1; }

    .reel-meta {
        grid-column: 3;
        grid-row: 1;
        display: flex;
        align-items: center;
        gap: 36px;
        padding: 42px 0 0 33px;
    }

    .reel-meta__lines {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: none;
        width: 103px;
        height: 77px;
    }

    .reel-meta__lines i { display: block; height: 1px; background: var(--color-line-strong); }
    .reel-meta__lines i:nth-child(1), .reel-meta__lines i:nth-child(5) { width: 33px; }
    .reel-meta__lines i:nth-child(2), .reel-meta__lines i:nth-child(4) { width: 47px; }
    .reel-meta__lines i:nth-child(3) { width: 103px; background: var(--color-navy); }

    .reel-meta__text { display: flex; flex-direction: column; gap: 8px; }

    .reel-meta__name {
        font-size: 32px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: var(--tracking-heading);
    }

    .reel-meta__flow {
        font-family: var(--font-display);
        font-size: 24px;
        line-height: 1.1;
        letter-spacing: var(--tracking-heading);
        color: rgba(12, 10, 31, 0.3);
        font-weight: 500;
    }

    /* Статьи */
    .blog {
        --frame-pad: max(var(--gutter), calc((100% - var(--container-max)) / 2));
        gap: 32px;
        padding: 80px 0;
        border-top: 0;
    }

    .blog__title,
    .blog__bar { padding-inline: var(--frame-pad, var(--gutter)); }

    .blog__list { --slider-gap: 10px; --slider-pad: var(--frame-pad, var(--gutter)); }

    .article { width: 430px; }
    .article__link { gap: 16px; }

    .article__thumb { height: 310px; border-radius: var(--radius-lg); margin-bottom: 8px; }

    .article__meta { padding-inline: 0; font-size: 14px; }
    .article__stat .icon { width: 18px; height: 18px; }
    .article__tags { padding-inline: 0; }
    .article__title { padding-inline: 0; font-size: 22px; line-height: 1.2; letter-spacing: var(--tracking-heading); }

    /* FAQ */
    .faq__inner {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: var(--grid-gap);
        align-items: start;
        padding-block: 80px;
    }

    /* Вопросы начинаются с той же колонки, что и фото формы ниже (6–12), и по ширине с ним совпадают */
    .faq__title { grid-column: 1 / 6; margin: 0; }
    .faq__list { grid-column: 6 / 13; }

    .faq__item:last-child { border-bottom: 0; }
    .faq__item:last-child .faq__summary { padding-bottom: 4px; }

    .faq__summary { padding-block: 28px 27px; }
    .faq__q { font-size: 22px; line-height: 1.1; letter-spacing: var(--tracking-heading); }
    .faq__a { padding-bottom: 27px; }

    /* Форма */
    .contact { padding: 0; }

    .contact__inner {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: var(--grid-gap);
        align-items: stretch;
        width: min(100% - var(--gutter) * 2, var(--container-max));
        margin-inline: auto;
        padding-block: 80px;   /* как у блока FAQ: 80 → 100 (≥1760) → ×1,2 (≥1920) */
    }

    /* Фото — колонки 6–12 сетки (7 из 12, по ширине как вопросы FAQ выше) и ровно той же высоты, что левая часть: оба блока
       тянутся по строке сетки.
       Кадр макета 1373 : 974 ниже формы по пропорции, и если растянуть его на всю высоту (cover), плашки направлений по краям
       срезаются. Поэтому кадр стоит целиком, прижатый к низу, а недостающая высота сверху добирается небом: фон блока —
       цвета верхней кромки кадра, а сама кромка плавно растворяется в нём (mask). */
    .contact__photo {
        grid-column: 6 / 13;   /* те же колонки, что у вопросов FAQ выше */
        order: 0;
        align-self: stretch;
        aspect-ratio: auto;   /* снимаем мобильные 359 / 230: высоту задаёт строка сетки, ширину — колонки */
        margin: 0;
        border-radius: var(--section-radius);
        background: linear-gradient(90deg, #21508e 0%, #23508c 13%, #24518b 25%, #25538a 38%, #29558b 50%, #2f5b8e 63%, #386596 75%, #4470a1 88%, #5181af 100%);
    }

    /* три класса — чтобы перебить параллакс карточек из motion.css: он увеличивает и сдвигает картинку, и у кадра,
       прижатого к низу, показалась бы полоска фона */
    .contact .contact__photo .media__img {
        inset: auto 0 0 0;
        height: auto;
        aspect-ratio: 1373 / 974;
        object-fit: fill;
        scale: 1;
        translate: none;
        animation: none;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%);
        mask-image: linear-gradient(to bottom, transparent 0, #000 9%);
    }

    /* Левая часть — колонки 1–4 сетки, поля крупнее, воздуха между блоками больше */
    .contact__form-col { grid-column: 1 / 5; gap: 40px; padding: 0; }
    .contact__head { gap: 20px; }
    .contact__lead { font-size: 17px; }

    .lead-form { gap: 44px; }
    .lead-form__fields { gap: 14px; }

    .field__input { height: 72px; padding: 0 32px; font-size: 17px; }

    .lead-form__submit { gap: 28px; }
    .consent { align-items: center; gap: 12px; font-size: 13px; }
    /* строка про оферту остаётся 12px, как на планшете: в одну линию она занимает ~470px, а колонка формы на десктопе уже —
       хвост уходит в пустую пятую колонку сетки, до фото не доходит */
    .lead-form__submit .consents__offer { margin-top: -14px; }
    .consent__box { width: 32px; height: 32px; margin-top: 0; }
    .consent__box:checked::after { left: 12px; top: 7px; width: 7px; height: 13px; }

    .btn--form { height: 72px; padding: 8px; font-size: 17px; }
    .btn--form .btn__knob { width: 56px; height: 56px; }
}

/* ==========================================================================
   Широкий ≥1760 (макет 1920)
   ========================================================================== */
@media (min-width: 1760px) {
    .reviews { --k: 1.112; }

    .faq__inner { padding-block: 100px; }
    .faq__summary { padding-block: 32px 31px; }
    .faq__a { padding-bottom: 31px; }
    .faq__item:last-child .faq__summary { padding-bottom: 20px; }

    .blog { padding-block: 100px; }
    .article { width: 460px; }
    .article__thumb { height: 334px; }

    .contact__inner { padding-block: 100px; }
}

/* ==========================================================================
   ≥1920: вертикальные отступы внутри блоков +20% (--pad-k, см. tokens.css)
   ========================================================================== */
@media (min-width: 1920px) {
    .blog { padding-block: calc(100px * var(--pad-k)); }
    .faq__inner { padding-block: calc(100px * var(--pad-k)); }
    .contact__inner { padding-block: calc(100px * var(--pad-k)); }

    /* под zoom (>1920) vw тоже ×1,2 — возвращаем исходные 16,7% ширины окна */
    @media (min-width: 1921px) {
        .reviews { --vh: calc(100vh / 1.2); }
    }
}
