/* ==========================================================================
   Gallery
   ========================================================================== */
.gallery-intro {
  margin: var(--space-2) auto 0;
  max-width: 46ch;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* Standalone gallery page — the hero already clears the fixed header, so
   pull the grid up closer to the title. */
.gallery {
  padding-top: var(--space-3);
}

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

.gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--color-bg-alt);
  border: none;
  padding: 0;
  position: relative;
}

.gallery-item:nth-child(3n + 1) {
  aspect-ratio: 1 / 1.35;
  grid-row: span 2;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-med) var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.08);
}

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

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

  .gallery-item:nth-child(3n + 1) {
    grid-row: span 1;
    aspect-ratio: 1;
  }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 14, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}
