/* Portfolio (issue #11): modern lightbox close control and hover/swipe arrows. */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: #ffffff;
  background: transparent;
}

.lightbox::backdrop {
  background: rgba(5, 10, 48, .8);
}

.lightbox button {
  font: inherit;
  color: #050a30;
  background: #ffffff;
  cursor: pointer;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #050a30;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.lightbox-close svg,
.lightbox-prev svg,
.lightbox-next svg {
  width: 22px;
  height: 22px;
  display: block;
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: calc(100dvh - 150px);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid #050a30;
  border-radius: 50%;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .2s ease;
}

.lightbox-prev {
  left: 12px;
}

.lightbox-next {
  right: 12px;
}

@media (hover: hover) and (pointer: fine) {
  .lightbox-stage:hover .lightbox-prev,
  .lightbox-stage:hover .lightbox-next,
  .lightbox-prev:focus-visible,
  .lightbox-next:focus-visible {
    opacity: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .lightbox-prev,
  .lightbox-next {
    opacity: 0;
    pointer-events: none;
  }

  .lightbox-prev:focus-visible,
  .lightbox-next:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.lightbox figure {
  box-sizing: border-box;
  height: 100%;
  margin: 0;
  padding: 72px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  background: #ffffff;
}

.lightbox figcaption {
  color: #ffffff;
  text-align: center;
  font-size: 15px;
  padding-top: 14px;
}

@media (max-width: 700px) {
  .lightbox {
    padding: 0;
  }

  .lightbox button {
    font-size: inherit;
    padding: 0;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }

  .lightbox figure {
    padding: 64px 16px 20px;
  }

  .lightbox-image {
    max-height: calc(100dvh - 130px);
    height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-prev,
  .lightbox-next {
    transition: none;
  }
}
