/**
 * Gallery. Prefix: bkg-
 *
 * Masonry by CSS columns rather than a grid of squares: the library mixes 3:2
 * landscape with 3:4 portrait, and cropping everything square throws away half
 * of the portrait thali shots.
 *
 * Button rules are scoped to a container so they outrank the Elementor kit's
 * `.elementor-kit-6 button` at (0,1,1).
 */

#bongknot-gallery {
  --bkg-ink: var(--ink, #241512);
  --bkg-ivory: var(--ivory-ground, #FAF6EF);
  --bkg-surface: var(--surface, #FFFFFF);
  --bkg-paper: #F2EBE0;
  --bkg-maroon: var(--maroon, #7A1220);
  --bkg-maroon-deep: var(--maroon-deep, #5A0D18);
  --bkg-gold: var(--gold, #B08A3E);
  --bkg-gerua: #B5652D;
  --bkg-muted: var(--muted, #6E5A50);
  --bkg-line: var(--line, #E3DACB);
  --bkg-pad: clamp(56px, 8vw, 110px);

  display: block;
  background: var(--bkg-ivory);
  color: var(--bkg-ink);
}

html body.bkg-page .site-main,
html body.bkg-page .page-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
html body.bkg-page .page-header { display: none; }

#bongknot-gallery .bkg-inner {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 24px;
}

#bongknot-gallery .bkg-label {
  font-family: var(--font-body, Karla), system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--bkg-gold);
  margin: 0 0 16px;
}

/* ---------- Hero ---------- */

#bongknot-gallery .bkg-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(320px, 40vh, 440px);
  background: var(--bkg-maroon-deep);
  color: var(--bkg-ivory);
  padding-block: clamp(60px, 9vw, 104px);
}
#bongknot-gallery .bkg-hero .bkg-inner { max-width: 840px; text-align: center; }
#bongknot-gallery .bkg-mark {
  display: block;
  width: 42px;
  height: 0;
  border-top: 1px solid var(--bkg-gold);
  margin: 0 auto 20px;
}
#bongknot-gallery .bkg-hero h1 {
  color: var(--bkg-ivory);
  max-width: 18ch;
  text-wrap: balance;
  margin: 0 auto;
  text-shadow: 0 1px 28px rgba(36, 21, 18, 0.3);
}
#bongknot-gallery .bkg-hero .bkg-lede {
  margin: 20px auto 0;
  max-width: 52ch;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgba(250, 246, 239, 0.9);
}
#bongknot-gallery .bkg-hero .bkg-label { color: rgba(250, 246, 239, 0.82); letter-spacing: 0.12em; }

/* ---------- Filters ---------- */

#bongknot-gallery .bkg-board { padding-block: var(--bkg-pad); }

#bongknot-gallery .bkg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: clamp(30px, 4vw, 48px);
}
#bongknot-gallery .bkg-filters .bkg-chip {
  font-family: var(--font-body, Karla), system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--bkg-line);
  background-color: transparent;
  color: var(--bkg-muted);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
#bongknot-gallery .bkg-filters .bkg-chip:hover {
  background-color: transparent;
  border-color: var(--bkg-maroon);
  color: var(--bkg-maroon);
}
#bongknot-gallery .bkg-filters .bkg-chip[aria-pressed="true"] {
  background-color: var(--bkg-maroon);
  border-color: var(--bkg-maroon);
  color: var(--bkg-ivory);
}
#bongknot-gallery .bkg-filters .bkg-chip:focus-visible { outline: 2px solid var(--bkg-gold); outline-offset: 2px; }
#bongknot-gallery .bkg-chip span { opacity: 0.6; margin-left: 6px; font-variant-numeric: tabular-nums; }

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

#bongknot-gallery .bkg-grid {
  column-count: 3;
  column-gap: 20px;
}
@media (max-width: 1000px) { #bongknot-gallery .bkg-grid { column-count: 2; } }
@media (max-width: 560px)  { #bongknot-gallery .bkg-grid { column-count: 1; } }

body #bongknot-gallery a.bkg-item { text-decoration: none; color: inherit; }
#bongknot-gallery .bkg-item {
  break-inside: avoid;
  margin: 0 0 20px;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
}
#bongknot-gallery .bkg-item[hidden] { display: none; }

#bongknot-gallery .bkg-shot {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--bkg-line);
  border-radius: 3px;
  background: var(--bkg-paper);
}
#bongknot-gallery .bkg-shot img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 760ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
#bongknot-gallery .bkg-item:hover .bkg-shot img,
#bongknot-gallery .bkg-item:focus-visible .bkg-shot img { transform: scale(1.045); }

