/* ═══ ВИДЕОГАЛЕРЕЯ /video ═══════════════════════════════════════════ */

/* ── Табы категорий ─────────────────────────────────────────────── */
.vg-tabs {
  display: flex; gap: 8px; margin-bottom: 24px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.vg-tabs::-webkit-scrollbar { display: none; }
.vg-tab {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 10px 16px; border-radius: 999px;
  background: var(--gray-light); border: 1px solid var(--gray-mid);
  font-size: 14px; font-weight: 700; color: var(--text);
  transition: var(--transition); white-space: nowrap;
}
.vg-tab:hover { border-color: var(--navy3); color: var(--text); }
.vg-tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.vg-tab i { font-size: 16px; }
.vg-tab__count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: rgba(0,0,0,.07); font-size: 12px; font-variant-numeric: tabular-nums;
}
.vg-tab.is-active .vg-tab__count { background: var(--red); }

/* ── Сетка ──────────────────────────────────────────────────────── */
.vg-card__date {
  display: block; margin-top: 4px; font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums;
}
.vg-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.vg-card {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  aspect-ratio: 9 / 16; border-radius: var(--radius-md); overflow: hidden;
  background: var(--navy2); cursor: pointer; text-align: left;
  box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition);
}
.vg-card[hidden] { display: none; }
.vg-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.vg-card:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.vg-card__img, .vg-card__bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.vg-card:hover .vg-card__img { transform: scale(1.04); }
/* Горизонтальное видео в вертикальной карточке: размытый фон + кадр целиком */
.vg-card--horizontal .vg-card__bg { filter: blur(18px) brightness(.55); transform: scale(1.2); }
.vg-card--horizontal .vg-card__img { object-fit: contain; }
.vg-card--horizontal:hover .vg-card__img { transform: none; }
.vg-card__img--product { object-fit: contain; background: #fff; padding: 16%; }
.vg-card__ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.25); font-size: 48px; }
.vg-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(6,13,24,.85) 0%, rgba(6,13,24,0) 45%);
}
.vg-card__play {
  position: absolute; top: 50%; left: 50%; z-index: 2;
  width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; color: #fff;
  background: rgba(255,255,255,.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.35);
  transition: transform var(--transition), background var(--transition);
}
.vg-card__play i { margin-left: 3px; }
.vg-card:hover .vg-card__play { transform: scale(1.1); background: var(--red); border-color: var(--red); }
.vg-card__badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(11,18,32,.6); color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.vg-card__meta { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 12px; }
.vg-card__title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: #fff; font-size: 13.5px; font-weight: 700; line-height: 1.3;
}

@media (max-width: 767px) {
  .vg-hero { padding: 40px 0 28px; }
  .vg-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .vg-card { border-radius: 10px; }
  .vg-card__play { width: 44px; height: 44px; margin: -22px 0 0 -22px; font-size: 22px; }
  .vg-card__badge { top: 8px; left: 8px; font-size: 10px; padding: 2px 7px; }
  .vg-card__meta { padding: 8px 9px; }
  .vg-card__title { font-size: 12px; }
  .vg-card__date { font-size: 10.5px; margin-top: 2px; }
}

/* ── Плеер-лента ────────────────────────────────────────────────── */
.vg-viewer {
  position: fixed; inset: 0; z-index: 10050; background: #000;
  overscroll-behavior: contain;
}
.vg-viewer[hidden] { display: none; }
html.vg-locked, html.vg-locked body { overflow: hidden !important; }
html.vg-locked .fw-widget { display: none !important; }

