/* Final sponsor and gallery refinements */

.sponsor-showcase .funder-bubble,
.sponsor-showcase .funder-bubble:hover,
.sponsor-showcase .funder-bubble:focus,
.sponsor-showcase .funder-bubble:focus-within {
  z-index: auto !important;
  transform: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.sponsor-showcase .funder-bubble img,
.sponsor-showcase .funder-bubble:hover img,
.sponsor-showcase .funder-bubble:focus img,
.sponsor-showcase .funder-bubble:focus-within img {
  transform: none !important;
  filter: none !important;
}

.heritage-gallery main > .section {
  position: relative;
  padding-top: clamp(72px, 8vw, 118px) !important;
  background:
    linear-gradient(rgba(252, 249, 242, 0.965), rgba(248, 241, 229, 0.985)),
    url("assets/cultural-ink-landscape-v1.webp") center top / cover fixed !important;
}

.heritage-gallery main > .section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 118, 39, 0.52), transparent);
}

.heritage-gallery .gallery-filter-note {
  max-width: 930px;
  margin: -0.25rem 0 2rem !important;
  padding: 18px 22px !important;
  border: 1px solid rgba(139, 35, 45, 0.12) !important;
  border-radius: 16px !important;
  background: rgba(255, 253, 248, 0.88) !important;
  color: #4b4540 !important;
  box-shadow: 0 14px 34px rgba(54, 38, 25, 0.06) !important;
  backdrop-filter: blur(10px);
}

.heritage-gallery .gallery-filter-note span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #921f2c;
  font-size: 1.15rem;
}

.heritage-gallery .gallery-filter-note p {
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.55;
}

.heritage-gallery .gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 12px;
  padding: 7px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(35, 31, 28, 0.09);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.88);
  box-shadow: 0 12px 32px rgba(55, 39, 27, 0.06);
  backdrop-filter: blur(12px);
}

.heritage-gallery .gallery-filters button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 13px 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #3c3935;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.heritage-gallery .gallery-filters button b {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding-inline: 6px;
  border-radius: 999px;
  background: rgba(139, 27, 39, 0.08);
  color: #8b1b27;
  font-size: 0.66rem;
}

.heritage-gallery .gallery-filters button:hover {
  background: rgba(139, 27, 39, 0.06);
}

.heritage-gallery .gallery-filters button.is-active {
  background: #8b1b27;
  color: #fff;
  box-shadow: 0 8px 20px rgba(111, 16, 27, 0.18);
}

.heritage-gallery .gallery-filters button.is-active b {
  background: rgba(255, 255, 255, 0.18);
  color: #fff4d7;
}

.gallery-results {
  margin: 0 0 20px;
  color: #736c64;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.heritage-gallery .gallery {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  grid-auto-flow: dense;
  grid-auto-rows: 72px !important;
  gap: clamp(12px, 1.4vw, 20px) !important;
}

.heritage-gallery .gallery figure,
.heritage-gallery .gallery figure:nth-child(n),
.heritage-gallery .gallery figure.is-wide,
.heritage-gallery .gallery figure.is-portrait {
  position: relative;
  grid-column: span 4 !important;
  grid-row: span 4 !important;
  min-width: 0;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(45, 39, 34, 0.09) !important;
  border-radius: 18px !important;
  background: #fffdfa !important;
  box-shadow: 0 13px 34px rgba(45, 34, 25, 0.08) !important;
  cursor: zoom-in;
  transform: none;
  transition: transform 220ms ease, box-shadow 220ms ease !important;
}

.heritage-gallery .gallery figure:nth-child(10n + 1) {
  grid-column: span 8 !important;
  grid-row: span 6 !important;
}

.heritage-gallery .gallery figure:nth-child(10n + 2) {
  grid-column: span 4 !important;
  grid-row: span 6 !important;
}

.heritage-gallery .gallery figure:nth-child(10n + 6),
.heritage-gallery .gallery figure:nth-child(10n + 7) {
  grid-column: span 6 !important;
  grid-row: span 5 !important;
}

