/* Video playback modal */
.tgwv-video-modal[hidden] {
  display: none !important;
}

.tgwv-video-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  overscroll-behavior: contain;
}

.tgwv-video-modal.is-open {
  opacity: 1;
}

.tgwv-video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.tgwv-video-modal__dialog {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(900px, 100%, calc((100vh - 6rem) * 16 / 9));
  padding: 0;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.tgwv-video-modal.is-open .tgwv-video-modal__dialog {
  transform: none;
}

/* Nút đóng ẩn khỏi giao diện: chỉ còn cho trình đọc màn hình. Đóng bằng ESC hoặc click nền. */
.tgwv-video-modal__close {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
}

.tgwv-video-modal__close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.tgwv-video-modal__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tgwv-video-modal__body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

/* Tràn 1px ra mép trên/trái/phải/dưới để không lộ viền đen do làm tròn kích thước; phần thừa bị bo góc + overflow cắt. */
.tgwv-video-modal__body iframe,
.tgwv-video-modal__body video {
  position: absolute;
  top: -1px;
  left: -1px;
  z-index: 0;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  border: 0;
}

.tgwv-video-modal__body::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  margin: -1.25rem 0 0 -1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.tgwv-video-modal__dialog.is-loading .tgwv-video-modal__body::after {
  opacity: 1;
  animation: tgwv-video-modal-spin 0.8s linear infinite;
}

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

html.tgwv-video-modal-open {
  overflow: hidden;
  padding-right: var(--tgwv-video-scrollbar, 0px);
}

@media (max-width: 575.98px) {
  .tgwv-video-modal {
    padding: 0.75rem;
  }

  .tgwv-video-modal__dialog {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tgwv-video-modal,
  .tgwv-video-modal__dialog,
  .tgwv-video-modal__close {
    transition: none;
  }

  .tgwv-video-modal__dialog.is-loading .tgwv-video-modal__body::after {
    animation-duration: 2.4s;
  }
}

.tgwv-video-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  pointer-events: none;
}

.tgwv-video-card__open {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.tgwv-video-card__media .tgwv-video-card__open {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  line-height: 0;
  position: relative;
}
