/*
 * ГЛАВНАЯ СТРАНИЦА.
 *
 * Размеры, отступы и пропорции взяты из утверждённой концепции
 * (delivery-package/design-concept/index.html), но значения цвета вынесены
 * в токены: конкретные оттенки задаёт клиентская вариация.
 *
 * Файл подключается только на шаблоне главной — на остальных страницах он
 * не нужен и лишь замедлял бы загрузку.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   ПЕРВЫЙ ЭКРАН

   Высота ограничена намеренно: по концепции после hero на обычном экране
   должно быть видно начало категорий. Первый экран во всю высоту прячет
   товар, ради которого человек пришёл.
   ═══════════════════════════════════════════════════════════════════════════ */

.st-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  min-height: 320px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: var(--st-radius-hero);
  background: var(--st-gradient-hero);
  color: var(--st-color-text);
  box-shadow: var(--st-shadow-hero);
}

.st-hero__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 38px;
}

.st-hero__kicker {
  color: var(--st-color-accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.st-hero__title {
  margin: 9px 0 10px;
  font-size: 38px;
  font-weight: var(--st-weight-heading);
  line-height: 1.04;
  letter-spacing: -1.5px;
}

.st-hero__text {
  max-width: 460px;
  margin: 0 0 20px;
  color: var(--st-color-text-muted);
}

.st-hero__stage {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 24px;
}

.st-hero__image {
  max-width: 100%;
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════════════════════
   КАТЕГОРИИ
   ═══════════════════════════════════════════════════════════════════════════ */

.st-cats__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.st-cat {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 140px;
  padding: 17px;
  border: 1px solid var(--st-color-border);
  border-radius: 16px;
  background: var(--st-color-surface);
  color: var(--st-color-text);
  text-decoration: none;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}

.st-cat:hover { transform: translateY(-2px); }

/* Цветные акценты плиток — часть фирменного стиля, значения задаёт
   клиентская вариация. В нейтральном шаблоне все четыре одинаковые. */
.st-cat--1 { border-color: var(--st-cat-1, var(--st-color-border)); box-shadow: var(--st-cat-shadow-1, none); }
.st-cat--2 { border-color: var(--st-cat-2, var(--st-color-border)); box-shadow: var(--st-cat-shadow-2, none); }
.st-cat--3 { border-color: var(--st-cat-3, var(--st-color-border)); box-shadow: var(--st-cat-shadow-3, none); }
.st-cat--4 { border-color: var(--st-cat-4, var(--st-color-border)); box-shadow: var(--st-cat-shadow-4, none); }

.st-cat__text { position: relative; z-index: 2; }
.st-cat__name { display: block; font-weight: 500; }
.st-cat__count { display: block; margin-top: 5px; color: var(--st-color-text-muted); font-size: 13px; }

/* Квадратный контейнер и contain: упаковку товара нельзя ни обрезать,
   ни растянуть — по ней покупатель узнаёт товар на полке. */
.st-cat__art {
  flex: 0 0 auto;
  display: block;
  width: 96px;
  aspect-ratio: 1 / 1;
}

.st-cat__art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ПОПУЛЯРНОЕ
   ═══════════════════════════════════════════════════════════════════════════ */

.st-rail__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  /* На телефоне фильтры прокручиваются вбок, а не переносятся: так они
     занимают одну строку и не отодвигают товары вниз. */
  scrollbar-width: none;
}

.st-rail__filters::-webkit-scrollbar { display: none; }

/* Товары выводит WooCommerce — перекрываем только сетку, чтобы карточки
   встали по пять в ряд, как в концепции. */
.st-rail__products .woocommerce ul.products,
.st-rail__products ul.products {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.st-rail__products ul.products li.product {
  width: auto !important;   /* Storefront задаёт ширину в процентах */
  margin: 0 !important;
  float: none !important;
  padding: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ПРЕИМУЩЕСТВА
   ═══════════════════════════════════════════════════════════════════════════ */

.st-benefits__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.st-benefit {
  padding: 16px;
  border-radius: 14px;
  background: var(--st-color-benefit-bg, var(--st-color-surface-soft));
  color: var(--st-color-benefit-text, var(--st-color-text));
}

.st-benefit__title { display: block; font-weight: 500; }
.st-benefit__text { display: block; margin-top: 4px; font-size: 14px; opacity: .85; }

/* ═══════════════════════════════════════════════════════════════════════════
   ОТЗЫВЫ
   ═══════════════════════════════════════════════════════════════════════════ */

.st-reviews__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.st-review {
  padding: 17px;
  border: 1px solid var(--st-color-border);
  border-radius: 15px;
  background: var(--st-color-surface);
}

.st-review__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.st-review__author { font-weight: 500; }
.st-review__stars { color: var(--st-color-rating); white-space: nowrap; }
.st-review__text { margin: 0 0 12px; color: var(--st-color-text-muted); }
.st-review__meta { color: var(--st-color-text-muted); font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════════════
   О БРЕНДЕ
   ═══════════════════════════════════════════════════════════════════════════ */

.st-brand {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: center;
  margin-top: 26px;
  padding: 28px;
  border-radius: var(--st-radius-hero);
  background: var(--st-color-brand-bg, var(--st-color-surface-soft));
}

.st-brand__visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 230px;
  border-radius: 17px;
  background: var(--st-gradient-brand, var(--st-color-primary));
  color: #fff;
  overflow: hidden;
}

.st-brand__logo {
  position: relative;
  z-index: 2;
  font-size: 34px;
  font-weight: 500;
  font-style: italic;
  text-align: center;
  padding: 0 16px;
}

.st-brand__orbit {
  position: absolute;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
}

.st-brand__orbit::after {
  content: "";
  position: absolute;
  top: 49px;
  left: 49px;
  width: 90px;
  height: 90px;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 50%;
}

.st-brand__kicker {
  color: var(--st-color-text-muted);
  font-size: 12px;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.st-brand__title { margin: 8px 0 12px; font-size: 24px; font-weight: var(--st-weight-heading); }
.st-brand__text { margin: 0 0 12px; color: var(--st-color-text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   ПЛАНШЕТЫ И ТЕЛЕФОНЫ
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .st-cats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-rail__products .woocommerce ul.products,
  .st-rail__products ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-reviews__grid { grid-template-columns: 1fr; }
  .st-brand { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Первый экран: текст сверху, товар под ним — как в мобильном макете.
     Картинку не прячем: покупателю, пришедшему с маркетплейса, товар на
     первом экране объясняет магазин быстрее любого заголовка. */
  .st-hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .st-hero__copy { padding: 22px 20px 16px; }
  .st-hero__title { font-size: 26px; letter-spacing: -.6px; }
  .st-hero__text { margin-bottom: 16px; }

  .st-hero__stage {
    display: grid;
    min-height: 0;
    padding: 0 20px 22px;
  }

  /* Ограничиваем высоту: без этого картинка занимает пол-экрана и
     отодвигает категории за пределы первого экрана. */
  .st-hero__image { max-height: 200px; }

  .st-section__title { font-size: 20px; }
  /* Категории в две колонки, как в макете: четыре раздела помещаются на
     один экран, и их видно целиком без прокрутки. */
  .st-cats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* На телефоне чипы переносятся в две строки, а не уезжают за край:
     фильтр, которого не видно, никто не нажмёт. Внутри себя текст при
     этом не ломается — иначе чип становится вдвое выше соседей. */
  .st-rail__filters {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 8px;
  }

  .st-rail__filters .st-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .st-cat {
    position: relative;
    display: block;
    min-height: 132px;
    padding: 12px;
    overflow: hidden;
  }

  .st-cat__name { font-size: 14px; line-height: 1.25; }
  .st-cat__count { font-size: 12px; margin-top: 3px; }

  /* Картинка уходит в правый нижний угол и частично выходит за край —
     так она не спорит с названием за место в узкой карточке. */
  .st-cat__art {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 74px;
  }

  .st-rail__products .woocommerce ul.products,
  .st-rail__products ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .st-benefits__grid { grid-template-columns: 1fr; }
  .st-brand { padding: 20px; }
  .st-brand__visual { min-height: 160px; }
}

/* Название товара в карточке: длинное имя не должно распирать колонку.
   Именно из-за этого сетка когда-то уезжала за край экрана на телефоне. */
.st-rail__products ul.products li.product .woocommerce-loop-product__title {
  overflow-wrap: anywhere;
  font-size: 14px;
}
