/* ==========================================================================
   Video gallery — header popup
   ========================================================================== */

nav.site-nav a.nav-video::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

body.vg-lock {
  overflow: hidden;
}

.vg-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.vg-modal.open {
  opacity: 1;
  visibility: visible;
}

.vg-modal [hidden] {
  display: none !important;
}

.vg-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.vg-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, 100%);
  max-height: 88vh;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease;
}

.vg-modal.open .vg-dialog {
  transform: translateY(0) scale(1);
}

.vg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--green);
  color: var(--white);
  flex-shrink: 0;
}

.vg-title {
  font-size: 20px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.vg-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.vg-close:hover {
  background: var(--red);
  transform: rotate(90deg);
}

.vg-close svg {
  width: 20px;
  height: 20px;
}

.vg-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.vg-grid-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.vg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 24px;
  overflow-y: auto;
}

.vg-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vg-card:hover,
.vg-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--green);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16);
  outline: none;
}

.vg-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #0d0d0d;
  overflow: hidden;
}

.vg-thumb video,
.vg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.vg-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0) 55%
  );
}

.vg-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(226, 36, 28, 0.92);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.vg-card:hover .vg-play,
.vg-card:focus-visible .vg-play {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--green);
}

.vg-play svg {
  width: 26px;
  height: 26px;
  margin-left: 3px;
}

.vg-card-info {
  display: block;
  padding: 14px 16px 16px;
}

.vg-card-title {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
}

.vg-card-desc {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.85;
}

.vg-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: #8a949c;
  font-size: 15px;
}

/* ===== PLAYER VIEW ===== */
.vg-player-view {
  padding: 20px 24px 26px;
  overflow-y: auto;
}

.vg-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 4px;
  background: var(--light);
  color: var(--dark);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.vg-back:hover {
  background: var(--green);
  color: var(--white);
}

.vg-back svg {
  width: 16px;
  height: 16px;
}

.vg-player-frame {
  margin-top: 16px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.vg-player-frame video {
  display: block;
  width: 100%;
  max-height: 62vh;
  background: #000;
}

.vg-player-title {
  margin-top: 14px;
  font-size: 20px;
  color: var(--dark);
}

@media (max-width: 767px) {
  .vg-modal {
    padding: 12px;
  }
  .vg-dialog {
    max-height: 92vh;
  }
  .vg-head {
    padding: 14px 16px;
  }
  .vg-title {
    font-size: 17px;
  }
  .vg-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
  .vg-player-view {
    padding: 16px;
  }
  .vg-player-frame video {
    max-height: 48vh;
  }
}
