/* ═══ Главная витрины: блоки над каталогом (assets/home.js) ═══════════════
   Промо-карусель, категории, «Товар дня», новинки, наличие,
   цены по разделам, бренды, доверие. Только на корне «/» без фильтров и не на
   странице продавца. Цвета — токены shop.css (обе темы). */

:root { --hp-ease: cubic-bezier(.22, .8, .24, 1); }
.hp-wrap { display: flex; flex-direction: column; gap: 28px; margin-bottom: 28px; }
.hp-sec { min-width: 0; }

.hp-in { opacity: 0; transform: translateY(12px); }
.hp-in.in { animation: hpIn .5s var(--hp-ease) both; animation-delay: var(--d, 0ms); }
@keyframes hpIn { to { opacity: 1; transform: none; } }

.hp-ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.hp-badge {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transition: transform .25s var(--hp-ease), background .25s ease;
}
.hp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.hp-head h2 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.hp-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.hp-link { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--accent); font-weight: 700; font-size: 13.5px; text-decoration: none; }
.hp-link .hp-ic { width: 16px; height: 16px; transition: transform .2s ease; }
.hp-link:hover .hp-ic { transform: translateX(3px); }
.hp-arrows { display: flex; gap: 6px; }
.hp-arr {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--txt); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.hp-arr:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.hp-arr .hp-ic { width: 18px; height: 18px; }

