/* Lightbox for content images (assets/js/lightbox.js) */

.lightbox-trigger {
  cursor: zoom-in;
}

.lightbox-trigger:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

/* form.css gives every dialog a top margin for the demo modal. The lightbox
   covers the whole viewport instead, and centers the image in it. The top
   padding keeps the image clear of the close button. */
dialog.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4rem 1rem 1rem;
  box-sizing: border-box;
  background: transparent;
  border: none;
  cursor: zoom-out;
}

dialog.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.lightbox::backdrop {
  background-color: rgba(8, 8, 20, 0.9);
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background-color: #fff;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
}

.lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.lightbox-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.lightbox[open] .lightbox-image {
    animation: lightbox-in 200ms ease-out;
  }

  @keyframes lightbox-in {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  }
}
