/* ============================================================
   PRIMARY mobile/tablet rules — driven by inline JS in <head> that
   tags <html> with .vp-mobile / .vp-tablet / .vp-desktop BEFORE CSS loads.
   These rules do NOT rely on @media queries, so they work even when
   the viewport meta tag is parsed late (Chrome DevTools Responsive Mode bug).
   ============================================================ */
/* Header / footer / cat-nav containers — must work on EVERY page (header & footer
   are global), so we don't restrict them to common-home. */
html.vp-mobile .top-bar > .container,
html.vp-mobile .header > .container,
html.vp-mobile .cat-nav > .container,
html.vp-mobile .footer__main > .container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

/* Homepage-only container reset — protects Bootstrap layout on inner pages */
html.vp-mobile body.common-home,
html.vp-tablet body.common-home {
  min-width: 0 !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
html.vp-mobile body.common-home .container,
html.vp-mobile body.common-home .row,
html.vp-mobile body.common-home .hero > .container,
html.vp-mobile body.common-home .trust-bar > .container,
html.vp-mobile body.common-home .categories > .container,
html.vp-mobile body.common-home .products > .container,
html.vp-mobile body.common-home .why-us > .container,
html.vp-mobile body.common-home .compare > .container,
html.vp-mobile body.common-home .reviews > .container,
html.vp-mobile body.common-home .faq > .container,
html.vp-mobile body.common-home .seo-text > .container,
html.vp-mobile body.common-home .subscribe > .container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

/* Header — show burger, hide desktop nav/search */
html.vp-mobile .header__nav,
html.vp-mobile .header__search,
html.vp-mobile .header__icon--desktop { display: none !important; }
html.vp-mobile .burger-btn { display: flex !important; }
html.vp-mobile .header { padding: 10px 0 !important; position: sticky !important; top: 0 !important; z-index: 200 !important; }
html.vp-mobile .header__logo img { height: 30px !important; width: auto !important; }

/* Top bar — only the slider visible */
html.vp-mobile .top-bar { height: 36px !important; }
html.vp-mobile .top-bar__left,
html.vp-mobile .top-bar__right { display: none !important; }
html.vp-mobile .top-bar__center { flex: 1 !important; }

/* Cat nav — sticky under header + horizontal scroll.
   Sticky rule mirrors header.css:374 — duplicated here under html.vp-mobile so it
   survives the first-paint window where @media (max-width: 768px) can lag behind
   the JS-driven class (Chrome DevTools Responsive Mode bug, iOS viewport-meta delay). */
html.vp-mobile .cat-nav {
  position: sticky !important;
  top: 65px !important;       /* actual header height: 44px content + 2×10px padding + 1px border-bottom */
  z-index: 199 !important;    /* one below the sticky .header (z-index 200) */
  background: var(--brand-teal) !important;
}
html.vp-mobile .cat-nav > .container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  scrollbar-width: none !important;
}
html.vp-mobile .cat-nav > .container::-webkit-scrollbar { display: none !important; }
html.vp-mobile .cat-nav a {
  flex-shrink: 0 !important; white-space: nowrap !important;
  padding: 10px 14px !important; font-size: 12px !important;
}

/* Hero */
html.vp-mobile .hero { min-height: 380px !important; padding: 40px 0 !important; }
html.vp-mobile .hero > .container {
  flex-direction: column !important;
  text-align: center !important;
  padding-top: 30px !important;
  padding-bottom: 30px !important;
}
html.vp-mobile .hero__product { display: none !important; }
html.vp-mobile .hero h1 { font-size: 24px !important; line-height: 1.25 !important; }
html.vp-mobile .hero__subtitle { font-size: 14px !important; }
html.vp-mobile .hero__cta-group { flex-direction: column !important; gap: 10px !important; align-items: stretch !important; }
html.vp-mobile .hero__cta,
html.vp-mobile .hero__cta--secondary {
  min-height: 50px !important; width: 100% !important; max-width: 100% !important;
  font-size: 15px !important; justify-content: center !important;
}
html.vp-mobile .hero__usps { flex-direction: column !important; gap: 6px !important; align-items: center !important; }

/* Trust bar 2x2 */
html.vp-mobile .trust-bar > .container {
  display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important;
}
html.vp-mobile .trust-item:not(:last-child)::after { display: none !important; }

/* Categories — horizontal scroll */
html.vp-mobile .categories__grid {
  display: flex !important;
  grid-template-columns: none !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  gap: 10px !important;
  scroll-snap-type: x mandatory !important;
  scrollbar-width: none !important;
}
html.vp-mobile .categories__grid::-webkit-scrollbar { display: none !important; }
html.vp-mobile .category-card { flex: 0 0 180px !important; scroll-snap-align: start !important; aspect-ratio: 3/4 !important; }

