/* Gallery Page Styles */

.gallery-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.gallery-intro {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: #4e2600;
}

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

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
}

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

/* Gallery Item */
.gallery-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

.gallery-item-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  background: #f5f5f5;
}

.gallery-item-info {
  padding: 1rem;
  text-align: left;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.gallery-item-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4e2600;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.gallery-item-caption {
  font-size: 0.9rem;
  color: #6b4423;
  margin: 0;
  line-height: 1.4;
  flex-grow: 1;
}

.gallery-item-date {
  font-size: 0.8rem;
  color: #8b6435;
  margin-top: 0.5rem;
}

/* Loading and Empty States */
.loading-message,
.error-message,
.empty-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.2rem;
  color: #4e2600;
}

.error-message {
  color: #d32f2f;
}

/* Load More Button */
.load-more-container {
  text-align: center;
  margin: 2rem 0;
}

.load-more-container.hidden {
  display: none;
}

#load-more-btn {
  min-width: 200px;
}

/* Lightbox Modal */
#lightbox-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  padding: 1rem;
  pointer-events: auto;
}

#lightbox-modal.hidden {
  display: none !important;
}

/* Ensure overlay is visible and behind modal */
#gallery-container ~ #overlay-backdrop {
  z-index: 2000;
}

#lightbox-modal .lightbox-content {
  background: white;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 2002;
}

.lightbox-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  min-height: 300px;
  max-height: 70vh;
  overflow: hidden;
}

#lightbox-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.lightbox-info {
  padding: 1.5rem;
  background: white;
  text-align: left;
}

.lightbox-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
  color: #4e2600;
}

.lightbox-info p {
  margin: 0.5rem 0;
  font-size: 1rem;
  color: #6b4423;
}

.lightbox-info .brand-link {
  display: inline-block;
  margin-top: 1rem;
  color: #f1603c;
  text-decoration: none;
  font-weight: 500;
}

.lightbox-info .brand-link:hover {
  text-decoration: underline;
}

/* Modal close button positioning for lightbox */
#lightbox-modal .modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  color: #4e2600;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

@media (max-width: 768px) {
  #lightbox-modal .lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .lightbox-image-container {
    max-height: 60vh;
  }

  #lightbox-image {
    max-height: 60vh;
  }

  .lightbox-info {
    padding: 1rem;
  }

  .lightbox-info h3 {
    font-size: 1.2rem;
  }

  .lightbox-info p {
    font-size: 0.9rem;
  }
}
