.gallery-grid .bni-gallery-open {
  display: block; position: relative; width: 100%; height: 100%; padding: 0;
  border: 0; background: transparent; cursor: zoom-in; color: #fff;
}
.gallery-grid .bni-gallery-open::after {
  content: '+'; position: absolute; z-index: 2; right: 12px; bottom: 12px; display: grid;
  place-items: center; width: 36px; height: 36px; border: 1px solid #fff9;
  border-radius: 50%; background: #111b; font: 26px/1 sans-serif;
}
.gallery-grid .bni-gallery-open:focus-visible { outline: 3px solid #d4b778; outline-offset: -5px; }
.gallery-grid figure[hidden] { display: none !important; }
.bni-gallery-title-group { display: inline-block; max-width: 100%; vertical-align: top; }
.bni-gallery-title-group h2 { width: max-content; max-width: 100%; }
.bni-gallery-progress {
  width: 100%; max-width: 100%; height: 3px; margin: 24px auto 0;
  overflow: hidden; background: var(--line); border-radius: 3px;
}
.bni-gallery-progress span {
  display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left;
  background: var(--gold);
}
@keyframes bni-gallery-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.gallery-grid.bni-gallery-preview figure {
  background: #000; opacity: 1 !important; transform: none !important; transition: none !important;
}
.gallery-grid.bni-gallery-preview figure img {
  transition: opacity 280ms ease var(--gallery-stagger, 0ms), transform .5s ease;
}
.gallery-grid.bni-gallery-preview figure figcaption,
.gallery-grid.bni-gallery-preview figure .bni-gallery-open::after {
  transition: opacity 280ms ease var(--gallery-stagger, 0ms);
}
.gallery-grid.bni-gallery-preview figure.bni-gallery-fading img,
.gallery-grid.bni-gallery-preview figure.bni-gallery-fading figcaption,
.gallery-grid.bni-gallery-preview figure.bni-gallery-fading .bni-gallery-open::after { opacity: 0; }
.gallery-grid.bni-gallery-changing .bni-gallery-open { pointer-events: none; }
.bni-gallery-dialog {
  box-sizing: border-box; width: min(1120px, calc(100% - 32px)); max-width: none;
  max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #b8975b66;
  border-radius: 12px; background: #131716; color: #faf8f2;
  font-family: inherit; color-scheme: dark; overscroll-behavior: contain;
}
.bni-gallery-dialog::backdrop { background: rgb(0 0 0 / .88); }
.bni-gallery-panel { padding: 16px; }
.bni-gallery-header, .bni-gallery-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bni-gallery-header { margin-bottom: 12px; }
.bni-gallery-header h2 { margin: 0; font-size: 18px; color: #d4b778; }
.bni-gallery-dialog button {
  flex-shrink: 0; min-width: 48px; min-height: 48px; padding: 8px 14px;
  border: 1px solid #b8975b88; border-radius: 6px; background: #232a27;
  color: #faf8f2; font: inherit; cursor: pointer;
}
.bni-gallery-dialog button:hover { background: #384037; }
.bni-gallery-dialog button:focus-visible { outline: 3px solid #e7c88b; outline-offset: 3px; }
.bni-gallery-close span { padding-left: 8px; font-size: 24px; vertical-align: middle; }
.bni-gallery-stage { display: grid; place-items: center; height: min(66dvh, 720px); touch-action: pan-y pinch-zoom; }
.bni-gallery-stage img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.bni-gallery-footer { margin-top: 12px; }
.bni-gallery-description { min-width: 0; text-align: center; }
.bni-gallery-description p { margin: 0; overflow-wrap: anywhere; line-height: 1.45; }
.bni-gallery-count { color: #d4b778; font-variant-numeric: tabular-nums; }
.bni-gallery-caption { font-size: 14px; }
.bni-gallery-error { text-align: center; color: #f3c9a2; }
.bni-gallery-dialog [hidden] { display: none !important; }
@media (max-width: 600px) {
  .bni-gallery-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .bni-gallery-panel { padding: 12px; }
  .bni-gallery-stage { height: 54dvh; }
  .bni-gallery-footer { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-grid img { transition: none; }
  .gallery-grid figure:hover img { transform: none; }
}
