/* ════════════════════════════════════════════════════
   Floating video widget — modal & responsive overrides
   ════════════════════════════════════════════════════ */

/* ── Скрытие виджета при открытии любого попапа на странице ── */
body.popup-open .video-widget {
  display: none !important;
}

/* ── Видимость возле футера ── */
.video-widget[data-near-footer="true"] {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* ── Мобильная версия виджета: 120×90 вместо display:none ── */
@media (max-width: 720px) {
  .video-widget {
    width: 120px;
    height: 90px;
    left: 12px;
    bottom: 12px;
    border-radius: 6px;
  }
  .video-widget__play {
    width: 32px;
    height: 32px;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    box-shadow: 0 0 0 4px rgba(200, 121, 42, 0.18), 0 4px 12px rgba(200, 121, 42, 0.45);
  }
  .video-widget__play svg {
    width: 14px;
    height: 14px;
  }
  .video-widget:hover .video-widget__play {
    transform: translate(-50%, 50%) scale(1.06);
  }
  .video-widget__label {
    display: none;
  }
  .video-widget__close {
    width: 22px;
    height: 22px;
    top: 4px;
    right: 4px;
  }
}

/* ════════════════════════════════════════════════════
   Video modal
   ════════════════════════════════════════════════════ */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.video-modal[data-open="true"] {
  display: flex;
}

.video-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.video-modal__content {
  position: relative;
  width: min(94vw, 1000px);
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.55);
  animation: video-modal-pop 220ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes video-modal-pop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.video-modal__player {
  position: absolute;
  inset: 0;
}

.video-modal__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* ── Close button (поверх overlay, в правом верхнем углу .video-modal) ── */
.video-modal__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}
.video-modal__close:hover,
.video-modal__close:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}
.video-modal__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Loading state ── */
.video-modal__loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2;
}
.video-modal[data-state="loading"] .video-modal__loading {
  display: flex;
}

.video-modal__spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: video-modal-spin 0.9s linear infinite;
}

@keyframes video-modal-spin {
  to { transform: rotate(360deg); }
}

/* ── Error state ── */
.video-modal__error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  background: rgba(20, 16, 12, 0.92);
  color: #fff;
  text-align: center;
  z-index: 2;
}
.video-modal[data-state="error"] .video-modal__error {
  display: flex;
}
.video-modal[data-state="error"] .video-modal__video,
.video-modal[data-state="error"] .video-modal__loading {
  display: none;
}
.video-modal__error p {
  margin: 0;
  max-width: 520px;
  font: 400 16px/1.5 var(--font-body);
  color: #F5F1EC;
}
.video-modal__error-close {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: 500 14px/1 var(--font-body);
  letter-spacing: 0.4px;
  padding: 12px 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.video-modal__error-close:hover,
.video-modal__error-close:focus-visible {
  background: var(--accent-dark);
}
.video-modal__error-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Mobile: close button goes inside content ── */
@media (max-width: 720px) {
  .video-modal {
    padding: 12px;
  }
  .video-modal__content {
    width: 100%;
    max-width: none;
  }
  .video-modal__close {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: rgba(20, 16, 12, 0.65);
    border-radius: 50%;
  }
  .video-modal__close:hover,
  .video-modal__close:focus-visible {
    background: rgba(20, 16, 12, 0.85);
  }
  .video-modal__error {
    padding: 20px;
  }
  .video-modal__error p {
    font-size: 14px;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .video-modal__content {
    animation: none;
  }
  .video-modal__spinner {
    animation-duration: 2s;
  }
  .video-widget,
  .video-widget[data-revealed="true"],
  .video-widget[data-near-footer="true"] {
    transition: none;
  }
}
