/* ──────────────────────────────────────────
   Custom YouTube Lightbox
   ────────────────────────────────────────── */

/* Overlay */
.yt-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.yt-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Video wrapper – 16:9 responsive */
.yt-lightbox-wrapper {
  position: relative;
  width: 90vw;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  transform: scale(0.92);
  transition: transform 0.3s ease;
}

.yt-lightbox-overlay.active .yt-lightbox-wrapper {
  transform: scale(1);
}

.yt-lightbox-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Close button */
.yt-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.2s ease;
  line-height: 1;
}

.yt-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Navigation arrows */
.yt-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100000;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
}

.yt-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.yt-lightbox-nav.hidden {
  opacity: 0;
  pointer-events: none;
}

.yt-lightbox-prev {
  left: 16px;
}

.yt-lightbox-next {
  right: 16px;
}

/* Caption */
.yt-lightbox-caption {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 16px;
  border-radius: 8px;
  max-width: 80vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Counter */
.yt-lightbox-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  z-index: 100000;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .yt-lightbox-wrapper {
    height: 50vh;
    width: 96vw;
    border-radius: 8px;
  }

  .yt-lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .yt-lightbox-prev {
    left: 6px;
  }

  .yt-lightbox-next {
    right: 6px;
  }

  .yt-lightbox-close {
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  /* Stack layout and mobile nav under the video */
  .yt-lightbox-overlay {
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .yt-lightbox-wrapper {
    margin-bottom: 56px; /* space for mobile nav */
  }

  .yt-lightbox-mobile-nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 960px;
    box-sizing: border-box;
    padding: 6px 12px 0 12px;
  }

  .yt-lightbox-mobile-nav .yt-lightbox-nav {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    margin: 0;
  }
}
