/* Gallery page. Shared pieces (header, footer, buttons, chips) are in styles.css */

.gallery-head {
  max-width: 40rem;
  padding: clamp(24px, 5vh, 56px) 0 32px;
}

.gallery-head h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem);
}

.gallery-intro {
  margin: 20px 0 0;
  font-size: 1.0625rem;
  color: var(--muted);
}

.gallery-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.gallery-count {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Masonry: photos keep their own shape */
.gallery-grid {
  columns: 3 260px;
  column-gap: 16px;
}

.gallery-item {
  break-inside: avoid;
  margin: 0 0 16px;
}

.gallery-item button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  transition: transform 0.6s ease;
}

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

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

.gallery-item figcaption {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--muted);
}

.gallery-empty {
  padding: 72px 0;
  text-align: center;
  color: var(--muted);
}

.gallery-empty p {
  max-width: 28rem;
  margin: 0 auto 24px;
}

.gallery-empty .gallery-empty-title {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--ink);
}

.gallery-cta {
  margin-top: 56px;
  padding: 64px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.gallery-cta h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}

.gallery-cta p {
  margin: 12px 0 0;
  color: var(--muted);
}

.gallery-cta .actions {
  justify-content: center;
  margin-top: 28px;
}

/* ---------- Lightbox (always dark, whatever the theme) ---------- */

.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(14, 12, 11, 0.96);
  color: #f1ece7;
}

.lightbox[open] {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 88px;
  align-items: center;
  animation: lb-in 0.25s ease;
}

.lightbox::backdrop {
  background: transparent;
}

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

.lightbox .icon-button {
  color: #f1ece7;
  border-color: rgba(241, 236, 231, 0.25);
}

.lightbox .icon-button:hover {
  border-color: #f1ece7;
}

.lb-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1;
}

.lb-nav {
  justify-self: center;
}

.lb-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 72px 0 32px;
}

.lb-figure img {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  border-radius: 8px;
}

.lb-figure figcaption {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  color: rgba(241, 236, 231, 0.75);
}

.lb-count {
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] {
    animation: none;
  }
}

@media (max-width: 720px) {
  .lightbox[open] {
    grid-template-columns: 1fr;
  }

  .lb-figure {
    padding: 72px 16px 96px;
  }

  .lb-figure img {
    max-height: calc(100dvh - 200px);
  }

  .lb-nav {
    position: absolute;
    bottom: 28px;
  }

  .lb-prev {
    left: calc(50% - 56px);
  }

  .lb-next {
    right: calc(50% - 56px);
  }
}

@media (max-width: 560px) {
  .gallery-grid {
    columns: 2;
    column-gap: 10px;
  }

  .gallery-item {
    margin-bottom: 10px;
  }

  .gallery-item button {
    border-radius: 12px;
  }
}
