/*
 * 5.0.7: Jetpack block fallbacks. Jetpack is not installed, but older project content still contains
 * jetpack/tiled-gallery, jetpack/slideshow and jetpack/image-compare blocks. These rules rebuild their
 * layout from the saved markup; js/jetpack-fallbacks.js adds the slideshow + compare behaviour.
 */

/* ---------- Tiled gallery: rows / columns as saved (column widths come from inline flex-basis) ---------- */
.wp-block-jetpack-tiled-gallery { max-width: 100%; margin-inline: auto; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__gallery { display: flex; flex-direction: column; width: 100%; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__row { display: flex; flex-direction: row; justify-content: center; width: 100%; margin: 0; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__row + .tiled-gallery__row { margin-top: 4px; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__col { display: flex; flex-direction: column; justify-content: center; min-width: 0; margin: 0; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__col + .tiled-gallery__col { margin-left: 4px; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__item { position: relative; display: flex; flex-grow: 1; margin: 0; padding: 0; overflow: hidden; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__item + .tiled-gallery__item { margin-top: 4px; }
.wp-block-jetpack-tiled-gallery .tiled-gallery__item img { display: block; width: 100%; height: 100%; max-width: 100%; object-fit: cover; }

/* ---------- Slideshow: native horizontal scroll with snap ---------- */
.wp-block-jetpack-slideshow { position: relative; max-width: 100%; margin-inline: auto; background: #000; }
.wp-block-jetpack-slideshow_container { position: relative; }
.wp-block-jetpack-slideshow_swiper-wrapper {
	display: flex; margin: 0; padding: 0; list-style: none;
	overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth;
	scrollbar-width: none;
}
.wp-block-jetpack-slideshow_swiper-wrapper::-webkit-scrollbar { display: none; }
.wp-block-jetpack-slideshow_swiper-wrapper:focus-visible { outline: 2px solid var(--bloompink, #e94e8a); outline-offset: -2px; }
.wp-block-jetpack-slideshow_slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0; list-style: none; scroll-snap-align: center; }
.wp-block-jetpack-slideshow_slide figure { margin: 0; width: 100%; display: flex; justify-content: center; }
.wp-block-jetpack-slideshow_image { display: block; width: 100%; height: auto; max-width: 100%; max-height: 80vh; object-fit: contain; }

.wp-block-jetpack-slideshow_button-prev,
.wp-block-jetpack-slideshow_button-next,
.wp-block-jetpack-slideshow_button-pause {
	position: absolute; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
	background: rgba(0, 0, 0, .35); cursor: pointer; display: flex; align-items: center; justify-content: center;
	transition: background-color .2s;
}
.wp-block-jetpack-slideshow_button-prev:hover,
.wp-block-jetpack-slideshow_button-next:hover,
.wp-block-jetpack-slideshow_button-pause:hover { background: rgba(0, 0, 0, .6); }
.wp-block-jetpack-slideshow_button-prev:focus-visible,
.wp-block-jetpack-slideshow_button-next:focus-visible,
.wp-block-jetpack-slideshow_button-pause:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.wp-block-jetpack-slideshow_button-prev,
.wp-block-jetpack-slideshow_button-next { top: 50%; transform: translateY(-50%); }
.wp-block-jetpack-slideshow_button-prev { left: 12px; }
.wp-block-jetpack-slideshow_button-next { right: 12px; }
.wp-block-jetpack-slideshow_button-prev::before,
.wp-block-jetpack-slideshow_button-next::before {
	content: ""; width: 12px; height: 12px; border: solid #fff; border-width: 0 0 2px 2px;
}
.wp-block-jetpack-slideshow_button-prev::before { transform: translateX(2px) rotate(45deg); }
.wp-block-jetpack-slideshow_button-next::before { transform: translateX(-2px) rotate(-135deg); }
.wp-block-jetpack-slideshow_button-pause { right: 12px; bottom: 12px; width: 36px; height: 36px; }
.wp-block-jetpack-slideshow_button-pause::before { content: ""; width: 10px; height: 12px; border: solid #fff; border-width: 0 3px; }
.wp-block-jetpack-slideshow_button-pause.is-paused::before { width: 0; height: 0; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; transform: translateX(2px); }

.wp-block-jetpack-slideshow_pagination { position: absolute; left: 0; right: 0; bottom: 14px; z-index: 2; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.wp-block-jetpack-slideshow_pagination button {
	pointer-events: auto; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .45); cursor: pointer;
}
.wp-block-jetpack-slideshow_pagination button[aria-current="true"] { background: #fff; }
.wp-block-jetpack-slideshow_pagination button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 600px) {
	.wp-block-jetpack-slideshow_button-prev,
	.wp-block-jetpack-slideshow_button-next { width: 36px; height: 36px; }
	.wp-block-jetpack-slideshow_button-prev { left: 6px; }
	.wp-block-jetpack-slideshow_button-next { right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
	.wp-block-jetpack-slideshow_swiper-wrapper { scroll-behavior: auto; }
}

/* ---------- Image compare: "after" image clipped over "before", draggable split ---------- */
.wp-block-jetpack-image-compare { max-width: 100%; margin-inline: auto; }
.wp-block-jetpack-image-compare .juxtapose { position: relative; overflow: hidden; line-height: 0; --split: 50%; }
.wp-block-jetpack-image-compare .juxtapose img { display: block; width: 100%; height: auto; max-width: 100%; }
.wp-block-jetpack-image-compare .juxtapose .image-compare__image-after {
	position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 0 0 var(--split));
}
.wp-block-jetpack-image-compare .bloom-compare-handle {
	position: absolute; top: 0; bottom: 0; left: var(--split); width: 2px; margin-left: -1px; background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, .4); pointer-events: none; z-index: 2;
}
.wp-block-jetpack-image-compare .bloom-compare-handle::after {
	content: ""; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px;
	border: 2px solid #fff; border-radius: 50%; background: rgba(0, 0, 0, .35);
}
.wp-block-jetpack-image-compare .bloom-compare-range {
	position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y;
}
.wp-block-jetpack-image-compare .juxtapose:focus-within .bloom-compare-handle::after { border-color: var(--bloompink, #e94e8a); }

/* 5.0.8: slideshows with more than 10 slides show a counter instead of dots */
.wp-block-jetpack-slideshow_pagination .bloom-slide-counter {
	padding: 3px 10px; border-radius: 12px; background: rgba(0, 0, 0, .45); color: #fff;
	font-size: 12px; letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
