/* Optional Gallery Block: native layout remains untouched. */
:where(.cb-gallery--grid).glb-gallery--grid {
  display: grid;
  grid-template-columns: repeat(var(--gallery-columns, 3), minmax(0, 1fr));
  gap: var(--gallery-gap, 1rem);
}
:where(.cb-gallery--grid).glb-gallery--grid > :where(.cb-gallery__item) {
  min-width: 0;
}

/* Optional compact native gallery. Hidden items stay in the Fancybox group. */
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid {
  display: grid;
  width: 100%;
  margin: 0 !important;
  grid-template-columns: repeat(var(--gallery-columns, 4), minmax(0, 1fr));
  gap: var(--gallery-gap, clamp(.5rem, .6vw, .75rem));
  align-items: stretch;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__item {
  width: auto !important;
  max-width: none;
  min-width: 0;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__frame {
  margin: 0 !important;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__link {
  position: relative;
  display: block;
  overflow: hidden;
  padding-bottom: var(--gallery-image-padding, 66.6667%) !important;
  border-radius: var(--gallery-radius, .25rem);
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__media {
  padding-bottom: var(--gallery-image-padding, 66.6667%) !important;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__item--overflow {
  display: none;
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__more {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui-font-font-family);
  font-size: var(--gallery-more-size, clamp(1rem, 1.2vw, 1.333rem));
  background: var(--gallery-more-background, rgba(255,255,255,.6));
  cursor: pointer;
  pointer-events: none;
  transition: background-color .2s ease;
}
@media (max-width: 1023px) {
  :where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid {
    grid-template-columns: repeat(var(--gallery-columns-tablet, 3), minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  :where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid:has(> :nth-child(2):last-child),
  :where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid:has(> :only-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  :where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  :where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__grid {
    grid-template-columns: repeat(var(--gallery-columns-mobile, 2), minmax(0, 1fr));
    gap: var(--gallery-gap-mobile, .375rem);
  }
}
:where(.cb-gallery--compact).glb-gallery--compact .cb-gallery__item:only-child {
  grid-column: 1 / -1;
}

