/**
 * public/assets/css/pages/gallery.css
 * Styles for the Gallery page — filter tabs, grid, lightbox.
 */

/* ══════════════════════════════════════════════════════
   FILTER TABS
══════════════════════════════════════════════════════ */
.gallery-filter-wrap {
  padding: var(--sp-lg) 0 var(--sp-md);
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-white);
  position: sticky;
  top: 68px;
  z-index: var(--z-sticky);
}

.gallery-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  font-family: var(--font-body);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--clr-border);
  background: var(--clr-white);
  color: var(--clr-text-muted);
  cursor: pointer;
  transition:
    background var(--t-fast),
    color var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}
.filter-btn:hover {
  background: var(--clr-bg-alt);
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}
.filter-btn.active {
  background: var(--clr-primary);
  color: var(--clr-white);
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-sm);
}

.filter-btn__count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}
.filter-btn:not(.active) .filter-btn__count {
  background: var(--clr-bg-alt);
  color: var(--clr-text-light);
}

/* ══════════════════════════════════════════════════════
   GALLERY GRID
══════════════════════════════════════════════════════ */
.gallery-section {
  padding: var(--sp-xl) 0 var(--sp-2xl);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* Gallery cell — uses shared .gallery-cell from components.css */
/* Override height for full-page gallery */
.gallery-grid .gallery-cell {
  height: 240px;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.gallery-grid .gallery-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Featured cells — larger */
.gallery-cell--featured {
  grid-column: span 2;
  grid-row: span 2;
  height: auto; /* override: height comes from grid rows */
}

/* Empty state */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-2xl) 0;
  color: var(--clr-text-muted);
}
.gallery-empty__icon {
  font-size: 48px;
  margin-bottom: var(--sp-sm);
}
.gallery-empty h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--clr-primary);
  margin-bottom: 8px;
}
.gallery-empty p {
  font-size: var(--fs-base);
}

/* ══════════════════════════════════════════════════════
   UPLOAD CTA (admin-visible, or general CTA)
══════════════════════════════════════════════════════ */
.gallery-cta-bar {
  background: var(--clr-accent-light);
  border: 1px solid var(--clr-accent);
  border-radius: var(--radius-lg);
  padding: var(--sp-md) var(--sp-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
}
.gallery-cta-bar p {
  font-size: var(--fs-sm);
  color: var(--clr-accent-dark);
  font-weight: 500;
  margin: 0;
}

/* ══════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 40, 0.95);
  backdrop-filter: blur(6px);
  padding: var(--sp-md);

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--t-mid) var(--ease),
    visibility var(--t-mid);
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox__inner {
  position: relative;
  max-width: 1000px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95);
  transition: transform var(--t-mid) var(--ease);
}
.lightbox.open .lightbox__inner {
  transform: scale(1);
}

/* Image */
.lightbox__img {
  max-height: 80vh;
  max-width: 100%;
  width: auto;
  border-radius: var(--radius-md);
  display: block;
  object-fit: contain;
  box-shadow: var(--shadow-xl);
}

/* Caption bar */
.lightbox__caption {
  margin-top: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--fs-sm);
  max-width: 600px;
  line-height: var(--lh-relaxed);
}
.lightbox__caption strong {
  color: var(--clr-white);
  font-weight: 600;
}

/* Counter (e.g. "3 / 12") */
.lightbox__counter {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.4);
  margin-top: 6px;
  letter-spacing: 1px;
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: -52px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--t-fast),
    color var(--t-fast);
  font-family: var(--font-body);
}
.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--clr-white);
}

/* Prev / Next arrows */
.lightbox__arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--t-fast),
    color var(--t-fast);
  font-family: var(--font-body);
  z-index: 1;
}
.lightbox__arrow:hover {
  background: rgba(255, 255, 255, 0.22);
  color: var(--clr-white);
}
.lightbox__arrow--prev {
  left: 16px;
}
.lightbox__arrow--next {
  right: 16px;
}

/* Loading spinner inside lightbox */
.lightbox__loading {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--clr-white);
  border-radius: 50%;
  animation: spinSlow 0.7s linear infinite;
  display: none;
}
.lightbox.loading .lightbox__loading {
  display: block;
}
.lightbox.loading .lightbox__img {
  opacity: 0;
}

/* ══════════════════════════════════════════════════════
   GALLERY PAGE RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .gallery-grid .gallery-cell {
    height: 220px;
  }
}

@media (max-width: 640px) {
  .gallery-filter-wrap {
    top: 68px;
    padding: var(--sp-sm) 0;
  }
  .gallery-filter {
    gap: 6px;
  }
  .filter-btn {
    font-size: var(--fs-xs);
    padding: 6px 12px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }
  .gallery-grid .gallery-cell {
    height: 160px;
  }
  .gallery-cell--featured {
    grid-column: span 2;
  }
  .lightbox__arrow {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .lightbox__arrow--prev {
    left: 6px;
  }
  .lightbox__arrow--next {
    right: 6px;
  }
}
