.lightbox {
  background: transparent;
  block-size: 100dvh;
  border: 0;
  inline-size: 100dvw;
  inset: 0;
  margin: auto;
  max-height: unset;
  max-width: unset;
  overflow: hidden;
  padding: clamp(0.75rem, 2vh, 1.5rem) clamp(0.75rem, 2vw, 1.5rem);

  &::backdrop {
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    background: rgb(0 0 0 / 0.94);
    opacity: 0;
    transition:
      display 180ms allow-discrete,
      opacity 180ms,
      overlay 180ms allow-discrete;
  }

  &[open] {
    display: grid;
    opacity: 1;
    place-items: center;

    &::backdrop {
      opacity: 1;
    }
  }

  @starting-style {
    &[open] {
      opacity: 0;
    }

    &[open]::backdrop {
      opacity: 0;
    }
  }
}

.lightbox__btn {
  align-items: center;
  align-self: start;
  background: rgb(0 0 0 / 0.45);
  border: 0;
  border-radius: 999px;
  color: rgb(156 163 175);
  cursor: pointer;
  display: inline-flex;
  grid-area: 1 / 1;
  justify-content: center;
  justify-self: end;
  line-height: 0;
  padding: 0.55rem;
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.5rem);
  top: clamp(0.75rem, 2vh, 1.5rem);
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.lightbox__btn:hover {
  background: rgb(0 0 0 / 0.6);
  color: rgb(255 255 255);
}

.lightbox__btn:focus-visible {
  outline: 2px solid rgb(255 255 255);
  outline-offset: 2px;
}

.lightbox__btn:active {
  transform: scale(0.97);
}

.lightbox__btn svg {
  block-size: 1.1rem;
  inline-size: 1.1rem;
}

.lightbox__image {
  grid-area: 1 / 1;
  max-block-size: min(92dvh, 1100px);
  max-inline-size: min(92dvw, 1800px);
  object-fit: contain;
}

html.lightbox-open,
body.lightbox-open {
  overflow: hidden;
}
