#wp-gallery-root {
  --cols: 5;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 12px;
  width: 100%;
}
@media (max-width: 768px) { #wp-gallery-root { --cols: 3; } }
@media (max-width: 480px) { #wp-gallery-root { --cols: 1; } }

.wg-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
}
.wg-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform .3s, opacity .3s;
}
.wg-item:hover img { transform: scale(1.04); opacity: .85; }

.wg-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.wg-play svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
  transition: transform .2s;
}
.wg-item:hover .wg-play svg { transform: scale(1.12); }

.wg-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: .5rem .75rem;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  color: #fff;
  font-size: .8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .2s;
}
.wg-item:hover .wg-caption { opacity: 1; }

/* Lightbox */
#wg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#wg-lightbox.open { display: flex; }
#wg-lightbox-inner {
  position: relative;
  width: 95vw;
  height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#wg-lightbox-content img {
  width:  clamp(280px, 88vw, min(88vw, 1400px));
  height: clamp(200px, 75vh, 82vh);
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
#wg-lightbox-content iframe {
  width: min(95vw, 1000px);
  height: min(95vh, 562px);
  aspect-ratio: 16/9;
  border: none;
  border-radius: 6px;
}
#wg-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: rgba(0,0,0,.5);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  z-index: 10;
}
#wg-lightbox-close:hover { background: rgba(0,0,0,.8); }

.wg-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.5);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  z-index: 10;
}
.wg-lightbox-nav:hover    { background: rgba(0,0,0,.8); }
.wg-lightbox-nav:disabled { opacity: .4; cursor: default; }
#wg-lightbox-prev { left:  1.5rem; }
#wg-lightbox-next { right: 1.5rem; }

#wg-lightbox-caption {
  position: absolute;
  bottom: 1rem;
  left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,.85);
  font-size: .9rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Pagination */
#wg-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#wg-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  border-radius: 6px;
  font-size: .875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
#wg-pagination button:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #aaa;
}
#wg-pagination button.active {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 600;
}
#wg-pagination button:disabled {
  opacity: .3;
  cursor: default;
}
