.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.gallery-header {
  text-align: center;
  margin-bottom: 40px;
}

.gallery-header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-font-color);
}

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

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  background: var(--body-bg);
  color: var(--primary-font-color);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary-font-color);
  color: var(--body-bg);
  border-color: var(--primary-font-color);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  grid-auto-rows: 200px;
  gap: 20px;
  grid-auto-flow: dense;
}

.gallery-item {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid var(--border-color);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-font-color);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  /* Kurangi biaya rendering offscreen */
  content-visibility: auto;
  contain-intrinsic-size: 300px 200px;
}

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

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 20px 15px 15px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  transform: translateY(0);
}

.gallery-title {
  font-size: 1rem;
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

.gallery-description {
  font-size: 0.85rem;
  opacity: 0.9;
  display: block;
  line-height: 1.3;
}

/* Size variations untuk layout yang lebih menarik */
.gallery-item.large {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item.medium {
  grid-column: span 1;
  grid-row: span 2;
}

.gallery-item.small {
  grid-column: span 1;
  grid-row: span 1;
}

/* Random positioning untuk efek abstrak */
.gallery-item:nth-child(3n) {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item:nth-child(5n) {
  grid-column: span 2;
  grid-row: span 1;
}

.gallery-item:nth-child(7n) {
  grid-column: span 1;
  grid-row: span 2;
}

/* Responsive design */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-auto-rows: 150px;
    gap: 15px;
  }

  .gallery-item.large,
  .gallery-item.medium {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gallery-header h1 {
    font-size: 2rem;
  }
}

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

  .gallery-item {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
}

/* Dark mode compatibility */
[data-theme="dark"] .gallery-item {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gallery-item:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Loading animation */
.gallery-item img {
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Staggered animation untuk efek yang lebih smooth */
.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }
.gallery-item:nth-child(9) { animation-delay: 0.9s; }
.gallery-item:nth-child(10) { animation-delay: 1.0s; }
.gallery-item:nth-child(11) { animation-delay: 1.1s; }
.gallery-item:nth-child(12) { animation-delay: 1.2s; }


