/* Gallery — masonry mosaic, category filters, and full-screen viewer */

.gallery-page {
  --gallery-gold: #c5a059;
  --gallery-ink: #1a1a1a;
  --gallery-muted: #6f6f6f;
  --gallery-line: #ececec;
  --gallery-soft: #f9f9f9;
  background: #fff;
  padding-bottom: 0;
}

.gallery-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  scroll-margin-top: 7rem;
}

@media (min-width: 768px) {
  .gallery-shell {
    padding: 0 3rem 5rem;
  }
}

/* ---------- Filter bar ---------- */

.gallery-filterbar {
  position: sticky;
  top: 5rem;
  z-index: 30;
  margin: 0 -1.25rem 1.25rem;
  padding: 0.75rem 0;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gallery-line);
}

@media (min-width: 768px) {
  .gallery-filterbar {
    margin: 0 -3rem 1.75rem;
    padding: 0.9rem 0;
  }
}

.gallery-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.25rem 1.25rem;
  scroll-snap-type: x proximity;
}

.gallery-filters::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .gallery-filters {
    padding: 0.25rem 3rem;
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.gallery-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  scroll-snap-align: center;
  padding: 0.55rem 1.05rem;
  border-radius: 9999px;
  border: 1px solid var(--gallery-line);
  background: #fff;
  color: var(--gallery-ink);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.gallery-chip:hover {
  border-color: rgba(197, 160, 89, 0.55);
  background: #fffbf4;
  transform: translateY(-1px);
}

.gallery-chip.is-active {
  background: var(--gallery-ink);
  border-color: var(--gallery-ink);
  color: #fff;
  box-shadow: 0 8px 22px rgba(26, 26, 26, 0.18);
}

.gallery-chip-count {
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 9999px;
  background: var(--gallery-soft);
  color: var(--gallery-muted);
  transition: background 0.25s ease, color 0.25s ease;
}

.gallery-chip.is-active .gallery-chip-count {
  background: rgba(197, 160, 89, 0.9);
  color: #1a1a1a;
}

.gallery-status {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gallery-muted);
}

/* ---------- Masonry ---------- */

.gallery-masonry {
  column-count: 2;
  column-gap: 0.75rem;
  transition: opacity 0.2s ease;
}

.gallery-masonry.is-swapping {
  opacity: 0;
}

@media (min-width: 640px) {
  .gallery-masonry {
    column-gap: 1rem;
  }
}

@media (min-width: 900px) {
  .gallery-masonry {
    column-count: 3;
    column-gap: 1.25rem;
  }
}

@media (min-width: 1280px) {
  .gallery-masonry {
    column-count: 4;
    column-gap: 1.5rem;
  }
}

.gallery-item {
  break-inside: avoid;
  margin: 0 0 0.75rem;
  padding: 0;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 640px) {
  .gallery-item {
    margin-bottom: 1rem;
  }
}

@media (min-width: 900px) {
  .gallery-item {
    margin-bottom: 1.25rem;
  }
}

@media (min-width: 1280px) {
  .gallery-item {
    margin-bottom: 1.5rem;
  }
}

.gallery-item.is-visible {
  opacity: 1;
  transform: none;
}

.gallery-item.is-hidden {
  display: none;
}

.gallery-item-btn {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--gallery-soft);
  cursor: zoom-in;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.45s ease, transform 0.45s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 900px) {
  .gallery-item-btn {
    border-radius: 24px;
  }
}

.gallery-item-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(26, 26, 26, 0.16);
}

.gallery-item-btn:focus-visible {
  outline: 3px solid var(--gallery-gold);
  outline-offset: 3px;
}

.gallery-item-btn img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.gallery-item-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 15, 15, 0.82) 0%, rgba(15, 15, 15, 0.32) 42%, rgba(15, 15, 15, 0) 72%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-item-btn:hover .gallery-item-veil,
.gallery-item-btn:focus-visible .gallery-item-veil {
  opacity: 1;
}

.gallery-item-meta {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item-btn:hover .gallery-item-meta,
.gallery-item-btn:focus-visible .gallery-item-meta {
  opacity: 1;
  transform: none;
}

.gallery-item-tag {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gallery-gold);
}

