/* =============================================
   TERRANOVA – GALLERY.CSS
   ============================================= */

/* Re-use page-hero from services */
.page-hero {
  position: relative; height: 55vh; min-height: 420px;
  display: flex; align-items: flex-end; padding-bottom: 4rem; overflow: hidden;
}
.page-hero-bg { position: absolute; inset: 0; }
.page-hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.page-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(13,14,15,0.95) 0%, rgba(13,14,15,0.4) 100%);
}
.page-hero-content {
  position: relative; z-index: 2;
  padding: 0 2rem; max-width: 1280px; margin: 0 auto; width: 100%;
}
.page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: 0.04em; line-height: 1; color: var(--light); margin-bottom: 0.75rem;
}
.page-sub { font-size: 1rem; color: rgba(244,241,236,0.65); max-width: 55ch; line-height: 1.7; }

/* FILTER BAR */
.gallery-filter-bar {
  position: sticky; top: 64px; z-index: 100;
  background: rgba(13,14,15,0.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(201,168,76,0.1);
  padding: 0;
}
.gallery-filter-bar .container {
  display: flex; align-items: center; justify-content: space-between;
}
.filter-list {
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
}
.filter-list::-webkit-scrollbar { display: none; }
.filter-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); background: none; border: none;
  padding: 1.1rem 1.4rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  cursor: none;
  transition: color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.filter-btn:hover { color: var(--light); }
.filter-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.gallery-count {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; padding: 0 0 0 1rem;
}

/* GALLERY SECTION */
.gallery-section { padding: 3rem 0 5rem; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 280px;
  gap: 6px;
}

.gallery-item {
  position: relative; overflow: hidden; border-radius: var(--radius);
  cursor: none;
  transition: transform 0.4s cubic-bezier(0.22,0.61,0.36,1);
}
.gallery-item.wide { grid-column: span 2; }
.gallery-item.tall { grid-row: span 2; }

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.22,0.61,0.36,1);
}
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item:hover { z-index: 2; }

.gallery-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(13,14,15,0.88) 0%, rgba(13,14,15,0.15) 60%, transparent 100%);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-info { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.gallery-cat {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); display: block; margin-bottom: 0.3rem;
}
.gallery-info h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem; letter-spacing: 0.05em;
  color: var(--light); line-height: 1.1; margin-bottom: 0.2rem;
}
.gallery-info p { font-size: 0.8rem; color: rgba(244,241,236,0.55); }

.gallery-expand {
  position: absolute; top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  background: rgba(201,168,76,0.9);
  border: none; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: none;
  transform: scale(0) rotate(-45deg);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.gallery-item:hover .gallery-expand { transform: scale(1) rotate(0); }
.gallery-expand svg {
  width: 16px; height: 16px;
  stroke: var(--dark); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* hidden items */
.gallery-item.hidden {
  display: none;
}

/* LIGHTBOX */
.lightbox {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(9,9,10,0.96);
  backdrop-filter: blur(8px);
}
.lightbox-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  max-width: min(1100px, 95vw);
  width: 100%;
  max-height: 92vh;
}
.lightbox-img-wrap {
  position: relative;
  flex: 1; overflow: hidden;
  border-radius: var(--radius);
  min-height: 0;
  background: var(--dark-3);
}
.lightbox-img-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;
  max-height: 72vh;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox-img-wrap img.loaded { opacity: 1; }
.lightbox-loader {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 36px; height: 36px;
  border: 2px solid rgba(201,168,76,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.lightbox-img-wrap img.loaded ~ .lightbox-loader { display: none; }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.lightbox-caption {
  padding: 1.25rem 0.5rem 0;
}
.lightbox-cat {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); display: block; margin-bottom: 0.3rem;
}
.lightbox-caption h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem; letter-spacing: 0.05em; color: var(--light);
}
.lightbox-caption p { font-size: 0.9rem; color: var(--muted); margin-top: 0.3rem; }

.lightbox-close {
  position: absolute; top: 1.25rem; right: 1.25rem; z-index: 3;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  cursor: none;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.lightbox-close:hover { background: rgba(201,168,76,0.15); border-color: rgba(201,168,76,0.3); }
.lightbox-close svg {
  width: 18px; height: 18px;
  stroke: var(--light); fill: none;
  stroke-width: 2; stroke-linecap: round;
}

.lightbox-nav {
  position: absolute; top: 50%; z-index: 3;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  cursor: none;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition), transform 0.25s ease;
}
.lightbox-nav:hover { background: var(--gold); border-color: var(--gold); transform: translateY(-50%) scale(1.05); }
.lightbox-nav:hover svg { stroke: var(--dark); }
.lightbox-nav.prev { left: 1.25rem; }
.lightbox-nav.next { right: 1.25rem; }
.lightbox-nav svg {
  width: 22px; height: 22px;
  stroke: var(--light); fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* CTA */
.gallery-cta {
  padding: 5rem 0;
  background: var(--dark-3);
  border-top: 1px solid rgba(201,168,76,0.1);
}
.gallery-cta-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 3rem; flex-wrap: wrap;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 240px; }
  .gallery-item.wide { grid-column: span 2; }
  .gallery-item.tall { grid-row: span 1; }
}
@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: 260px; }
  .gallery-item.wide { grid-column: span 1; }
  .gallery-overlay { opacity: 1; }
  .gallery-expand { transform: scale(1) rotate(0); }
  .gallery-cta-inner { flex-direction: column; }
  .lightbox-nav { display: none; }
  .gallery-filter-bar .container { flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }
  .gallery-count { padding: 0 0 0.5rem; }
}
