body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--graphite-deep) 92%, black);
  padding: max(env(safe-area-inset-top, 0px), var(--space-6)) max(env(safe-area-inset-right, 0px), var(--space-6)) max(env(safe-area-inset-bottom, 0px), var(--space-6)) max(env(safe-area-inset-left, 0px), var(--space-6));
}

.lightbox__img {
  position: relative;
  z-index: var(--z-lightbox-panel);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lightbox);
  background: var(--paper-deep);
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-standard);
}

.lightbox__img.is-transitioning {
  opacity: 0;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: fixed;
  z-index: var(--z-lightbox-panel);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  color: var(--ink-strong);
}

.lightbox__close svg,
.lightbox__prev svg,
.lightbox__next svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__close {
  top: max(env(safe-area-inset-top, 0px), var(--space-5));
  right: max(env(safe-area-inset-right, 0px), var(--space-5));
}

.lightbox__prev {
  left: max(env(safe-area-inset-left, 0px), var(--space-5));
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__next {
  right: max(env(safe-area-inset-right, 0px), var(--space-5));
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
  outline: 2px solid var(--amber-ink);
  outline-offset: 3px;
}

.lightbox__zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  cursor: pointer;
}

.lightbox__zone--prev {
  left: 0;
}

.lightbox__zone--next {
  right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__img {
    transition: none;
  }
}