/* ── Промо-карусель ─────────────────────────────────────────────────────── */
.hp-slider { position: relative; border-radius: 18px; overflow: hidden; min-height: 320px; background: var(--hdr); color: #fff; isolation: isolate; }
.hp-slide {
  position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center; gap: 24px; padding: 36px 48px 54px;
  opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility .7s;
}
.hp-slide.on { opacity: 1; visibility: visible; z-index: 1; }
.hp-slide::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(560px 300px at var(--gx, 80%) 20%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 64%),
    radial-gradient(420px 260px at 10% 120%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    linear-gradient(135deg, #14181d 0%, #101317 55%, #1a1f26 100%);
}
.hp-kicker {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255, 106, 0, .16); color: #ff9a4d;
}
.hp-kicker .hp-ic { width: 14px; height: 14px; }
.hp-slide h2 { margin: 14px 0 10px; font-size: 34px; line-height: 1.12; font-weight: 800; }
.hp-slide p { margin: 0 0 20px; color: #c9d1d9; font-size: 15px; max-width: 460px; }
.hp-slide .tm-btn { display: inline-flex; align-items: center; gap: 8px; }
.hp-slide .tm-btn .hp-ic { width: 18px; height: 18px; }
.hp-sl-txt > * { opacity: 0; transform: translateY(12px); }
.hp-slide.on .hp-sl-txt > * { animation: hpIn .6s var(--hp-ease) both; }
.hp-slide.on .hp-sl-txt > *:nth-child(2) { animation-delay: .08s; }
.hp-slide.on .hp-sl-txt > *:nth-child(3) { animation-delay: .16s; }
.hp-slide.on .hp-sl-txt > *:nth-child(4) { animation-delay: .24s; }
.hp-sl-art { position: relative; height: 240px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: center; }
.hp-plate {
  background: var(--photo); border-radius: 16px; aspect-ratio: 1; display: grid; place-items: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35); overflow: hidden; opacity: 0;
}
.hp-plate img { width: 84%; height: 84%; object-fit: contain; }
.hp-plate:nth-child(2) { --py: -14px; --ps: 1.08; }
.hp-slide.on .hp-plate { animation: hpPlate .8s var(--hp-ease) both; }
.hp-slide.on .hp-plate:nth-child(2) { animation-delay: .12s; }
.hp-slide.on .hp-plate:nth-child(3) { animation-delay: .24s; }
@keyframes hpPlate { from { opacity: 0; transform: translateY(30px) scale(.9); } to { opacity: 1; transform: translateY(var(--py, 0)) scale(var(--ps, 1)); } }
.hp-sl-nav {
  position: absolute; left: 48px; right: 48px; bottom: 20px; z-index: 3;
  display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 8px; max-width: 320px;
}
.hp-dot { height: 4px; border: none; padding: 0; border-radius: 4px; background: rgba(255, 255, 255, .22); cursor: pointer; overflow: hidden; }
.hp-dot i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.hp-dot.on i { animation: hpProg var(--dur, 6s) linear forwards; }
.hp-dot.done i { width: 100%; }
.hp-slider.paused .hp-dot.on i { animation-play-state: paused; }
@keyframes hpProg { to { width: 100%; } }

/* ── Категории ──────────────────────────────────────────────────────────── */
.hp-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; grid-auto-rows: 1fr; }
.hp-cats.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hp-cat {
  display: flex; align-items: center; gap: 12px; padding: 14px; min-width: 0; height: 100%; box-sizing: border-box;
  text-decoration: none; color: var(--txt); border: 1px solid var(--line);
  transition: transform .2s var(--hp-ease), border-color .2s ease, box-shadow .2s ease;
}
.hp-cat:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(16, 22, 26, .10); }
.hp-cat:hover .hp-badge { transform: scale(1.06) rotate(-4deg); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.hp-cat-t { min-width: 0; }
.hp-cat-t b { display: block; font-size: 13.5px; line-height: 1.25; }
.hp-cat-t span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ── Товар дня + «Только поступило» ─────────────────────────────────────── */
.hp-bento { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
.hp-tile { position: relative; border-radius: 18px; overflow: hidden; padding: 22px; min-width: 0; box-sizing: border-box; }
.hp-tile.dark { background: var(--hdr); color: #fff; isolation: isolate; }
.hp-tile.dark::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(420px 260px at 85% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 64%),
              linear-gradient(135deg, #14181d, #101317 60%, #1a1f26);
}
.hp-t-day { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 20px; align-items: center; }
.hp-tile .sub { color: #aeb6bf; font-size: 13px; }
.hp-day-ph { width: 100%; max-width: 300px; justify-self: center; background: var(--photo); border-radius: 16px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.hp-day-ph img { width: 86%; height: 86%; object-fit: contain; animation: hpFloat 6s ease-in-out infinite; }
@keyframes hpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.hp-day-nm { font-size: 20px; font-weight: 800; line-height: 1.25; margin: 12px 0 10px; color: #fff; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hp-day-pr { font-size: 22px; font-weight: 900; margin-bottom: 14px; }
.hp-day-pr .tm-muted { color: #aeb6bf; }
.hp-timer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 250px; margin: 6px 0 18px; }
.hp-timer div { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .10); border-radius: 12px; padding: 8px 0; text-align: center; }
.hp-timer b { display: block; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hp-timer span { font-size: 11px; color: #aeb6bf; text-transform: uppercase; letter-spacing: .08em; }
.hp-timer b.tick { animation: hpTick .35s ease; }
@keyframes hpTick { from { transform: translateY(-5px); opacity: .3; } to { transform: none; opacity: 1; } }
.hp-day-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 320px; }
.hp-day-acts .tm-btn { justify-content: center; text-align: center; }
.hp-day-acts .tm-btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .25); background: transparent; }
.hp-t-arr { display: flex; flex-direction: column; }
.hp-t-arr .hp-head { margin: 0; }
.hp-arr-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; flex: 1 1 auto; }
.hp-arr-it { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; text-decoration: none; color: var(--txt); min-width: 0; padding: 8px; border-radius: 12px; border: 1px solid var(--line); transition: transform .2s var(--hp-ease), border-color .2s; }
.hp-arr-it:hover { transform: translateY(-2px); border-color: var(--accent); }
.hp-arr-it .ph { background: var(--photo); border-radius: 10px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.hp-arr-it .ph img { width: 84%; height: 84%; object-fit: contain; }
.hp-arr-it .n { font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hp-arr-it .p { font-size: 13px; font-weight: 800; margin-top: 4px; }

/* ── Рельса товаров ─────────────────────────────────────────────────────── */
.hp-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 4 * 14px) / 5); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 2px 2px 10px;
  scrollbar-width: none;
}
.hp-rail::-webkit-scrollbar { display: none; }
.hp-card {
  scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 12px; text-decoration: none; color: var(--txt); border: 1px solid var(--line);
  transition: transform .2s var(--hp-ease), border-color .2s ease, box-shadow .2s ease;
}
.hp-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(16, 22, 26, .10); }
.hp-card-ph { position: relative; background: var(--photo); border-radius: 10px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.hp-card-ph img { width: 88%; height: 88%; object-fit: contain; transition: transform .35s var(--hp-ease); }
.hp-card:hover .hp-card-ph img { transform: scale(1.05); }
.hp-tag { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--accent); }
.hp-tag.ok { background: var(--ok); }
.hp-card-br { color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 4px; min-height: 1.3em; }
.hp-card-nm { font-size: 13.5px; line-height: 1.3; height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hp-card-pr { margin-top: auto; font-weight: 800; font-size: 15px; }
.hp-card-pr .tm-muted { font-weight: 600; font-size: 12.5px; }
.hp-card .tm-btn { width: 100%; justify-content: center; }

/* ── Цены по разделам ───────────────────────────────────────────────────── */
.hp-from { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; grid-auto-rows: 1fr; }
.hp-from a {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 10px; align-items: center;
  padding: 14px; text-decoration: none; color: var(--txt); border: 1px solid var(--line); height: 100%; box-sizing: border-box;
  transition: transform .2s var(--hp-ease), border-color .2s ease;
}
.hp-from a:hover { transform: translateY(-2px); border-color: var(--accent); }
.hp-from .nm { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hp-from .lb { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hp-from .pr { font-size: 16px; font-weight: 900; margin-top: 2px; }
.hp-from .ph { background: var(--photo); border-radius: 10px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.hp-from .ph img { width: 86%; height: 86%; object-fit: contain; transition: transform .35s var(--hp-ease); }
.hp-from a:hover .ph img { transform: scale(1.08) rotate(-2deg); }

/* ── Бренды ─────────────────────────────────────────────────────────────── */
.hp-brands { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; grid-auto-rows: 1fr; }
.hp-brand {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  padding: 16px 8px; text-decoration: none; color: var(--txt); border: 1px solid var(--line);
  transition: transform .2s var(--hp-ease), border-color .2s ease, color .2s ease;
}
.hp-brand b { font-size: 16px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hp-brand span { font-size: 12px; color: var(--muted); }
.hp-brand:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }

/* ── Доверие ────────────────────────────────────────────────────────────── */
.hp-trust { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; grid-auto-rows: 1fr; }
.hp-tr { display: flex; gap: 12px; align-items: flex-start; padding: 16px; height: 100%; box-sizing: border-box; }
.hp-tr b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.hp-tr span { color: var(--muted); font-size: 13px; line-height: 1.4; }

/* ── Журнал: 3 последние статьи ─────────────────────────────────────────── */
.hp-jr { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 14px; grid-auto-rows: 1fr; }
.hp-jr-c { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; color: var(--txt); border: 1px solid var(--line); height: 100%; box-sizing: border-box; transition: transform .2s var(--hp-ease), border-color .2s ease, box-shadow .2s ease; }
.hp-jr-c:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(16, 22, 26, .10); }
.hp-jr-cov { position: relative; height: 140px; background: var(--hdr); display: grid; grid-template-columns: repeat(3, minmax(0, 104px)); justify-content: center; gap: 10px; align-items: center; padding: 14px 16px; isolation: isolate; box-sizing: border-box; overflow: hidden; }
.hp-jr-cov::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(260px 150px at var(--gx, 80%) 0%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%); }
.hp-jr-cov > span { background: var(--photo); border-radius: 10px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; transition: transform .35s var(--hp-ease); }
.hp-jr-cov > span img { width: 84%; height: 84%; object-fit: contain; }
.hp-jr-cov > i { grid-column: 1 / -1; display: grid; place-items: center; color: #ff9a4d; }
.hp-jr-cov > i .hp-ic { width: 44px; height: 44px; stroke-width: 1.5; }
.hp-jr-c:hover .hp-jr-cov > span:nth-child(odd) { transform: translateY(-4px); }
.hp-jr-c:hover .hp-jr-cov > span:nth-child(even) { transform: translateY(4px); }
.hp-jr-b { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.hp-jr-r { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hp-jr-b b { font-size: 15.5px; line-height: 1.3; }
.hp-jr-l { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.hp-cat-head { margin: 4px 0 14px; scroll-margin-top: 80px; }

/* ── Адаптив ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hp-rail { grid-auto-columns: calc((100% - 3 * 14px) / 4); }
  .hp-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hp-from { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hp-bento { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .hp-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hp-brands { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hp-brands.b6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .hp-wrap { gap: 22px; }
  .hp-head h2 { font-size: 19px; }
  .hp-slider { min-height: 470px; }
  .hp-slide { grid-template-columns: minmax(0, 1fr); align-content: start; padding: 24px 20px 48px; gap: 18px; }
  .hp-slide h2 { font-size: 24px; }
  .hp-sl-art { height: auto; }
  /* на телефоне средняя плитка не приподнята: иначе наезжает на кнопку над ней */
  .hp-plate:nth-child(2) { --py: 0px; --ps: 1; }
  .hp-sl-nav { left: 20px; right: 20px; bottom: 18px; }
  .hp-rail { grid-auto-columns: calc((100% - 14px) / 2); }
  .hp-cats { gap: 8px; }
  .hp-cat { flex-direction: column; text-align: center; padding: 12px 6px; gap: 8px; }
  .hp-cat-t b { font-size: 12.5px; }
  .hp-brands { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hp-t-day { grid-template-columns: minmax(0, 1fr); }
  .hp-t-day .hp-day-ph { order: -1; max-width: 220px; }
  .hp-day-acts { max-width: none; }
  .hp-arr-list { grid-template-columns: minmax(0, 1fr); }
  .hp-from { grid-template-columns: minmax(0, 1fr); }
  .hp-jr { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
}
@media (max-width: 420px) {
  .hp-trust { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .hp-in, .hp-sl-txt > *, .hp-plate { opacity: 1 !important; transform: none !important; animation: none !important; }
  .hp-plate:nth-child(2) { transform: translateY(-14px) scale(1.08) !important; }
  .hp-day-ph img, .hp-timer b.tick, .hp-dot.on i { animation: none !important; }
  .hp-dot.on i { width: 100%; }
  .hp-slide { transition: none; }
  .hp-cat, .hp-card, .hp-brand, .hp-from a, .hp-arr, .hp-arr-it { transition: none; }
  .hp-cat:hover, .hp-card:hover, .hp-brand:hover, .hp-from a:hover, .hp-arr-it:hover { transform: none; }
  .hp-rail { scroll-behavior: auto; }
  .hp-jr-c, .hp-jr-cov > span { transition: none; }
  .hp-jr-c:hover, .hp-jr-c:hover .hp-jr-cov > span { transform: none !important; }
  .hp-card-ph img, .hp-from .ph img, .hp-badge, .hp-link .hp-ic, .hp-arr { transition: none; }
  .hp-card:hover .hp-card-ph img, .hp-from a:hover .ph img, .hp-cat:hover .hp-badge, .hp-link:hover .hp-ic, .hp-arr:hover { transform: none; }
}
