.PhotoListing .grid {
  --gaps: 0.25rem;

  .row {
    display: flex;
    gap: var(--gaps);
    margin-bottom: var(--gaps);
  }
  .row:last-child {
    margin-bottom: 0;
  }

  .item {
    position: relative;
    overflow: hidden;

    img {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      height: 100%;
      width: auto;
      display: block;
    }
  }
}

.lightbox {
  --text-color: light-dark(black, white);

  font-family: monospace;

  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: light-dark(white, black);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0s linear 0.3s;
  z-index: 1000;

  a {
    color: var(--text-color);
    &:hover {
      background: none !important;
      color: firebrick;
    }
  }

  &.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* cancel visibility hide delay when showing */
    transition-delay: 0s, 0s;
  }

  .lightbox-content {
    position: relative;
    /* fit within viewport with space for controls */
    max-width: 100vw;
    max-height: 100vh;
    margin: auto;
  }

  .lightbox-header,
  .lightbox-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    line-height: 1.2;
    margin: 0.5rem 0;
    color: var(--text-color);
  }

  .lightbox-metadata {
    display: flex;
    flex-direction: column;
  }

  .lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 12rem);
    object-fit: contain;
  }
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next {
    position: absolute;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
  }
  .lightbox-close {
    top: 0;
    right: 0;
  }
  .lightbox-prev,
  .lightbox-next {
    top: 50%;
    transform: translateY(-50%) scale(200%);
    padding: 8rem 4rem;
    --extra-space-x: 8rem;
  }
  .lightbox-prev {
    left: 10px;
    padding-right: var(--extra-space-x);
  }
  .lightbox-next {
    right: 10px;
    padding-left: var(--extra-space-x);
  }
  .lightbox-download {
    font-size: 1.2em;
  }
}
