/* ============================================
   PROJECTS / PORTFOLIO PAGE STYLES
   ============================================ */

/* ── Filter Tabs ── */
.gallery-filter {
  padding: var(--space-3xl) 0 var(--space-xl);
  background: var(--concrete);
  display: flex;
  justify-content: center;
}

.gallery-filter__list {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.gallery-filter__btn {
  font-family: var(--font-accent);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  padding: 10px 24px;
  background: var(--pure-white);
  border: 1px solid var(--concrete-dark);
  border-radius: var(--radius-full);
  color: var(--steel-light);
  transition: all var(--duration-fast) var(--ease-out);
}

.gallery-filter__btn:hover,
.gallery-filter__btn.active {
  background: var(--amber);
  color: var(--charcoal);
  border-color: var(--amber);
  box-shadow: var(--shadow-sm);
}

/* ── Gallery Masonry Grid ── */
.gallery-section {
  padding: 0 0 var(--space-5xl);
  background: var(--concrete);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.gallery__item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--pure-white);
  cursor: pointer;
  height: 380px; /* Fixed height for consistency, or masonry effect via absolute positioning/js. Let's make it look asymmetric by having different heights or using grid-row-span if we want it purely CSS */
  transition: all var(--duration-normal) var(--ease-out);
}

/* Asymmetric heights/spans to simulate masonry look */
.gallery__item:nth-child(3n+1) {
  height: 460px;
}

.gallery__item:nth-child(3n+2) {
  height: 340px;
}

.gallery__item:nth-child(3n+3) {
  height: 400px;
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.gallery__item:hover .gallery__img {
  transform: scale(1.05);
}

/* Overlay & Caption */
.gallery__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 27, 42, 0.9) 0%, rgba(13, 27, 42, 0) 70%);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-xl);
  z-index: 2;
}

.gallery__item:hover .gallery__overlay {
  opacity: 1;
}

.gallery__caption-title {
  color: var(--white);
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-xs);
  transform: translateY(20px);
  transition: transform var(--duration-normal) var(--ease-out);
}

.gallery__caption-subtitle {
  color: var(--amber);
  font-family: var(--font-accent);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: 0;
  transform: translateY(20px);
  transition: transform var(--duration-normal) var(--ease-out) 0.05s;
}

.gallery__item:hover .gallery__caption-title,
.gallery__item:hover .gallery__caption-subtitle {
  transform: translateY(0);
}

/* ── Lightbox Overlay Styles ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 42, 0.95);
  backdrop-filter: blur(8px);
}

.lightbox__content {
  position: relative;
  z-index: 2;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox__caption {
  color: var(--white);
  font-family: var(--font-accent);
  font-size: var(--text-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-top: var(--space-lg);
  text-align: center;
}

/* Close & Navigation Buttons */
.lightbox__btn {
  position: absolute;
  color: var(--white);
  font-size: var(--text-2xl);
  cursor: pointer;
  z-index: 3;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  transition: all var(--duration-fast) var(--ease-out);
}

.lightbox__btn:hover {
  background: var(--amber);
  color: var(--charcoal);
}

.lightbox__btn--close {
  top: -60px;
  right: 0;
}

.lightbox__btn--prev {
  left: -80px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__btn--next {
  right: -80px;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery__item,
  .gallery__item:nth-child(3n+1),
  .gallery__item:nth-child(3n+2),
  .gallery__item:nth-child(3n+3) {
    height: 320px;
  }

  .lightbox__btn--prev {
    left: var(--space-md);
    top: auto;
    bottom: -60px;
  }

  .lightbox__btn--next {
    right: var(--space-md);
    top: auto;
    bottom: -60px;
  }

  .lightbox__btn--close {
    top: -50px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery__item,
  .gallery__item:nth-child(3n+1),
  .gallery__item:nth-child(3n+2),
  .gallery__item:nth-child(3n+3) {
    height: 280px;
  }
}
