@media (max-width: 768px) {
    .header-container {
        justify-content: space-between; 
        gap: 0;
    }
}

@media (max-width: 768px) {
    .burger { display: block; cursor: pointer; }
    .nav-menu { display: none; } /* Скрываем меню на телефоне */
    .header-container { padding: 15px 20px; }
}

@media (max-width: 768px) {
    .carousel-btn { display: none; }
    .carousel-wrapper { padding: 50px 0; } /* Оставляем место для 3D на мобилках */
}

@media (max-width: 768px) {
    .main-name {
        font-size: 2.5rem;
    }
    .brand-sub {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    body {
        background-image: none; /* Убираем картинки */
    }
}

@media (max-width: 768px) {
    .trust-signals {
        flex-direction: column;
        gap: 8px;
    }
    .trust-divider { 
        display: none; /* Прячем палочку на телефоне */
    }
}

@media (max-width: 768px) {
    .method-card {
        width: 100%; /* На телефоне карточка во всю ширину */
    }
}

@media (max-width: 768px) {
    .methods-grid {
        flex-direction: column; /* Вертикально */
    }
    .method-card {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .problem-item {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .manifesto-tags {
        gap: 10px;
    }
    .manifesto-tags span {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .lang-switch {
        margin: 15px auto;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .methods-grid-container {
        flex-direction: column !important; /* На планшетах и телефонах - в столб */
        align-items: center !important;
    }
    .method-card {
        width: 100% !important;
        max-width: 450px !important;
        margin-bottom: 30px !important;
    }
}

/* ===== FIX: Mobile clipping / half-visible cards (AOS + overflow) ===== */
@media (max-width: 900px) {
  /* На мобилке не режем контент карточек — иначе AOS-transform может выглядеть как “обрезано” */
  .method-card {
    overflow: visible !important;
  }

  /* Чуть безопаснее поведение для layout на мобилках */
  .methods-grid-container {
    min-height: auto;
  }
}

/* Доп. страховка именно для iOS Safari */
@supports (-webkit-touch-callout: none) {
  .method-card {
    overflow: visible !important;
  }
}

/* ===========================
   Mobile burger drawer (ONLY mobile)
   =========================== */
@media (max-width: 768px) {

  /* Mobile brand (desktop unaffected) */
  .mobile-brand{
    display: block;
    text-decoration: none;
    color: var(--primary-green);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .2px;
    line-height: 1;
  }

  /* Turn burger into a real button */
  .burger{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .burger span{
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
  }

  .burger span + span{ margin-top: 5px; }

  /* Overlay */
  .mobile-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1200;
  }

  /* Drawer */
  .mobile-drawer{
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(86vw, 360px);
    background: #fff;
    z-index: 1300;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -16px 0 40px rgba(0,0,0,.12);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .mobile-drawer.is-open{
    transform: translateX(0);
  }

  .mobile-drawer__top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
  }

  .mobile-drawer__brand{
    text-decoration: none;
    color: var(--primary-green);
    font-weight: 700;
  }

  .mobile-drawer__close{
    width: 44px;
    height: 44px;
    border: 0;
    background: #f4f4f4;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }

  .mobile-drawer__nav{
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
  }

  .mobile-drawer__link{
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 12px 12px;
    border-radius: 12px;
    background: #f9f9f9;
  }

  .mobile-drawer__link:active{
    transform: scale(0.99);
  }

  /* Put languages inside drawer on mobile (the header lang-switch can remain visible or we can hide it below) */
  .mobile-drawer__langs{
    margin-top: auto;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
  }

  .mobile-drawer__langs a{
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid transparent;
    opacity: .75;
    transition: all .2s ease;
  }

  .mobile-drawer__langs a.active{
    opacity: 1;
    border-color: var(--primary-green);
  }

  .mobile-drawer__langs img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Optional UX: hide header lang-switch on mobile, because languages are in drawer */
  .header-container .lang-switch{
    display: none;
  }

  /* Lock page scroll when menu open */
  body.nav-open{
    overflow: hidden;
    touch-action: none;
  }
}

/* Desktop: hide mobile brand & drawer always */
@media (min-width: 769px){
  .mobile-brand,
  .mobile-overlay,
  .mobile-drawer{
    display: none !important;
  }
}

/* ===========================
   Mobile header: logo + burger + drawer (ONLY mobile)
   =========================== */
@media (max-width: 768px) {

  /* Mobile logo in header */
  .mobile-logo{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-logo img{
    width: 34px;
    height: 34px;
    display: block;
  }

  /* Burger button — professional hit-area + "дороже" вид */
  .burger{
    display: inline-flex;              /* переопределяем любые старые display */
    align-items: center;
    justify-content: center;
    width: 44px;                       /* hit area */
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;

    
    background: transparent;
  }
  .burger:active{
    transform: scale(0.98);
  }

  /* Icon: 3 ровные линии */
  .burger-icon{
    position: relative;
    width: 22px;
    height: 16px;
    display: block;

    /* средняя линия */
    box-shadow: 0 7px 0 0 var(--text-color);
    border-radius: 2px;
    transition: box-shadow .2s ease;
  }
  .burger-icon::before,
  .burger-icon::after{
    content: "";
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: transform .2s ease, top .2s ease, opacity .2s ease;
  }
  .burger-icon::before{ top: 0; }
  .burger-icon::after{ top: 14px; }

  /* Burger -> X (через JS: .burger.is-active) */
  .burger.is-active .burger-icon{
    box-shadow: 0 7px 0 0 transparent; /* прячем среднюю */
  }
  .burger.is-active .burger-icon::before{
    top: 7px;
    transform: rotate(45deg);
  }
  .burger.is-active .burger-icon::after{
    top: 7px;
    transform: rotate(-45deg);
  }

  /* Overlay */
  .mobile-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1200;
  }

  /* Drawer */
  .mobile-drawer{
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(86vw, 360px);
    background: #fff;
    z-index: 1300;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -16px 0 40px rgba(0,0,0,.12);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .mobile-drawer.is-open{
    transform: translateX(0);
  }

  .mobile-drawer__top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
  }

  .mobile-drawer__brand{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    text-decoration: none;
  }
  .mobile-drawer__brand img{
    width: 34px;
    height: 34px;
    display: block;
  }

  .mobile-drawer__close{
    width: 44px;
    height: 44px;
    border: 0;
    background: rgba(0,0,0,.06);
    border-radius: 14px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }
  .mobile-drawer__close:active{
    transform: scale(0.98);
  }

  .mobile-drawer__nav{
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
  }

  .mobile-drawer__link{
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 12px 12px;
    border-radius: 12px;
    background: #f9f9f9;
  }
  .mobile-drawer__link:active{
    transform: scale(0.99);
  }

  .mobile-drawer__langs{
    margin-top: auto;
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
  }

  /* На мобилке языки прячем из хедера, потому что они есть в drawer */
  .header-container .lang-switch{
    display: none;
  }

  /* Lock scroll when menu is open */
  body.nav-open{
    overflow: hidden;
    touch-action: none;
  }
}

/* Desktop: force-hide mobile-only elements (не трогает твою текущую навигацию) */
@media (min-width: 769px){
  .mobile-logo,
  .mobile-overlay,
  .mobile-drawer{
    display: none !important;
  }
}

/* ============================================================
   MOBILE HEADER: logo | flags | burger  (mobile only)
   ============================================================ */
@media (max-width: 768px) {

  /* 3-column grid so flags are truly centered */
  .header-container{
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    column-gap: 10px;
  }

  .mobile-logo{ grid-column: 1; justify-self: start; }

  /* Show flags in header on mobile (override earlier rules that hid them) */
  .header-container .lang-switch{
    display: flex !important;
    grid-column: 2;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
  }

  /* Bigger tap targets (hit area), but keep flag circle visually clean */
  .header-container .lang-switch a{
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    overflow: hidden;
    border: 2px solid transparent;
    opacity: .85;
    transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
  }
  .header-container .lang-switch a:active{ transform: scale(0.98); }
  .header-container .lang-switch a.active{
    opacity: 1;
    border-color: var(--primary-green);
  }
  .header-container .lang-switch img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .burger{ grid-column: 3; justify-self: end; }

  .burger:focus-visible{
    outline: 2px solid rgba(0,144,93,.35);
    outline-offset: 2px;
  }
}

/* ============================================================
   MOBILE DRAWER: language flags at TOP + bottom safe area
   ============================================================ */
@media (max-width: 768px) {

  /* Protect bottom from browser bar + iOS safe-area */
  .mobile-drawer{
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  /* LANGS at top (we add class mobile-drawer__langs--top in HTML) */
  .mobile-drawer__langs--top{
    margin-top: 10px;
    margin-bottom: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;

    display: flex;
    gap: 12px;
    justify-content: flex-start;
  }

  .mobile-drawer__langs--top a{
    width: 36px;
    height: 36px;
    border-radius: 999px;
  }

  .mobile-drawer__langs--top img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Let nav scroll if items exceed height (top stays visible) */
  .mobile-drawer__nav{
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  /* If old bottom-langs styles exist, neutralize margin-top:auto */
  .mobile-drawer__langs{
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 768px) {

  /* Вертикальное центрирование текста в кнопке "Записаться" */
  .btn-fill {
    display: flex;
    align-items: center;
    justify-content: center;

    line-height: 1;
    padding-top: 0;
    padding-bottom: 0;
  }

}

