.photo-gallery {
  padding-block: clamp(18px, 3vw, 40px) clamp(44px, 7vw, 100px);
}
.photo-gallery-intro {
  max-width: 46rem;
  padding-block: clamp(30px, 6vw, 80px) clamp(25px, 4vw, 55px);
}
.photo-gallery-intro h1 {
  font-size: clamp(2.6rem, 6vw, 5.7rem);
  text-wrap: balance;
}
.photo-gallery-intro p {
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.24rem);
}
.photo-gallery-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(15px, 2vw, 25px);
}
.photo-gallery-filter { width: min(100%, 22rem); }
.photo-gallery-filter label {
  display: block;
  margin-bottom: 5px;
  font-weight: 650;
}
.photo-gallery-filter select { width: 100%; }
.photo-gallery-count { color: var(--muted); }
.photo-gallery-count strong { margin-inline-start: .2em; color: var(--deep); }
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 25px);
}
.photo-card {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}
.photo-card-media {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--sage);
  cursor: zoom-in;
}
.photo-card-media:focus-visible { outline-offset: -4px; }
.photo-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: var(--photo-fit, cover);
  object-position: var(--photo-position, center 45%);
}
.photo-card figcaption {
  display: grid;
  gap: 2px;
  padding: clamp(11px, 1.6vw, 20px);
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.photo-card-place { width: fit-content; color: var(--deep); font-weight: 700; }
.photo-card-place:hover { text-decoration: underline; text-underline-offset: .2em; }
.photo-gallery-more { display: grid; justify-items: center; margin-top: 26px; }
.photo-gallery-more:has([hidden]) { display: none; }
.photo-viewer {
  width: min(94vw, 74rem);
  max-height: 94dvh;
  padding: clamp(10px, 2vw, 22px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
  color: var(--text);
}
.photo-viewer::backdrop { background: #0a190fe8; }
.photo-viewer figure { margin: 0; }
.photo-viewer img {
  width: 100%;
  height: min(68dvh, 52rem);
  object-fit: contain;
  background: var(--deep);
  border-radius: 9px;
}
.photo-viewer figcaption { margin-top: 9px; text-align: center; overflow-wrap: anywhere; }
.photo-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 13px;
}
.photo-viewer-actions button:disabled { display: none; }
@media (max-width: 900px) {
  .photo-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .photo-gallery-grid { grid-template-columns: minmax(0, 1fr); }
  .photo-gallery-controls { align-items: start; flex-direction: column; }
  .photo-gallery-filter { width: 100%; }
  .photo-viewer img { height: min(61dvh, 125vw); }
  .photo-viewer-actions .button { padding-inline: 12px; }
}
