.local-gallery {
  position: relative;
  width: 100%;
  margin: 0;
}

.local-gallery:not(.local-gallery--ready) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.local-gallery:not(.local-gallery--ready) .e-gallery-item {
  position: relative;
  height: 200px;
}

.local-gallery .e-gallery-item {
  position: absolute;
  display: block;
  overflow: hidden;
  margin: 0;
  opacity: 1;
}

.local-gallery .e-gallery-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
}

.local-gallery .e-gallery-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.local-gallery .elementor-gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 250ms ease;
}

.local-gallery .e-gallery-item:hover .elementor-gallery-item__overlay,
.local-gallery .e-gallery-item:focus-visible .elementor-gallery-item__overlay {
  opacity: 1;
}

.gallery-lightbox {
  --gallery-viewer-background: rgba(10, 10, 10, 0.96);
  --gallery-viewer-control: rgba(255, 255, 255, 0.12);
  --gallery-viewer-control-hover: rgba(212, 154, 68, 0.9);
  --gallery-viewer-text: #ffffff;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 20px;
  padding: 70px 28px 28px;
  background: var(--gallery-viewer-background);
  color: var(--gallery-viewer-text);
}

.gallery-lightbox button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--gallery-viewer-text);
  cursor: pointer;
  font: inherit;
}

.gallery-lightbox__close {
  position: absolute;
  top: 18px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: transparent;
  font-size: 42px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
}

.gallery-lightbox__previous,
.gallery-lightbox__next {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gallery-viewer-control);
  font-size: 48px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  transition: background 180ms ease;
}

.gallery-lightbox__previous:hover,
.gallery-lightbox__next:hover,
.gallery-lightbox__previous:focus-visible,
.gallery-lightbox__next:focus-visible,
.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
  background: var(--gallery-viewer-control-hover);
}

.gallery-lightbox__figure {
  display: flex;
  min-width: 0;
  max-height: calc(100vh - 100px);
  margin: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox__figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.gallery-lightbox__figure figcaption {
  display: flex;
  width: 100%;
  max-width: 1000px;
  justify-content: space-between;
  gap: 24px;
  padding-top: 16px;
  color: var(--gallery-viewer-text);
  font-family: "Nunito", sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

@media (max-width: 767px) {
  .local-gallery:not(.local-gallery--ready) {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .local-gallery:not(.local-gallery--ready) .e-gallery-item {
    height: 150px;
  }

  .gallery-lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 6px;
    padding: 64px 8px 18px;
  }

  .gallery-lightbox__previous,
  .gallery-lightbox__next {
    width: 40px;
    height: 40px;
    font-size: 36px !important;
  }

  .gallery-lightbox__close {
    top: 12px;
    right: 12px;
  }

  .gallery-lightbox__figure img {
    max-height: calc(100vh - 190px);
  }

  .gallery-lightbox__figure figcaption {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .local-gallery .elementor-gallery-item__overlay,
  .gallery-lightbox__previous,
  .gallery-lightbox__next {
    transition: none;
  }
}
