:root {
  --gallery-lightbox-control-background: #ffffff;
  --gallery-lightbox-control-hover: #e1e1e1;
  --gallery-lightbox-control-border: #b9b9b9;
  --gallery-lightbox-control-color: #767676;
}

.gallery-lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(242, 242, 242, 0.18);
  backdrop-filter: blur(2px);
  z-index: 9999;
  touch-action: none;
  overscroll-behavior: contain;
  animation: fadeIn 0.3s ease;
}

.gallery-lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}


.lightbox-content {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 3.5rem 5rem 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #53419be0;
  background: #00000080;

}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 5px 18px rgba(27, 37, 31, 0.18);
  cursor: zoom-in;
  touch-action: none;
  animation: slideIn 0.3s ease;
}

.lightbox-image.is-zoomed {
  cursor: grab;
}

.lightbox-image.is-panning {
  cursor: grabbing;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  background: var(--gallery-lightbox-control-background);
  border: 1px solid var(--gallery-lightbox-control-border);
  border-radius: 50%;
  color: var(--gallery-lightbox-control-color);
  font-size: 0;
  cursor: pointer;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.18s ease, background-color 0.2s ease;
  z-index: 10000;
}

.lightbox-close:hover {
  background: var(--gallery-lightbox-control-hover);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: calc(50% - 1.5rem);
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  background-color: var(--gallery-lightbox-control-background);
  border: 1px solid var(--gallery-lightbox-control-border);
  border-radius: 50%;
  color: var(--gallery-lightbox-control-color);
  font-size: 0;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.18s ease, background-color 0.2s ease;
  z-index: 10000;
}

.gallery-lightbox.controls-visible .lightbox-prev,
.gallery-lightbox.controls-visible .lightbox-next,
.gallery-lightbox.controls-visible .lightbox-close,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible,
.lightbox-close:focus-visible {
  opacity: 1;
}

.lightbox-close svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

.lightbox-prev svg,
.lightbox-next svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.lightbox-prev:hover:not(:disabled),
.lightbox-next:hover:not(:disabled) {
  background-color: var(--gallery-lightbox-control-hover);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  cursor: not-allowed;
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.45rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  white-space: nowrap;
  z-index: 10000;
}

@media (max-width: 768px) {
  .gallery-lightbox {
    width: 100vw;
    height: 100vh;
  }

  .gallery-lightbox.active {
    width: 100dvw;
    height: 100dvh;
  }

  .lightbox-content {
    width: 100vw;
    height: 100vh;
    padding: 3.5rem 1rem 3rem;
    border-radius: 0;
  }

  @supports (height: 100dvh) {
    .lightbox-content {
      width: 100dvw;
      height: 100dvh;
    }
  }

  .lightbox-close {
    top: max(0.75rem, env(safe-area-inset-top));
    right: max(0.75rem, env(safe-area-inset-right));
    opacity: 1;
  }

  .lightbox-counter {
    bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

@media (hover: none) and (pointer: coarse) {

  .lightbox-prev,
  .lightbox-next {
    display: none;
  }
}