/* =====================================================
   RESPONSIVE-OVERRIDES (FULL MOBILE READY)
   Подключать ПОСЛЕ styles.css — не ломает десктоп
   Включает: topbar компактный, hero (картинка сбоку/под текстом),
   красивые фоны для AI/consultation, исправленный слайдер,
   правки About и заголовков
===================================================== */

/* ==============
   БАЗОВЫЕ ПРАВКИ
   ============== */
/* Небольшие безопасные общие правила для всех планшетов/мобилок */
@media (max-width: 1024px) {
  html, body {
    max-width: 100%;
    scrollbar-gutter: stable;
  }

  img, picture, svg {
    max-width: 100%;
    height: auto;
    display: block;
  }

  * {
    box-sizing: border-box;
  }
}

/* ==============
   ТИПОГРАФИКА / ЗАГОЛОВКИ
   ============== */
@media (max-width: 1024px) {
  .works h2,
  .about h2,
  .ai-content h2,
  .advantages h2,
  .contacts-section h2 { font-size: 40px; }
}

@media (max-width: 768px) {
  .hero-left h1 { font-size: 42px; line-height: 1.04; letter-spacing: -0.6px; }
  .works h2,
  .about h2,
  .ai-content h2,
  .advantages h2,
  .contacts-section h2 { font-size: 32px; text-align: center; margin-left: 0; }
}

@media (max-width: 480px) {
  .hero-left h1 { font-size: 34px; }
  .lead, .about-bg-overlay p, .ai-description, .about-text-card { font-size: 15px; }
  .services-title { font-size: 28px; text-align: center;}
}

/* ==============
   TOPBAR (КОМПАКТ, ОДНА СТРОКА ЛОГО + NAV; ТЕЛЕФОН/CTA НИЖЕ)
   ============== */
/* На мобильных оставляем логотип + навигация в одной строке
   а контакт/кнопку делаем отдельной строкой под ними */
@media (max-width: 768px) {
  .topbar {
    flex-direction: row;
    flex-wrap: wrap; /* позволяет элементам переноса */
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 14px;
  }

  .logo {
    flex: 1;
    display: flex;
    justify-content: flex-start;
  }

  .nav {
    display: flex;
    gap: 1px;
    flex: 2;
    justify-content: center;
  }
  
  .nav a {
    margin: 0 8px;
  }

  .contact-info {
    flex: 1;
    justify-content: flex-start;
    font-size: 12px;
  }

  /* Уменьшаем размеры для мобильного */
  .logo_img {
    width: 80px;
    padding: 5px;
  }

  .cta {
    margin-left: 0;
    margin-top: 8px;
    text-align: center;
  }
}

/* ==============
   HERO — ТЕКСТ + КРАСИВАЯ КАРТИНКА СБОКУ / ПОД ТЕКСТОМ
   ==============
   На мобилке: текст вверху, картинка под текстом, сбоку правее (визуально)
   картинка имеет правый отступ, чтобы создать асимметрию */
@media (max-width: 1100px) {
  .hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 180px 20px 50px;
    gap: 12px;
    text-align: left;
  }

  .hero-left {
    position: relative;
    z-index: 3;
    max-width: 100%;
  }

  .hero-left h1 {
    font-size: 38px;
    line-height: 1.05;
  }

}

@media (max-width: 768px) {
  .lead {
    font-size: 16px;
    max-width: 100%;
    margin-bottom: 14px;
    text-align: left;
  }

  /* Картинка визуально справа под текстом */
  .hero-right {
    position: absolute;
    right: -25%;
    bottom: -20px;
    width: 82%;
    max-width: 360px;
    z-index: 2;
    pointer-events: none;
  }

  .hero-right img {
    width: 100%;
    height: auto;
    border-radius: 24px;
  }
  


  /* CTA — под текстом, растягиваем */
  .hero-cta {
    order: 3;
    width: 100%;
    display: flex;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta .btn { width: 100%; }
}

/* ==============
   ABOUT — фикс картинок и декора, колонка
   ============== */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 18px;
    align-items: start;
  }

  .about-bg-card {
    order: 1;
  }

  .about-image {
    order: 2;
    display: block;
  }

  .about-image img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    border-radius: 18px;
  }

  .about-text-card {
    order: 3;
    padding: 18px;
  }

  .about-bg-overlay {
    padding: 18px;
  }

  .mini-about-p { width: 100%; margin-top: 12px; }

}

