/* Обучающие ролики: карточка раздела, окно с плеером, встроенный плеер.
   Обычный CSS без Tailwind: подключается и на страницах разделов, и на
   страницах сайта. Переменные темы из base.css, с запасными значениями. */


/* ── Маленький плеер по центру колонки раздела ──────── */
.hv-plate {
  position: relative;
  flex-shrink: 0;
  width: 220px;
  margin: 12px auto 4px;
}

.hv-plate[hidden] {
  display: none;
}

.hv-plate__open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-body, #ccc);
  text-align: center;
  cursor: pointer;
}

.hv-plate__frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border, #3a3a3a);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  transition: border-color .15s, transform .15s;
}

.hv-plate__open:hover .hv-plate__frame,
.hv-plate__open:focus-visible .hv-plate__frame {
  border-color: var(--brand, #E2841F);
}

.hv-plate__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hv-plate__play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: var(--brand, #E2841F);
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .45);
  transition: transform .15s;
}

.hv-plate__open:hover .hv-plate__play {
  transform: scale(1.08);
}

.hv-plate__dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
}

.hv-plate__label {
  display: block;
  margin-top: 8px;
  color: var(--text-primary, #f2f2f2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.hv-plate__hide {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  cursor: pointer;
}

/* Область нажатия крестика больше видимого круга. */
.hv-plate__hide::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.hv-plate__hide:hover {
  background: rgba(0, 0, 0, .9);
}

@media (max-width: 767px) {
  .hv-plate {
    width: 200px;
    margin: 10px auto 4px;
  }
}

/* ── Окно с плеером ─────────────────────────────────── */
/* margin и inset заданы явно: сброс стилей сайта обнуляет margin у dialog,
   и окно без этого прижимается к левому верхнему углу. */
.hv-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(960px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border, #3a3a3a);
  border-radius: var(--radius-xl, 14px);
  background: var(--bg-white, #1c1c1c);
  color: var(--text-primary, #f2f2f2);
  overflow: auto;
}

.hv-dialog::backdrop {
  background: rgba(0, 0, 0, .7);
}

.hv-dialog__box {
  padding: 14px 16px 16px;
}

.hv-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.hv-dialog__title {
  font-size: 15px;
  font-weight: 600;
}

.hv-dialog__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius, 6px);
  background: transparent;
  color: var(--text-subtle, #aaa);
  cursor: pointer;
}

.hv-dialog__close:hover {
  background: var(--bg-surface, #262626);
  color: var(--text-primary, #f2f2f2);
}

.hv-dialog__video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md, 8px);
  background: #000;
}

.hv-dialog__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.hv-dialog__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--border-light, #2e2e2e);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.hv-dialog__item:hover,
.hv-dialog__item.is-active {
  border-color: var(--brand, #E2841F);
}

.hv-dialog__item img {
  width: 72px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
}

.hv-dialog__item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hv-dialog__item-title {
  font-size: 12px;
  line-height: 1.3;
}

.hv-dialog__item-dur {
  font-size: 11px;
  color: var(--text-muted, #888);
}

.hv-dialog__foot {
  margin-top: 12px;
  text-align: right;
}

.hv-dialog__all {
  color: var(--brand, #E2841F);
  font-size: 13px;
  text-decoration: underline;
}

/* ── Ссылка "Как это работает" в окнах чата ─────────── */
.hv-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand, #E2841F);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.hv-link:hover {
  text-decoration: underline;
}

/* ── Встроенный плеер на страницах ──────────────────── */
.hv-inline {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xl, 14px);
  overflow: hidden;
  background: #000;
}

.hv-inline__video {
  display: block;
  width: 100%;
  height: 100%;
}

/* Заставка с кнопкой видна только со скриптом. Без него остаётся <video>
   с controls без poster: атрибут poster грузится сразу, поэтому его нет. */
.hv-inline__cover {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: #000;
  cursor: pointer;
}

.hv-js .hv-inline__cover {
  display: flex;
}

.hv-js .hv-inline__cover[hidden] {
  display: none;
}

.hv-inline__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hv-inline__play {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--brand, #E2841F);
  color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .4);
  transition: transform .15s;
}

.hv-inline__cover:hover .hv-inline__play {
  transform: scale(1.06);
}

.hv-inline__dur {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 13px;
}

/* ── Страница "Как пользоваться" и блок на посадочных ── */
.hv-page__group {
  margin: 40px 0 16px;
  font-size: 28px;
  font-weight: 500;
}

.hv-page__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px 24px;
}

.hv-page__title {
  margin: 12px 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.hv-page__summary {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
}

.hv-page__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.hv-page__go {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--brand, #E2841F);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.hv-page__go:hover {
  background: var(--brand-dark, #c86f12);
}

.hv-landing {
  max-width: 960px;
  margin: 0 auto;
}

.hv-landing__caption {
  margin-top: 12px;
  font-size: 15px;
  text-align: center;
}

.hv-landing__caption a {
  color: var(--brand, #E2841F);
  text-decoration: underline;
}

@media (max-width: 767px) {
  .hv-page__grid {
    grid-template-columns: 1fr;
  }

  .hv-page__group {
    font-size: 22px;
  }
}

.modal-header .hv-link {
  margin-left: auto;
  margin-right: 12px;
}

.sp-help-link {
  align-self: flex-start;
  margin: 2px 0 0 4px;
}

/* ── Кнопка ролика в правой панели раздела ──────────── */
.hv-panel-btn {
  width: 100%;
  color: var(--text-body, #ccc);
}

.hv-panel-btn__dur {
  margin-left: auto;
  color: var(--text-muted, #888);
  font-weight: 400;
}

/* ── Запасная кнопка ролика (галерея, карточки товара) ── */
/* Видна только после закрытия плеера: класс ставит скрипт плеера. */
html:not(.hv-plate-hidden) .hv-fallback {
  display: none;
}

.hv-fallback {
  gap: 6px;
  cursor: pointer;
}

.ig-hist-tab.hv-fallback {
  display: inline-flex;
  align-items: center;
  border: none;
  background: none;
  font-family: inherit;
}

/* На телефоне в строке вкладок галереи места нет: только значок. */
@media (max-width: 767px) {
  .ig-hist-tab.hv-fallback {
    padding: 6px;
  }

  html.hv-plate-hidden .ig-hist-header {
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  html.hv-plate-hidden .ig-hist-create-btn {
    margin-left: auto;
  }

  .ig-hist-tab.hv-fallback .hv-fallback__text {
    display: none;
  }
}

/* ── Крупный ролик под формой входа у гостя ─────────── */
.hv-guest {
  width: 100%;
  max-width: 380px;
}

.hv-guest__lead {
  margin: 0 0 10px;
  color: var(--text-body, #ccc);
  font-size: 13px;
  text-align: center;
}

.hv-guest .hv-inline {
  border: 1px solid var(--border, #3a3a3a);
  border-radius: 14px;
}

.hv-guest .hv-inline__play {
  width: 56px;
  height: 56px;
}

/* Страница входа: ролик под карточкой входа, по её ширине (max-w-md). */
.hv-auth {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 28rem;
  margin-top: 24px;
}

.hv-auth .hv-guest {
  max-width: none;
}
