/* Progressive enhancement: all figures remain readable when JavaScript is off. */
.project-gallery {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}
.project-gallery .gallery-slides { min-width: 0; touch-action: pan-y pinch-zoom; }
.project-gallery .gallery-slide { min-width: 0; margin: 0; }
.project-gallery .gallery-slide + .gallery-slide { margin-top: 1rem; }
.project-gallery[data-gallery-ready] .gallery-slide { margin-top: 0; }
.project-gallery .gallery-slide[hidden],
.project-gallery .gallery-controls[hidden] { display: none !important; }
.project-gallery .gallery-slide > .original-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 2 / 1;
  max-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line, #cfd4cc);
  border-radius: 4px;
  background: #fff;
  text-decoration: none;
  cursor: zoom-in;
}
.project-gallery .gallery-slide > .original-media > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.project-gallery .gallery-slide figcaption {
  min-height: 2.9em;
  margin: .4rem 0 0;
  color: var(--muted, #58615c);
  font-size: .82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.project-gallery .gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-width: 0;
  margin-top: .55rem;
}
.project-gallery .gallery-controls button {
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line, #cfd4cc);
  border-radius: 4px;
  background: var(--panel, #fffdf8);
  color: var(--ink, #242b29);
  font: 1.5rem/1 sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.project-gallery .gallery-controls button:hover {
  border-color: var(--accent, #155b55);
  background: var(--accent-soft, #dceae4);
}
.project-gallery .gallery-controls button:focus-visible,
.project-gallery .original-media:focus-visible {
  outline: 3px solid var(--accent, #155b55);
  outline-offset: 3px;
}
.project-gallery .gallery-count {
  min-width: 3.5em;
  color: var(--muted, #58615c);
  font-size: .82rem;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.catalog-item-grid > .project-gallery { max-width: 320px; }
@media (max-width: 700px) {
  .catalog-item-grid > .project-gallery { max-width: 480px; }
}
@media print {
  .project-gallery .gallery-controls { display: none !important; }
  .project-gallery .gallery-slide,
  .project-gallery .gallery-slide[hidden] {
    display: block !important;
    break-inside: avoid-page;
  }
  .project-gallery .gallery-slide + .gallery-slide { margin-top: 8pt; }
  .project-gallery .gallery-slide > .original-media { max-height: none; }
  .project-gallery .gallery-slide figcaption { min-height: 0; }
}