@media (max-width: 768px) {
  .ai-section {
    padding: 0px;
  }

  /* Фон для мобильных — замени путь на своё изображение */
  .ai-section .ai-container {
    padding: 28px 18px;
    min-height: auto;
    background-image:
      linear-gradient(180deg, rgba(5,9,14,0.6), rgba(5,9,14,0.35)),
      url('/images/Group 385 (4).png');
    background-size: cover;
    background-position: 70% 100%;
  }

  /* Ограничиваем ширину контента, центрируем */
  .ai-section .ai-content {
    max-width: 720px;
    margin: 0 auto;
    display: block;
    padding: 6px 6px 18px 6px;
  }

  .ai-section h2 {
    font-family: var(--mts-wide);
    font-size: 30px;
    line-height: 1.05;
    margin: 0 0 12px 0;
    color: #e6f7ff;
    text-align: center;
  }

  .content_about_ai {
    margin-left: 0px;
  }

  .ai_question {
    font-size: 16px;
    font-weight: 700;
    margin: 8px 0 12px 0;
    color: #fff;
    text-align: left;
  }

  /* Контейнер с шагами и кнопкой — переводим в колонку */
  .button_content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
  }

  /* Стили для списка шагов: карточки */
  .ai-steps {
    width: 95%;
    gap: 20px;
  }

  .ai-steps ol {
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 2px;
  }

  .ai-step {
    border-radius: 12px;
    position: relative;
    width: 100%;
  }


  .step-content p {
    margin: 0;
    color: rgba(230,247,255,0.95);
    font-size: 14px;
    line-height: 1.45;
  }

  /* Кнопка — полная ширина, заметная */
  .ai-btn {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(36,129,235,0.28);
    align-self: stretch;
  }

  /* Заметная примечалка */
  .ai-note {
    margin-top: 16px;
    color: rgba(230,247,255,0.75);
    font-size: 13px;
    line-height: 1.45;
  }

  .ai-note hr {
    border: none;
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 12px 0;
  }
}

/* На маленьких экранах — удаляем тяжелую картинку, ставим градиент */
@media (max-width: 768px) {
  .ai-container {
    background-image:
      linear-gradient(135deg, rgba(61,180,255,0.12), rgba(36,129,235,0.18));
    padding: 36px 16px;
    min-height: auto;
  }

  .ai-description { font-size: 16px; }
  .ai-btn { width: 100%; }
  .button_content { grid-template-columns: 1fr; gap: 18px; }
}

/* ==============
   CONSULTATION — фон + overlay
   ============== */
@media (max-width: 1024px) {
  .consultation-container {
    background-image:
      linear-gradient(180deg, rgba(20,40,60,0.55), rgba(10,20,30,0.5)),
      url('/images/Group 398.png');
    background-size: cover;
    padding: 48px 20px;
    background-position: 90% 10%;
  }

  .consultation-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(5,9,14,0.15), rgba(5,9,14,0.35));
    border-radius: inherit;
    z-index: 1;
  }

  .consultation-content { position: relative; z-index: 2; }
}

/* На мобильных — упрощаем фон до мягкого градиента */
@media (max-width: 768px) {
  .consultation-container {
    background-image: url('/images/Group 398.png');
    background-size: cover;
    padding: 48px 20px;
    background-position: 85% 50%;
  }

  .consultation-content { width: 100%; padding: 14px; }
  .consultation-phone { flex-direction: column; gap: 10px; align-items: stretch; }
  .consultation-phone input { width: 100%; min-width: auto; }
  .consultation-btn { width: 100%; min-width: auto; }
}

/* ==============
   СЛАЙДЕР — фикс переполнения + точный шаг
   ============== */
/* Общие правки: убираем лишние отступы, скрываем горизонтальный скролл */
@media (max-width: 1024px) {
  .slider-container { max-width: 100%; box-sizing: border-box; }
  .slider-track { display: flex; gap: 20px; align-items: stretch; }
  .work-card { box-sizing: border-box; }
}

/* На мобильных делаем карточку ровно шириной с экраном,
   обнуляем gap для трансформаций и гарантируем отсутствие overflow */
