/* ============ Gallery page ============ */
.gallery-page {
  padding: 8.5rem 2rem 5rem;
  max-width: 1240px;
  margin: 0 auto;
}

.gallery-head {
  margin-bottom: 3.5rem;
}

.gallery-kicker {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.gallery-title {
  font-family: "Anton", sans-serif;
  font-size: clamp(3.2rem, 9vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.gallery-intro {
  margin-top: 1.4rem;
  max-width: 34rem;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1.9;
}

/* ---- Masonry-style photo grid (CSS columns) ---- */
.gallery-grid {
  columns: 1;
  column-gap: 1.1rem;
}

.gallery-item {
  display: block;
  width: 100%;
  margin: 0 0 1.1rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  break-inside: avoid;
  overflow: hidden;
  /* faint frame so portraits don't melt into the bg */
  outline: 1px solid rgba(244, 241, 234, 0.07);
  outline-offset: -1px;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0.92);
  transform: scale(1);
  transition: filter 0.45s ease, transform 0.45s ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  filter: brightness(1.05);
  transform: scale(1.025);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (min-width: 680px) {
  .gallery-grid {
    columns: 2;
  }
}

@media (min-width: 1060px) {
  .gallery-grid {
    columns: 3;
  }
}

/* reserve the scrollbar gutter so locking scroll doesn't shift the page */
html {
  scrollbar-gutter: stable;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(13, 8, 18, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-fade 0.25s ease;
}

@keyframes lb-fade {
  from { opacity: 0; }
}

.lightbox[hidden] {
  display: none;
}

.lightbox-img {
  max-width: min(92vw, 1400px);
  max-height: 84vh;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}

.lightbox-counter {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
}

.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(13, 8, 18, 0.55);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.lightbox button:hover,
.lightbox button:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

.lightbox-close {
  top: 1.2rem;
  right: 1.2rem;
}

.lightbox-prev {
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
}

/* lock page scroll while the lightbox is open */
body.lightbox-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item img {
    transition: none;
  }
  .lightbox {
    animation: none;
  }
}

@media (max-width: 560px) {
  .gallery-page {
    padding: 7rem 1.1rem 3.5rem;
  }
  .gallery-head {
    margin-bottom: 2.4rem;
  }
  .lightbox-img {
    max-width: 100vw;
    max-height: 76vh;
  }
  .lightbox button {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.35rem;
  }
  .lightbox-prev {
    left: 0.6rem;
  }
  .lightbox-next {
    right: 0.6rem;
  }
}