/* Products grid 2 cols.
   max-width: none / margin: 0 — resets the @media (max-width: 480px) rule below
   that wants `max-width: 340px; margin: auto` for the 1-col narrow-phone layout.
   Since vp-mobile keeps 2 cols, the 340px clamp would squeeze the grid into a
   narrow centred strip with huge empty side margins.

   ТЗ: тонкая равная полоска со ВСЕХ сторон между карточками. Боковой padding
   секции уменьшен до 6px (см. .products > .container override ниже), gap между
   карточками - тот же 6px. Это даёт визуальную «решётку» где все промежутки
   одинаковой толщины. Если нужно ещё уже - снизить оба значения синхронно. */
html.vp-mobile .products__grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 6px !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Override общего .container padding (16px из строк 16-17 / 45-46) специально
   для секции .products на мобиле — чтобы боковая полоска совпадала с gap. */
html.vp-mobile body.common-home .products > .container,
html.vp-mobile .products > .container {
  padding-left: 6px !important;
  padding-right: 6px !important;
}
html.vp-mobile .counters { gap: 16px !important; flex-direction: row !important; justify-content: space-around !important; }
html.vp-mobile .counter:not(:last-child)::after { display: none !important; }
html.vp-mobile .counter__number { font-size: 22px !important; }

/* Sticker "Хит продаж" — visible on mobile (display:none removed).
   Sits in the bottom-right corner of the card, same as on desktop. */

/* Why-us 1 col */
html.vp-mobile .why-us__grid { grid-template-columns: 1fr !important; gap: 12px !important; }

/* Compare "Топ моделей" — horizontal scroll carousel (like categories) */
html.vp-mobile .compare__grid {
  display: flex !important;
  grid-template-columns: none !important;
  /* justify-content: flex-start — обязательно перебиваем `center` из
     compare.css desktop-правила. На flex+overflow-x:auto центрирование
     ломает скролл влево (контент центрируется, первые карточки уезжают
     в недостижимую negative-зону), пользователь видит карусель «с середины»
     и может скроллить только вправо. */
  justify-content: flex-start !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  gap: 12px !important;
  scroll-snap-type: x mandatory !important;
  scrollbar-width: none !important;
  max-width: none !important;
  padding-bottom: 8px !important;
}
html.vp-mobile .compare__grid::-webkit-scrollbar { display: none !important; }
html.vp-mobile .compare__card { flex: 0 0 clamp(180px, 62vw, 230px) !important; scroll-snap-align: start !important; }
html.vp-mobile .compare__card--featured { transform: none !important; }
/* Carousel affordance: next card always peeks + soft fade on the right edge */
html.vp-mobile .compare > .container { position: relative !important; }
html.vp-mobile .compare > .container::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 36px;
  background: linear-gradient(to right, rgba(255,255,255,0), #ffffff);
  pointer-events: none;
  z-index: 4;
}

/* Footer 1 col */
html.vp-mobile .footer__grid { grid-template-columns: 1fr !important; gap: 24px !important; }

/* Subscribe form vertical */
html.vp-mobile .subscribe__form { flex-direction: column !important; gap: 10px !important; }
html.vp-mobile .subscribe__input,
html.vp-mobile .subscribe__btn { width: 100% !important; border-radius: 10px !important; }

/* ============================================================
   TABLET (≤1024px)
   ============================================================ */
html.vp-tablet .compare__grid { grid-template-columns: repeat(2, 1fr) !important; max-width: 720px !important; }
html.vp-tablet .compare__card--featured { transform: none !important; }
html.vp-tablet .why-us__grid { grid-template-columns: repeat(2, 1fr) !important; }
html.vp-tablet .footer__grid { grid-template-columns: repeat(2, 1fr) !important; }
html.vp-tablet .hero__product { display: none !important; }
html.vp-tablet .hero > .container { flex-direction: column !important; text-align: center !important; }
html.vp-tablet .categories__grid { grid-template-columns: repeat(2, 1fr) !important; }
html.vp-tablet .products__grid { grid-template-columns: repeat(3, 1fr) !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero .container { flex-direction: column; text-align: center; }
  .hero__product { display: none; }
  .hero h1 { font-size: 32px; }
  .hero__usps { justify-content: center; }
  .hero__cta-group { justify-content: center; }
  .hero__subtitle { max-width: 100%; }
  .categories__grid { grid-template-columns: repeat(2, 1fr); }
  .products__grid { grid-template-columns: repeat(3, 1fr); }
  .why-us__grid { grid-template-columns: repeat(2, 1fr); }
  .compare__grid { grid-template-columns: repeat(2, 1fr) !important; max-width: 720px !important; }
  .compare__card--featured { transform: none !important; }
  .review-card { flex: 0 0 320px; }
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
  .footer__bottom-row { flex-direction: column; gap: 12px; text-align: center; }
  .footer__legal-info { justify-content: center; }
}