@media (max-width: 768px) {
  .works {
    padding-left: 12px;
    padding-right: 12px;
    overflow: hidden;
  }

  /* Контейнер занимает реальную ширину родителя (не 100vw!) */
  .slider-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    left: auto;
    transform: none;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Здесь задаём gap и внутренние side paddings — они учитываются в ширине карточки */
  .slider-track {
    display: flex;
    gap: 20px;               /* <-- используем 16px на мобиле, JS прочитает это значение */
    padding: 0 12px;         /* <-- внутренние отступы, чтобы карточка не прилипала к краям */
    transition: transform .45s cubic-bezier(.22,.9,.3,1);
    will-change: transform;
    touch-action: pan-y;     /* не мешаем вертикальной прокрутке страницы */
  }

  /* Карточка теперь считает свою ширину от ширины контейнера (с учётом padding) */
  .work-card {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  .work-card img {
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    width: 100%;
    display: block;
    height: auto;
    object-fit: cover;
  }

  .slider-btn { width: 44px; height: 44px; }
}

/* ==============
   WORKS — дополнительная предохранительная обрезка
   ============== */
@media (max-width: 768px) {
  .works { padding-bottom: 40px; padding-top: 40px;}
  .works-header { gap: 12px; align-items: center; }
  .works h2 { font-size: 32px; margin: 0; }
}

/* ==============
   ADVANTAGES / SERVICES / CONTACTS — мелкие правки
   ============== */
@media (max-width: 768px) {
  .adv-card p {
    font-size: 15px;
  }
}

@media (max-width: 1200px) {
  .adv_container {padding: 0px;}
  .advantages-grid {
    grid-template-columns: 1fr;
  }

  .advantages-grid > .adv-card {
    grid-column: 1 / -1 !important;
  }
  .services-section {padding: 60px 20px;}
  .services-grid { grid-template-columns: 1fr; gap: 12px;}
  .contacts-wrap { grid-template-columns: 1fr; gap: 20px; padding: 0 12px; }
  .contact-card { height: 120px; border-radius: 14px; }
  .contacts-footer { font-size: 13px; padding: 0 12px; }
}

/* ==============
   ФИНАЛЬНЫЕ ПОЛЕЗНЫЕ ПРАВКИ
   ============== */
/* Убираем возможные горизонтальные полосы у отдельных блоков */
@media (max-width: 1024px) {
  .hero-wrapper::before,
  .ai-container::after,
  .consultation-container::after {
    transform-origin: center;
  }
}

@media (max-width: 1400px) {
  .hero-left h1 {
    font-size: 50px;
  }

  .hero-right img {
    width: 350px;
  }

  .hero-wrapper {
    min-height: 40vh;
  }

  .about-grid {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .about-image {
    width: 100%;        /* ← КЛЮЧ */
    height: 100%;
  }

  .about-image img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
  }

  .about-bg-overlay p {
    width: 80%;
  }
}

@media (max-width: 1100px) {
  .about-bg-overlay p {
    width: 100%;
  }
  .about-decor { display: none; } 

  .hero-left h1 {
    font-size: 40px;
  }

  .hero-wrapper {
    min-height: 100vh;
  }
  .hero-right img {
    display: none;
  }

  .topbar .nav,
  .topbar .contact-info,
  .topbar .cta {
    display: none !important;
  }

  .topbar {
    padding: 12px 18px;
    margin: 0;
    border-radius: 0;
    align-items: center;
  }

  .logo { margin-right: auto; }

  .mobile-burger { display: inline-flex; }

  #mobile-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 56px;
    height: 44px;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    position: relative;
    z-index: 3200;
  }

  #mobile-burger .line {
    height: 2.8px;
    background: #fbfcfe;
    border-radius: 2px;
    transition: transform .35s cubic-bezier(.2,.9,.2,1),
                width .25s ease;
  }

  #mobile-burger .line-long {
    width: 28px;
  }

  #mobile-burger .line-short {
    width: 16px;
  }

  #mobile-burger.open {
    display: none;
  }
}

/* Мягкие тени, плавность */
@media (max-width: 1024px) {
  .card, .work-card, .about-bg-card {
    transition: transform .28s ease, box-shadow .28s ease;
  }
}

/* ==============
   РЕЗЮМЕ: дополнительные подсказки (не CSS) — прочитай в коде JS:
   При использовании этих правил JS должен:
   - Для шага слайда на мобилке брать slider.getBoundingClientRect().width
   - При ресайзе делать reset index = 0 и update()
   Это уже обсуждалось — CSS и JS вместе дают идеальный результат.
   ============== */
