/*
 * Hover effect "Edge title": the caption group (the group right after the featured image) sits on the image's bottom
 * edge in the overlay colour, showing only its first block (the title); the rest of the caption opens on hover and
 * keyboard focus. Touch screens show the whole caption. Texts inside take the overlay text colour unless a block sets
 * its own colour.
 */
.wp-block-rtthemes-post-gallery.has-hover-edge-title .wp-block-post:has(> .wp-block-post-featured-image + .wp-block-group),
.wp-block-rtthemes-post-gallery.has-hover-edge-title .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-edge-title .wp-block-post-featured-image:has(+ .wp-block-group) {
	grid-area: 1 / 1;
	margin-block: 0;
}

.wp-block-rtthemes-post-gallery.has-hover-edge-title .wp-block-post-featured-image + .wp-block-group {
	z-index: 1;
	grid-area: 1 / 1;
	align-self: end;
	justify-self: start;
	max-width: 100%;
	margin-block: 0;
	color: var(--rtthemes-post-gallery-overlay-text, var(--wp--preset--color--base, #fff));
	background-color: var(--rtthemes-post-gallery-overlay, color-mix(in srgb, var(--wp--preset--color--contrast, #000) 85%, transparent));
}

:where(.wp-block-rtthemes-post-gallery.has-hover-edge-title .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-edge-title .wp-block-post-featured-image + .wp-block-group > * {
	transition: opacity 0.3s ease;
}

@starting-style {
	.wp-block-rtthemes-post-gallery.has-hover-edge-title .wp-block-post-featured-image + .wp-block-group > * {
		opacity: 0;
	}
}

@media (hover: hover) {
	.wp-block-rtthemes-post-gallery.has-hover-edge-title .wp-block-post:not(:hover, :focus-within) .wp-block-post-featured-image + .wp-block-group > :not(:first-child) {
		display: none;
	}
}
