/* Photos opened over the page. Navigating to the image file itself leaves no way back in the installed app, which has
   no browser chrome at all. */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 7500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.9);
}

.photo-viewer[hidden] {
  display: none !important;
}

.photo-viewer-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.photo-viewer-frame img {
  max-width: 100%;
  /* Room for the caption and the close button on a phone. */
  max-height: calc(100dvh - 90px);
  width: auto;
  height: auto;
  border: 1px solid var(--c-grey-333);
  border-radius: 4px;
}

.photo-viewer-caption {
  margin: 0;
  color: var(--c-grey-aaa);
  font-size: 0.75rem;
  text-align: center;
}

.photo-viewer-caption:empty {
  display: none;
}

.photo-viewer-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--c-grey-444);
  border-radius: 50%;
  background: var(--c-grey-111);
  color: var(--c-white);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

/* The page behind doesn't scroll while a photo is open. */
body.photo-viewer-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .photo-viewer {
    padding: 10px;
  }

  .photo-viewer-close {
    top: 0;
    right: 0;
  }
}
