/* ===== Gallery grid =====
   auto-fill + minmax is the key trick: the browser fits as many
   140px-minimum tiles as will comfortably fit the row width, and
   stretches them evenly to fill any leftover space. No breakpoints
   to maintain — it's responsive automatically at every width. */

.tivy-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  max-width: 1100px;
  margin: 20px auto;
}

.tivy-gallery-item {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 2px;
}

.tivy-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.tivy-gallery-item:hover img {
  transform: scale(1.05);
}

.tivy-gallery-item:focus-visible {
  outline: 3px solid #1a2b4c;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tivy-gallery-item img {
    transition: none;
  }
}


/* ===== PhotoSwipe custom caption bar =====
   PhotoSwipe's own viewer chrome (close button, arrows, counter, swipe,
   zoom) all come from photoswipe.css — we only need to style the one
   custom element we added ourselves for captions (PhotoSwipe has no
   built-in caption support).
*/

.pswp__tivy-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  color: #fff;
  font-size: 15px;
  padding: 0 60px; /* keep clear of the close button in the corner */
  z-index: 100000;
  pointer-events: none;
}
