/* ===========================
   Сітка героя на десктопі (від 992px):
   карусель банерів-картинок + плитки автобанерів (Розпродаж / Новинки / Хіти).
   До 991px — одна мобільна карусель (.hero-slider--mobile), сітка прихована.
   =========================== */
.hero-grid { display: none; }

@media (min-width: 992px) {
  .hero-slider--mobile { display: none; }

  .hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .hero-grid.has-sale { grid-template-columns: 1fr 1fr .86fr; }

  .hg-carousel { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
  .hg-carousel .hero-slider { border-radius: 18px; height: 100%; }

  .hg-tile--sale { grid-column: 3; grid-row: 1 / 3; }
  .hero-grid:not(.has-new):not(.has-top) .hg-tile--sale { grid-row: 1; }
  .hg-tile--new { grid-column: 1; grid-row: 2; }
  .hg-tile--top { grid-column: 2; grid-row: 2; }
  .hero-grid:not(.has-top) .hg-tile--new,
  .hero-grid:not(.has-new) .hg-tile--top { grid-column: 1 / 3; }
}

/* Ширина героя на великих екранах — .container-wide (static/css/store/header-v2.css) */

/* ---------- плитки ---------- */
.hg-tile {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  color: #fff;
  min-width: 0;
  box-shadow: 0 12px 30px rgba(20, 10, 60, .25);
  transition: transform .25s ease, box-shadow .25s ease;
}
.hg-tile:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(20, 10, 60, .35); }

.hg-tile--sale {
  background: linear-gradient(160deg, #ff5f6d 0%, #c2185b 45%, #764ba2 100%);
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}
/* відблиск, що пробігає по плитці "Розпродаж" */
.hg-tile--sale::after {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .22) 50%, transparent 60%);
  transform: translateX(-60%);
  pointer-events: none;
  animation: hg-sheen 6s ease-in-out infinite;
}
@keyframes hg-sheen {
  0%, 60% { transform: translateX(-60%); }
  85%, 100% { transform: translateX(60%); }
}

.hg-tile--new { background: linear-gradient(120deg, #4f7cf0, #667eea 60%, #7a5fd0); }
.hg-tile--top { background: linear-gradient(120deg, #5b45b5, #764ba2 70%, #8a3f9a); }
.hg-tile--new,
.hg-tile--top {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 14px;
  align-items: center;
}

.hg-chip {
  justify-self: start;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
}
.hg-title { margin: 0; font-weight: 900; line-height: 1.05; color: #fff; text-wrap: balance; }
.hg-tile--sale .hg-title { font-size: 1.9rem; }
.hg-tile--new .hg-title,
.hg-tile--top .hg-title { font-size: 1.25rem; }
.hg-accent { color: #ffe066; }
.hg-sub { margin: 4px 0 0; font-size: .82rem; opacity: .85; }
.hg-text { display: grid; gap: 10px; min-width: 0; }

.hg-cta {
  position: relative;
  z-index: 1;
  justify-self: start;
  background: #fff;
  color: #764ba2;
  font-weight: 800;
  font-size: .85rem;
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform .2s ease;
}
.hg-cta:hover { color: #764ba2; text-decoration: none; transform: translateY(-2px); }

/* ---------- Розпродаж: список товарів ---------- */
.hg-list { position: relative; z-index: 1; display: grid; gap: 10px; align-content: start; }
.hg-row {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  background: #fff;
  color: #1f2133;
  border-radius: 14px;
  padding: 8px 12px 8px 8px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(20, 10, 60, .2);
  transition: transform .2s ease;
}
.hg-row:hover { color: #1f2133; text-decoration: none; transform: translateX(3px); }
.hg-row-photo { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: #fff; }
.hg-row-photo img { width: 100%; height: 100%; object-fit: contain; }
.hg-row-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #e5484d;
  color: #fff;
  font-size: .66rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 6px;
}
.hg-row-name {
  font-size: .8rem;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-width: 0;
}
.hg-row-prices { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hg-old { display: block; color: #8a8ea6; text-decoration: line-through; font-size: .72rem; }
.hg-price { color: #4f5bd5; font-weight: 900; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* 5-й і 6-й товар "Розпродажу" — тільки на широких екранах, де плитка висока */
.hg-row--wide { display: none; }
@media (min-width: 1600px) {
  .hg-row--wide { display: grid; }
}

/* ---------- Новинки / Хіти: міні-картки, що змінюються по колу ---------- */
.hg-minis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  min-width: 0;
  transition: opacity .45s ease;
}
.hg-minis.is-fading { opacity: 0; }
/* широкий екран: по 3 картки за раз (кількість задає JS у home.html) */
@media (min-width: 1600px) {
  .hg-minis { grid-template-columns: repeat(3, 1fr); }
}
.hg-mini {
  position: relative;
  display: grid;
  gap: 4px;
  background: #fff;
  color: #1f2133;
  border-radius: 12px;
  padding: 8px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(20, 10, 60, .22);
  min-width: 0;
}
.hg-mini:hover { color: #1f2133; text-decoration: none; }
.hg-mini-photo { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #fff; }
.hg-mini-photo img { width: 100%; height: 100%; object-fit: contain; }
.hg-mini-name { font-size: .72rem; line-height: 1.25; height: 2.5em; overflow: hidden; }
.hg-mini .hg-price { font-size: .9rem; }
.hg-mini-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  font-size: .62rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 6px;
}
.hg-mini-badge--new { background: #2fb58c; color: #fff; }
.hg-mini-badge--rank { background: #ffb020; color: #3a2a00; }

.hg-row:focus-visible,
.hg-mini:focus-visible,
.hg-cta:focus-visible { outline: 3px solid #ffe066; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .hg-tile--sale::after { animation: none; }
  .hg-tile, .hg-row, .hg-cta, .hg-minis { transition: none; }
  .hg-tile:hover, .hg-row:hover, .hg-cta:hover { transform: none; }
}
