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

.gallery-grid {
  display: grid;
  gap: 12px;
}

.gallery-grid.masonry {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-rows: 200px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.gallery-item.tall { grid-row: span 2; }
.gallery-item.wide { grid-column: span 2; }

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.06);
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,8,16,0.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--dur-mid);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

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

.gallery-item-caption {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Video play button */
.gallery-item.video-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(244,114,182,0.9);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.gallery-item.video-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-46%, -50%);
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 16px solid white;
  z-index: 3;
}

/* Placeholder when no image */
.gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.gallery-placeholder-icon {
  font-size: 2rem;
  opacity: 0.4;
}

@media (max-width: 600px) {
  .gallery-grid.masonry {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 160px;
  }

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