/*! Hair.Express — доповнення до статичної збірки: підписи категорій над фото, відеогалереї. */

/* ---------- Категорії: номер, назва й опис над фото ---------- */
#products .grid > article {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
#products .grid > article > .media-frame { order: 3; }
#products .grid > article > div.mt-5 { margin-top: 0; }
#products .grid > article > p.body-text {
  flex: 1 0 auto;
  margin-bottom: 1.25rem;
}
@media (min-width: 1024px) {
  #products .grid > article > p.body-text { margin-bottom: 1.5rem; }
}

/* ---------- Відеогалереї ---------- */
.hev-section .hev-head {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
@media (min-width: 640px) {
  .hev-section .hev-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 2.5rem; }
}
.hev-lead { margin-top: 1rem; max-width: 52ch; }

.hev-rail {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0 1.25rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-user-select: none;
  user-select: none;
}
.hev-rail::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .hev-rail { gap: 1.25rem; } }
@media (min-width: 768px) { .hev-rail { padding-inline: 90px; } }
@media (min-width: 1024px) {
  .hev-rail { cursor: grab; }
  .hev-rail.is-dragging { cursor: grabbing; }
}

.hev-tile {
  position: relative;
  flex: none;
  height: 21rem;
  aspect-ratio: 9 / 16;
}
@media (min-width: 640px) { .hev-tile { height: 27rem; } }
@media (min-width: 1024px) { .hev-tile { height: 33rem; } }

.hev-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-md, 10px);
  background-color: var(--color-graphite, #2a2e35);
}
.hev-frame img,
.hev-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
.hev-frame video { z-index: 1; background: #000; }
.hev-tile:not(.is-started) .hev-frame video { opacity: 0; }

/* затемнення знизу, щоб підпис читався на будь-якому кадрі */
.hev-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 22, 26, 0) 55%, rgba(20, 22, 26, 0.55) 100%);
  transition: opacity 0.5s var(--ease-out-expo, ease);
}
.hev-tile.is-playing .hev-frame::after { opacity: 0.35; }

/* велика кнопка відтворення в центрі обкладинки */
.hev-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink, #1f2329);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hev-play__disc {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  background: rgba(246, 241, 231, 0.9);
  box-shadow: 0 14px 34px -14px rgba(20, 22, 26, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.45s var(--ease-out-expo, ease), opacity 0.35s linear, background-color 0.3s linear;
}
.hev-play__disc svg { margin-left: 3px; }
@media (min-width: 1024px) { .hev-play__disc { width: 4.5rem; height: 4.5rem; } }
@media (hover: hover) {
  .hev-play:hover .hev-play__disc { transform: scale(1.08); background: #fff; }
}
.hev-play:focus-visible { outline: none; }
.hev-play:focus-visible .hev-play__disc { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 3px; }
.hev-tile.is-playing .hev-play__disc { opacity: 0; transform: scale(0.85); }
.hev-tile.is-playing .hev-play:focus-visible .hev-play__disc { opacity: 1; transform: none; }
.hev-tile.is-playing .hev-play__disc svg.hev-i-play,
.hev-tile:not(.is-playing) .hev-play__disc svg.hev-i-pause { display: none; }
.hev-tile.is-playing .hev-play__disc svg { margin-left: 0; }

/* підпис-плашка: як на наявній каруселі */
.hev-chip {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100% - 2rem);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm, 6px);
  background: rgba(26, 29, 34, 0.62);
  color: var(--color-bone, #f6f1e7);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.hev-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* кнопки поверх відео, що грає: звук і повний екран */
.hev-tools {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 4;
  display: flex;
  gap: 0.375rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s linear;
}
.hev-tile.is-started .hev-tools { opacity: 1; pointer-events: auto; }
.hev-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: rgba(26, 29, 34, 0.62);
  color: var(--color-bone, #f6f1e7);
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background-color 0.3s linear;
}
.hev-tool:hover { background: rgba(26, 29, 34, 0.86); }
.hev-tool:focus-visible { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 2px; }
.hev-tool[aria-pressed='true'] .hev-i-muted,
.hev-tool[aria-pressed='false'] .hev-i-sound { display: none; }

/* тонкий прогрес унизу */
.hev-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 3px;
  background: rgba(246, 241, 231, 0.22);
  opacity: 0;
  transition: opacity 0.3s linear;
  pointer-events: none;
}
.hev-progress i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--color-bone, #f6f1e7);
}
.hev-tile.is-started .hev-progress { opacity: 1; }

