/* Gallery Layouts */
:root {
  --primary-color: #f4bc21;
  --primary-dark: #e0a800;
  --secondary-color: #1a202c;
  --bg-light: #f8f9fa;
  --text-dark: #2d3748;
}

/* ===== 1. Grid View ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ===== 2. Masonry View ===== */
.gallery-masonry {
  column-count: 3;
  column-gap: 1.25rem;
}

@media (max-width: 992px) {
  .gallery-masonry { column-count: 2; }
}

@media (max-width: 576px) {
  .gallery-masonry { column-count: 1; }
}

.gallery-masonry .gallery-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 1.25rem;
}

.gallery-masonry .gallery-item img {
  height: auto;
}

/* ===== 3. Coverflow / 3D Perspective View ===== */
.gallery-coverflow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  perspective: 1000px;
}

.gallery-coverflow .gallery-item {
  width: 300px;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.gallery-coverflow .gallery-item:hover {
  transform: scale(1.05) rotateY(0deg) !important;
  z-index: 10;
}

/* ===== Gallery Item (shared) ===== */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: white;
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.13);
}

.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.82), transparent);
  color: white;
  padding: 1.5rem 1rem 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* ===== Facts Popup ===== */
.facts-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}

.facts-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.facts-content {
  background: white;
  padding: 3rem;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  text-align: center;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.5s ease;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.facts-popup-overlay.active .facts-content {
  transform: translateY(0);
}

.facts-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.facts-text {
  font-size: 1.4rem;
  line-height: 1.6;
  color: var(--text-dark);
  font-weight: 600;
  margin-bottom: 2rem;
}

.facts-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #a0aec0;
  transition: color 0.3s;
}

.facts-close:hover { color: var(--text-dark); }

.facts-progress {
  width: 100%;
  height: 4px;
  background: #edf2f7;
  position: absolute;
  bottom: 0;
  left: 0;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.facts-timer {
  height: 100%;
  background: var(--primary-color);
  width: 100%;
  transition: width 5s linear;
}

/* ===== Lightbox ===== */
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.92);
}

.lightbox-content-wrapper {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  color: white;
  border: none;
  padding: 1rem;
  cursor: pointer;
  font-size: 2rem;
  border-radius: 50%;
  transition: background 0.3s;
  z-index: 10002;
  pointer-events: auto;
  user-select: none;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  opacity: 0.8;
  z-index: 10001;
}

.lightbox-details {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  padding: 1rem;
  background: rgba(0,0,0,0.5);
}

/* ===== Drive image fallback (when blocked by Google) ===== */
.gallery-item.img-error .drive-img-fallback {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 180px;
  background: #f8f9fa;
}

/* ===== Load More button ===== */
#load-more-btn {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #1a202c;
  font-weight: 600;
  border-radius: 25px;
  padding: 0.6rem 2rem;
  transition: all 0.2s;
}
#load-more-btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244,188,33,0.35);
}
#load-more-btn:disabled {
  opacity: 0.7;
  transform: none;
  cursor: not-allowed;
}
