/* --- GALLERY LAYOUT & COMPONENTS --- */

/* Search and Filter Section */
.gallery-controls {
  max-width: 1200px;
  margin: 0 auto 4rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.search-wrapper {
  position: relative;
  max-width: 500px;
  width: 100%;
}

.search-input {
  width: 100%;
  min-height: 48px;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-laser);
  box-shadow: 0 0 15px rgba(var(--accent-laser-rgb), 0.2);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

/* --- UNIFORM GRID LAYOUT (Updated from Column-Masonry) --- */
.gallery-grid-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 400px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  width: 100%;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: all var(--transition-smooth);
  cursor: pointer;
  animation: fadeUp 0.5s ease forwards;
  content-visibility: auto;
  contain-intrinsic-size: 320px 360px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item:hover {
  border-color: var(--accent-laser);
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(var(--accent-laser-rgb), 0.1);
}

/* Square Image Container with letterbox/pillarbox background */
.gallery-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* Forces perfect square */
  background-color: #07080a; /* Dark elegant padding background */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* DOES NOT CROP: keeps full image bounds */
  transition: transform var(--transition-smooth);
}

.gallery-item:hover .gallery-img {
  transform: scale(1.04);
}

/* Card Text Block (Placed below image) */
.gallery-card-info {
  padding: 1.25rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.gallery-item-category {
  color: var(--accent-laser);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.gallery-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Centered Zoom Icon on Hover */
.gallery-zoom-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 46px;
  height: 46px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: all var(--transition-smooth);
  z-index: 10;
}

.gallery-item:hover .gallery-zoom-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.gallery-item:hover .gallery-zoom-icon:hover {
  background: var(--accent-laser);
  color: var(--bg-primary);
  border-color: var(--accent-laser);
  box-shadow: 0 0 15px rgba(var(--accent-laser-rgb), 0.4);
}

/* No Results Notification */
.gallery-no-results {
  text-align: center;
  padding: 5rem 2rem;
  grid-column: 1 / -1;
}

.gallery-no-results i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.gallery-no-results h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.gallery-no-results p {
  color: var(--text-secondary);
}

/* --- LIGHTBOX MODAL --- */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(3, 4, 6, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
  user-select: none;
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 1010;
}

.lightbox-close:hover {
  background: var(--accent-laser);
  color: var(--bg-primary);
  border-color: var(--accent-laser);
  box-shadow: 0 0 15px rgba(var(--accent-laser-rgb), 0.4);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 1010;
}

.lightbox-nav:hover {
  background: var(--accent-laser);
  color: var(--bg-primary);
  border-color: var(--accent-laser);
  box-shadow: 0 0 15px rgba(var(--accent-laser-rgb), 0.4);
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

.lightbox-content-wrapper {
  max-width: 80%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.lightbox-img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(var(--accent-laser-rgb), 0.05);
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.lightbox-modal.active .lightbox-img {
  transform: scale(1);
}

.lightbox-caption {
  margin-top: 1.5rem;
  text-align: center;
  max-width: 600px;
}

.lightbox-category {
  color: var(--accent-laser);
  font-family: var(--font-headers);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.lightbox-title {
  display: none;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .gallery-controls {
    margin-bottom: 3rem;
  }
  .gallery-grid-wrapper {
    min-height: 280px;
  }
  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
  }
  .lightbox-prev {
    left: 1rem;
  }
  .lightbox-next {
    right: 1rem;
  }
  .lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .lightbox-content-wrapper {
    max-width: 90%;
    max-height: 78dvh;
  }
  .lightbox-img {
    max-height: 66dvh;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .lightbox-close {
    top: 0.9rem;
    right: 0.9rem;
  }
  .lightbox-content-wrapper {
    max-width: calc(100% - 1.5rem);
  }
  .lightbox-img {
    max-height: 58dvh;
  }
  .lightbox-nav {
    top: auto;
    bottom: 1rem;
    transform: none;
  }
  .lightbox-prev {
    left: calc(50% - 56px);
  }
  .lightbox-next {
    right: calc(50% - 56px);
  }
  .gallery-breadcrumb {
    gap: 0.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
  }
}

/* --- GALLERY ALBUMS & BREADCRUMBS --- */
.gallery-breadcrumb {
  max-width: 1200px;
  margin: 0 auto 2rem auto;
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-headers);
  font-size: 0.95rem;
  color: var(--text-secondary);
  animation: fadeUp 0.4s ease forwards;
}

.gallery-breadcrumb .crumb-btn {
  color: var(--accent-laser);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.gallery-breadcrumb .crumb-btn:hover {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(var(--accent-laser-rgb), 0.3);
}

.gallery-breadcrumb .breadcrumb-separator {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.gallery-breadcrumb .active-crumb {
  color: var(--text-primary);
  font-weight: 600;
}

/* Album Badge overlaid on cover image */
.album-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(2, 2, 3, 0.85);
  border: 1px solid rgba(var(--accent-laser-rgb), 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 5;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-fast);
}

.gallery-item:hover .album-badge {
  border-color: var(--accent-laser);
  box-shadow: 0 0 10px rgba(var(--accent-laser-rgb), 0.3);
}



