/* css/gallery.css */
.gallery-header {
  padding-top: 120px;
  padding-bottom: 2rem;
  text-align: center;
}

.gallery-header h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.gallery-header p {
  color: var(--color-muted);
  font-size: 1.1rem;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 0 5% 3rem;
  position: sticky;
  top: 80px;
  z-index: 900;
  background: var(--color-bg); /* fallback */
  background: linear-gradient(to bottom, var(--color-bg) 70%, transparent 100%);
}

.filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 4px 15px rgba(201, 95, 187, 0.4);
}

/* Image Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0 5% 5rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  display: none; /* hidden by default, shown by JS */
}

.gallery-item.show {
  display: block;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
  background: rgba(255, 255, 255, 0.02); /* placeholder while loading */
}

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

.item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 11, 26, 0.5);
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-overlay i {
  color: white;
  font-size: 2rem;
  transform: scale(0.5);
  transition: transform var(--transition-fast);
}

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

.gallery-item:hover .item-overlay i {
  transform: scale(1);
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

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

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 10px;
  transition: color var(--transition-fast);
}

.lightbox-close:hover {
  color: var(--color-accent);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  backdrop-filter: blur(4px);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--color-accent);
}

.lightbox-prev {
  left: -20px;
}

.lightbox-next {
  right: -20px;
}

.lightbox-info {
  position: absolute;
  bottom: -40px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: 0.9rem;
}

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

@media (max-width: 768px) {
  .filter-bar {
    top: 70px;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
  }
  
  .lightbox-prev { left: 0; }
  .lightbox-next { right: 0; }
}

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