#bongknot-gallery .bkg-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 18px;
  background: linear-gradient(180deg, rgba(36, 21, 18, 0) 45%, rgba(36, 21, 18, 0.72) 100%);
  opacity: 0;
  transition: opacity 300ms ease;
}
#bongknot-gallery .bkg-item:hover .bkg-veil,
#bongknot-gallery .bkg-item:focus-visible .bkg-veil { opacity: 1; }
#bongknot-gallery .bkg-veil span {
  font-family: var(--font-heading, Marcellus), Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.3;
  color: var(--bkg-ivory);
  text-shadow: 0 1px 12px rgba(36, 21, 18, 0.5);
}
#bongknot-gallery .bkg-item:focus-visible { outline: 2px solid var(--bkg-gold); outline-offset: 3px; }

#bongknot-gallery .bkg-empty {
  text-align: center;
  color: var(--bkg-muted);
  padding: 40px 0;
}
#bongknot-gallery .bkg-empty[hidden] { display: none; }

/* Touch devices have no hover, so the caption sits on permanently. */
@media (hover: none) {
  #bongknot-gallery .bkg-veil { opacity: 1; background: linear-gradient(180deg, rgba(36, 21, 18, 0) 55%, rgba(36, 21, 18, 0.66) 100%); }
  #bongknot-gallery .bkg-item { cursor: pointer; }
}

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

.bkg-box {
  position: fixed;
  inset: 0;
  z-index: 99996;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 48px);
  background: rgba(30, 6, 10, 0.92);
  opacity: 0;
  transition: opacity 260ms ease;
}
@supports (backdrop-filter: blur(4px)) {
  .bkg-box { background: rgba(30, 6, 10, 0.86); backdrop-filter: blur(8px); }
}
.bkg-box[hidden] { display: none; }
.bkg-box.is-open { opacity: 1; }

.bkg-box-stage {
  position: relative;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.bkg-box img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  width: auto;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}
.bkg-box figcaption {
  font-family: var(--font-body, Karla), system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(250, 246, 239, 0.88);
  text-align: center;
  max-width: 60ch;
}
.bkg-box figcaption b {
  display: block;
  font-family: var(--font-heading, Marcellus), Georgia, serif;
  font-weight: 400;
  font-size: 1.25rem;
  color: #FAF6EF;
  margin-bottom: 4px;
}
.bkg-box-count {
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(250, 246, 239, 0.55);
  font-variant-numeric: tabular-nums;
}

.bkg-box .bkg-box-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: rgba(250, 246, 239, 0.1);
  border: 1px solid rgba(250, 246, 239, 0.28);
  border-radius: 50%;
  color: #FAF6EF;
  cursor: pointer;
  font-size: 0;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.bkg-box .bkg-box-btn:hover { background-color: rgba(250, 246, 239, 0.22); border-color: rgba(250, 246, 239, 0.6); }
.bkg-box .bkg-box-btn svg { width: 20px; height: 20px; }
.bkg-box .bkg-prev { left: -68px; }
.bkg-box .bkg-next { right: -68px; }

.bkg-box .bkg-box-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  transform: none;
}
.bkg-box .bkg-box-btn:focus-visible { outline: 2px solid var(--gold, #B08A3E); outline-offset: 2px; }

@media (max-width: 900px) {
  .bkg-box .bkg-prev { left: 4px; }
  .bkg-box .bkg-next { right: 4px; }
  .bkg-box img { max-height: calc(100vh - 230px); }
  .bkg-box .bkg-box-close { top: 10px; right: 10px; }
}

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

#bongknot-gallery .bkg-band {
  background: var(--bkg-maroon);
  color: var(--bkg-ivory);
  padding-block: clamp(56px, 8vw, 100px);
  text-align: center;
}
#bongknot-gallery .bkg-band h2 {
  color: var(--bkg-ivory);
  margin: 0 0 14px;
  font-size: clamp(1.625rem, 3vw, 2.375rem);
}
#bongknot-gallery .bkg-band p {
  color: rgba(250, 246, 239, 0.78);
  max-width: 52ch;
  margin: 0 auto;
  line-height: 1.7;
}
#bongknot-gallery .bkg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}
body #bongknot-gallery .bkg-band a.bk-btn--ghost {
  background: transparent;
  color: var(--bkg-ivory);
  border: 1px solid rgba(250, 246, 239, 0.45);
  text-decoration: none;
}
body #bongknot-gallery .bkg-band a.bk-btn--ghost:hover {
  background: var(--bkg-ivory);
  color: var(--bkg-maroon);
  border-color: var(--bkg-ivory);
}

@media (max-width: 480px) {
  #bongknot-gallery .bkg-actions { flex-direction: column; align-items: stretch; }
  #bongknot-gallery .bkg-actions .bk-btn { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #bongknot-gallery .bkg-shot img,
  .bkg-box { transition: none; }
}