@media (max-width: 768px) {
  /* Container reset only for OUR sections (homepage, header & footer) — never
     touch a bare .container so Bootstrap layouts on inner pages keep working. */
  .top-bar > .container,
  .header > .container,
  .cat-nav > .container,
  .footer__main > .container,
  body.common-home .hero > .container,
  body.common-home .trust-bar > .container,
  body.common-home .categories > .container,
  body.common-home .why-us > .container,
  body.common-home .compare > .container,
  body.common-home .reviews > .container,
  body.common-home .faq > .container,
  body.common-home .seo-text > .container,
  body.common-home .subscribe > .container,
  body.common-home .products > .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* — Force any wide hero/sections content to never overflow viewport — */
  .hero,
  .trust-bar,
  .categories,
  .products,
  .why-us,
  .compare,
  .reviews,
  .faq,
  .seo-text,
  .subscribe,
  .footer {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* — Top bar — */
  .top-bar { height: 36px; font-size: 12px; }
  .top-bar .container { justify-content: center; }
  .top-bar__left { display: none; }
  .top-bar__right { display: none; }
  .top-bar__center { flex: 1; }

  /* — Header: sticky + burger — */
  .header {
    position: sticky; top: 0; z-index: 200;
    padding: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }
  .header__nav { display: none; }
  .header__search { display: none; }
  .header__logo img { height: 30px; width: auto; }
  .header__icons { gap: 4px; }
  .header__icon { width: 44px; height: 44px; }
  .burger-btn { display: flex; }
  .header__icon--desktop { display: none; }

  /* — Cat-nav: горизонтальный скролл с индикатором "ещё пункты справа" — */
  .cat-nav {
    position: sticky;
    top: 65px;
    z-index: 199;
    overflow: hidden;       /* контейнер задаёт фейд через ::after */
  }
  .cat-nav::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 32px;
    background: linear-gradient(to left, var(--brand-teal), rgba(130, 180, 189, 0));
    pointer-events: none;
    z-index: 1;
  }
  .cat-nav > .container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    flex-wrap: nowrap;
    scrollbar-width: none;
    gap: 0 !important;
    padding-left: 12px !important;
    padding-right: 36px !important;  /* запас под градиент-индикатор */
  }
  .cat-nav > .container::-webkit-scrollbar { display: none; }
  .cat-nav a {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 11px 14px;
    font-size: 12px;
    letter-spacing: 0.4px;
  }
  .cat-nav a.cat-nav--highlight {
    border-bottom-width: 2px;
  }

  /* — Hero — */
  .hero { min-height: 380px; padding: 40px 0; }
  .hero h1 { font-size: 24px; line-height: 1.25; }
  .hero__badge { font-size: 10px; padding: 6px 14px; letter-spacing: 1px; }
  .hero__subtitle { font-size: 14px; margin-bottom: 20px; }
  .hero__cta-group { flex-direction: column; gap: 10px; align-items: stretch; }
  .hero__cta, .hero__cta--secondary {
    min-height: 50px; width: 100%; max-width: 100%;
    font-size: 15px; justify-content: center; padding: 14px 24px;
  }
  /* Make secondary CTA more visible on dark hero */
  .hero__cta--secondary {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.5);
  }
  .hero__usps { flex-direction: column; gap: 6px; font-size: 13px; align-items: center; }
  .hero__usp { justify-content: flex-start; max-width: 280px; width: 100%; }

  /* — Trust bar — */
  .trust-bar { padding: 16px 0; }
  .trust-bar .container {
    display: grid !important; grid-template-columns: 1fr 1fr !important;
    gap: 8px; justify-items: stretch;
  }
  .trust-item { padding: 10px 8px; width: 100%; justify-content: flex-start; }
  .trust-item:not(:last-child)::after { display: none; }
  .trust-item__icon { width: 36px; height: 36px; min-width: 36px; border-radius: 10px; }
  .trust-item__icon svg { width: 16px; height: 16px; }
  .trust-item__text strong { font-size: 12px; }
  .trust-item__text span { font-size: 10px; }

  /* — Categories: горизонтальный скролл — */
  .categories { padding: 40px 0 32px; }
  .categories h2 { font-size: 22px; margin-bottom: 20px; }
  .categories__grid {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; gap: 10px;
    padding-bottom: 8px; scrollbar-width: none;
  }
  .categories__grid::-webkit-scrollbar { display: none; }
  .category-card {
    flex: 0 0 180px; scroll-snap-align: start; aspect-ratio: 3/4;
  }
  .category-card__name { font-size: 14px; letter-spacing: 0.8px; }
  .category-card__overlay { padding: 14px; }
  .category-card__icon { width: 32px; height: 32px; margin-bottom: 6px; }
  .category-card__icon svg { width: 15px; height: 15px; }
  .category-card__count { font-size: 11px; }
  .category-card__arrow { display: none; }

  /* — Products / "Популярные модели" — */
  .products { padding: 40px 0; }
  .products h2 { font-size: 22px; margin-bottom: 18px; }
  .counters {
    gap: 16px !important;
    margin: 6px 0 24px !important;
    padding: 12px 0 !important;
    flex-direction: row !important;
    justify-content: space-around !important;
  }
  .counter:not(:last-child)::after { display: none; }
  .counter__number { font-size: 22px !important; }
  .counter__label { font-size: 10px !important; }
  .products__grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .product-card { border-radius: 10px; }
  .product-card__name { font-size: 12px; line-height: 1.3; }
  .product-card__info { padding: 10px 10px 12px; }
  .product-card__price { font-size: 14px; }
  .product-card__delivery { font-size: 10px; padding: 0; }
  .product-card__delivery svg { width: 12px; height: 12px; }
  .product-card__rating { font-size: 11px; }
  .product-card__specs { font-size: 10px; }
  .product-card__buy { padding: 8px 12px; font-size: 11px; }
  .product-card__compare { width: 36px; height: 36px; }
  .product-card__sticker { width: 64px; height: 64px; }
  .product-card__sticker-inner { font-size: 8px; padding: 2px 0; bottom: 11px; right: -35px; }
  .product-card__tools-badge .product-card__tools-num { width: 30px; height: 30px; font-size: 13px; }
  .product-card__size-badge { padding: 3px 6px; }
  .product-card__size-badge .product-card__size-value { font-size: 13px; }

  /* — Why-us — */
  .why-us { padding: 40px 0; }
  .why-us h2 { font-size: 22px; margin-bottom: 8px; }
  .why-us__subtitle { font-size: 13px; margin-bottom: 24px; }
  .why-us__grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .why-us__item { padding: 24px 20px; }
  .why-us__icon { width: 60px; height: 60px; margin-bottom: 14px; }
  .why-us__icon svg { width: 28px; height: 28px; }
  .why-us__number { font-size: 26px; }
  .why-us__title { font-size: 15px; }
  .why-us__desc { font-size: 13px; }

  /* — Compare — */
  .compare { padding: 40px 0; }
  .compare h2 { font-size: 22px; }
  .compare__subtitle { font-size: 13px; }
  .compare__grid {
    display: flex !important;
    grid-template-columns: none !important;
    /* Перебиваем justify-content: center из compare.css desktop — на flex+overflow:auto
       центрирование ломает скролл влево (см. html.vp-mobile правило выше). */
    justify-content: flex-start !important;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; gap: 12px;
    padding-bottom: 8px; scrollbar-width: none;
    max-width: none !important;
  }
  .compare__grid::-webkit-scrollbar { display: none; }
  .compare__card {
    flex: 0 0 clamp(180px, 62vw, 230px); scroll-snap-align: start;
    padding: 20px 16px;
  }
  .compare__card--featured { transform: none !important; }
  .compare > .container { position: relative; }
  .compare > .container::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 36px;
    background: linear-gradient(to right, rgba(255,255,255,0), #ffffff);
    pointer-events: none;
    z-index: 4;
  }

  /* — Reviews — */
  .reviews { padding: 40px 0; }
  .reviews h2 { font-size: 22px; }
  .review-card { flex: 0 0 280px !important; padding: 20px; }
  .reviews__avg { font-size: 32px; }

  /* — FAQ — */
  .faq { padding: 40px 0; }
  .faq h2 { font-size: 22px; }
  .faq__question { font-size: 14px; padding: 16px 14px; }

  /* — Subscribe — */
  .subscribe { padding: 40px 0; }
  .subscribe h2 { font-size: 22px; }
  .subscribe__form { flex-direction: column; gap: 10px; }
  .subscribe__input,
  .subscribe__btn {
    width: 100%;
    border-radius: 10px !important;
  }

  /* — Footer — */
  .footer__grid { grid-template-columns: 1fr !important; gap: 24px; }
  .footer__col h4 { margin-bottom: 12px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 21px; }
  .hero__badge { font-size: 9px; padding: 5px 12px; }
  .hero__subtitle { font-size: 13px; }

  .products__grid {
    grid-template-columns: 1fr !important;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }

  .counters { gap: 10px !important; }
  .counter__number { font-size: 20px !important; }
}

