import PhotoSwipeLightbox from 'photoswipe/lightbox';
import 'photoswipe/style.css';

document.addEventListener('DOMContentLoaded', () => {
  const galleries = document.querySelectorAll('.gallery');
  if (!galleries.length) return;

  galleries.forEach((gallery) => {
    const lightbox = new PhotoSwipeLightbox({
      gallery: gallery,
      children: 'a[data-pswp-src]',
      pswpModule: () => import('photoswipe')
    });
    lightbox.init();
  });
});

/* Captions under images in posts */
.story-image figcaption {
  font-size: 0.65rem;
  line-height: 1.25;
  color: #666;
  text-align: center;
  margin-top: 0.4rem;
  font-style: italic;
}