.heritage-gallery .gallery figure:hover,
.heritage-gallery .gallery figure:focus-visible {
  transform: translateY(-3px) !important;
  box-shadow: 0 20px 48px rgba(45, 34, 25, 0.13) !important;
}

.heritage-gallery .gallery figure:focus-visible {
  outline: 3px solid #c79a42;
  outline-offset: 3px;
}

.heritage-gallery .gallery img {
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
  padding: 0 !important;
  object-fit: cover !important;
  object-position: center 36% !important;
  border-radius: 0 !important;
  background: #e9e4da;
  transform: none;
  transition: transform 380ms cubic-bezier(0.2, 0.72, 0.25, 1) !important;
}

.heritage-gallery .gallery figure:hover img {
  transform: scale(1.018) !important;
}

.heritage-gallery .gallery figcaption {
  position: static !important;
  width: auto !important;
  min-height: 54px;
  padding: 13px 15px 14px !important;
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(46, 39, 33, 0.07);
  border-radius: 0 !important;
  background: #fffdfa !important;
  color: #38342f !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.35;
  transform: none !important;
}

.lightbox {
  position: relative;
  width: min(1240px, calc(100% - 24px)) !important;
  max-width: none;
  max-height: calc(100dvh - 24px) !important;
  border: 1px solid rgba(247, 215, 147, 0.24) !important;
  border-radius: 20px !important;
  background: #111614 !important;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.lightbox::backdrop {
  background: rgba(10, 12, 11, 0.88) !important;
  backdrop-filter: blur(8px);
}

.lightbox figure {
  height: min(88dvh, 900px) !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
}

.lightbox img {
  object-fit: contain !important;
  background: #111614 !important;
}

.lightbox__meta {
  min-height: 64px;
  padding: 15px 78px 15px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #171d1a;
}

.lightbox .lightbox__meta figcaption {
  padding: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.lightbox__count {
  flex: 0 0 auto;
  color: #e6c77e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(24, 29, 27, 0.86);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color 180ms ease, transform 180ms ease;
}

.lightbox__close {
  top: 15px !important;
  right: 15px !important;
  width: 44px !important;
  height: 44px !important;
  font-size: 1.45rem;
}

.lightbox__nav {
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translateY(-50%);
  font-size: 2rem;
}

.lightbox__nav--prev {
  left: 16px;
}

.lightbox__nav--next {
  right: 16px;
}

.lightbox__close:hover {
  background: #8b1b27;
  transform: scale(1.05);
}

.lightbox__nav:hover {
  background: #8b1b27;
  transform: translateY(-50%) scale(1.05);
}

@media (max-width: 980px) {
  .heritage-gallery .gallery figure,
  .heritage-gallery .gallery figure:nth-child(n),
  .heritage-gallery .gallery figure.is-wide,
  .heritage-gallery .gallery figure.is-portrait {
    grid-column: span 6 !important;
    grid-row: span 5 !important;
  }

  .heritage-gallery .gallery figure:nth-child(7n + 1) {
    grid-column: span 12 !important;
    grid-row: span 7 !important;
  }
}

@media (max-width: 640px) {
  .heritage-gallery .gallery-filters {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-radius: 15px;
    scrollbar-width: thin;
  }

  .heritage-gallery .gallery-filters button {
    flex: 0 0 auto;
  }

  .heritage-gallery .gallery {
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    gap: 16px !important;
  }

  .heritage-gallery .gallery figure,
  .heritage-gallery .gallery figure:nth-child(n),
  .heritage-gallery .gallery figure.is-wide,
  .heritage-gallery .gallery figure.is-portrait {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .heritage-gallery .gallery img {
    height: min(68vw, 330px) !important;
    object-position: center 32% !important;
  }

  .lightbox__nav {
    width: 42px;
    height: 42px;
  }

  .lightbox__nav--prev {
    left: 8px;
  }

  .lightbox__nav--next {
    right: 8px;
  }

  .lightbox__meta {
    padding: 14px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .heritage-gallery .gallery figure,
  .heritage-gallery .gallery img,
  .lightbox__close,
  .lightbox__nav {
    transition: none !important;
  }
}
