/* ============================================================
   IVPOL.RU — адаптивность (full width, от 3440px до 360px)
   ============================================================ */

/* ---------- Сверхширокие мониторы ---------- */
@media (min-width: 1700px) {
  .hero { min-height: min(86vh, 940px); }
  .hero-content { max-width: 1020px; }
  .hero h1 { font-size: clamp(48px, 3.6vw, 66px); }
  .section-head { max-width: 900px; }
  .step p { max-width: 40ch; }
}

@media (min-width: 2600px) {
  .hero h1 { font-size: clamp(56px, 3vw, 78px); }
  .hero-sub { font-size: clamp(22px, 1.2vw, 30px); }
}

/* ---------- Планшеты и маленькие десктопы: бургер-меню ---------- */
@media (max-width: 1360px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    top: var(--hd);
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px var(--pad-x) 28px;
    background: var(--dark);
    border-top: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 34px 60px rgba(8, 14, 20, .45);
    max-height: calc(100vh - var(--hd));
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-14px);
    transition: opacity .28s, transform .28s, visibility .28s;
  }
  .main-nav.open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .main-nav > ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 15px 4px;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .sub-menu {
    position: static;
    display: none;
    min-width: 0;
    margin: 6px 0 10px;
    padding: 4px;
    background: rgba(255, 255, 255, .05);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    border-radius: 10px;
  }
  .nav-item.is-open > .sub-menu { display: block; }
  .sub-menu a {
    color: #E7EDF2;
    padding: 12px 14px;
  }
  .sub-menu a:hover {
    background: rgba(255, 255, 255, .09);
    color: var(--accent);
  }

  .header-contacts { margin-left: auto; }
}

@media (max-width: 1500px) {
  .btn-call { display: none; }
}

/* ---------- Сетки: 2 колонки ---------- */
@media (max-width: 980px) {
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reviews-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reviews-grid .review:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .split { grid-template-columns: minmax(0, 1fr); }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-left: 0; padding: 12px clamp(8px, 2vw, 24px); }
  .stat:nth-child(even) { border-left: 1px solid rgba(255, 255, 255, .14); }
  .stat:nth-child(n + 3) { border-top: 1px solid rgba(255, 255, 255, .14); }

  .steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(18px, 3vw, 30px);
  }
  .step__arrow { display: none; }

  .contacts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .works-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Планшеты ---------- */
@media (max-width: 768px) {
  :root { --hd: 62px; }

  .brand img { height: 38px; }

  .hero {
    min-height: min(92vh, 760px);
    padding-top: clamp(44px, 7vh, 70px);
    padding-bottom: clamp(44px, 7vh, 70px);
  }
  .hero-background { background-position: 66% center; }
  .hero::after {
    background:
      linear-gradient(180deg,
        rgba(13, 22, 30, .93) 0%,
        rgba(13, 22, 30, .84) 55%,
        rgba(13, 22, 30, .72) 100%);
  }

  .cta-inner { flex-direction: column; align-items: flex-start; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-contacts { flex-direction: column; align-items: flex-start; gap: 14px; }

  .awards { flex-direction: column; align-items: flex-start; }

  .page-hero { padding-top: clamp(40px, 7vw, 64px); }

  .cta-line { flex-direction: column; align-items: flex-start; }

  .lightbox img.lb-img { max-height: 74vh; }
  .lb-btn { width: 44px; height: 44px; font-size: 22px; }
}

/* ---------- Мобильные: одна колонка ---------- */
@media (max-width: 640px) {
  .services-grid { grid-template-columns: minmax(0, 1fr); }
  .reviews-grid { grid-template-columns: minmax(0, 1fr); }

  .hero-features { flex-direction: column; gap: 14px; }
  .hero-feature { max-width: none; }

  .hero-actions .btn { width: 100%; }

  .works-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }

  .contacts-grid { grid-template-columns: minmax(0, 1fr); }

  .form-grid { grid-template-columns: minmax(0, 1fr); }

  .steps { grid-template-columns: minmax(0, 1fr); }

  .clients-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .section-head--center { text-align: left; }
  .section-head--center h2::after { margin-left: 0; }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
}

/* ---------- Смартфоны ---------- */
@media (max-width: 520px) {
  .btn-call { display: none; }
  .header-phone { font-size: 14.5px; }
  .header-phone svg { width: 18px; height: 18px; }

  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 10px; }
  .stat:first-child { padding-left: 10px; }
  .stat svg { width: 30px; height: 30px; }

  .review__head { flex-direction: row; }

  .err-actions .btn { width: 100%; }
}

@media (max-width: 400px) {
  .brand img { height: 34px; }
  .header-inner { gap: 10px; }
  .header-phone { font-size: 13.5px; gap: 6px; }
  .nav-toggle { width: 40px; height: 40px; }

  .hero h1 { font-size: 27px; }
  .hero-sub { font-size: 15.5px; }

  .btn { padding: 14px 20px; font-size: 15px; }

  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-caption { font-size: 12.5px; padding: 8px 14px; }
}

/* ---------- Тач-устройства: крупнее цели ---------- */
@media (hover: none) {
  .gallery-item__zoom { opacity: 1; transform: none; }
  .service-card:hover { transform: none; }
}

@media (min-width: 1081px) {
  .hero-content { max-width: 1160px; }
  .hero h1 .hero-line { white-space: nowrap; }
}

@media (min-width: 2600px) {
  .hero-content { max-width: 1400px; }
}
