/* Gallery Section Styles - Facebook-inspired Design */

/* Gallery Tabs */
.gallery-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.gallery-tab {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #65676b;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border-bottom: 4px solid transparent;
}

.gallery-tab:hover {
  color: #2a5298;
  background-color: #f2f3f5;
  border-radius: 8px 8px 0 0;
}

.gallery-tab.active {
  color: #2a5298;
  border-bottom: 4px solid #2a5298;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Gallery Items - Square Images */
.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1; /* Perfect square */
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #f5f5f5;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Overlay with magnifying glass icon */
.gallery-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-overlay i {
  color: white;
  font-size: 2rem;
}

/* Hidden items (filtered out) */
.gallery-item.hidden {
  display: none;
}

/* Gallery Count */
.gallery-count {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  padding: 1rem 0;
}

.gallery-count strong {
  color: #2a5298;
  font-weight: 600;
}

/* Modal Styles */
.gallery-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-modal.show {
  display: flex;
  opacity: 1;
}

.gallery-modal-content {
  max-width: 95%;
  max-height: 95%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-modal-content img {
  max-width: 100%;
  max-height: calc(95vh - 4rem); /* Full height minus padding and caption space */
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  object-fit: contain; /* Show full image without cropping */
}

#gallery-modal-caption {
  color: white;
  font-size: 1.2rem;
  margin-top: 1rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
  }

  .gallery-tabs {
    gap: 0.25rem;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-tab {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .gallery-modal {
    padding: 1rem;
  }

  .gallery-modal-content img {
    max-height: calc(90vh - 3rem);
  }
}

.gallery-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Play icon badge on video thumbnails */
.gallery-item.is-video {
  position: relative;
}

.gallery-video-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.gallery-video-badge i {
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

.gallery-item.is-video .gallery-item-overlay {
  display: none; /* optional: don’t show magnifier on videos */
}


@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .gallery-modal {
    padding: 0.5rem;
  }

  .gallery-modal-content img {
    max-height: calc(85vh - 2rem);
  }
}

/* =========================================================
   Category tiles (homepage) – readable white overlay text
   ========================================================= */

.gallery-category-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Category items reuse .gallery-item, but we adjust overlay behavior */
.gallery-category-item {
  position: relative;
  overflow: hidden;
}

/* Gradient overlay layer for readability */
.gallery-category-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0.35) 40%,
    rgba(0, 0, 0, 0.1) 70%,
    rgba(0, 0, 0, 0) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Show gradient on hover */
.gallery-category-card:hover .gallery-category-item::after {
  opacity: 1;
}

/* For category tiles we don't want a heavy solid overlay */
.gallery-category-item .gallery-item-overlay {
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Make overlay visible on hover (so text appears) */
.gallery-category-card:hover .gallery-item-overlay {
  opacity: 1;
}

/* Position text nicely inside the tile */
.gallery-category-label {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 2;

  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.gallery-category-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.gallery-category-subtitle {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Category page top bar */
.gallery-category-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.gallery-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  color: #2a5298;
}

.gallery-category-meta {
  margin: 6px 0 0;
  color: #666;
}

/* Empty state on category page */
.gallery-empty {
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 12px;
  color: #444;
  background: #fafafa;
}

/* Video thumbnail indicator */
.gallery-item.is-video {
  position: relative;
}

.gallery-video-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.gallery-video-badge i {
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  transition: transform 0.25s ease, background 0.25s ease;
}

.gallery-item.is-video:hover .gallery-video-badge i {
  transform: scale(1.08);
  background: rgba(0, 0, 0, 0.75);
}

/* Optional: remove the magnifying icon on video (since it’s not a “zoom”) */
.gallery-item.is-video .gallery-item-overlay {
  display: none;
}


/* =========================================================
   Category page layout fixes (centred header + centred grid)
   ========================================================= */

body[data-page="gallery-category"] .gallery-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  color: #2a5298;
  margin-bottom: 14px;
}

body[data-page="gallery-category"] .gallery-category-header {
  text-align: center;
  margin-bottom: 22px;
}

body[data-page="gallery-category"] .gallery-category-meta {
  margin: 10px 0 0;
  color: #666;
  font-size: 1rem;
}

/* Centre the grid columns so 1–2 photos don't sit on the far left */
body[data-page="gallery-category"] .gallery-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 340px));
  justify-content: center;
}

/* Optional: slightly larger tiles on desktop for nicer balance */
@media (min-width: 1024px) {
  body[data-page="gallery-category"] .gallery-item {
    border-radius: 12px;
  }
}

