.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483647 !important;
  isolation: isolate;
}

.lightbox-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 0;
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1420px, calc(100vw - 56px));
  margin: 18px auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  box-shadow: none;
  pointer-events: auto;
}

.lightbox-figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: min(1180px, calc(100vw - 120px));
  height: min(82vh, 820px);
  min-height: 420px;
  padding: 0 34px 46px;
  box-sizing: border-box;
  background: #ffffff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

#lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: #ffffff;
  transition: opacity 0.28s ease;
  will-change: opacity;
}

.lightbox-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  text-align: center;
  z-index: 3;
  opacity: 1;
  transition: opacity 0.24s ease;
}

.lightbox-loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid #d1d5db;
  border-top-color: #111827;
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
}

.lightbox.is-loading #lightbox-image {
  opacity: 0;
}

.lightbox:not(.is-loading) .lightbox-loading {
  opacity: 0;
  pointer-events: none;
}

#lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.98);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

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

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 0;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}

.lightbox-prev {
  left: -56px;
}

.lightbox-next {
  right: -56px;
}

.lightbox-actions {
  margin-top: 12px;
  text-align: center;
}

.lightbox-detail-link {
  display: inline-block;
  min-width: 130px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid #ffffff;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
}

.lightbox-detail-link:hover {
  background: #ffffff;
  color: #111111;
}

.lightbox.is-loading .lightbox-actions,
.lightbox.is-loading #lightbox-caption,
.lightbox.is-loading .lightbox-nav {
  opacity: 0;
  pointer-events: none;
}
