.pbhg-gallery {
  width: 100%;
  height: var(--pbhg-height, 500px);
  --pbhg-gutter: 4px;
  --pbhg-tile-radius: 4px;
  --pbhg-frame-radius: 12px;
  --pbhg-overlay-bg: rgba(0, 0, 0, 0.45);
  --pbhg-skeleton-base: #eceff3;
  --pbhg-skeleton-highlight: rgba(255, 255, 255, 0.55);
  --pbhg-skeleton-speed: 1.6s;
  --pbhg-skeleton-fade: 180ms;
}

.pbhg-gallery__mobile {
  height: 100%;
}

.pbhg-gallery__desktop {
  display: none;
  height: 100%;
}

.pbhg-gallery.pbhg-gallery--use-desktop .pbhg-gallery__mobile {
  display: none;
}

.pbhg-gallery.pbhg-gallery--use-desktop .pbhg-gallery__desktop {
  display: block;
}

.pbhg-mosaic {
  width: 100%;
  height: 100%;
}

.pbhg-mosaic__scroller {
  height: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--pbhg-gutter, 4px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-inline: var(--pbhg-inset, 20px);
  scroll-padding-inline: var(--pbhg-inset, 20px);
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}

.pbhg-mosaic__scroller::-webkit-scrollbar {
  display: none;
}

.pbhg-mosaic__col--square {
  flex: 0 0 calc(100% / var(--pbhg-tiles, 1.15));
}

.pbhg-mosaic__col--stacked {
  flex: 0 0 calc(100% / var(--pbhg-tiles, 1.15) / 2);
}

.pbhg-mosaic__col {
  height: 100%;
  display: grid;
  gap: var(--pbhg-gutter, 4px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.pbhg-mosaic__col--square {
  grid-template-rows: 1fr;
}

.pbhg-mosaic__col--stacked {
  grid-template-rows: 1fr 1fr;
}

.pbhg-mosaic__col:first-child .pbhg-media__tile:first-child {
  border-top-left-radius: var(--pbhg-frame-radius, 12px);
  border-bottom-left-radius: var(--pbhg-frame-radius, 12px);
}

.pbhg-mosaic__col:last-child .pbhg-media__tile:last-child {
  border-top-right-radius: var(--pbhg-frame-radius, 12px);
  border-bottom-right-radius: var(--pbhg-frame-radius, 12px);
}

.pbhg-media__tile {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: var(--pbhg-tile-radius, 4px);
  overflow: hidden;
  display: block;
}

.pbhg-media__tile img,
.pbhg-media__tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pbhg-gallery--skeleton .pbhg-media__tile--skeleton img,
.pbhg-gallery--skeleton .pbhg-media__tile--skeleton video {
  opacity: 0;
  transition: opacity var(--pbhg-skeleton-fade, 180ms) ease;
}

.pbhg-gallery--skeleton .pbhg-media__tile--loaded img,
.pbhg-gallery--skeleton .pbhg-media__tile--loaded video {
  opacity: 1;
}

.pbhg-media__skeleton {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--pbhg-skeleton-base, #eceff3);
  opacity: 1;
  transition: opacity var(--pbhg-skeleton-fade, 180ms) ease;
}

.pbhg-gallery--skeleton .pbhg-media__skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 15%,
    var(--pbhg-skeleton-highlight, rgba(255, 255, 255, 0.55)) 45%,
    transparent 75%
  );
  transform: translateX(-120%);
  animation: pbhg-skeleton-shimmer var(--pbhg-skeleton-speed, 1.6s) ease-in-out infinite;
}

.pbhg-gallery--skeleton .pbhg-media__tile--loaded .pbhg-media__skeleton {
  opacity: 0;
  visibility: hidden;
}

.pbhg-gallery--skeleton .pbhg-media__tile--error .pbhg-media__skeleton::after {
  display: none;
}

.pbhg-gallery--skeleton .pbhg-media__tile--error img,
.pbhg-gallery--skeleton .pbhg-media__tile--error video {
  opacity: 0;
}

@keyframes pbhg-skeleton-shimmer {
  to {
    transform: translateX(120%);
  }
}

.pbhg-dgrid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--pbhg-grid-cols, 5), 1fr);
  grid-template-rows: repeat(var(--pbhg-grid-rows, 4), 1fr);
  gap: var(--pbhg-gutter, 8px);
  border-radius: var(--pbhg-frame-radius, 12px);
  overflow: hidden;
}

.pbhg-dgrid > a.pbhg-media__tile:nth-child(1) {
  grid-column: 1/-1;
  grid-row: 1/calc(var(--pbhg-hero-row-span, 3) + 1);
}

.pbhg-dgrid > a.pbhg-media__tile:nth-child(n + 2) {
  grid-row: calc(var(--pbhg-hero-row-span, 3) + 1)/-1;
  grid-column: auto;
}

.pbhg-dgrid__overlay {
  position: absolute;
  inset: 0;
  background: var(--pbhg-overlay-bg, rgba(0, 0, 0, 0.45));
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pbhg-dgrid__overlayText {
  font-family: Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.pbhg-mosaic__lightboxVideo {
  width: min(100vw, 1000px);
  max-height: 85vh;
  margin: 0 auto;
  display: block;
}
