/* ===== Gallery carousels =====
   Turns each native WordPress Gallery block (.wp-block-gallery) inside
   .gallery-content into a horizontal, swipeable carousel that matches the
   Golden Solstice theme. Editors just add/upload images to Gallery blocks
   in the WordPress editor — no per-image markup needed here. */

.gallery-content { margin: 0 auto; }

/* Headings between carousels (wp:heading blocks) */
.gallery-content h2,
.gallery-content .wp-block-heading {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--parchment);
  text-align: center;
  margin: 2.5rem 0 1.4rem;
}
.gallery-content > p {
  text-align: center;
  color: rgba(168, 197, 160, 0.75);
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.8;
}

/* Carousel wrapper added by gallery.js */
.itw-carousel {
  position: relative;
  margin: 0 0 3rem;
}

/* The Gallery block becomes the scroll track */
.itw-carousel .wp-block-gallery {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 0.5rem 0 1.2rem;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-light) transparent;
}
.itw-carousel .wp-block-gallery::-webkit-scrollbar { height: 6px; }
.itw-carousel .wp-block-gallery::-webkit-scrollbar-thumb {
  background: var(--gold-light);
  border-radius: 3px;
}

/* Each item (supports current figure-based and legacy li-based markup).
   !important + flex-basis override the WordPress Gallery block's column
   flex rules, which otherwise shrink each slide to ~1/N of the row. */
.itw-carousel .wp-block-gallery .wp-block-image,
.itw-carousel .wp-block-gallery > li,
.itw-carousel .wp-block-gallery.has-nested-images figure.wp-block-image {
  flex: 0 0 auto !important;
  width: min(80vw, 480px) !important;
  flex-basis: min(80vw, 480px) !important;
  max-width: none !important;
  scroll-snap-align: center;
  margin: 0;
}
.itw-carousel .wp-block-gallery img {
  width: 100%;
  height: clamp(280px, 56vh, 520px);
  object-fit: cover;
  display: block;
  border-radius: 4px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.itw-carousel .wp-block-gallery figcaption {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-light);
  text-align: center;
  margin-top: 0.6rem;
}

/* Prev / next controls */
.itw-carousel__nav {
  position: absolute;
  top: calc(50% - 0.6rem);
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--gold-light);
  background: rgba(20, 24, 16, 0.7);
  color: var(--parchment);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, transform 0.25s;
  backdrop-filter: blur(3px);
}
.itw-carousel__nav:hover { background: var(--gold-light); color: #1a1d12; }
.itw-carousel__nav--prev { left: -8px; }
.itw-carousel__nav--next { right: -8px; }

@media (max-width: 640px) {
  .itw-carousel__nav { width: 38px; height: 38px; font-size: 1.3rem; }
  .itw-carousel__nav--prev { left: 2px; }
  .itw-carousel__nav--next { right: 2px; }
}

/* Empty-state hint shown when a Gallery block has no images yet */
.itw-carousel--empty::after {
  content: "Add images to this Gallery block in the WordPress editor.";
  display: block;
  text-align: center;
  color: rgba(168, 197, 160, 0.6);
  font-style: italic;
  padding: 2rem 0;
}
