/* ===========================================================
   Gallery: tabs, responsive grid, lightbox, video card
   Link this next to styles.css:
   <link rel="stylesheet" href="gallery.css">
   =========================================================== */

.gallery-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 36px;
}

.gallery-tab-btn {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.gallery-tab-btn.active,
.gallery-tab-btn:hover {
  background: #c9a24b; /* falls back gracefully if the site doesn't define this accent elsewhere */
  border-color: #c9a24b;
  color: #111;
}

.gallery-status {
  text-align: center;
  opacity: 0.7;
  padding: 24px 0;
  font-size: 14px;
}

/* Tabs + the "N Category Name" count badge sit on the same row, so it's
   obvious there's more to browse than the 3 images currently visible */
.gallery-tabs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.gallery-tabs-row .gallery-tabs {
  margin: 0;
}

.gallery-count-badge {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9a24b;
  opacity: 0.85;
  white-space: nowrap;
}

.gallery-status {
  margin-top: 12px;
}

/* ===== Carousel: shows a fixed number of items per "page"; arrows scroll ===== */
.carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.carousel-viewport {
  flex: 1;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  /* hide scrollbar cross-browser; arrows are the intended way to navigate */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Soft fade at both edges of the viewport, hinting there are more images
   just out of view - sits on the wrapper (not the scrolling element itself)
   so it stays fixed in place while the track underneath scrolls */
.carousel-wrapper::before,
.carousel-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  z-index: 3;
  pointer-events: none;
}

.carousel-wrapper {
  position: relative;
}

.carousel-wrapper::before {
  left: 58px; /* clears the arrow button */
  background: linear-gradient(90deg, #08080a, transparent);
}

.carousel-wrapper::after {
  right: 58px;
  background: linear-gradient(270deg, #08080a, transparent);
}

@media (max-width: 640px) {
  .carousel-wrapper::before,
  .carousel-wrapper::after {
    width: 28px;
  }
  .carousel-wrapper::before {
    left: 44px;
  }
  .carousel-wrapper::after {
    right: 44px;
  }
}

.carousel-viewport::-webkit-scrollbar {
  display: none;
}

.gallery-dyn-grid {
  /* this is the scrolling track inside .carousel-viewport */
  display: flex;
  gap: 16px;
}

.carousel-arrow {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.carousel-arrow:hover {
  background: #c9a24b;
  color: #111;
  border-color: #c9a24b;
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border-color: rgba(255, 255, 255, 0.25);
}

.gallery-dyn-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  scroll-snap-align: start;

  /* exactly 3 visible per "page" on desktop: each item is 1/3 of the
     viewport width minus its share of the two 16px gaps between items */
  flex: 0 0 calc((100% - 32px) / 3);
  aspect-ratio: 4 / 3;
}

.gallery-dyn-item img,
.gallery-dyn-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.gallery-dyn-item:hover img,
.gallery-dyn-item:hover video {
  transform: scale(1.06);
}

/* Caption naming each photo (e.g. "Elevated Pavilion") - sits at the
   bottom of the tile on a gradient so it's readable over any image, and
   fades in on hover/keyboard focus rather than being visible all the time */
.gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 14px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 2;
}

.gallery-dyn-item:hover .gallery-caption,
.gallery-dyn-item:focus-visible .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

/* On touch devices hover doesn't really exist, so keep captions visible
   at all times there instead of hidden behind a hover that won't fire */
@media (hover: none) {
  .gallery-caption {
    opacity: 1;
    transform: none;
    padding-top: 20px;
  }
}

/* Video card play affordance */
.gallery-dyn-item.is-video::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

.gallery-dyn-item.is-video .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.gallery-dyn-item.is-video .play-icon svg {
  width: 20px;
  height: 20px;
  fill: #111;
  margin-left: 3px;
}

/* ===== Lightbox ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 8px;
  display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
  top: 20px;
  right: 20px;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  opacity: 0.75;
  letter-spacing: 0.05em;
}

.lightbox-caption {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 6px;
}

/* Fewer items per page on smaller screens - 3-up doesn't fit a phone */
@media (max-width: 900px) {
  .gallery-dyn-item {
    flex: 0 0 calc((100% - 16px) / 2); /* 2 per page on tablets */
  }
}

@media (max-width: 640px) {
  .carousel-wrapper {
    gap: 8px;
  }
  .carousel-arrow {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  .gallery-dyn-grid {
    gap: 0;
  }
  .gallery-dyn-item {
    flex: 0 0 100%; /* one image fills the screen at a time, no cut-off peek */
  }
  .lightbox-prev,
  .lightbox-next {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}
