/* ==========================================================================
   Gallery Page — Parker Oliver
   VOGUE-editorial style with spring accents
   Firestore-powered family photo gallery
   ========================================================================== */

/* WHY: All classes prefixed with "fs-" to avoid collision with existing lightbox/gallery in main.js */

/* --- Gallery Hero --- */
.gallery-hero {
  padding: 10rem 2rem 4rem;
  text-align: center;
  background: var(--off-white);
}
.gallery-hero-inner {
  max-width: 600px;
  margin: 0 auto;
}
.gallery-hero-tag {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.gallery-hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 300;
  color: var(--charcoal);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.gallery-hero-desc {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--light-gray);
  line-height: 1.7;
}

/* --- Filter Bar --- */
.fs-filter-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--off-white);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1rem 2rem;
}
.fs-filter-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.fs-filter-group {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.fs-filter-group::-webkit-scrollbar { display: none; }

.fs-filter-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius);
  color: var(--mid-gray);
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s;
}
.fs-filter-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--charcoal);
}
.fs-filter-btn.active {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--white);
}
/* WHY: Visual affordance — plus/minus indicates expandable behavior */
.fs-filter-btn::after {
  content: ' +';
  font-weight: 400;
  opacity: 0.5;
}
.fs-filter-btn.active::after {
  content: ' \2212';
  opacity: 1;
}

.fs-gallery-search {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  margin-left: auto;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  color: var(--charcoal);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  outline: none;
  transition: border-color 0.3s;
}
.fs-gallery-search:focus { border-bottom-color: var(--accent); }
.fs-gallery-search::placeholder { color: var(--light-gray); }

/* --- Gallery Grid --- */
/* WHY: Gallery starts collapsed (max-height: 0) and animates open when a category is selected */
.fs-gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.4s ease;
}
.fs-gallery-container.gallery-expanded {
  max-height: none;
  overflow: visible;
  opacity: 1;
}
.fs-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.fs-gallery-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--light-gray);
}

/* --- Gallery Card --- */
.fs-gallery-card {
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: fsGalleryFadeIn 0.5s ease forwards;
}
@keyframes fsGalleryFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

.fs-gallery-card-image {
  position: relative;
  overflow: hidden;
  background: var(--ivory);
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
}
.fs-gallery-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.fs-gallery-card:hover .fs-gallery-card-image img {
  transform: scale(1.05);
}

.fs-gallery-card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: var(--white);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: var(--radius);
}

.fs-gallery-card-caption {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--charcoal);
  margin-top: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fs-gallery-card-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0.5rem;
}
.fs-gallery-card-person {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(232, 145, 122, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius);
}

/* --- Lightbox --- */
.fs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.fs-lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}
.fs-lightbox-img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  filter: none;
}
.fs-lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  font-size: 2rem;
  color: var(--white);
  z-index: 1001;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.fs-lightbox-close:hover { opacity: 1; }

.fs-lightbox-prev,
.fs-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: var(--white);
  z-index: 1001;
  padding: 16px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.fs-lightbox-prev:hover,
.fs-lightbox-next:hover { opacity: 1; }
.fs-lightbox-prev { left: 16px; }
.fs-lightbox-next { right: 16px; }

.fs-lightbox-meta {
  color: var(--white);
  text-align: center;
  margin-top: 20px;
  max-width: 600px;
}
.fs-lightbox-caption {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 12px;
}
.fs-lightbox-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
.fs-lightbox-people {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

/* --- Feed States --- */
.fs-feed-empty {
  text-align: center;
  padding: 5rem 0;
}
.fs-empty-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--light-gray);
  margin-bottom: 0.5rem;
}
.fs-empty-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--light-gray);
}
.fs-feed-loading {
  display: flex;
  justify-content: center;
  padding: 4rem 0;
}
.fs-loader {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fsSpin 0.8s linear infinite;
}
@keyframes fsSpin {
  to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .gallery-hero { padding: 8rem 1.5rem 3rem; }
  .fs-filter-bar { padding: 0.75rem 1.5rem; }
  .fs-filter-bar-inner {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  .fs-gallery-search { max-width: none; margin-left: 0; }
  .fs-gallery-container { padding: 1.5rem; }
  .fs-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  .fs-filter-group { flex-wrap: wrap; }
  .fs-lightbox-prev { left: 4px; font-size: 2rem; }
  .fs-lightbox-next { right: 4px; font-size: 2rem; }
  .fs-lightbox-close { top: 12px; right: 16px; }
}
