/*
 * Hover effect "Dark fade": the caption group (the group right after the featured image) covers the image in the
 * overlay colour and fades in, its blocks centred. The image and the caption share one grid cell; blocks after the
 * caption stay below. Touch screens show the caption all the time, as a shade at the bottom of the image.
 * Texts inside take the overlay text colour unless a block sets its own colour.
 */
.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post:has(> .wp-block-post-featured-image + .wp-block-group),
.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post > :has(> .wp-block-post-featured-image + .wp-block-group) {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
}

.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post-featured-image:has(+ .wp-block-group) {
	grid-area: 1 / 1;
	margin-block: 0;
}

.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post-featured-image + .wp-block-group {
	z-index: 1;
	display: flex;
	flex-direction: column;
	grid-area: 1 / 1;
	align-items: center;
	justify-content: center;
	margin-block: 0;
	text-align: center;
	color: var(--rtthemes-post-gallery-overlay-text, var(--wp--preset--color--base, #fff));
	background-color: color-mix(in srgb, var(--rtthemes-post-gallery-overlay, var(--wp--preset--color--contrast, #000)) 70%, transparent);
	opacity: 0;
	transition: opacity 0.35s ease;
}

:where(.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post-featured-image) + .wp-block-group :is(a, h1, h2, h3, h4, h5, h6) {
	color: inherit;
}

.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post:is(:hover, :focus-within) .wp-block-post-featured-image + .wp-block-group {
	opacity: 1;
}

@media (hover: none) {
	.wp-block-rtthemes-post-gallery.has-hover-dark-fade .wp-block-post-featured-image + .wp-block-group {
		align-self: end;
		justify-content: end;
		background: linear-gradient(transparent, color-mix(in srgb, var(--rtthemes-post-gallery-overlay, var(--wp--preset--color--contrast, #000)) 80%, transparent));
		opacity: 1;
	}
}
