/* =============================================
   HERO — MOTION (варіант 3+4). Доповнює стилі .hero з home.css.
   Відкат: Вигляд → Налаштувати → «Hero головної» → Класичний.
   ============================================= */

.hero--motion .hm-panel {
  /* студійний сірий фон — у нього «розчиняються» білі фони фото (multiply) */
  background: linear-gradient(180deg, #e4e4e4 0%, #c9c9c9 55%, #9d9d9d 100%);
  isolation: isolate;
}

.hero--motion .hm-depth {
  position: absolute;
  inset: -3%;
  will-change: transform;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Слайди (по одному на категорію) ── */
.hero--motion .hm-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: translateY(4%) scale(1.04);
  transition:
    opacity 0.9s ease,
    transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero--motion .hm-slide.is-active {
  opacity: 1;
  transform: none;
}
.hero--motion .hm-slide.is-leaving {
  opacity: 0;
  transform: translateY(-4%) scale(0.98);
}

/* стагер між колонками */
.hero--motion .hero__panel--2 .hm-slide { transition-delay: 0.12s; }
.hero--motion .hero__panel--3 .hm-slide { transition-delay: 0.24s; }

.hero--motion .hm-slide img {
  /* перекриваємо contain:strict/transition з home.css — анімуємо обгортку */
  transition: none;
  will-change: auto;
}

/* повнокадрові фото на сірому фоні */
.hero--motion .hm-slide--cover img {
  object-fit: cover;
  object-position: center 10%;
}

/* фото на білому фоні: річ «вирізається» з фону + плаває.
   Фон — на самому слайді: слайд є контекстом накладання (opacity/transform),
   тож multiply змішує фото саме з цим градієнтом. */
.hero--motion .hm-slide--contain {
  background: linear-gradient(180deg, #e4e4e4 0%, #c9c9c9 55%, #9d9d9d 100%);
}
.hero--motion .hm-slide--contain img {
  object-fit: contain;
  object-position: center 38%;
  padding: 9% 9% 26%;
  mix-blend-mode: multiply;
  animation: hmFloat 7s ease-in-out infinite;
}
.hero--motion .hero__panel--2 .hm-slide--contain img { animation-delay: -2.3s; animation-duration: 8s; }
.hero--motion .hero__panel--3 .hm-slide--contain img { animation-delay: -4.6s; animation-duration: 7.5s; }

@keyframes hmFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2.2%) rotate(-0.6deg); }
}

/* підписи-колонки (7px, майже невидимі під затемненням) — у цій версії не показуємо */
.hero--motion .hero__panel-label { display: none; }

/* ── Слово-категорія в заголовку ── */
.hero--motion .hero__title {
  font-size: clamp(28px, 5vw, 76px);
}
.hero--motion .hm-word-line .hero__title-inner {
  color: #C4A8A5;
}
.hero--motion .hero__title-line:nth-child(3) .hero__title-inner {
  color: #ffffff;
}
.hero--motion .hm-words {
  position: relative;
  display: block;
  height: 1em;
  line-height: 0.91;
  overflow: visible;
}
.hero--motion .hm-word {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  transform: translateY(105%);
  opacity: 0;
  transition:
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s ease;
}
.hero--motion .hm-word.is-active {
  position: relative;
  transform: none;
  opacity: 1;
}
.hero--motion .hm-word.is-leaving {
  transform: translateY(-105%);
  opacity: 0;
}
.hero--motion .hm-word-line {
  overflow: hidden;
  padding-bottom: 0.06em; /* щоб не різало літери з виносними елементами */
}

/* індикатор категорій */
.hero--motion .hm-dots {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  pointer-events: auto;
}
.hero--motion .hm-dot {
  width: 26px;
  height: 3px;
  border: 0;
  padding: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.hero--motion .hm-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #C4A8A5;
  transform: scaleX(0);
  transform-origin: left;
}
.hero--motion .hm-dot.is-active::after {
  animation: hmProgress var(--hm-interval, 3600ms) linear forwards;
}
.hero--motion.is-paused .hm-dot.is-active::after { animation-play-state: paused; }
@keyframes hmProgress { to { transform: scaleX(1); } }

/* ── Мобільні ── */
@media (max-width: 680px) {
  .hero--motion .hm-depth { inset: 0; transition: none; }
  .hero--motion .hm-slide--contain img { padding: 6% 6% 14%; object-position: center 30%; }
  .hero--motion .hm-dot { width: 22px; height: 4px; }
}

/* ── Користувачі, які вимкнули анімацію в системі ── */
/* лише плавна зміна прозорості — без зсувів, «плавання» і паралаксу */
@media (prefers-reduced-motion: reduce) {
  .hero--motion .hm-slide,
  .hero--motion .hm-slide.is-active,
  .hero--motion .hm-slide.is-leaving,
  .hero--motion .hm-word,
  .hero--motion .hm-word.is-active,
  .hero--motion .hm-word.is-leaving {
    transform: none !important;
    transition: opacity 0.7s ease !important;
  }
  .hero--motion .hm-depth { transition: none !important; transform: none !important; }
  .hero--motion .hm-slide--contain img { animation: none !important; }
}

/* ── Телефон: hero росте під вміст (раніше фіксовані 100svh обрізали кнопку) ── */
@media (max-width: 680px) {
  .hero--motion {
    height: auto;
    min-height: 0;
  }
  .hero--motion .hero__grid {
    flex: 0 0 auto;
    height: 34svh;
    min-height: 220px;
    margin-top: 16px;
  }
  .hero--motion .hero__content {
    flex: 0 0 auto;
    overflow: visible;
    padding-bottom: 28px;
  }
  .hero--motion .hero__title { font-size: clamp(26px, 8vw, 32px); }
  .hero--motion .hm-dots { margin-top: 12px; }
  .hero--motion .hero__sub { font-size: 14px; line-height: 1.55; margin-bottom: 12px; }
  .hero--motion .hero__bottom { gap: 14px; }
}

/* Телефон: рядки заголовка не накладаються (line-height <1 + перенос першого рядка) */
@media (max-width: 480px) {
  .hero--motion .hero__title { font-size: 24px; line-height: 1.08; }
  .hero--motion .hero__title-line { line-height: 1.08; }
  .hero--motion .hm-words { height: 1.12em; line-height: 1.08; }
  .hero--motion .hm-word { line-height: 1.08; }
  .hero--motion .hero__sub { font-size: 14px; }
  .hero--motion .hero__price { font-size: 11px; }
}
@media (max-width: 380px) {
  .hero--motion .hero__title { font-size: 22px; }
}
