/* Gallery archive — natural-ratio masonry + contained lightbox. */

.post-type-archive-bc_gallery .wd-content-layout {
  padding-top: clamp(24px, 3vw, 40px) !important;
}

.post-type-archive-bc_gallery .wd-page-title {
  display: none !important;
}

.bc-gallery-wrap {
  max-width: min(1180px, calc(100vw - 48px));
  margin-inline: auto;
  padding: clamp(8px, 1.5vw, 20px) 0 clamp(56px, 7vw, 96px);
}

.bc-gallery-head {
  margin-bottom: clamp(28px, 4vw, 44px);
  text-align: center;
}

.bc-gallery-title {
  margin: 0;
  color: var(--bc-ink);
  font-family: var(--bc-serif);
  font-size: clamp(2.1rem, 4.2vw, 3.6rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.bc-gallery-grid {
  column-count: 3;
  column-gap: clamp(14px, 1.5vw, 22px);
}

.bc-gallery-item {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 clamp(14px, 1.5vw, 22px);
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid rgba(43, 29, 18, .08);
  border-radius: 6px;
  background: #f4f0ea;
  box-shadow: 0 10px 28px rgba(43, 29, 18, .06);
  cursor: zoom-in;
  vertical-align: top;
  transition: border-color .25s ease, box-shadow .25s ease;
}

.bc-gallery-item::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(20, 16, 12, .06), transparent 32%);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.bc-gallery-item::after {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 22px rgba(20, 16, 12, .14);
  color: #2c2824;
  content: "+";
  font-family: var(--bc-sans);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .25s ease, transform .25s ease;
}

.bc-gallery-item img {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
  background: #f4f0ea;
  transition: transform .4s ease;
}

.bc-gallery-item[data-full$=".svg"] img {
  padding: clamp(18px, 2vw, 30px);
}

.bc-gallery-item[data-full$="bagscabinet_logo_dark.svg"],
.bc-gallery-item[data-full$="bagscabinet_logo_dark.svg"] img,
.bc-gallery-lightbox-inner img[src$="bagscabinet_logo_dark.svg"] {
  background: #2c2824;
}

.bc-gallery-item:hover {
  border-color: rgba(174, 148, 116, .32);
  box-shadow: 0 16px 38px rgba(43, 29, 18, .12);
}

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

.bc-gallery-item:hover::before,
.bc-gallery-item:hover::after {
  opacity: 1;
  transform: none;
}

.bc-gallery-item .bc-gallery-caption {
  display: none !important;
}

.bc-gallery-pagination {
  margin-top: 32px;
  text-align: center;
}

.bc-gallery-empty {
  color: var(--bc-muted);
  text-align: center;
}

/* Lightbox */
.bc-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 56px);
  background: rgba(20, 16, 12, .84);
  backdrop-filter: blur(10px);
}

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

.bc-gallery-lightbox-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  width: min(820px, calc(100vw - 64px));
  max-height: calc(100vh - 96px);
  overflow: hidden;
  border: 1px solid rgba(219, 198, 170, .22);
  border-radius: 8px;
  background: #f4f0ea;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .46);
}

.bc-gallery-lightbox-inner img {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: min(72vh, 720px);
  padding: 0;
  object-fit: contain;
  background: #f4f0ea;
}

.bc-gallery-lightbox-inner img[src$=".svg"] {
  min-height: 220px;
  padding: clamp(28px, 4vw, 48px);
}

.bc-gallery-lightbox-meta {
  position: static;
  max-width: none;
  padding: 18px 24px 20px;
  border-top: 1px solid rgba(43, 29, 18, .1);
  background: #fff;
  box-shadow: none;
  color: var(--bc-ink);
  text-align: left;
}

.bc-gallery-lightbox-meta h3 {
  margin: 0 0 6px;
  color: var(--bc-ink) !important;
  font-family: var(--bc-sans);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}

.bc-gallery-lightbox-meta p {
  margin: 0;
  color: var(--bc-muted);
  font-size: 14px;
  line-height: 1.6;
}

.bc-gallery-close {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 2147483647;
  display: flex;
  width: 44px;
  height: 44px;
  min-height: 0 !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, .32) !important;
  border-radius: 50% !important;
  background: rgba(20, 16, 12, .72) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.bc-gallery-close:hover {
  border-color: rgba(255, 255, 255, .52) !important;
  background: rgba(20, 16, 12, .92) !important;
}

body:has(.bc-gallery-lightbox:not([hidden])) :is(
  .bcb,
  .bc-float-bar,
  iframe[title*="chat" i]
) {
  visibility: hidden !important;
  opacity: 0 !important;
}

@media (max-width: 1024px) {
  .bc-gallery-grid {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  .bc-gallery-wrap {
    max-width: calc(100vw - 28px);
  }

  .bc-gallery-grid {
    column-count: 1;
  }

  .bc-gallery-lightbox {
    padding: 16px;
  }

  .bc-gallery-lightbox-inner {
    width: 100%;
    max-height: calc(100vh - 72px);
  }

  .bc-gallery-lightbox-inner img {
    max-height: 64vh;
  }

  .bc-gallery-lightbox-inner img[src$=".svg"] {
    min-height: 170px;
    padding: 24px;
  }

  .bc-gallery-lightbox-meta {
    padding: 15px 17px 17px;
  }
}
