.photo-gallery {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid #dce6d9;
}

.photo-gallery-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #245d49;
  font-size: 12px;
  line-height: 1.5;
}

.photo-gallery-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-heading span {
  flex: 0 0 auto;
  color: #607068;
  font-size: 11px;
}

.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.photo-gallery-tile {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #203b33;
  text-align: left;
  overflow: hidden;
}

.photo-gallery-tile:hover,
.photo-gallery-tile:focus-visible {
  background: #e8f0e9;
}

.photo-gallery-tile:disabled {
  cursor: default;
  opacity: 1;
}

.photo-gallery-thumb {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dce2d8;
  border-radius: 8px;
  background: #edf2e9;
  color: #607068;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.photo-gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-gallery-caption {
  display: -webkit-box;
  min-height: 1.4em;
  overflow: hidden;
  color: #607068;
  font-size: 11px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.photo-gallery-dialog {
  width: min(900px, calc(100vw - 28px));
  max-width: min(900px, calc(100vw - 28px));
  margin: auto;
  padding: 18px;
  border: 1px solid #dce2d8;
  border-radius: 18px;
  background: #fffefa;
  color: #203b33;
  box-shadow: 0 20px 80px #142e3850;
}

.photo-gallery-dialog::backdrop {
  background: rgba(14, 33, 27, .62);
}

.photo-gallery-modal-open {
  overflow: hidden;
}

.photo-gallery-dialog-inner {
  min-width: 0;
}

.photo-gallery-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.photo-gallery-dialog-head h2 {
  font-size: 20px;
  line-height: 1.4;
}

.photo-gallery-dialog-close {
  flex: 0 0 auto;
  min-width: 38px;
  padding: 5px 10px;
  font-size: 22px;
  line-height: 1.2;
}

.photo-gallery-viewer-stage {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
}

.photo-gallery-nav {
  min-width: 38px;
  min-height: 40px;
  padding: 3px 8px;
  border-radius: 10px;
  color: #245d49;
  font-size: 27px;
  line-height: 1;
}

.photo-gallery-viewer-figure {
  min-width: 0;
  margin: 0;
}

.photo-gallery-viewer-image-wrap {
  display: grid;
  min-height: 160px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #edf2e9;
}

.photo-gallery-viewer-image {
  display: block;
  width: 100%;
  max-height: min(70dvh, 720px);
  object-fit: contain;
}

.photo-gallery-viewer-error {
  padding: 36px 18px;
  color: #607068;
  font-size: 14px;
  text-align: center;
}

.photo-gallery-viewer-figure figcaption {
  padding-top: 10px;
}

.photo-gallery-viewer-caption {
  color: #203b33;
  font-size: 14px;
  line-height: 1.65;
}

.photo-gallery-viewer-meta {
  margin-top: 3px;
  color: #607068;
  font-size: 12px;
  line-height: 1.6;
}

.photo-gallery-viewer-source {
  display: inline-block;
  margin-top: 5px;
  color: #245d49;
  font-size: 12px;
}

.photo-gallery-viewer-count {
  margin-top: 10px;
  color: #607068;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 560px) {
  .photo-gallery {
    margin-top: 11px;
    padding-top: 8px;
  }

  .photo-gallery-grid {
    gap: 5px;
  }

  .photo-gallery-caption {
    font-size: 10px;
  }

  .photo-gallery-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    padding: 13px;
    border-radius: 14px;
  }

  .photo-gallery-viewer-stage {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 5px;
  }

  .photo-gallery-nav {
    min-width: 32px;
    min-height: 36px;
    padding: 2px 5px;
  }

  .photo-gallery-viewer-image-wrap {
    min-height: 120px;
  }
}
