/* ============================================================
   PS Quality — gallery.css
   Styles for projects.html gallery page + lightbox
============================================================ */

/* ============================================================
   PAGE HEADER
============================================================ */
.page-header {
  background: var(--bg-stone);
  padding: calc(var(--section-pad) * 0.75 + 4rem) 0 calc(var(--section-pad) * 0.65);
  text-align: center;
  border-bottom: 1px solid rgba(184, 118, 58, 0.18);
}
.page-header .eyebrow { display: block; margin-bottom: 0.75rem; }
.page-header h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}
.page-header__sub {
  max-width: 560px;
  margin: 0 auto;
  color: rgba(240, 232, 218, 0.7);
  font-size: 1rem;
}

/* Nav active state on this page */
.nav__link--active {
  color: var(--copper-light) !important;
}

/* ============================================================
   GALLERY GRID
============================================================ */
.gallery-section {
  background: var(--bg-primary);
  padding: var(--section-pad) 0;
}

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

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-stone);
  border: none;
  padding: 0;
  cursor: zoom-in;
  display: block;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
  display: block;
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 27, 24, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--ease);
}

.gallery-item__overlay svg {
  width: 28px;
  height: 28px;
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.06);
}
.gallery-item:hover .gallery-item__overlay {
  background: rgba(30, 27, 24, 0.5);
}
.gallery-item:hover .gallery-item__overlay svg {
  opacity: 1;
  transform: scale(1);
}
.gallery-item:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  z-index: 1;
}

/* ============================================================
   CTA STRIP
============================================================ */
.gallery-cta {
  background: var(--bg-stone);
  padding: 4rem 0;
  text-align: center;
}
.gallery-cta .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.gallery-cta p {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-light);
  margin: 0;
}

/* ============================================================
   LIGHTBOX
============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 11, 0.96);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}

.lightbox__stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100vw - 10rem);
  max-height: calc(100vh - 5rem);
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.7);
  display: block;
  transition: opacity 0.2s ease;
}
.lightbox__img.loading { opacity: 0; }

.lightbox__counter {
  margin: 0.9rem 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: background 0.2s, color 0.2s;
}
.lightbox__close:hover { background: var(--copper); border-color: var(--copper); }
.lightbox__close svg { width: 18px; height: 18px; }

/* Arrow buttons */
.lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.lightbox__arrow:hover { background: var(--copper); border-color: var(--copper); }
.lightbox__arrow:disabled { opacity: 0.2; pointer-events: none; }
.lightbox__arrow svg { width: 22px; height: 22px; }
.lightbox__arrow--prev { left: 1.25rem; }
.lightbox__arrow--next { right: 1.25rem; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

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

  .lightbox__stage {
    max-width: calc(100vw - 1rem);
    max-height: calc(100vh - 7rem);
  }
  .lightbox__arrow--prev { left: 0.4rem; }
  .lightbox__arrow--next { right: 0.4rem; }
  .lightbox__arrow { width: 40px; height: 40px; }
  .lightbox__arrow svg { width: 18px; height: 18px; }
}
