/*
 * Full-image presentation for the story Gallery.
 * Foreground images are never cropped. Any unused card/modal space is filled
 * by a soft Gaussian-blurred copy of the same image.
 */

.msf-gallery-photo-card {
	isolation: isolate;
	background: #0a1823;
}

.msf-gallery-photo-card::before,
.msf-gallery-lightbox__stage::before {
	position: absolute;
	z-index: 0;
	inset: -12%;
	background-image: var(--msf-gallery-blur-image, none);
	background-position: center;
	background-size: cover;
	content: "";
	filter: blur(22px) saturate(1.08);
	opacity: 0.88;
	pointer-events: none;
	transform: scale(1.08);
}

.msf-gallery-photo-card::after,
.msf-gallery-lightbox__stage::after {
	position: absolute;
	z-index: 0;
	inset: 0;
	background: rgba(3, 12, 20, 0.14);
	content: "";
	pointer-events: none;
}

.msf-gallery-photo-card__image {
	position: relative !important;
	z-index: 1;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	object-fit: contain !important;
	object-position: center center !important;
	filter: none !important;
	transform: none !important;
}

.msf-gallery-photo-card:hover .msf-gallery-photo-card__image,
.msf-gallery-photo-card:focus-visible .msf-gallery-photo-card__image {
	filter: saturate(1.035) contrast(1.015) !important;
	transform: none !important;
}

.msf-gallery-photo-card__overlay {
	z-index: 2;
}

.msf-gallery-photo-card__open {
	z-index: 3;
}

/* Keep the category label at the top while balancing the story heading block
 * around the vertical centre of the title card. */
.msf-gallery-story__title-card {
	justify-content: flex-start;
}

.msf-gallery-story__title-copy {
	width: 100%;
	margin-block: auto;
	padding-block: clamp(0.75rem, 1.5vw, 1.35rem);
}

.msf-gallery-lightbox__stage {
	isolation: isolate;
	background: #02080d;
}

.msf-gallery-lightbox__stage::before {
	background-image: var(--msf-lightbox-blur-image, none);
	filter: blur(34px) saturate(1.08);
	opacity: 0.74;
	transform: scale(1.12);
}

.msf-gallery-lightbox__stage::after {
	background: rgba(2, 8, 13, 0.22);
}

.msf-gallery-lightbox__image {
	position: relative !important;
	z-index: 1;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	object-fit: contain !important;
	object-position: center center !important;
}

.msf-gallery-lightbox__nav {
	z-index: 4;
}

@media (max-width: 600px) {
	.msf-gallery-photo-card::before {
		filter: blur(16px) saturate(1.06);
	}

	.msf-gallery-lightbox__stage::before {
		filter: blur(24px) saturate(1.06);
	}

	.msf-gallery-story__title-copy {
		padding-block: 0.65rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msf-gallery-photo-card__image {
		transition: none !important;
	}
}
