/* Front end only: slideshow, scrolling strips and lightbox. */

html { overflow-x: clip; }

/* Shared gallery resets: captions sit under the image, never over it */
.wp-block-gallery.is-style-bmd-strip figure.wp-block-image:has(figcaption)::before,
.wp-block-gallery.is-style-bmd-slideshow figure.wp-block-image:has(figcaption)::before { display: none !important; content: none !important; }

/* ---------- Scrolling strip ---------- */
.wp-block-gallery.has-nested-images.is-style-bmd-strip {
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: flex-start !important;
	gap: 48px !important;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	margin-right: calc((100% - 100vw) / 2) !important;
	padding-right: var(--wp--style--root--padding-right, 40px);
	padding-bottom: 8px;
	outline: none;
}
.wp-block-gallery.is-style-bmd-strip::-webkit-scrollbar { display: none; }
.wp-block-gallery.is-style-bmd-strip:focus-visible { outline: 2px solid var(--bmd-ink); outline-offset: 4px; }

.wp-block-gallery.has-nested-images.is-style-bmd-strip figure.wp-block-image {
	flex: 0 0 auto !important;
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: flex-start !important;
	gap: 10px;
	scroll-snap-align: start;
}
.wp-block-gallery.has-nested-images.is-style-bmd-strip figure.wp-block-image img {
	height: var(--bmd-strip-h) !important;
	width: auto !important;
	max-width: none !important;
	flex: none !important;
	object-fit: contain !important;
	cursor: zoom-in;
	display: block;
}
.wp-block-gallery.has-nested-images.is-style-bmd-strip figure.wp-block-image figcaption {
	position: static !important;
	background: none !important;
	color: var(--bmd-ink) !important;
	padding: 0 !important;
	margin: 0 !important;
	max-height: none !important;
	overflow: visible !important;
	text-align: left !important;
	text-shadow: none !important;
	font-size: 14px;
	line-height: 1.5;
	width: 0;
	min-width: 100%;
	display: flex;
	justify-content: space-between;
	gap: 12px;
}
.wp-block-gallery.is-style-bmd-strip > .blocks-gallery-caption { display: none; }

/* Caption: first line is the title, the rest is set as data */
.bmd-caption__text {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	font-family: var(--bmd-mono);
	font-size: 12px;
	line-height: 1.75;
	color: var(--bmd-graphite);
}
.bmd-caption__text::first-line {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 14px;
	color: var(--bmd-ink);
}
.bmd-counter {
	font-family: var(--bmd-mono);
	font-size: 12px;
	color: var(--bmd-graphite);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Call-to-action slide moved into a strip */
.wp-block-gallery.is-style-bmd-strip > .wp-block-group.is-style-bmd-cta {
	flex: 0 0 auto;
	height: var(--bmd-strip-h);
	width: calc(var(--bmd-strip-h) * 0.78);
	max-width: 86vw;
	margin: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	justify-content: space-between !important;
	align-items: flex-start !important;
	scroll-snap-align: start;
}
.wp-block-gallery.is-style-bmd-strip > .is-style-bmd-cta > * { margin: 0 !important; }

/* Strip arrows */
.bmd-strip-nav { display: flex; align-items: center; gap: 4px; margin-right: -12px !important; }
.bmd-strip-nav button {
	width: 44px; height: 44px;
	border: 0; padding: 0; margin: 0;
	background: transparent; color: var(--bmd-ink);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
}
.bmd-strip-nav button:disabled { opacity: 0.3; cursor: default; }
.bmd-strip-nav button:focus-visible { outline: 2px solid var(--bmd-ink); outline-offset: 2px; }

@media (max-width: 760px) {
	.wp-block-gallery.has-nested-images.is-style-bmd-strip { gap: 24px !important; }
	.wp-block-gallery.is-style-bmd-strip > .wp-block-group.is-style-bmd-cta { padding: 28px 24px; width: 78vw; }
}

/* ---------- Slideshow ---------- */
.wp-block-gallery.has-nested-images.is-style-bmd-slideshow { display: block !important; margin-top: 0; }
.wp-block-gallery.is-style-bmd-slideshow:not(.bmd-ready) figure.wp-block-image:not(:first-of-type) { display: none !important; }
.wp-block-gallery.is-style-bmd-slideshow:not(.bmd-ready) figure.wp-block-image:first-of-type img { height: var(--bmd-hero-h) !important; width: 100% !important; object-fit: contain !important; background: var(--bmd-mount); }

.bmd-slideshow__stage {
	position: relative;
	overflow: hidden;
	height: var(--bmd-hero-h);
	background: var(--bmd-mount);
	touch-action: pan-y;
	outline: none;
}
.bmd-slideshow__stage:focus-visible { outline: 2px solid var(--bmd-ink); outline-offset: 3px; }
.bmd-slideshow__track {
	display: flex;
	height: 100%;
	transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.wp-block-gallery.has-nested-images.is-style-bmd-slideshow .bmd-slideshow__track > figure.wp-block-image {
	flex: 0 0 100% !important;
	width: 100% !important;
	max-width: none !important;
	height: 100%;
	margin: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
}
.wp-block-gallery.has-nested-images.is-style-bmd-slideshow .bmd-slideshow__track > figure.wp-block-image img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: contain !important;
	flex: none !important;
	user-select: none;
	-webkit-user-drag: none;
}
.wp-block-gallery.has-nested-images.is-style-bmd-slideshow .bmd-slideshow__track > figure.is-style-bmd-fill img { object-fit: cover !important; }
.wp-block-gallery.is-style-bmd-slideshow figure.wp-block-image figcaption { display: none !important; }
.wp-block-gallery.is-style-bmd-slideshow > .blocks-gallery-caption { text-align: left; }

.bmd-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 56px; height: 56px;
	border: 0; padding: 0;
	background: transparent;
	color: var(--bmd-ink);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s;
	z-index: 2;
}
.bmd-arrow:hover, .bmd-arrow:focus-visible { opacity: 1; }
.bmd-arrow:focus-visible { outline: 2px solid var(--bmd-ink); }
.bmd-arrow--prev { left: 12px; }
.bmd-arrow--next { right: 12px; }

.bmd-slideshow__bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	padding-top: 16px;
}
.bmd-slideshow__bar .bmd-counter { padding-top: 3px; }

@media (max-width: 760px) {
	.bmd-arrow { display: none; }
}

/* ---------- Lightbox ---------- */
html.bmd-lock { overflow: hidden; }
.bmd-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(241, 241, 238, 0.98);
	color: var(--bmd-ink);
	display: flex;
	flex-direction: column;
	outline: none;
}
.bmd-lightbox[hidden] { display: none; }
.bmd-lightbox__top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 0 clamp(16px, 3vw, 40px);
}
.bmd-lightbox__close {
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bmd-ink);
	cursor: pointer;
}
.bmd-lightbox__stage {
	flex: 1;
	min-height: 0;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px 88px;
}
.bmd-lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bmd-lightbox .bmd-arrow { opacity: 0.7; }
.bmd-lightbox__caption {
	padding: 12px clamp(16px, 3vw, 40px) calc(28px + env(safe-area-inset-bottom, 0px));
	text-align: center;
}
.bmd-lightbox__caption .bmd-caption__text::first-line { font-size: 14px; }
@media (max-width: 760px) {
	.bmd-lightbox__stage { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.bmd-slideshow__track { transition: none !important; }
	.wp-block-gallery.is-style-bmd-strip { scroll-behavior: auto; }
}
