.photo-popup .leaflet-popup-content {
  margin: 12px;
}

.photo-details {
  display: grid;
  gap: 0.5rem;
  width: min(256px, calc(100vw - 6rem));
  max-width: 100%;
  overflow-wrap: anywhere;
}

.photo-preview-link {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: zoom-in;
}

.photo-preview-link:focus-visible {
  outline: 3px solid #2276c9;
  outline-offset: 3px;
}

.photo-preview {
  display: block;
  width: 100%;
  height: min(192px, 35dvh);
  object-fit: contain;
  background: #eee;
}

.photo-popup .photo-preview-error {
  margin: 0;
  color: #a00;
}

.photo-share {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.photo-share-manual {
  min-width: 0;
}

.photo-share-button,
.photo-share-manual a {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem;
  border: 1px solid #777;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font: inherit;
}

.photo-share-button {
  cursor: pointer;
}

.photo-share-manual a {
  display: block;
  margin-top: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.photo-share-button:focus-visible,
.photo-share-manual a:focus-visible {
  outline: 3px solid #2276c9;
  outline-offset: 2px;
}

.photo-popup .photo-share-status {
  margin: 0;
}

.photo-viewer {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  overflow: hidden;
  background: #050505;
  color: #fff;
}

.photo-viewer[open] {
  display: grid;
  place-items: center;
}

.photo-viewer::backdrop {
  background: #050505;
}

.photo-fullsize {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.photo-fullsize[hidden] {
  display: none;
}

.photo-viewer-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgb(0 0 0 / 75%);
  color: #fff;
  font: 2rem / 1 system-ui, sans-serif;
  cursor: pointer;
}

.photo-viewer-status {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 4rem);
  margin: 0;
  padding: 0.75rem;
  background: rgb(0 0 0 / 75%);
  text-align: center;
}
