.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  /* place content starting below the site header */
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
}

.lightbox-content {
  max-width: 80vw;
  max-height: 80vh;
  margin: auto;
  display: block;
}

.lightbox-content#lightbox-video {
  z-index: 1000;
  position: relative;
}

.lightbox-caption {
  color: #fff;
  text-align: center;
  margin-top: 16px;
  font-size: 1.05rem;
  font-family: "Lora", serif;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  max-width: 80vw;
}

.lightbox-modal .close {
  /* use fixed positioning so the close button stays above any sticky header */
  position: fixed;
  top: 18px;
  right: 18px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 200000; /* very high to ensure visibility above headers/iframes */
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  padding: 6px 12px;
  line-height: 1;
}

/* Hide the modal's internal close button visually — we use the global close button
   to avoid stacking/context issues. Keep the element in DOM for JS handlers. */
.lightbox-modal .close { display: none !important; }

/* Global close button appended to <body> to avoid stacking/context issues
   This sits above everything and is not nested inside the modal. */
.global-lightbox-close {
  position: fixed;
  /* default to sit below header; JS will update --site-header-height at open */
  top: calc(var(--site-header-height, 56px) + 8px);
  right: 14px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 999999 !important;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  padding: 6px 12px;
  line-height: 1;
  display: none;
}
.global-lightbox-close.show {
  display: block;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center; /* Center thumbnails horizontally */
  align-items: flex-start;
}

.gallery a {
  display: inline-block;
  margin: 10px;
}

.gallery figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px; /* Match your thumbnail width */
  margin: 0;
  word-break: break-word;
}

.gallery img {
  width: 150px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}

.gallery img:hover,
.video-thumbnails img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 1.5px 6px rgba(0,0,0,0.12);
  transition: transform 0.18s cubic-bezier(.4,2,.6,1), box-shadow 0.18s cubic-bezier(.4,2,.6,1);
  z-index: 2;
}

.gallery figcaption {
  margin-top: 8px;
  font-size: 0.98rem;
  color: #234e2e;
  font-family: "Lora", serif;
  text-align: center;
  word-break: break-word;
  width: 100%;
  max-width: 100%;
  line-height: 1.2;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  user-select: none;
  z-index: 10001; /* Higher than modal and video */
  padding: 0 18px;
  opacity: 0.8;
}
.left-arrow {
  left: 10px;
}
.right-arrow {
  right: 10px;
}
.lightbox-arrow:hover {
  opacity: 1;
}

.video-gallery {
  margin-top: 40px;
  text-align: center;
}

.video-thumbnails {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.video-thumbnails figure {
  display: inline-block;
  margin: 10px;
  text-align: center;
}

.video-thumbnails video {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  width: 320px;
  height: 180px;
  background: #000;
}

.video-thumbnails img {
  width: 150px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.video-thumbnails figcaption {
  margin-top: 8px;
  font-size: 0.98rem;
  color: #234e2e;
  font-family: "Lora", serif;
}

.photo-gallery h2,
.video-gallery h2 {
  text-align: center;
}

/* Add this after the <video> tag in your lightbox modal */
#lightbox-video-close {
  display: none;
}

.lightbox-video-close {
  margin: 20px auto 0 auto;
  display: block;
  background: #234e2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 1001;
}
.lightbox-video-close:hover {
  background: #16321f;
}

.photo-gallery:not(:first-of-type) {
  margin-top: 40px;
}

.photo-gallery p,
.video-gallery p {
  text-align: center;
}