.lightbox {
  border-radius: 14px;
  box-shadow: 0 28px 100px rgba(0, 0, 0, .55);
}

.lightbox[open] {
  animation: lightbox-enter .28s cubic-bezier(.22, 1, .36, 1);
}

.lightbox[open]::backdrop {
  animation: lightbox-backdrop .25s ease-out;
}

#lightbox-counter {
  font-variant-numeric: tabular-nums;
}

.lightbox-stage {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  height: min(68svh, 720px, calc(90svh - 150px));
  padding: 20px;
}

.lightbox-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.lightbox-media #lightbox-image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.lightbox-stage .photo-nav {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: rgba(22, 33, 43, .9);
  border-color: #3c4d5e;
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}

.photo-nav .icon {
  display: block;
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.lightbox-stage .photo-nav:hover {
  color: var(--orange-light);
  background: #2b2928;
  border-color: var(--orange);
  transform: scale(1.06);
}

.lightbox-stage .photo-nav:active {
  transform: scale(.96);
}

.lightbox-stage .photo-nav:focus-visible {
  outline-offset: 4px;
}

.lightbox-stage .photo-nav:disabled {
  cursor: default;
  opacity: .3;
  transform: none;
}

.lightbox > p {
  min-height: 50px;
  padding: 6px 20px 20px;
}

.lightbox-media[aria-busy="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: var(--orange);
  border-radius: 50%;
  pointer-events: none;
  animation: photo-loading .8s linear infinite;
}

@keyframes lightbox-enter {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lightbox-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes photo-loading {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .lightbox { border-radius: 10px; }
  .lightbox-stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    height: min(65svh, 640px, calc(90svh - 140px));
    padding: 12px 10px;
  }
  .lightbox-stage .photo-nav { width: 44px; height: 44px; }
  .lightbox > p { padding: 6px 15px 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open], .lightbox[open]::backdrop,
  .lightbox-media[aria-busy="true"]::after { animation: none; }
  .lightbox-stage .photo-nav { transition: none; }
  .lightbox-stage .photo-nav:hover, .lightbox-stage .photo-nav:active { transform: none; }
}
