/* ============ GALLERY GRID (EXACT SCREENSHOT MASONRY LAYOUT) & LIGHTBOX ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 260px;
  gap: 18px;
}

@media (max-width: 1200px) {
  .gallery-grid {
    grid-auto-rows: 240px;
    gap: 16px;
  }
}

@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 220px;
    gap: 14px;
  }
}

@media (max-width: 576px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 200px;
    gap: 12px;
  }
}

.gallery-grid > div {
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #051413;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.25);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.gallery-grid > div:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border-color: var(--gold, #fbbf24);
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
  position: absolute;
  inset: 0;
}

.gallery-grid > div:hover img {
  transform: scale(1.06);
}

.g1 { grid-column: span 2; grid-row: span 2; }
.g5 { grid-column: span 2; }
.g7 { grid-column: span 2; }

@media (max-width: 768px) {
  .g1, .g5, .g7 {
    grid-column: span 1;
    grid-row: span 1;
  }
}

.g1 a img,
.g1 img,
.gallery-grid .g1 a img,
.gallery-grid .g1 img {
  object-fit: cover !important;
  object-position: center top !important;
  width: 100% !important;
  height: 100% !important;
}

/* Ensure wide panoramic photos like Executive Session & Cultural Fellowship fit completely inside their box */
img[src*="13.48.27"],
img[src*="13.48.33"] {
  object-fit: contain !important;
  background: #051413 !important;
  padding: 4px !important;
}

.g-caption {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: #fbbf24 !important; /* Gold title for high contrast & easy visibility */
  padding: 14px 16px;
  letter-spacing: 0.01em;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  background: linear-gradient(0deg, rgba(5, 16, 15, 0.96) 0%, rgba(5, 16, 15, 0.75) 75%, transparent 100%);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
  line-height: 1.35;
}

.g-caption strong {
  color: #ffffff !important;
}

/* Lightbox Modal */
.gallery-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 14, 13, 0.94);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.gallery-modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-modal-img {
  max-width: 88vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(212, 175, 55, 0.4);
}

.gallery-modal-caption {
  margin-top: 16px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  background: rgba(12, 43, 39, 0.92);
  padding: 10px 24px;
  border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  max-width: 800px;
}

.gallery-modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: none;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 100000;
}

.gallery-modal-close:hover {
  background: #e11d48;
  transform: scale(1.1);
}

.gallery-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.25);
  color: #ffffff;
  border: 1px solid rgba(212, 175, 55, 0.4);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 100000;
}

.gallery-modal-nav:hover {
  background: var(--gold, #fbbf24);
  color: #0c2b27;
  transform: translateY(-50%) scale(1.1);
}

.gallery-modal-prev { left: 24px; }
.gallery-modal-next { right: 24px; }

@media (max-width: 576px) {
  .gallery-modal-prev { left: 8px; }
  .gallery-modal-next { right: 8px; }
}
