/* TASK-0284 — первый экран главной heavytop: слайдер, товар дня, преимущества.
   Разметка — core/elements/chunks/home-hero.tpl и home-daily.tpl.
   Все классы с префиксом .hh- : блок не должен цеплять общие стили темы
   и не должен быть зацеплен ими.
   Высоты слайдера и карточки заданы жёстко — блок не двигает раскладку,
   пока грузятся картинки (требование по CLS, TASK-0197). */

/* Тема задаёт text-align: justify глобально — в заголовке и абзаце слайда это
   давало рваные межсловные пробелы. Внутри блока выравнивание своё. */
.hh { margin: 12px 0 4px; text-align: left; }
/* Тема вешает на все кнопки padding 16px/56px и на часть блоков display:flex.
   С box-sizing:border-box такой padding не даёт кнопке сжаться до заданной
   ширины, а flex глотает перенос по <br>. Гасим оба на своих элементах. */
.hh button { padding: 0; font-family: inherit; }
.hh__page { display: block; box-sizing: border-box; padding: 0 12px; }
.hh *, .hh *::before, .hh *::after { box-sizing: border-box; }
.hh a { color: inherit; text-decoration: none; }

.hh-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }

/* ---------- слайдер ---------- */
.hh-slider { position: relative; height: 360px; border: 1px solid #edf0f3; border-radius: 12px; overflow: hidden; background: #f7f4ef; }
.hh-slide { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .55s ease; z-index: 1; }
.hh-slide.is-active { opacity: 1; pointer-events: auto; z-index: 2; }
.hh-slide__photo { position: absolute; right: 0; top: 0; width: 52%; height: 100%; object-fit: cover; object-position: center; }
.hh-slide__fade { position: absolute; top: 0; bottom: 0; right: 38%; width: 14%; z-index: 2; }
.hh-slide__body { position: relative; z-index: 3; height: 100%; max-width: 470px; padding: 34px 40px 54px; display: flex; flex-direction: column; justify-content: center; gap: 13px; }
.hh-tag { align-self: flex-start; padding: 6px 11px; border-radius: 999px; background: #fff; color: #f0801f; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 1px 3px rgba(27, 36, 48, .08); }
.hh-slide h2 { margin: 0; font-size: 33px; line-height: 1.12; font-weight: 800; letter-spacing: -.025em; color: #1b2430; }
.hh-slide p { margin: 0; max-width: 360px; font-size: 15px; line-height: 1.45; color: #5c6773; }
.hh-btn { align-self: flex-start; margin-top: 4px; display: inline-flex; align-items: center; gap: 9px; padding: 12px 22px; border-radius: 8px; background: #f0801f; color: #fff; font-size: 14px; font-weight: 700; }
.hh-btn:hover { background: #d16a12; color: #fff; }

.hh-dots { position: absolute; left: 40px; bottom: 24px; z-index: 4; display: flex; align-items: center; gap: 8px; }
.hh-dots button { height: 4px; width: 16px; padding: 0; border: none; border-radius: 999px; background: rgba(27, 36, 48, .18); cursor: pointer; transition: width .3s ease, background .3s ease; }
.hh-dots button.is-active { width: 30px; background: #f0801f; }
.hh-nav { position: absolute; right: 20px; bottom: 20px; z-index: 4; display: flex; gap: 8px; }
.hh-nav button { width: 40px; height: 40px; border-radius: 8px; border: 1px solid rgba(27, 36, 48, .12); background: rgba(255, 255, 255, .85); color: #1b2430; font-size: 16px; line-height: 1; cursor: pointer; }
.hh-nav button:hover { background: #fff; border-color: #f0801f; color: #f0801f; }

/* ---------- товар дня ---------- */
.hh-daily { position: relative; height: 360px; display: flex; flex-direction: column; border: 1px solid #e6eaee; border-radius: 12px; background: #fff; overflow: hidden; }
.hh-daily__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #eef1f4; }
.hh-daily__title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; color: #1b2430; }
.hh-daily__title i { width: 6px; height: 6px; border-radius: 50%; background: #f0801f; animation: hhPulse 1.6s ease-in-out infinite; }
@keyframes hhPulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
.hh-timer { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: #1b2430; }
.hh-timer small { font-size: 11px; font-weight: 700; color: #8b97a5; }
.hh-timer s { color: #c3cad2; text-decoration: none; }
.hh-timer .hh-sec { color: #f0801f; }

.hh-daily__pic { position: relative; height: 152px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.hh-daily__pic a { display: block; height: 100%; }
.hh-daily__pic img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.hh-badges { position: absolute; top: 10px; left: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.hh-badge { padding: 4px 8px; border-radius: 4px; font-weight: 800; }
.hh-badge--sale { background: #e03d2f; color: #fff; font-size: 12px; }
.hh-badge--stock { background: #eef7ee; color: #3d8a4a; font-size: 11px; font-weight: 700; }
.hh-badge.hidden { display: none; }
.hh-fav { position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; border: none; border-radius: 8px; background: #f5f7f9; color: #97a1ab; font-size: 15px; line-height: 1; cursor: pointer; }
.hh-fav:hover { background: #fdf1e6; color: #f0801f; }
.hh-fav.active, .hh-fav.msf-active { background: #fdf1e6; color: #e03d2f; }

.hh-daily__body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.hh-daily__name { font-size: 14px; font-weight: 600; line-height: 1.35; color: #1b2430; }
.hh-daily__name:hover { color: #f0801f; }
.hh-price { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hh-price__old { font-size: 13px; line-height: 1; color: #9aa3ad; text-decoration: line-through; }
.hh-price__new { margin-top: 4px; font-size: 27px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: #e03d2f; }
.hh-price__save { display: block; text-align: right; font-size: 12px; line-height: 1.35; color: #7d8794; }
.hh-price__save b { color: #1b2430; }
.hh-cart-form { margin: auto 0 0; }
.hh-cart { width: 100%; padding: 13px 12px !important; border: none; border-radius: 8px; background: #f0801f; color: #fff; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.hh-cart:hover { background: #d16a12; }

/* ---------- преимущества ---------- */
.hh-adv { margin-top: 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.hh-adv__item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 16px; border-radius: 12px; background: #fbf7f2; border: 1px solid #f2eae1; }
.hh-adv__item--blue { background: #f4f8fd; border-color: #e4edf7; }
/* min-height держит высоту строки постоянной, пока счётчик перебирает числа */
.hh-adv__num { min-height: 32px; font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.03em; color: #f0801f; font-variant-numeric: tabular-nums; }
.hh-adv__item--blue .hh-adv__num { color: #2f6fb5; }
.hh-adv__label { font-size: 14px; font-weight: 800; line-height: 1.2; color: #1b2430; }
.hh-adv__text { font-size: 12px; line-height: 1.35; color: #7d8794; }

@media (max-width: 1100px) {
  .hh-top { grid-template-columns: 1fr; }
  .hh-daily { height: auto; }
  .hh-adv { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .hh { margin: 8px 0 4px; }
  .hh__page { padding: 0 8px; }
  .hh-slider { height: 300px; }
  .hh-slide__photo, .hh-slide__fade { display: none; }
  .hh-slide__body { max-width: none; padding: 22px 18px 52px; }
  .hh-slide h2 { font-size: 24px; }
  .hh-slide p { font-size: 14px; }
  .hh-dots { left: 18px; bottom: 20px; }
  .hh-nav { right: 12px; bottom: 14px; }
  .hh-nav button { width: 36px; height: 36px; }
  /* Пять карточек в один столбец — слишком длинная лента на 360 px.
     Два столбца, пятая карточка на всю ширину. */
  .hh-adv { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hh-adv__item { padding: 14px 10px; gap: 4px; }
  .hh-adv__item--wide { grid-column: 1 / -1; }
  .hh-adv__num { min-height: 26px; font-size: 26px; }
  .hh-adv__label { font-size: 13px; }
  .hh-adv__text { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .hh-slide { transition: none; }
  .hh-daily__title i { animation: none; }
}
