/* Keep every gallery preview whole; the full-size viewer opens when a photograph is selected. */
.photo-trigger {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.gallery .photo-card {
  background: #dce5d7;
}

.gallery .photo-card img {
  object-fit: contain;
  background: #dce5d7;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.gallery .photo-card:hover img {
  transform: none;
}

.photo-trigger,
.about-portrait-image,
.photo-viewer figure {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.photo-viewer {
  /* Keep the enlarged photo in the phone's visible screen, not at its page position. */
  position: fixed;
  inset: 0;
  width: min(1100px, calc(100vw - 32px));
  max-width: 1100px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  height: fit-content;
  padding: 0;
  border: 0;
  background: #14221c;
  color: #f4f0e8;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
  overflow: hidden;
  overscroll-behavior: contain;
}

.photo-viewer::backdrop {
  background: rgba(8, 15, 11, .84);
}

.photo-viewer figure {
  display: grid;
  place-items: center;
  margin: 0;
}

.photo-viewer img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 145px);
  object-fit: contain;
}

.photo-viewer figcaption {
  width: 100%;
  padding: 14px 55px 16px 20px;
}

.photo-viewer-caption-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.photo-viewer figcaption p {
  margin: 0;
  color: #dce8be;
  font: 500 10px 'DM Mono', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.photo-viewer figcaption h2 {
  margin: 5px 0 0;
  color: #f4f0e8;
  font: 600 clamp(22px, 3vw, 34px) / 1.05 'Playfair Display', Georgia, serif;
  letter-spacing: -.03em;
}

.photo-viewer-close {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 12px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(244, 240, 232, .55);
  border-radius: 50%;
  background: rgba(20, 34, 28, .72);
  color: #fff;
  font: 400 29px / 1 system-ui, sans-serif;
  cursor: pointer;
}

.photo-viewer-previous,
.photo-viewer-next {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(244, 240, 232, .55);
  border-radius: 50%;
  background: rgba(20, 34, 28, .72);
  color: #fff;
  font: 400 28px / 1 system-ui, sans-serif;
  cursor: pointer;
  transform: translateY(-50%);
}

.photo-viewer-previous {
  left: 12px;
}

.photo-viewer-next {
  right: 12px;
}

.photo-viewer-previous:hover,
.photo-viewer-previous:focus-visible,
.photo-viewer-next:hover,
.photo-viewer-next:focus-visible {
  background: #dce8be;
  color: #14221c;
}

.photo-viewer-previous:disabled,
.photo-viewer-next:disabled {
  cursor: not-allowed;
  opacity: .28;
}

.photo-viewer-close:hover,
.photo-viewer-close:focus-visible {
  background: #dce8be;
  color: #14221c;
}

@media (max-width: 780px) {
  .photo-viewer {
    inset: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .photo-viewer img {
    max-height: calc(100dvh - 132px);
  }

  .photo-viewer-previous,
  .photo-viewer-next {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }
}
