/* Modern core/gallery presentation, loaded only on singular views containing the block. */
.entry-content .wp-block-gallery.has-nested-images {
	display: flex;
	flex-wrap: wrap;
	align-items: normal;
	gap: var(--wp--style--unstable-gallery-gap, var(--wp--style--gallery-gap-default, 0.5em));
	box-sizing: border-box;
	max-width: 100%;
	padding: 0;
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image {
	display: flex;
	flex: 1 0 calc(50% - var(--wp--style--unstable-gallery-gap, 16px) / 2);
	flex-direction: column;
	justify-content: center;
	position: relative;
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
	margin: 0;
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image > a,
.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image > div {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	margin: 0;
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image img {
	display: block;
	width: auto;
	max-width: 100% !important;
	height: auto;
}

.entry-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image > a,
.entry-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image > div:not(.components-drop-zone) {
	display: flex;
}

.entry-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image a,
.entry-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image img {
	flex: 1 0 0%;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.entry-content .wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image {
	align-self: flex-start;
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before,
.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	box-sizing: border-box;
	max-height: 100%;
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before {
	height: 3em;
	content: "";
	pointer-events: none;
	background: linear-gradient(0deg, rgb(0 0 0 / 40%), transparent);
}

.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	overflow: auto;
	margin: 0;
	padding: 1em;
	color: #fff;
	font-size: 13px;
	text-align: center;
	text-shadow: 0 0 1.5px #000;
	scrollbar-width: thin;
}

.entry-content .wp-block-gallery.has-nested-images > figcaption {
	flex: 1 0 100%;
	text-align: center;
}

.entry-content .wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image {
	flex-basis: 100%;
}

.entry-content .wp-block-gallery.has-nested-images.aligncenter {
	justify-content: center;
}

@media (min-width: 600px) {
	.entry-content .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image {
		flex-basis: calc(33.3333% - var(--wp--style--unstable-gallery-gap, 16px) * 2 / 3);
	}

	.entry-content .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:first-child:nth-last-child(2),
	.entry-content .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:first-child:nth-last-child(2) ~ figure.wp-block-image {
		flex-basis: calc(50% - var(--wp--style--unstable-gallery-gap, 16px) / 2);
	}

	.entry-content .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:only-child {
		flex-basis: 100%;
	}

	.entry-content .wp-block-gallery.has-nested-images.columns-2 figure.wp-block-image { flex-basis: calc(50% - var(--wp--style--unstable-gallery-gap, 16px) / 2); }
	.entry-content .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image { flex-basis: calc(33.3333% - var(--wp--style--unstable-gallery-gap, 16px) * 2 / 3); }
	.entry-content .wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image { flex-basis: calc(25% - var(--wp--style--unstable-gallery-gap, 16px) * 3 / 4); }
	.entry-content .wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image { flex-basis: calc(20% - var(--wp--style--unstable-gallery-gap, 16px) * 4 / 5); }
	.entry-content .wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image { flex-basis: calc(16.6667% - var(--wp--style--unstable-gallery-gap, 16px) * 5 / 6); }
	.entry-content .wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image { flex-basis: calc(14.2857% - var(--wp--style--unstable-gallery-gap, 16px) * 6 / 7); }
	.entry-content .wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image { flex-basis: calc(12.5% - var(--wp--style--unstable-gallery-gap, 16px) * 7 / 8); }
	.entry-content .wp-block-gallery.has-nested-images.columns-9 figure.wp-block-image { flex-basis: calc(11.1111% - var(--wp--style--unstable-gallery-gap, 16px) * 8 / 9); }
}
