.hopa-vg,
.hopa-vg * { box-sizing: border-box; }

.hopa-vg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hopa-vg-item { min-width: 0; }

.hopa-vg-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  cursor: pointer;
  background: #111;
  aspect-ratio: 16/9;
  isolation: isolate;
}

.hopa-vg-media::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}

.hopa-vg-media:hover::after,
.hopa-vg-media:focus-visible::after { opacity: 1; }

.hopa-vg-player,
.hopa-vg-player iframe,
.hopa-vg-player video,
.hopa-vg-poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.hopa-vg-poster { z-index: 2; }

.hopa-vg-play-icon {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0,0,0,.62);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.hopa-vg-play-icon::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 16px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid #fff;
}

.hopa-vg-item.is-playing .hopa-vg-play-icon { opacity: 0; transform: translate(-50%, -50%) scale(.85); }
.hopa-vg-caption { line-height: 1.3; }

.hopa-vg-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hopa-vg-modal.is-open { display: flex; }
.hopa-vg-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.82); }

.hopa-vg-modal-dialog {
  position: relative;
  z-index: 1;
  width: 88vw;
  max-width: 1400px;
  max-height: calc(100vh - 48px);
  padding: 24px;
  overflow: auto;
  border-radius: 10px;
  background: #111;
  box-shadow: 0 20px 70px rgba(0,0,0,.5);
}

.hopa-vg-modal-title { padding: 0 44px 0 0; color: #fff; }

.hopa-vg-modal-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.hopa-vg-modal-media iframe,
.hopa-vg-modal-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.hopa-vg-modal-close {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 10px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.12);
  font: 32px/38px Arial, sans-serif;
  cursor: pointer;
}

html.hopa-vg-modal-open { overflow: hidden; }

@media (max-width: 767px) {
  .hopa-vg-modal { padding: 10px; }
  .hopa-vg-modal-dialog { width: 96vw; max-height: calc(100vh - 20px); padding: 14px; }
  .hopa-vg-play-icon { width: 46px; height: 46px; }
  .hopa-vg-play-icon::before { left: 18px; top: 13px; }
}

.hopa-vg-caption-link {
  color: #0a66c2;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color .18s ease, text-decoration-color .18s ease;
}

.hopa-vg-caption-link:hover,
.hopa-vg-caption-link:focus-visible {
  color: #064f9e;
  text-decoration-thickness: 2px;
}


.hopa-vg-item.is-external .hopa-vg-media:hover::after,
.hopa-vg-item.is-external .hopa-vg-media:focus-visible::after { opacity: .45; }

.hopa-vg-item.is-external .hopa-vg-play-icon { display: none; }

.hopa-vg-external-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: #fff;
  font: 700 16px/1.25 Arial, sans-serif;
  text-align: center;
  background: linear-gradient(135deg, #0f6ea8, #13a6b6);
}

.hopa-vg-external-placeholder span {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  background: rgba(0,0,0,.18);
}

.hopa-vg-external-badge {
  position: absolute;
  z-index: 5;
  right: 10px;
  bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0,0,0,.7);
  font: 700 11px/1 Arial, sans-serif;
  letter-spacing: .03em;
  text-transform: uppercase;
  pointer-events: none;
}
