/* ------------------------------------------------------------------ lightbox

   The full-size viewer. One component, used wherever something has to be seen
   properly rather than listed: the public gallery and the files delivered on a
   task. An image is shown at its own size, a clip is played, and a document says
   what it is and offers the door that opens it, because the browser's own viewer
   is the right surface for a PDF and this page is not allowed to frame it.
*/

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(14, 17, 26, 0.9);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__figure {
  margin: 0;
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  max-inline-size: min(92vw, 1100px);
}

.lightbox__img,
.lightbox__media {
  max-inline-size: 100%;
  max-block-size: calc(100vh - 9rem);
  object-fit: contain;
  border-radius: var(--radius-card);
  background: #000;
}

.lightbox__caption {
  color: #f5efe2;
  text-align: center;
  font-size: var(--text-lg);
}

.lightbox__title {
  display: block;
  overflow-wrap: anywhere;
}

.lightbox__counter {
  display: block;
  color: #b9c1d4;
  font-size: var(--text-sm);
}

/* A document cannot be painted here, so the plate says what the file is and the
   line under it is the way to read it. */
.lightbox__doc {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 1.6rem 2rem;
  border: 1px solid rgba(247, 242, 230, 0.35);
  border-radius: var(--radius-card);
  background: rgba(28, 23, 18, 0.55);
  text-align: center;
}

.lightbox__ext {
  display: grid;
  place-items: center;
  inline-size: 5.5rem;
  block-size: 5.5rem;
  border: 2px solid rgba(247, 242, 230, 0.55);
  border-radius: 1rem;
  color: #f7f2e6;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lightbox__name {
  color: #f7f2e6;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  margin: 0;
  max-inline-size: 34rem;
}

.lightbox__open {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  border: 1px solid rgba(247, 242, 230, 0.55);
  border-radius: var(--radius-button);
  color: #f7f2e6;
  font-size: var(--text-sm);
  text-decoration: none;
}

.lightbox__open:hover {
  background: rgba(247, 242, 230, 0.14);
  text-decoration: underline;
}

.lightbox__btn {
  position: absolute;
  border: 1px solid rgba(247, 242, 230, 0.35);
  background: rgba(28, 23, 18, 0.55);
  color: #f7f2e6;
  cursor: pointer;
  font: inherit;
  border-radius: 50%;
  display: grid;
  place-items: center;
  inline-size: 2.8rem;
  block-size: 2.8rem;
}

.lightbox__btn:hover {
  background: rgba(28, 23, 18, 0.85);
}

.lightbox__btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.lightbox__close {
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox__prev,
.lightbox__next {
  inset-block-start: 50%;
  transform: translateY(-50%);
}

.lightbox__prev {
  inset-inline-start: 1rem;
}

.lightbox__next {
  inset-inline-end: 1rem;
}

.lightbox__prev span,
.lightbox__next span {
  inline-size: 0.55rem;
  block-size: 0.55rem;
  border-block-start: 2px solid currentColor;
  border-inline-end: 2px solid currentColor;
}

.lightbox__prev span {
  transform: rotate(225deg);
}

.lightbox__next span {
  transform: rotate(45deg);
}

@media (max-width: 40rem) {
  /* One hand is on the phone, so the arrows move under the picture and leave the
     corners to the close button. */
  .lightbox__prev,
  .lightbox__next {
    inset-block-start: auto;
    inset-block-end: 1rem;
    transform: none;
  }
}
