/* ================================================
   MOBILE-FIRST TYPOGRAPHY & LAYOUT IMPROVEMENTS
   ================================================ */

@media (max-width: 768px) {
    /* Секции — меньше отступы на мобиле */
    .section {
        padding: 60px 0;
    }

    /* Hero — компактная mobile-first композиция без горизонтального overflow */
    .hero {
        min-height: auto;
        align-items: flex-start;
        padding: calc(100px + env(safe-area-inset-top, 0px)) 0 28px;
    }

    .hero__content {
        max-width: none;
    }

    .hero__title {
        font-size: clamp(2.3rem, 9vw, 3.4rem);
        line-height: 1.04;
        letter-spacing: -0.04em;
        margin-bottom: 18px;
        text-wrap: balance;
    }

    .hero__title-accent {
        display: block;
        margin-top: 8px;
        white-space: normal;
    }

    .hero__overline {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .hero__subtitle-list {
        margin-bottom: 24px;
        padding-left: 0;
    }

    .hero__subtitle-list li {
        font-size: 1rem;
        line-height: 1.45;
        margin-bottom: 0.75rem;
    }

    .hero__subtitle {
        font-size: 1rem;
        line-height: 1.45;
        max-width: 33ch;
        margin-bottom: 24px;
    }

    .hero__actions {
        width: 100%;
        gap: 12px;
        margin-bottom: 0;
    }

    .hero__actions .btn {
        width: 100% !important;
        max-width: none !important;
        min-height: 56px;
        padding: 16px 20px !important;
        font-size: 1rem;
        justify-content: center;
    }

    .hero__features {
        display: none;
    }

    .hero__bg img {
        object-position: 60% center;
    }

    /* Section titles */
    .section__title {
        letter-spacing: -0.5px;
    }

    .section__subtitle {
        font-size: 0.95rem;
    }

    /* Trust bar — 2x2 на мобиле */
    .trust-bar__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .trust-bar__item:nth-child(2) {
        border-right: none;
    }

    .trust-bar__item:nth-child(1),
    .trust-bar__item:nth-child(2) {
        border-bottom: 1px solid #e8e8e8;
    }

    /* Trust block — 2x2 */
    .trust-block__numbers {
        grid-template-columns: repeat(2, 1fr);
    }

    .trust-block__stat:nth-child(2) {
        border-right: none;
    }

    .trust-block__stat:nth-child(1),
    .trust-block__stat:nth-child(2) {
        border-bottom: 1px solid #e8e8e8;
    }

    /* Gallery CTA — в колонку */
    .gallery-cta .container {
        flex-direction: column;
        text-align: center;
    }

    .gallery-cta__btn {
        width: 100%;
        justify-content: center;
    }

    /* Contact steps — wrap на маленьких экранах */
    .contact__steps {
        gap: 6px;
    }

    .contact__step-arrow {
        display: none;
    }

    .contact__step {
        font-size: 0.82rem;
    }

    /* Service cards — полная ширина */
    .services__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .section__title {
        font-size: clamp(1.6rem, 7vw, 2rem);
    }

    .hero {
        padding: calc(92px + env(safe-area-inset-top, 0px)) 0 24px;
    }

    .hero__title {
        font-size: clamp(2.1rem, 10vw, 3rem);
    }

    .hero__subtitle {
        font-size: 0.98rem;
    }
}

/* Исправления для мобильных устройств и iOS */
/* CSS-hint: Эти свойства используются для мобильной оптимизации и могут вызывать предупреждения в некоторых валидаторах */

/* Предотвращение zoom на iOS при фокусе на input */
@supports (-webkit-touch-callout: none) {
    .form__input,
    .form__select,
    .form__textarea {
        font-size: 16px !important;
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
        transform: scale(1);
        transition: transform 0.1s ease;
    }
}

/* Исправление бургер-меню */
.burger {
    width: 48px !important;
    height: 48px !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    -webkit-appearance: none;
    appearance: none;
}

.burger span {
    width: 24px !important;
    height: 2px !important;
    margin: 3px 0 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 1px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: var(--text-dark) !important;
}

.burger:hover span {
    background-color: var(--primary-color) !important;
    box-shadow: none !important;
}

.burger:focus {
    outline: none !important;
    box-shadow: none !important;
}

.burger--active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px) !important;
    background-color: var(--primary-color) !important;
    box-shadow: none !important;
}

.burger--active span:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
    box-shadow: none !important;
}

.burger--active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px) !important;
    background-color: var(--primary-color) !important;
    box-shadow: none !important;
}

/* Убираем все возможные границы и outlines */
.burger,
.burger:focus,
.burger:focus-visible,
.burger:active,
.burger:visited {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Предотвращение двойного тапа на iOS */
.form__input,
.form__select,
.form__textarea,
.btn {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* Исправление для мобильной навигации */
@media (max-width: 768px) {
    .nav__link {
        padding: 12px 16px !important;
        font-size: 16px !important;
        min-height: 44px !important;
        display: flex;
        align-items: center;
    }
    
    .menu-overlay {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    .nav {
        padding: 80px 20px 40px !important;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Сближаем иконку телефона с гамбургером */
    .header__mobile-contacts {
        gap: 0px !important;
        margin-right: 0px !important;
        padding-left: 0px !important;
    }
    
    /* Убираем лишние отступы у контактов */
    .header__mobile-contact {
        margin: 0 !important;
        padding: 0 !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Оптимизация для мобильных иконок контактов */
    .header__mobile-contact {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Обеспечиваем одинаковую жирность для иконки телефона */
    .header__mobile-contact i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-weight: 900 !important;
    }
}
