/*
 * mobile-improvements.css
 * buy-lending.ru — мобильные улучшения
 *
 * Подключить в <head> ПОСЛЕ основного <style>:
 * <link rel="stylesheet" href="/css/mobile-improvements.css">
 */

/* ══════════════════════════════════════════════════════════
   1. ГАМБУРГЕР-КНОПКА (появляется на ≤900px)
══════════════════════════════════════════════════════════ */

.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px; height: 40px;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    transition: background .2s;
    flex-shrink: 0;
    margin-left: auto;
}
.burger:hover { background: rgba(0,0,0,.05); }
.burger span {
    display: block;
    width: 22px; height: 2px;
    background: var(--dark, #0f172a);
    border-radius: 2px;
    transition: transform .25s, opacity .2s;
    transform-origin: center;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════
   2. МОБИЛЬНОЕ МЕНЮ (drawer)
══════════════════════════════════════════════════════════ */

.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
}
.mobile-nav.open {
    display: block;
    pointer-events: auto;
}

/* Затемнение */
.mobile-nav__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .25s;
}
.mobile-nav.open .mobile-nav__overlay { opacity: 1; }

/* Панель */
.mobile-nav__panel {
    position: absolute;
    top: 0; right: 0;
    width: min(300px, 85vw);
    height: 100%;
    background: #fff;
    padding: 24px 20px 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
}
.mobile-nav.open .mobile-nav__panel { transform: translateX(0); }

.mobile-nav__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.mobile-nav__logo {
    font-family: var(--font-head, 'Montserrat', sans-serif);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark, #0f172a);
    text-decoration: none;
}
.mobile-nav__logo span { color: var(--primary, #1a56db); }

.mobile-nav__close {
    width: 36px; height: 36px;
    border: none; background: #f1f5f9;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #64748b;
    transition: background .2s;
}
.mobile-nav__close:hover { background: #e2e8f0; }

.mobile-nav__links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}
.mobile-nav__links a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text, #1e293b);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.mobile-nav__links a:hover {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #1a56db);
}

.mobile-nav__cta {
    display: block;
    margin-top: 20px;
    padding: 14px;
    background: var(--primary, #1a56db);
    color: #fff !important;
    border-radius: 10px;
    text-align: center;
    font-weight: 700;
    font-family: var(--font-head, 'Montserrat', sans-serif);
    font-size: 0.95rem;
    text-decoration: none;
    transition: background .2s;
}
.mobile-nav__cta:hover { background: var(--primary-dark, #1341a8) !important; }

.mobile-nav__contacts {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mobile-nav__contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #64748b;
    text-decoration: none;
}
.mobile-nav__contact-item:hover { color: var(--primary, #1a56db); }
.mobile-nav__contact-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}

/* Body lock при открытом меню */
body.menu-open { overflow: hidden; }

/* ══════════════════════════════════════════════════════════
   3. АДАПТИВНОСТЬ — исправления и улучшения
══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    /* Показываем гамбургер, прячем десктопные ссылки и CTA */
    .burger { display: flex; }
    .nav-links { display: none !important; }
    .header-cta { display: none; }

    /* Hero: центрируем текст на мобильном */
    .hero-inner { text-align: center; }
    .hero-cta { justify-content: center; }
    .hero-trust { justify-content: center; }
    .hero-eyebrow { margin: 0 auto 16px; }

    /* Stats: 2 колонки */
    .stats-row { grid-template-columns: repeat(2, 1fr); }

    /* Benefits: 2 колонки */
    .benefits-row { grid-template-columns: repeat(2, 1fr); }

    /* Pricing: 1 колонка центрирована */
    .pricing-row {
        grid-template-columns: 1fr;
        max-width: 440px;
        margin: 0 auto;
    }

    /* Footer: стопка */
    .footer-inner { flex-direction: column; text-align: center; gap: 16px; }
    .footer-nav { flex-wrap: wrap; justify-content: center; gap: 12px 18px; }

    /* Float CTA — чуть меньше на мобильном */
    .float-cta { padding: 12px 18px; font-size: 0.82rem; bottom: 16px; right: 16px; }
}

@media (max-width: 600px) {
    /* Services: 1 колонка */
    .services-grid { grid-template-columns: 1fr !important; }

    /* Benefits: всё ещё 2, но меньше padding */
    .benefits-row { gap: 14px; }
    .benefit-card { padding: 22px 16px; }

    /* Blog: 1 колонка */
    .blog-grid { grid-template-columns: 1fr !important; }

    /* Portfolio: 1 колонка */
    .portfolio-grid { grid-template-columns: 1fr !important; }

    /* Cities: 1 колонка */
    .cities-grid-js { grid-template-columns: 1fr 1fr !important; }

    /* Hero padding */
    .hero { padding: 56px 0 44px; }
    .section { padding: 48px 0; }

    /* Меньше отступы в hero */
    .hero h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
    .hero-sub { font-size: 0.95rem; }

    /* Кнопки hero стопкой */
    .hero-cta { flex-direction: column; align-items: stretch; }
    .btn-hero, .btn-hero-outline {
        text-align: center;
        justify-content: center;
        padding: 14px 20px;
    }

    /* Stats: по 2 на строку, но меньше */
    .stat-num { font-size: 1.7rem; }
    .stat-lbl { font-size: 0.76rem; }

    /* Process cards: 2 колонки → 1 */
    #process .steps-grid { grid-template-columns: 1fr !important; }
    #process .step-detail.visible { grid-template-columns: 1fr !important; }
    #process .detail-right { flex-direction: row !important; align-items: center; justify-content: space-between; }

    /* Contact: одна колонка */
    #contact .cf-contacts { grid-template-columns: 1fr !important; }
    #contact .cf-card { padding: 20px 16px; }

    /* Pricing */
    .price-card { padding: 24px 20px; }

    /* Float CTA скрыть текст, оставить иконку */
    .float-cta { border-radius: 50%; width: 52px; height: 52px; padding: 0; justify-content: center; }
    .float-cta::after { content: none; }
}

@media (max-width: 400px) {
    /* Benefits: 1 колонка */
    .benefits-row { grid-template-columns: 1fr; }

    /* Cities: 1 колонка */
    .cities-grid-js { grid-template-columns: 1fr !important; }

    /* Container padding */
    .container { padding: 0 14px; }

    /* Footer nav */
    .footer-nav { flex-direction: column; gap: 8px; }
}

/* ══════════════════════════════════════════════════════════
   4. ТЕЛЕФОННАЯ МАСКА В ФОРМЕ БРИФА
══════════════════════════════════════════════════════════ */

/* cf-form поля на узких экранах */
@media (max-width: 380px) {
    #contact .cf-card { padding: 16px 12px; }
    #contact .cf-row { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════
   5. УЛУЧШЕНИЕ TOUCH-TARGETS
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    /* Все кликабельные элементы min 44px высотой */
    .nav-links a,
    .mobile-nav__links a,
    .btn-price,
    .btn-blog-more,
    .header-cta {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Карточки тарифов — кнопка заказа крупнее */
    .btn-price {
        padding: 14px;
        font-size: 1rem;
        justify-content: center;
    }

    /* Форма — поля крупнее */
    .form-field input,
    .form-field select,
    .form-field textarea {
        padding: 14px 16px;
        font-size: 16px; /* предотвращает зум на iOS */
    }

    #contact .cf-field input,
    #contact .cf-field select,
    #contact .cf-field textarea {
        font-size: 16px; /* предотвращает зум на iOS */
        padding: 12px 14px;
    }
}
