/* TitovSystems: мобильная адаптация (поверх main.min.css).
   На телефонах и во встроенных браузерах (Telegram, VK, Instagram) отключаем
   постраничную прокрутку и фиксированную высоту секций — контент течёт естественно. */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 640px) {
    html,
    body {
        scroll-snap-type: none !important;
        overscroll-behavior-y: auto;
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
    }

    html {
        scroll-padding-top: calc(76px + env(safe-area-inset-top, 0px));
    }

    /* Шапка: непрозрачный фон, чтобы контент не просвечивал под ней */
    .topbar {
        padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: 0 1px 0 rgba(16, 22, 36, .06);
    }

    .brand__logo {
        width: 150px;
    }

    .topbar__action {
        min-height: 38px;
        padding: 9px 14px;
        font-size: 10px;
    }

    /* Секции: без 100svh и обрезки */
    .section,
    .section.hero-section,
    .section:not(.hero-section),
    #formats,
    #quiz,
    #quiz.has-form-result {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        scroll-snap-align: none !important;
        scroll-snap-stop: normal !important;
        padding: calc(84px + env(safe-area-inset-top, 0px)) 16px 40px !important;
        align-items: start;
    }

    .section::before,
    .section.hero-section::before {
        top: calc(66px + env(safe-area-inset-top, 0px));
        left: 16px;
        right: 16px;
    }

    .section:not(.hero-section) .grid,
    #formats .grid,
    #quiz .grid,
    #quiz.has-form-result .grid {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* ---------- Первый экран ---------- */
    .section.hero-section {
        padding-top: calc(92px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 32px !important;
        overflow: hidden !important; /* фото выходит за правый край — обрезаем по ширине */
    }

    .hero-section .hero-layout {
        width: 100%;
        max-width: 400px;
    }

    .hero-section .audit-kicker {
        margin-bottom: 16px;
    }

    .hero-section .hero-title {
        min-width: 0;
        width: 100%;
        max-width: 300px;
        margin-bottom: 20px;
        font-size: clamp(24px, 7vw, 30px);
    }

    .hero-section .hero-text {
        margin: 24px 0 40px;
        width: 54%;
        max-width: 200px;
        font-size: clamp(15px, 4.4vw, 18px);
    }

    .hero-section .hero-person {
        top: 96px;
        right: -40px;
        width: 52%;
        max-width: 230px;
        height: clamp(340px, 105vw, 420px);
    }

    .hero-section .hero-video-cta {
        position: relative;
        z-index: 7;
        margin-top: 0;
        width: min(100%, 230px);
    }

    .hero-section .quick-audit {
        position: relative;
        z-index: 6;
        width: 100%;
        max-width: 100%;
        margin-top: 24px;
    }

    .hero-section .quick-audit > div,
    .hero-section .quick-list {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-section .quick-list li {
        font-size: 13px;
        padding: 3px 0;
    }

    .hero-section .quick-visual {
        display: none;
    }

    /* ---------- Форматы ---------- */
    #formats .grid {
        justify-content: flex-start;
        max-width: 480px;
    }

    #formats h2 {
        font-size: clamp(26px, 7.5vw, 34px);
    }

    #formats .card p {
        font-size: 13px;
    }

    /* ---------- Форма ---------- */
    #quiz {
        display: block !important;
    }

    #quiz .grid {
        max-width: 480px;
        margin: 0 auto;
        grid-template-rows: auto auto;
        gap: 14px;
        padding: 20px 16px 18px;
    }

    #quiz h2 {
        max-width: 100%;
        margin-bottom: 0;
        font-size: clamp(20px, 6vw, 24px);
        line-height: 1.12;
    }

    #quiz .quiz {
        overflow: visible;
        gap: 12px;
    }

    #quiz .quiz label {
        gap: 6px;
        font-size: 12px;
    }

    #quiz .quiz input,
    #quiz .quiz select,
    #quiz .quiz textarea {
        min-height: 46px;
        padding: 11px 14px;
        font-size: 16px; /* меньше 16px — iOS зумит страницу при фокусе */
    }

    #quiz .quiz textarea {
        min-height: 84px;
        max-height: 160px;
        resize: vertical;
    }

    .choice-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px;
    }

    .choice-pill span {
        min-height: 40px;
        font-size: 13px;
    }

    #quiz .consent-check {
        grid-template-columns: 20px 1fr;
        gap: 10px;
        font-size: 11px;
        line-height: 1.35;
    }

    #quiz .consent-check input {
        width: 20px;
        height: 20px;
        min-height: 20px;
    }

    #quiz .quiz .btn {
        min-height: 52px;
        font-size: 15px;
    }

    #quiz.has-form-result {
        display: block !important;
    }

    /* ---------- Cookie-баннер компактнее ---------- */
    .cookie-banner {
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 10px;
        padding: 12px;
    }

    .cookie-banner__text {
        font-size: 11px;
        line-height: 1.3;
    }

    .cookie-banner .btn {
        min-height: 38px;
    }
}

@media (max-width: 360px) {
    .brand__logo {
        width: 128px;
    }

    .topbar__action {
        padding: 8px 10px;
        font-size: 9px;
    }

    .hero-section .hero-person {
        right: -52px;
    }

    .hero-section .audit-kicker {
        font-size: 10px;
        letter-spacing: .14em;
    }
}