.gallery-item-caption {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.gallery-item-zoom {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gallery-ink);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item-zoom svg {
  width: 1rem;
  height: 1rem;
}

.gallery-item-btn:hover .gallery-item-zoom,
.gallery-item-btn:focus-visible .gallery-item-zoom {
  opacity: 1;
  transform: none;
}

.gallery-noresults {
  margin: 3rem 0 0;
  text-align: center;
  color: var(--gallery-muted);
  font-size: 1rem;
}

/* ---------- Empty state ---------- */

.gallery-empty {
  max-width: 34rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
}

.gallery-empty-icon {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gallery-soft);
  color: var(--gallery-gold);
}

.gallery-empty-icon svg {
  width: 2rem;
  height: 2rem;
}

.gallery-empty h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gallery-ink);
  margin: 0 0 0.75rem;
}

.gallery-empty p {
  color: var(--gallery-muted);
  line-height: 1.7;
  margin: 0 0 2rem;
}

.gallery-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ---------- Closing CTA band ---------- */

.gallery-cta {
  background: var(--gallery-ink);
  color: #fff;
  padding: 3.5rem 1.5rem;
}

@media (min-width: 768px) {
  .gallery-cta {
    padding: 5rem 3rem;
  }
}

.gallery-cta-inner {
  max-width: 46rem;
  margin: 0 auto;
  text-align: center;
}

.gallery-cta-kicker {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gallery-gold);
  margin-bottom: 1.25rem;
}

.gallery-cta-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 1rem;
  color: #fff;
}

@media (min-width: 768px) {
  .gallery-cta-title {
    font-size: 2.5rem;
  }
}

.gallery-cta-text {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.75;
  margin: 0 0 2.25rem;
}

.gallery-cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 640px) {
  .gallery-cta-row {
    flex-direction: row;
    justify-content: center;
  }
}

.gallery-cta-row .page-hero-cta--outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.gallery-cta-row .page-hero-cta--outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gallery-gold);
}

/* ---------- Lightbox ---------- */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-lightbox.is-open {
  opacity: 1;
}

.gallery-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: zoom-out;
}

.gallery-lb-stage {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(1200px, 94vw);
  width: 100%;
}

.gallery-lb-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 74vh;
}

.gallery-lb-frame img {
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lb-frame img.is-loaded {
  opacity: 1;
  transform: none;
}

.gallery-lb-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  padding: 0 1rem;
}

.gallery-lb-tag {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gallery-gold, #c5a059);
}

.gallery-lb-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.gallery-lb-counter {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

.gallery-lb-btn {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

/* display:flex above would otherwise defeat the hidden attribute. */
.gallery-lb-btn[hidden] {
  display: none;
}

.gallery-lb-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.gallery-lb-btn:hover {
  background: rgba(197, 160, 89, 0.9);
  border-color: transparent;
  color: #1a1a1a;
}

.gallery-lb-btn:focus-visible {
  outline: 3px solid var(--gallery-gold, #c5a059);
  outline-offset: 3px;
}

.gallery-lb-close {
  top: 1rem;
  right: 1rem;
}

.gallery-lb-nav {
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lb-nav:hover {
  transform: translateY(-50%) scale(1.06);
}

.gallery-lb-prev {
  left: 0.75rem;
}

.gallery-lb-next {
  right: 0.75rem;
}

@media (min-width: 768px) {
  .gallery-lb-btn {
    width: 3.25rem;
    height: 3.25rem;
  }

  .gallery-lb-close {
    top: 1.75rem;
    right: 1.75rem;
  }

  .gallery-lb-prev {
    left: 1.75rem;
  }

  .gallery-lb-next {
    right: 1.75rem;
  }
}

body.gallery-lb-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item-btn,
  .gallery-item-btn img,
  .gallery-item-veil,
  .gallery-item-meta,
  .gallery-item-zoom,
  .gallery-masonry,
  .gallery-lightbox,
  .gallery-lb-frame img {
    transition-duration: 0.01ms !important;
  }

  .gallery-item {
    opacity: 1;
    transform: none;
  }

  .gallery-item-btn:hover {
    transform: none;
  }

  .gallery-item-btn:hover img {
    transform: none;
  }
}
