/* ============================================
   GALLERY SECTION
   ============================================ */

.gallery-section {
  background: var(--bg-primary);
  position: relative;
}

/* ---- Gallery Grid ---- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  grid-auto-rows: 250px;
}

/* ---- Gallery Item ---- */
.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

.gallery-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Large spanning item */
.gallery-item-large {
  grid-column: span 2;
  grid-row: span 2;
}

/* ---- Item Image ---- */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* ---- Item Overlay ---- */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

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

.gallery-item-overlay i {
  color: var(--text-primary);
  font-size: 2rem;
  transform: translateY(8px);
  transition: transform 0.35s ease;
}

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

.gallery-item-overlay span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transform: translateY(8px);
  transition: transform 0.35s ease 0.05s;
  opacity: 0.8;
}

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

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

/* ---- Lightbox Controls ---- */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 10;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.25s ease,
              border-color 0.25s ease,
              transform 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.lightbox-close:active {
  transform: scale(0.90);
}

.lightbox-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
}

.lightbox-prev:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox-prev:active {
  transform: translateY(-50%) scale(0.90);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
}

.lightbox-next:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox-next:active {
  transform: translateY(-50%) scale(0.90);
}

/* ---- Lightbox Content ---- */
.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 60px 80px;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

/* ---- Lightbox Caption ---- */
.lightbox-caption {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---- Lightbox Counter ---- */
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 16px;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
  }
}

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

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

  .lightbox-content {
    padding: 60px 20px;
  }

  .lightbox-prev {
    left: 10px;
    width: 40px;
    height: 40px;
  }

  .lightbox-next {
    right: 10px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-auto-rows: 180px;
  }

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