/* ===========================================
   MOBILE — финальная адаптация под телефон
   Загружается последней, перекрывает предыдущие правила.
   =========================================== */

/* === Общие фиксы === */
html, body {
  overflow-x: hidden; /* отрезаем горизонтальный скролл */
  -webkit-text-size-adjust: 100%;
}
img, video, svg { max-width: 100%; height: auto; }

* { min-width: 0; }

/* === Mobile (≤ 800px) === */
@media (max-width: 800px) {
  .container { padding: 0 14px; }

  /* Topbar/promo на мобиле — компактные */
  .promo-bar { font-size: 11px; padding: 6px 12px; line-height: 1.3; }
  .promo-bar__badge { font-size: 9px; padding: 2px 6px; }
  .promo-bar__timer { font-size: 12px; padding: 2px 6px; }

  /* Шапка — лого компактно, иконки удобные */
  .header__row { height: 64px; gap: 8px; }
  .logo__icon-img { width: 38px; height: 38px; }
  .logo__text-img { height: 22px; }
  .icon-btn { width: 42px; height: 42px; }

  /* Корзина в шапке — только иконка с badge */
  .cart-btn { padding: 9px; gap: 0; }
  .cart-btn span:not(.cart-badge) { display: none; }
  .cart-badge { margin-left: 0; position: absolute; top: -2px; right: -2px; }

  /* Hero — компактнее */
  .hero { padding: 28px 0 48px; border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .hero__inner { gap: 28px; }
  .hero__title { font-size: clamp(28px, 8vw, 36px); }
  .hero__lead { font-size: 15px; margin-bottom: 24px; }
  .hero__pill { font-size: 12px; padding: 6px 12px 6px 6px; margin-bottom: 18px; }
  .hero__actions { gap: 8px; margin-bottom: 32px; }
  .hero__actions .btn { flex: 1; min-width: 0; font-size: 14px; padding: 14px 18px; }
  .hero__actions .btn svg { width: 16px; height: 16px; }
  .hero__visual { height: 280px; }
  .hero__card.c3 { padding: 14px; }
  .hero__card__big { font-size: 22px; }
  .hero__card__small { font-size: 11px; }
  .hero__stats { gap: 14px; padding-top: 24px; }
  .hero__stat-num { font-size: 22px; }
  .hero__stat-label { font-size: 11px; }

  /* Секции — меньше отступы */
  .section { padding: 44px 0; }
  .section__head { margin-bottom: 28px; }
  .section__title { font-size: clamp(24px, 6vw, 32px); }
  .section__lead { font-size: 14px; padding: 0 8px; }
  .section__eyebrow { font-size: 11px; }

  /* Категории и товары на мобиле — 2 колонки */
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-card { padding: 18px 14px 14px; min-height: 140px; }
  .cat-card__icon { width: 48px; height: 48px; font-size: 24px; }
  .cat-card__name { font-size: 15px; line-height: 1.2; }
  .cat-card__count { font-size: 12px; }
  .cat-card__arrow { width: 28px; height: 28px; bottom: 14px; right: 14px; }

  /* Карточки товаров на мобиле */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-card { border-radius: var(--r-lg); }
  .product-card__body { padding: 12px 12px 14px; gap: 6px; }
  .product-card__cat { font-size: 10px; }
  .product-card__title { font-size: 13px; line-height: 1.2; -webkit-line-clamp: 2; }
  .product-card__rating { font-size: 11px; gap: 3px; }
  .product-card__price-old { font-size: 11px; }
  .product-card__price-new { font-size: 16px; }
  .product-card__add { width: 36px; height: 36px; }
  .product-card__add svg { width: 16px; height: 16px; }
  .product-card__badge { font-size: 9px; padding: 4px 8px; top: 8px; left: 8px; }
  .product-card__fav { width: 32px; height: 32px; top: 8px; right: 8px; }
  .product-card__fav svg { width: 14px; height: 14px; }
  .product-card__colors { gap: 4px; }
  .color-swatch { width: 14px; height: 14px; }
  .product-card__quick { display: none; } /* tap-only mode */

  /* Trust badges */
  .trust__grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .trust__icon { width: 40px; height: 40px; }
  .trust__icon svg { width: 20px; height: 20px; }
  .trust__title { font-size: 13px; }
  .trust__desc { font-size: 11px; }

  /* Banner акции */
  .banner { padding: 28px 22px; border-radius: var(--r-xl); }
  .banner__title { font-size: clamp(22px, 5vw, 28px); }
  .banner__lead { font-size: 14px; margin-bottom: 20px; }

  /* Footer */
  .footer { padding: 40px 0 16px; margin-top: 40px; }
  .footer__grid { gap: 24px; margin-bottom: 32px; }
  .footer__about p { font-size: 13px; }
  .footer__col h5 { font-size: 14px; margin-bottom: 14px; }
  .footer__col a { font-size: 13px; }
  .trust-badges { gap: 6px; padding-top: 16px; margin-top: 16px; }
  .trust-badge { font-size: 10px; padding: 5px 9px; gap: 4px; }
  .trust-badge svg { width: 12px; height: 12px; }
  .trust-badges__label { font-size: 10px; width: 100%; margin-bottom: 4px; }

  /* === Каталог === */
  .catalog-hero { padding: 28px 0 24px; margin-bottom: 20px; }
  .catalog-title { font-size: clamp(24px, 7vw, 32px); }
  .catalog-meta { font-size: 13px; }
  .catalog-toolbar { padding: 12px 14px; gap: 10px; }
  .catalog-toolbar__left { gap: 8px; width: 100%; }
  .search-input { font-size: 13px; padding: 9px 14px 9px 32px; background-size: 16px; }
  .sort-select { font-size: 13px; padding: 9px 32px 9px 12px; }

  /* Фильтры — slide-in справа */
  .filters {
    width: 86vw;
    max-width: 340px;
    padding: 20px;
    overflow-y: auto;
  }
  .filters__group { padding-bottom: 18px; margin-bottom: 18px; }
  .filters__title { font-size: 13px; margin-bottom: 10px; }
  .filter-list label { padding: 9px 11px; font-size: 13px; }

  /* === Страница товара === */
  .product-page { padding: 18px 0 100px; } /* +space для sticky-cart */
  .product-layout { gap: 22px; }
  .gallery__main { border-radius: var(--r-lg); }
  .gallery__thumb { width: 60px; height: 60px; }
  .gallery__thumbs--photos .gallery__thumb { width: 56px; height: 56px; }
  .gallery__variants .gallery__thumb { width: 50px; height: 50px; }
  .product-info__title { font-size: clamp(22px, 5.5vw, 28px); }
  .product-info__cat { font-size: 11px; }
  .price-row { padding: 16px 18px; gap: 10px; border-radius: var(--r-md); }
  .price-row__new { font-size: 26px; }
  .price-row__old { font-size: 14px; }
  .product-info__desc { font-size: 14px; }
  .opt-group__title { font-size: 12px; }
  .color-row__item { padding: 5px 12px 5px 5px; font-size: 12px; }
  .color-row__swatch { width: 24px; height: 24px; }
  .qty-stepper button { width: 32px; height: 32px; font-size: 18px; }
  .qty-stepper input { width: 40px; font-size: 14px; }
  .product-actions { gap: 8px; }
  .product-actions .btn { padding: 14px 18px; font-size: 14px; min-width: 0; }
  .features { padding: 18px; }
  .features__title { font-size: 16px; margin-bottom: 12px; }
  .features__list li { font-size: 13px; }
  .delivery-info { padding: 14px 16px; gap: 12px; }
  .delivery-info__icon { width: 40px; height: 40px; }
  .delivery-info__title { font-size: 13px; }
  .delivery-info__text { font-size: 11px; }

  /* === Корзина === */
  .cart-page { padding: 18px 0 100px; }
  .cart-head h1 { font-size: clamp(24px, 7vw, 32px); }
  .cart-head p { font-size: 13px; }
  .cart-item { grid-template-columns: 70px 1fr; gap: 12px; padding: 12px; border-radius: var(--r-md); }
  .cart-item__img { width: 70px; height: 70px; border-radius: var(--r-sm); }
  .cart-item__title { font-size: 14px; line-height: 1.2; }
  .cart-item__variant { font-size: 11px; }
  .cart-item__price { font-size: 15px; }
  .cart-item__controls { grid-column: 1 / -1; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ink-100); }
  .cart-item__remove { width: 32px; height: 32px; }
  .qty-stepper button { width: 28px; height: 28px; }
  .qty-stepper input { width: 36px; font-size: 13px; }

  /* Чекаут форма */
  .checkout-form { padding: 20px 16px; border-radius: var(--r-md); }
  .checkout-form h3 { font-size: 20px; margin-bottom: 18px; }
  .checkout-form h4 { font-size: 14px; margin-bottom: 10px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field input, .field textarea, .field select { padding: 12px 14px; font-size: 14px; }
  .delivery-options { grid-template-columns: 1fr; gap: 8px; }
  .delivery-option { padding: 12px 14px; gap: 10px; }
  .delivery-option__label { font-size: 13px; }
  .delivery-option__price { font-size: 11px; }

  .summary { padding: 20px; border-radius: var(--r-md); }
  .summary h3 { font-size: 18px; margin-bottom: 18px; }
  .summary__row { font-size: 13px; padding: 10px 0; }
  .summary__total span { font-size: 14px; }
  .summary__total strong { font-size: 22px; }
  .promo-row input { padding: 10px 12px; font-size: 13px; }
  .promo-row button { padding: 10px 14px; font-size: 12px; }

  /* === Блог === */
  .blog-hero { padding: 28px 0 24px; margin-bottom: 24px; }
  .blog-hero h1 { font-size: clamp(26px, 7vw, 36px); }
  .blog-hero p { font-size: 14px; }
  .blog-cats { gap: 6px; margin-bottom: 20px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .blog-cat { white-space: nowrap; padding: 8px 14px; font-size: 12px; }
  .article-card { border-radius: var(--r-lg); }
  .article-card__body { padding: 16px; gap: 8px; }
  .article-card__title { font-size: 16px; -webkit-line-clamp: 3; }
  .article-card__excerpt { font-size: 13px; -webkit-line-clamp: 3; }
  .article-card__meta { font-size: 11px; }

  .article-hero { padding: 28px 0 24px; margin-bottom: 24px; }
  .article-hero h1 { font-size: clamp(22px, 6vw, 30px); }
  .article-hero__cat { font-size: 10px; padding: 5px 10px; margin-bottom: 12px; }
  .article-meta { font-size: 12px; gap: 10px; }
  .article-cover { margin-bottom: 28px; border-radius: var(--r-md); }
  .article-body { font-size: 15px; padding: 0 4px; }
  .article-body .lead { font-size: 16px; margin-bottom: 24px; }
  .article-body h2 { font-size: 19px; margin: 24px 0 12px; }
  .article-body h3 { font-size: 17px; margin: 20px 0 10px; }
  .article-body ul, .article-body ol { padding-left: 22px; }
  .article-body .cta { padding: 14px 16px; font-size: 14px; }
  .article-body table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
  .article-body table th, .article-body table td { padding: 6px !important; }
  .article-related { padding: 0 14px; margin-top: 36px; }
  .article-related h3 { font-size: 20px; margin-bottom: 16px; }

  /* === Toast === */
  .toast-stack { top: 76px; right: 12px; left: 12px; }
  .toast { min-width: 0; font-size: 13px; padding: 12px 16px; }

  /* Empty states */
  .empty { padding: 56px 16px; }
  .empty__icon { width: 80px; height: 80px; font-size: 36px; }
  .empty__title { font-size: 20px; }
  .empty__lead { font-size: 14px; }

  /* === FAB не должен перекрывать sticky cart === */
  .fab { bottom: 80px; }
  .social-proof { bottom: 150px; } /* выше FAB и sticky-cart */

  /* FAQ */
  .faq-item summary { padding: 14px 16px; font-size: 14px; gap: 12px; }
  .faq-item__body { padding: 0 16px 16px; font-size: 13px; }

  /* Breadcrumbs */
  .breadcrumbs { font-size: 11px; gap: 5px; }

  /* Модалки админки на мобиле */
  .modal { max-width: 100%; border-radius: var(--r-md); margin: 12px; }
  .modal__head { padding: 14px 18px; }
  .modal__head h3 { font-size: 18px; }
  .modal__body { padding: 14px 18px; }
  .modal__footer { padding: 12px 18px; flex-wrap: wrap; gap: 8px; }
  .modal__footer .btn { flex: 1; min-width: 0; }
}

/* === Ultra-small phones (≤ 380px) === */
@media (max-width: 380px) {
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .products-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero__title { font-size: 26px; }
  .hero__stats { flex-direction: column; gap: 12px; }
  .hero__stat-num { font-size: 20px; }
  .product-card__title { font-size: 12px; }
  .product-card__price-new { font-size: 14px; }
  .product-card__add { width: 32px; height: 32px; }
  .cart-btn { padding: 8px; }
  .logo__text-img { display: none; } /* только иконка на самых узких */
}

/* === iOS Safari Notch (safe-area) === */
@supports (padding: env(safe-area-inset-bottom)) {
  .sticky-cart { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  @media (max-width: 800px) {
    .fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  }
}

/* === Tap-friendly: убрать hover-эффекты на touch === */
@media (hover: none) {
  .product-card:hover { transform: none; }
  .product-card:hover .product-card__media img { transform: none; }
  .cat-card:hover { transform: none; }
  .btn--primary:hover { transform: none; }
  .icon-btn:hover { transform: none; }
  .cart-btn:hover { transform: none; }
}

/* === Smooth scrolling везде === */
* { -webkit-tap-highlight-color: rgba(255, 80, 129, 0.1); }
