/* Projects Page Specific Styles */
.projects-page {
  padding-top: 150px;
  min-height: 100vh;
}

.projects-header {
  padding: 4rem 2rem 2rem;
}

/* CSS Masonry Layout */
.masonry {
  column-count: 3;
  column-gap: 1.5rem;
  padding: 2rem 0;
}

@media (max-width: 1024px) {
  .masonry {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .projects-page {
    padding-top: 100px;
  }
  .projects-header {
    padding: 2rem 1.25rem 1rem;
  }
  .masonry {
    column-count: 1;
    column-gap: 1rem;
    padding: 1rem 0;
  }
  .masonry-item {
    margin-bottom: 1rem;
  }
  .lightbox-close {
    top: 16px;
    right: 20px;
    font-size: 32px;
  }
}

.masonry-item {
  break-inside: avoid-column;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg-secondary);
}

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
  will-change: transform;
}

.masonry-item:hover img {
  transform: scale(1.05);
  filter: brightness(0.85);
}

.masonry-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 9, 8, 0.4);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

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

.masonry-icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center; justify-content: center;
  color: var(--on-image);
  font-size: 1.5rem;
  transform: scale(0.5);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.masonry-item:hover .masonry-icon {
  transform: scale(1);
}

/* Lightbox Modal */
.lightbox {
  display: none; 
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(5, 4, 3, 0.95);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.active {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 30px; right: 40px;
  color: var(--on-image);
  font-size: 40px;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.3s;
}

.lightbox-close:hover {
  /* The bright brand gold, not the darkened text-safe one — the lightbox
     backdrop is near-black. */
  color: var(--accent-gold-bright);
}

/* ===== Portfolio filter bar ===== */
.portfolio-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 2.5rem auto 0;
}

.filter-btn {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  transition: color .3s ease, border-color .3s ease, background .3s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: rgba(207, 168, 115, 0.5);
}

.filter-btn.active {
  color: var(--bg-primary);
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}

/* ===== Masonry caption ===== */
.masonry-overlay {
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.5rem;
  /* Carries the caption, so it has to hold white text over an arbitrary
     photo — several portfolio shots are bright exactly where the caption
     lands. The scrim is deeper and reaches further up than the page theme
     would suggest; this is one of the surfaces that stays dark. */
  background: linear-gradient(to top, rgba(10, 9, 8, 0.92) 0%, rgba(10, 9, 8, 0.55) 45%, rgba(10, 9, 8, 0.12) 75%, transparent 100%);
}

.masonry-caption h3 {
  font-size: 1.15rem;
  color: var(--on-image);
  margin-bottom: 0.2rem;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(10, 9, 8, 0.55);
}

.masonry-caption p {
  font-size: 0.8rem;
  /* Not --accent-gold: that token is the darkened, text-safe gold for white
     backgrounds and disappears against a photograph. */
  color: var(--on-image-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0;
  text-shadow: 0 1px 3px rgba(10, 9, 8, 0.55);
}

.masonry-icon {
  flex: 0 0 auto;
  margin-left: 1rem;
}

[dir="rtl"] .masonry-icon {
  margin-left: 0;
  margin-right: 1rem;
}

#lightbox-caption {
  position: absolute;
  bottom: 2rem;
  left: 0;
  width: 100%;
  text-align: center;
  /* Sits on the near-black lightbox backdrop, not the white page. */
  color: var(--on-image);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  letter-spacing: 1px;
  pointer-events: none;
}

@media (max-width: 600px) {
  .portfolio-filters { gap: 0.5rem; margin-top: 1.75rem; }
  .filter-btn { font-size: 0.85rem; padding: 0.5rem 1rem; }
  .masonry-caption h3 { font-size: 1rem; }
}
