body.hgc-lightbox-open {
  overflow: hidden;
}

.hgc-lightbox {
  --hgc-lightbox-overlay-opacity: 0.82;
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.hgc-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.hgc-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, var(--hgc-lightbox-overlay-opacity));
  backdrop-filter: blur(8px);
}

.hgc-lightbox__panel {
  position: relative;
  width: min(96vw, 1340px);
  height: 100vh;
  max-height: 100vh;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 62px 16px 22px;
  box-sizing: border-box;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.hgc-lightbox.is-open .hgc-lightbox__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.hgc-lightbox.is-fade .hgc-lightbox__panel {
  transform: none;
}

.hgc-lightbox__stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

.hgc-lightbox__image {
  max-width: min(94vw, calc(100vw - 210px));
  max-height: min(92vh, calc(100vh - 150px));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.hgc-lightbox__image.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.hgc-lightbox__close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 10px;
  right: 14px;
  width: 42px;
  height: 42px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1f2937;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hgc-lightbox__close::before {
  content: "\00d7";
  display: block;
  font-size: 30px;
  line-height: 1;
  transform: translateY(-1px);
}

.hgc-lightbox__close:hover {
  transform: scale(1.06);
  background: #ffffff;
}

.hgc-lightbox__nav {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 52px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hgc-lightbox__nav::before {
  content: "";
  width: 12px;
  height: 12px;
  border-top: 2.5px solid currentColor;
  border-right: 2.5px solid currentColor;
  box-sizing: border-box;
  display: block;
}

.hgc-lightbox__nav--prev::before {
  transform: rotate(-135deg);
  margin-left: 3px;
}

.hgc-lightbox__nav--next::before {
  transform: rotate(45deg);
  margin-right: 3px;
}

.hgc-lightbox__nav:hover {
  transform: scale(1.05);
  background: #ffffff;
}

.hgc-lightbox__mobile-controls {
  display: none;
}

.hgc-lightbox__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.hgc-lightbox__caption {
  max-width: 78%;
  color: #f6f7fb;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(8, 10, 16, 0.6);
}

.hgc-lightbox__counter {
  color: #f6f7fb;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.6);
}

.hgc-lightbox button:focus-visible {
  outline: 3px solid #36bdb4;
  outline-offset: 2px;
}

@media (max-width: 991px) {
  .hgc-lightbox__panel {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 54px) 8px calc(env(safe-area-inset-bottom, 0px) + 12px);
    box-sizing: border-box;
  }

  .hgc-lightbox__close {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: calc(env(safe-area-inset-right, 0px) + 8px);
  }

  .hgc-lightbox__stage {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0;
    height: auto;
  }

  .hgc-lightbox__mobile-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    margin-top: 8px;
    z-index: 2;
    pointer-events: auto;
  }

  .hgc-lightbox__mobile-controls .hgc-lightbox__nav {
    position: static;
    top: auto;
    margin: 0;
    transform: none;
    width: 46px;
    height: 46px;
  }

  .hgc-lightbox__mobile-controls .hgc-lightbox__counter {
    position: static;
    margin: 0;
    white-space: nowrap;
  }

  .hgc-lightbox__image {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 260px);
  }

  .hgc-lightbox__meta {
    position: static;
    width: 100%;
    margin-top: 10px;
    bottom: auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
  }

  .hgc-lightbox__caption {
    max-width: 95%;
    text-align: center;
    pointer-events: none;
  }
}