.vg-feed {
  height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.vg-feed::-webkit-scrollbar { display: none; }
.vg-slide {
  position: relative; height: 100vh; height: 100dvh;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.vg-slide__bg {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(30px) brightness(.4);
}
.vg-box {
  position: relative; background: #000; overflow: hidden;
  /* ПК: вертикальное — колонка 9:16 по высоте экрана */
  height: calc(100dvh - 40px); aspect-ratio: 9 / 16; max-width: 100%; border-radius: 14px;
}
.vg-slide--horizontal .vg-box { height: auto; width: min(88vw, calc((100dvh - 40px) * 16 / 9)); aspect-ratio: 16 / 9; }
.vg-box__poster, .vg-box video, .vg-box iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.vg-box__poster { object-fit: cover; }
.vg-box video { object-fit: contain; background: transparent; }
.vg-slide--horizontal .vg-box__poster { object-fit: contain; }
.vg-box video.is-cover { object-fit: cover !important; }
/* Обложка нужна только до старта видео — потом прячем, чтобы не просвечивала по краям */
.vg-box.is-ready .vg-box__poster { opacity: 0; transition: opacity .2s; }
/* Ловит свайпы поверх iframe (иначе iframe «съедает» жесты) */
.vg-catch { position: absolute; inset: 0; z-index: 3; }
.vg-box.is-paused::before {
  content: '\F4F4'; font-family: 'bootstrap-icons'; z-index: 4; pointer-events: none;
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 72px; color: rgba(255,255,255,.85); text-shadow: 0 2px 16px rgba(0,0,0,.5);
}
.vg-box__spin {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; z-index: 2;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%;
  animation: vgSpin .8s linear infinite; pointer-events: none;
}
.vg-box.is-ready .vg-box__spin { display: none; }
@keyframes vgSpin { to { transform: rotate(360deg); } }

.vg-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 60px 16px 18px; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0));
}
.vg-info > * { pointer-events: auto; }
.vg-info__cat {
  display: inline-block; margin-bottom: 6px; padding: 2px 9px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
}
.vg-info__title { color: #fff; font-size: 16px; font-weight: 800; line-height: 1.3; margin: 0 0 10px; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.vg-info__btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  background: #fff; color: var(--navy); font-size: 13px; font-weight: 800;
}
.vg-info__btn:hover { background: var(--red); color: #fff; }
.vg-slide--horizontal .vg-info { padding-top: 40px; }

/* Кнопки управления */
.vg-ctl {
  width: 46px; height: 46px; border-radius: 50%; border: 0; z-index: 10;
  display: grid; place-items: center; font-size: 20px; color: #fff;
  background: rgba(255,255,255,.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background var(--transition), opacity var(--transition);
}
.vg-ctl:hover { background: rgba(255,255,255,.28); }
.vg-ctl:disabled { opacity: .25; pointer-events: none; }
.vg-ctl--close { position: absolute; top: 16px; left: 16px; }
.vg-ctl--mute  { position: absolute; top: 16px; right: 16px; }
.vg-ctl--mute[hidden] { display: none; }
.vg-nav {
  position: absolute; right: 24px; top: 50%; transform: translateY(-50%); z-index: 10;
  display: flex; flex-direction: column; gap: 12px;
}
.vg-hint {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 10;
  padding: 8px 16px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff;
  font-size: 13px; font-weight: 600; pointer-events: none; opacity: 0;
  transition: opacity .4s;
}
.vg-hint.is-show { opacity: 1; animation: vgNudge 1.2s ease-in-out 2; }
@keyframes vgNudge { 50% { transform: translate(-50%, -10px); } }

/* Мобила: на весь экран, как в TikTok/Reels */
@media (max-width: 767px) {
  .vg-box { height: 100%; width: 100%; aspect-ratio: auto; border-radius: 0; }
  .vg-slide--vertical .vg-box video { object-fit: cover; }
  .vg-slide--horizontal .vg-box { width: 100%; height: 100%; aspect-ratio: auto; background: transparent; }
  .vg-slide--horizontal .vg-box video { object-fit: contain; }
  .vg-slide--horizontal .vg-box iframe { top: 50%; bottom: auto; height: auto; aspect-ratio: 16 / 9; transform: translateY(-50%); }
  .vg-info { padding: 80px 72px calc(20px + env(safe-area-inset-bottom)) 16px; }
  .vg-ctl { width: 42px; height: 42px; font-size: 18px; background: rgba(0,0,0,.35); }
  .vg-ctl--close { top: calc(12px + env(safe-area-inset-top)); left: 12px; }
  .vg-ctl--mute  { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
  .vg-nav { right: 12px; top: auto; bottom: calc(24px + env(safe-area-inset-bottom)); transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .vg-card, .vg-card__img, .vg-hint.is-show { transition: none; animation: none; }
}
