/* Shared accessible image lightbox. */
body.lightbox-is-open {
  overflow: hidden;
}

.project-lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: 24px;
  overflow: hidden;
  color: var(--card);
  background: rgb(23 24 26 / 96%);
  border: 0;
}

.project-lightbox[open] {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 24px;
}

.project-lightbox::backdrop {
  background: rgb(23 24 26 / 96%);
}

.project-lightbox-figure {
  display: grid;
  min-width: 0;
  height: calc(100svh - 48px);
  margin: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  place-items: center;
}

.project-lightbox-figure img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.project-lightbox-figure figcaption {
  min-height: 24px;
  color: var(--card);
  font-size: 14px;
  line-height: 24px;
}

.project-lightbox-nav,
.project-lightbox-close {
  display: grid;
  width: 56px;
  height: 56px;
  padding: 16px;
  color: var(--ink);
  background: var(--card);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  place-items: center;
  transition:
    color 180ms var(--ease-out),
    background-color 180ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.project-lightbox-close {
  position: fixed;
  z-index: 2;
  top: 24px;
  right: 24px;
}

@media (hover: hover) and (pointer: fine) {
  .project-lightbox-nav:hover,
  .project-lightbox-close:hover {
    color: var(--card);
    background: var(--red);
  }
}

.project-lightbox-nav:active,
.project-lightbox-close:active {
  transform: scale(0.96);
}

.project-lightbox-nav:focus-visible,
.project-lightbox-close:focus-visible {
  outline: 3px solid var(--focus-on-media);
  outline-offset: 3px;
}

.project-lightbox-close span {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.project-lightbox-close span::before,
.project-lightbox-close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 2px;
  background: currentcolor;
}

.project-lightbox-close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.project-lightbox-close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.project-lightbox-nav svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 620px) {
  .project-lightbox {
    padding: 16px;
  }

  .project-lightbox[open] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) 48px;
    gap: 16px;
  }

  .project-lightbox-figure {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: 100%;
  }

  .project-lightbox-nav {
    width: 48px;
    height: 48px;
    padding: 13px;
  }

  .project-lightbox-prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .project-lightbox-next {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .project-lightbox-close {
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-lightbox-nav,
  .project-lightbox-close {
    transition-duration: 1ms;
  }
}