.hev-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 2.5rem;
  height: 2.5rem;
  margin: -1.25rem 0 0 -1.25rem;
  border: 2px solid rgba(246, 241, 231, 0.35);
  border-top-color: var(--color-bone, #f6f1e7);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  animation: hev-spin 0.9s linear infinite;
  transition: opacity 0.2s linear;
}
.hev-tile.is-loading .hev-spinner { opacity: 1; }
.hev-tile.is-loading .hev-play__disc { opacity: 0; }
@keyframes hev-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .hev-play__disc, .hev-frame::after { transition: none; }
  .hev-spinner { animation-duration: 2.4s; }
}

/* Стара фото-стрічка «Свежее производство» замінена відеогалереєю */
#production.hev-replaced > .reveal:not(.hev-wrap) { display: none; }

/* ---------- WhatsApp ---------- */
/* нижня панель на телефоні — квадратна кнопка поруч з «Войти» */
/* усі кнопки панелі — однієї висоти (класу !min-h-[2.875rem] у збірці немає, висота «плавала») */
div.fixed.inset-x-0.bottom-0 .btn {
  height: 3.25rem;
  min-height: 3.25rem;
  padding-block: 0;
}
div.fixed.inset-x-0.bottom-0 .btn.hew-wa-btn { width: 3.25rem; }
.hew-wa-btn {
  padding: 0;
  border: 1px solid #25d366;
  background-color: #25d366;
  color: #fff;
}
.hew-wa-btn:hover { background-color: #1ebe5a; border-color: #1ebe5a; }

/* десктоп — кругла кнопка ліворуч від плаваючої «H·E» */
.hew-float { display: flex; align-items: center; gap: 0.75rem; }
.hew-wa-float {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background-color: #25d366;
  color: #fff;
  box-shadow: 0 18px 40px -20px rgba(31, 35, 41, 0.6);
  transition: background-color 0.4s var(--ease-out-expo, ease), transform 0.25s var(--ease-out-expo, ease);
}
.hew-wa-float:hover { background-color: #1ebe5a; }
.hew-wa-float:active { transform: translateY(1px); }
.hew-wa-float:focus-visible, .hew-wa-btn:focus-visible { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 3px; }

/* мобільне меню — посилання поруч з Instagram */
.hew-menu-links { display: flex; align-items: center; gap: 1.5rem; align-self: flex-start; }
.hew-menu-wa { display: inline-flex; align-items: center; gap: 0.4rem; }
.hew-menu-wa svg { color: #25d366; }

/* ---------- Заглушка для сайтів мережі, яких ще немає ---------- */
.hew-toast {
  position: fixed;
  left: 50%;
  top: 6.5rem;
  z-index: 90;
  padding: 0.75rem 1.125rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--color-ink, #1f2329);
  color: var(--color-bone, #f6f1e7);
  font-size: 0.875rem;
  box-shadow: 0 18px 40px -20px rgba(31, 35, 41, 0.6);
  transform: translate(-50%, -8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s linear, transform 0.4s var(--ease-out-expo, ease);
}
.hew-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* мобільне меню: нижні кнопки не ховаються під панеллю чату */
html.hxc-on:not(.hxc-launcher-mode) #mobile-menu > div { padding-bottom: 6.5rem; }

/* ---------- Десктоп: одна кнопка «Связаться» замість трьох (WhatsApp · H·E · чат) ---------- */
.hec { display: none; }
@media (min-width: 1024px) {
  /* старі окремі кнопки ховаємо лише коли хаб на сторінці */
  html.hec-on div.fixed.bottom-8.right-8 { display: none !important; }
  html.hec-on .hxc-launcher { display: none !important; }

  .hec {
    --hec-ink: var(--color-ink, #1f2329);
    --hec-bone: var(--color-bone, #f6f1e7);
    --hec-ease: var(--ease-out-expo, cubic-bezier(.16, 1, .3, 1));
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 56;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transition: right .5s var(--hec-ease);
  }
  /* поруч із панеллю / вікном чату, а не під ними */
  html.hxc-on:not(.hxc-launcher-mode) .hec { right: calc(2rem + 22.5rem + .75rem); }
  html.hxc-on:has(.hxc[data-mode="open"]) .hec { right: calc(2rem + 24rem + .75rem); }

  .hec-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .625rem;
    margin: 0 0 .75rem;
    padding: 0 0 .25rem; /* «міст» для курсора між меню і кнопкою */
    list-style: none;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear .35s;
  }
  .hec.is-open .hec-menu { visibility: visible; pointer-events: auto; transition: visibility 0s; }

  .hec-item {
    opacity: 0;
    transform: translateY(10px) scale(.96);
    transform-origin: 100% 100%;
    transition: opacity .25s linear, transform .45s var(--hec-ease);
  }
  .hec.is-open .hec-item { opacity: 1; transform: none; }
  .hec.is-open .hec-item:nth-last-child(1) { transition-delay: 0s; }
  .hec.is-open .hec-item:nth-last-child(2) { transition-delay: .04s; }
  .hec.is-open .hec-item:nth-last-child(3) { transition-delay: .08s; }

  .hec-action {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
  }
  .hec-label {
    padding: .625rem .9375rem;
    border-radius: var(--radius-sm, 6px);
    background: #fffdf9;
    border: 1px solid var(--color-hair, rgba(31, 35, 41, .13));
    box-shadow: 0 18px 40px -24px rgba(31, 35, 41, .55);
    color: var(--hec-ink);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color .3s linear, border-color .3s linear;
  }
  .hec-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: var(--hec-ink);
    color: var(--hec-bone);
    box-shadow: 0 18px 40px -20px rgba(31, 35, 41, .6);
    font-family: var(--font-display, Georgia, serif);
    font-size: .875rem;
    letter-spacing: .04em;
    transition: transform .4s var(--hec-ease), background-color .3s linear;
  }
  .hec-action--wa .hec-icon { background: #25d366; color: #fff; }
  .hec-action:hover .hec-label, .hec-action:focus-visible .hec-label { border-color: var(--color-hair-strong, rgba(31, 35, 41, .24)); background: #fff; }
  .hec-action:hover .hec-icon, .hec-action:focus-visible .hec-icon { transform: scale(1.06); }
  .hec-action:focus-visible { outline: none; }
  .hec-action:focus-visible .hec-icon { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 3px; }

  .hec-toggle {
    position: relative;
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--hec-ink);
    color: var(--hec-bone);
    cursor: pointer;
    box-shadow: 0 18px 40px -20px rgba(31, 35, 41, .6);
    transition: transform .5s var(--hec-ease), background-color .35s linear;
  }
  .hec-toggle:hover { transform: translateY(-2px); }
  .hec.is-open .hec-toggle { background: var(--color-accent, #8a6a4a); }
  .hec-toggle:focus-visible { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 3px; }
  .hec-toggle svg { grid-area: 1 / 1; transition: transform .45s var(--hec-ease), opacity .25s linear; }
  .hec-toggle .hec-i-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
  .hec.is-open .hec-toggle .hec-i-open { opacity: 0; transform: rotate(90deg) scale(.6); }
  .hec.is-open .hec-toggle .hec-i-close { opacity: 1; transform: none; }
  /* непрочитане в прихованому чаті */
  .hec-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: .75rem;
    height: .75rem;
    border-radius: 999px;
    background: var(--color-accent, #8a6a4a);
    border: 2px solid var(--hec-ink);
    display: none;
  }
  html.hxc-launcher-mode:has(.hxc.hxc--unread) .hec-dot { display: block; }

  @media (prefers-reduced-motion: reduce) {
    .hec, .hec-item, .hec-toggle, .hec-toggle svg, .hec-icon { transition: none !important; }
  }
}

/* ---------- Прихований «Перейти к содержимому» ---------- */
/* Лишається для скрінрідерів, але ніколи не зʼявляється над хедером. */
a[href="#main"].sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  background: transparent !important;
  color: transparent !important;
  inset: auto !important;
  z-index: auto !important;
}

/* ---------- «Срезы / На кератине»: заголовок і текст над фото ---------- */
@media (max-width: 1023.98px) {
  #products div.grid.items-center > :first-child { order: 2; }
  #products div.grid.items-center > :last-child { order: 1; }
}

/* ---------- Хедер: пункти меню з підписами ---------- */
[data-he-nav-off] { display: none !important; }
nav[data-he-nav-root] a[data-he-nav] { display: flex; flex-direction: column; }
.he-nav__name { display: block; }
.he-nav__note { display: block; font-family: var(--font-sans); font-weight: 400; }

/* Верхня панель: вужче за 1280px місця на підписи немає — лишаються самі назви. */
nav[data-he-nav-root='bar'] { gap: 1rem; }
nav[data-he-nav-root='bar'] a[data-he-nav] {
  font-size: 0.625rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
}
nav[data-he-nav-root='bar'] .he-nav__note { display: none; }
@media (min-width: 1280px) {
  nav[data-he-nav-root='bar'] { gap: 1.25rem; }
  nav[data-he-nav-root='bar'] a[data-he-nav] { white-space: normal; }
  nav[data-he-nav-root='bar'] .he-nav__name { white-space: nowrap; }
  nav[data-he-nav-root='bar'] .he-nav__note {
    display: block;
    max-width: 7rem;
    margin-top: 0.2rem;
    font-size: 0.5625rem;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: var(--color-muted, #878d95);
  }
}

/* мобільне меню */
nav[data-he-nav-root='menu'] a[data-he-nav] { white-space: normal; }
nav[data-he-nav-root='menu'] .he-nav__name { font-size: 1.375rem; letter-spacing: 0.01em; }
nav[data-he-nav-root='menu'] .he-nav__note {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--color-slate, #5a6069);
}

/* ---------- Футер: підпис DOMIK.AI ---------- */
.he-domik {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-slate, #5a6069);
}
.he-domik__item { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.he-domik__flag { font-size: 1rem; line-height: 1; }
@media (min-width: 640px) {
  .he-domik { justify-content: flex-start; }
}

/* Мобільне меню: компактніші вертикальні відступи між пунктами */
#mobile-menu nav.shell { padding-top: 0.5rem; }
#mobile-menu nav[data-he-nav-root='menu'] > a { padding-block: 0.625rem; }
nav[data-he-nav-root='menu'] .he-nav__name { font-size: 1.25rem; }
nav[data-he-nav-root='menu'] .he-nav__note { margin-top: 0.2rem; }

/* ---------- Щільніші стики відеогалерей із сусідніми блоками ---------- */
/* стрічка «Производство» → заголовок «Что можно заказать» / підпис «КАТЕГОРИИ» */
#factories.hev-has-rail { padding-bottom: 2rem; }
#products { padding-block: 2.5rem; }
/* блок «Товар на видео» / підпис «ИЗ НАЛИЧИЯ» */
#product-videos.hev-section { padding-top: 2rem; }

/* ---------- Картки відгуків відкривають відео в Instagram ---------- */
.review-card { cursor: pointer; }
.review-card:focus-visible { outline: 2px solid var(--color-accent, #8a6a4a); outline-offset: 3px; }

/* Верхня панель ≥1280px: підписи в один рядок, назви на одній лінії */
@media (min-width: 1280px) {
  nav[data-he-nav-root='bar'] { align-items: flex-start; }
  nav[data-he-nav-root='bar'] a[data-he-nav] { flex: none; width: max-content; max-width: none; white-space: nowrap; }
  nav[data-he-nav-root='bar'] .he-nav__note { max-width: none; white-space: nowrap; }
}

/* Menu entries without subtitles. */
.he-nav__note:empty { display: none !important; }

/* Верхня панель 1024–1279px: місця мало — назви по словах у два рядки, щоб не налазили на мови */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  nav[data-he-nav-root='bar'] { gap: .75rem; align-items: center; }
  nav[data-he-nav-root='bar'] a[data-he-nav] { width: min-content; white-space: normal; font-size: .5625rem; line-height: 1.25; }
}

/* Keep two-line navigation clear of the language and account controls on laptops. */
@media (min-width: 1280px) and (max-width: 1535.98px) {
  header .shell > div { gap: 1rem; }
  nav[data-he-nav-root='bar'] { gap: .75rem; }
  nav[data-he-nav-root='bar'] a[data-he-nav] { flex: 1 1 auto; width: auto; }
  nav[data-he-nav-root='bar'] .he-nav__note { white-space: normal; }
}
