/* ============================================================
   GALLERY PAGE STYLES
   ============================================================ */

.gallery-wrapper {
  padding-top: 70px; /* nav height */
}

/* ============================================================
   MASONRY GRID
   ============================================================ */
.gallery-grid {
  columns: 3 280px;
  column-gap: 1rem;
  padding: 1rem 2rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--color-white);
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.gallery-item .item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
  padding: 2rem 0.875rem 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.gallery-item .item-uploader {
  color: rgba(255,255,255,0.9);
  font-size: 0.8rem;
  font-weight: 500;
}

.gallery-item .item-time {
  color: rgba(255,255,255,0.65);
  font-size: 0.72rem;
}

.video-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.video-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .video-play-icon { opacity: 1; }

.play-circle {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-triangle {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent var(--color-forest);
  margin-left: 3px;
}

/* ============================================================
   LOAD MORE
   ============================================================ */
.load-more-wrapper {
  text-align: center;
  padding: 2rem;
}

.gallery-empty {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--color-slate);
}

.gallery-empty h3 {
  margin-bottom: 0.75rem;
  color: var(--color-slate);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(13, 13, 13, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-media-wrap {
  position: relative;
  max-width: 100%;
  max-height: calc(90vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: calc(90vh - 80px);
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-info {
  margin-top: 0.875rem;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

.lightbox-uploader {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: color var(--transition);
  z-index: 10;
}
.lightbox-close:hover { color: white; }

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-counter {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .gallery-grid {
    columns: 2 160px;
    padding: 0.75rem 0.75rem 2rem;
    column-gap: 0.5rem;
  }
  .gallery-item { margin-bottom: 0.5rem; }
  .gallery-item .item-overlay { opacity: 1; }
  .lightbox-nav { display: none; }
}

@media (max-width: 480px) {
  .gallery-grid {
    columns: 2 120px;
  }
}
