/* ==========================================
   GALLERY COMPONENT
   ========================================== */

/* Gallery Grid - used for lightbox image galleries */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-sm);
  margin: var(--spacing-md) 0;
}

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

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--color-bg-alt);
}

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

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

.gallery-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.gallery-item:hover::after {
  background: rgba(0, 0, 0, 0.3);
}

/* Gallery Lightbox Overlay Icon */
.gallery-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='m21 3-7 7'/%3E%3Cpath d='m3 21 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px;
}

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

/* GLightbox Custom Styling */
.glightbox-clean .gslide-description {
  background: rgba(0, 0, 0, 0.85);
  padding: var(--spacing-md);
}

.glightbox-clean .gdesc-inner {
  font-size: 1rem;
  line-height: 1.6;
}

/* Modal/Lightbox Project Details */
.project-modal {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
}

.project-modal-header {
  margin-bottom: var(--spacing-md);
}

.project-modal-title {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

.project-modal-meta {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-sm);
}

.project-modal-date {
  color: var(--color-text-muted);
}

.project-modal-gallery {
  margin: var(--spacing-lg) 0;
}

.project-modal-description {
  font-size: 1.125rem;
  line-height: 1.8;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-muted);
}

.project-modal-services {
  margin-bottom: var(--spacing-md);
}

.project-modal-services h3 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

.project-modal-testimonial {
  padding: var(--spacing-md);
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-text-dark);
  border-radius: var(--border-radius);
  margin-top: var(--spacing-lg);
}

.project-modal-testimonial-text {
  font-size: 1.125rem;
  font-style: italic;
  margin-bottom: var(--spacing-sm);
  line-height: 1.6;
}

.project-modal-testimonial-author {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Lazy Loading Placeholder */
.gallery-item img[data-src] {
  filter: blur(10px);
  transition: filter 0.3s ease;
}

.gallery-item img[data-src].loaded {
  filter: blur(0);
}

/* Image loading state */
.gallery-item.loading {
  position: relative;
}

.gallery-item.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-bg-alt);
  border-top-color: var(--color-text-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

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

  .project-modal {
    padding: var(--spacing-md);
  }

  .project-modal-title {
    font-size: 1.5rem;
  }

  .project-modal-description {
    font-size: 1rem;
  }
}
