.v3d-gallery-trigger {
  cursor: zoom-in;
}

html.v3d-gallery-open {
  overflow: hidden;
}

.v3d-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  padding: clamp(10px, 2.5vw, 32px);
  background: rgba(3, 8, 18, 0.96);
  color: #fff;
}

.v3d-gallery-lightbox.is-open {
  display: grid;
  place-items: center;
}

.v3d-gallery-stage {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.v3d-gallery-figure {
  display: grid;
  width: 100%;
  height: 100%;
  margin: 0;
  place-items: center;
  grid-template-rows: minmax(0, 1fr) auto;
}

.v3d-gallery-image {
  display: block;
  max-width: min(100%, 1600px);
  max-height: calc(100vh - 92px);
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.16s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.v3d-gallery-image.is-loading {
  opacity: 0;
}

.v3d-gallery-caption {
  max-width: min(900px, calc(100vw - 110px));
  margin-top: 10px;
  color: #f3f6fa;
  font: 500 14px/1.4 Arial, sans-serif;
  text-align: center;
}

.v3d-gallery-close,
.v3d-gallery-nav {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(10, 18, 32, 0.78);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  backdrop-filter: blur(7px);
}

.v3d-gallery-close {
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  font-size: 32px;
}

.v3d-gallery-nav {
  top: 50%;
  width: 52px;
  height: 72px;
  transform: translateY(-50%);
  font-size: 50px;
}

.v3d-gallery-prev {
  left: 0;
}

.v3d-gallery-next {
  right: 0;
}

.v3d-gallery-close:hover,
.v3d-gallery-nav:hover,
.v3d-gallery-close:focus-visible,
.v3d-gallery-nav:focus-visible {
  border-color: #fff;
  background: #192a46;
  outline: 3px solid rgba(88, 255, 164, 0.45);
}

.v3d-gallery-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  min-width: 62px;
  color: #fff;
  font: 700 14px/1 Arial, sans-serif;
  text-align: right;
}

.v3d-gallery-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
}

.v3d-gallery-loader.is-loading {
  display: block;
}

.v3d-gallery-loader span {
  display: block;
  width: 100%;
  height: 100%;
  border: 4px solid rgba(255, 255, 255, 0.24);
  border-top-color: #58ffa4;
  border-radius: 50%;
  animation: v3d-gallery-spin 0.8s linear infinite;
}

@keyframes v3d-gallery-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 680px) {
  .v3d-gallery-lightbox {
    padding: 8px;
  }

  .v3d-gallery-image {
    max-height: calc(100vh - 70px);
  }

  .v3d-gallery-close {
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
  }

  .v3d-gallery-nav {
    top: auto;
    bottom: 4px;
    width: 54px;
    height: 48px;
    transform: none;
    font-size: 40px;
  }

  .v3d-gallery-prev {
    left: 4px;
  }

  .v3d-gallery-next {
    right: 4px;
  }

  .v3d-gallery-counter {
    right: 50%;
    bottom: 20px;
    transform: translateX(50%);
    text-align: center;
  }

  .v3d-gallery-caption {
    max-width: calc(100vw - 24px);
    margin-bottom: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v3d-gallery-image {
    transition: none;
  }
}
