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 */
.article-image figcaption {
  font-size: 0.65rem;     /* smaller text */
  line-height: 1.4;
  color: var(--color-neutral-600, #666);
  text-align: center;     /* keep it centered */
  margin-top: 0.4rem;     /* small space above caption */
  font-style: italic;     /* optional */
}

