/* ══════════════════════════════════════════
   shop-catalog.css — страница «Магазин» /Shop (04.11.2026; 07.11.2026 — витрина из плиток). Разметка — Views/Shop/Index.cshtml
   и _ShopCatalogTile.cshtml.

   Requires: shop-product.css — чипы статуса, цена, переменные .shop (зелёный «В продаже», тень) и их тёмная тема. Корень страницы
   носит оба класса: .shop .store. Цвета — только токены сайта, поэтому тёмная тема работает сама; ниже — лишь то, что у неё своё.
   ══════════════════════════════════════════ */

/* Корень — .shop из shop-product.css (ширина 1120, поля 32/16, появление); у страницы ещё поля сверху и снизу. */
.store {
  padding-top: 16px;
  padding-bottom: 56px;
}

.store__title {
  margin: 0 0 16px;
  color: var(--text);
  font-family: "Lora", Georgia, serif;
  font-size: var(--page-title-size, clamp(1.5rem, 3vw, 1.75rem));
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* «Мои заказы» под заголовком (07.11.2026, «Магазин только на сайте»): тихая ссылка, витрина остаётся главным. Красный текст — только --primary-text. */
.store__orders {
  margin: -8px 0 20px;
  font-size: 16px;
}
.store__orders a {
  color: var(--primary-text);
  font-weight: 600;
  text-decoration: none;
}
.store__orders a:hover {
  color: var(--primary-text-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.store__orders a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Сетка плиток ── */

/* Четыре плитки в ряд при ширине страницы 1056: первая строка целиком на экране ноутбука, плитка не шире обложки. */
.store__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.store__cell {
  min-width: 0;
}

.store-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--card-radius);
  box-shadow: var(--shop-shadow);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.store-tile:hover {
  transform: translateY(-2px);
}
/* Кольцо фокуса — на всей плитке: растянутая ссылка заголовка и есть «вся плитка». */
.store-tile:has(.store-tile__link:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Фото — в квадратном кадре на подложке, целиком (contain): обложки раскрасок чаще квадратные, остальные встают с полями, а
   ряд не прыгает. */
/* Кадр задаёт ТОЛЬКО aspect-ratio, фото лежит в нём абсолютно: в потоке фото с другой пропорцией растягивало кадр, и
   заголовки соседних плиток вставали на разную высоту. */
.store-tile__media {
  --tile-pad: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--surface);
}
.store-tile__img {
  position: absolute;
  inset: var(--tile-pad);
  display: block;
  width: calc(100% - 2 * var(--tile-pad));
  height: calc(100% - 2 * var(--tile-pad));
  object-fit: contain;
}
.store-tile__placeholder {
  color: var(--text-4, var(--text-3));
}
.store-tile__status {
  padding: 2px 9px;
  font-size: 12px;
}

.store-tile__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px 16px;
}
.store-tile__title {
  margin: 0;
  font-family: "Lora", Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.store-tile__link {
  color: var(--text);
  text-decoration: none;
}
.store-tile__link:hover {
  color: var(--primary-text);
}
.store-tile__link:focus-visible {
  outline: none;
}
/* Растянутая ссылка: вся плитка, с чипом и фото, ведёт на страницу книги. */
.store-tile__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.store-tile .shop__price-now {
  font-size: 19px;
}
.store-tile__note {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.35;
}

/* Распроданные и снятые с продажи: видны, но тише. */
.store-tile--muted {
  box-shadow: none;
}
.store-tile--muted .store-tile__img {
  opacity: 0.72;
  filter: grayscale(0.4);
}

.store__grid + .store__section {
  margin-top: 40px;
}
.store__section-title {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

/* Кнопка пустой страницы и «Продолжить покупки» корзины: контур, а не заливка. */
.store__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 26px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.store__more:hover {
  border-color: var(--primary);
  color: var(--primary-text);
}
.store__more:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ── Пусто ── */

.store__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 56px 24px;
  background: var(--card);
  border-radius: var(--card-radius);
  box-shadow: var(--shop-shadow);
  text-align: center;
}
.store__empty-icon {
  color: var(--text-3);
}
.store__empty-text {
  max-width: 460px;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
}

/* ── Тёмная тема ── */

html[data-theme="dark"] .store-tile__link:hover,
html[data-theme="dark"] .store__more:hover {
  color: #f19a8f;
}
html[data-theme="dark"] .store__more:hover {
  border-color: #f19a8f;
}

/* ── Адаптив ── */

@media (max-width: 700px) {
  .store {
    padding-top: 16px;
    padding-bottom: 40px;
  }
  .store__title {
    margin-bottom: 14px;
  }
  /* Две плитки в ряд, как в обычных интернет-магазинах: витрину листают, а читают уже на странице книги. */
  .store__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .store-tile__media {
    --tile-pad: 10px;
  }
  .store-tile__body {
    padding: 10px 12px 12px;
  }
  .store-tile__title {
    font-size: 16px;
  }
  .store-tile .shop__price-now {
    font-size: 17px;
  }
  .store__more {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .store-tile,
  .store-tile:hover {
    transition: none;
    transform: none;
  }
}
