/*
 * Image showcase "Jälkiä on jätetty" (patterns/image-showcase.php).
 *
 * Desktop: a full-bleed 1 : 1 : 3.4 grid (269 / 269 / 903px at 1440) in two
 * rows, photos butted together. Row 1: two photos and the text; row 2: a
 * photo across the first two columns (`--wide`) and one under the text.
 * Each year caption is the Image block's own caption, laid over the photo's
 * bottom-right corner ("Dark caption" style for light photos).
 * Phone: two columns; the text and the last two photos span both.
 */

.kt-image-showcase.wp-block-group {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 3.36fr);
	grid-template-rows: minmax(28vw, auto) 26vw;
}

.kt-image-showcase.wp-block-group > * {
	margin: 0;
}

.kt-image-showcase .kt-image-showcase__photo--wide {
	grid-column: span 2;
}

/* Photos fill their cell; the caption is positioned against the figure. */
.kt-image-showcase .kt-image-showcase__photo.wp-block-image {
	position: relative;
	min-height: 0;
	overflow: hidden;
}

/* Editor canvas: a selected image sits in a resize wrapper; fill the cell. */
.kt-image-showcase .kt-image-showcase__photo > .components-resizable-box__container {
	width: 100% !important; /* Beats the wrapper's inline size. */
	height: 100% !important;
}

.kt-image-showcase .kt-image-showcase__photo img {
	display: block;
	width: 100%;
	height: 100% !important; /* Beats the editor's inline `height: auto`. */
	object-fit: cover;
}

.kt-image-showcase .kt-image-showcase__photo figcaption {
	position: absolute;
	right: var(--wp--preset--spacing--30);
	bottom: var(--wp--preset--spacing--20);
	margin: 0;

	/* The Image style "Dark caption" (block-styles.css) sets the two variables. */
	color: var(--kt-caption-color, var(--wp--preset--color--white));
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--display-md);
	line-height: 1;
	text-align: right;
	text-shadow: var(--kt-caption-shadow, 0 1px 6px rgb(0 0 0 / 55%));
}

.kt-image-showcase .kt-image-showcase__text {
	padding-block: var(--wp--preset--spacing--60);
	padding-inline: var(--wp--preset--spacing--50) var(--wp--style--root--padding-right, 16px);
}

.kt-image-showcase__text > * {
	margin-block: 0;
}

.kt-image-showcase .kt-image-showcase__heading {
	margin-block-start: var(--wp--preset--spacing--40);
	line-height: 1;
}

.kt-image-showcase .kt-image-showcase__quote {
	max-width: 52rem;
	margin-block-start: var(--wp--preset--spacing--70);
	line-height: 1.45;
}

@media (max-width: 781px) {

	.kt-image-showcase.wp-block-group {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: none;
	}

	.kt-image-showcase .kt-image-showcase__text {
		grid-column: 1 / -1;
		grid-row: 1;
		padding-inline: var(--wp--style--root--padding-left, 16px) var(--wp--style--root--padding-right, 16px);
	}

	.kt-image-showcase .kt-image-showcase__photo.wp-block-image {
		aspect-ratio: 3 / 4;
	}

	.kt-image-showcase .kt-image-showcase__photo--wide.wp-block-image,
	.kt-image-showcase .kt-image-showcase__photo--wide ~ .kt-image-showcase__photo.wp-block-image {
		grid-column: 1 / -1;
		aspect-ratio: 16 / 10;
	}

	.kt-image-showcase .kt-image-showcase__photo figcaption {
		font-size: var(--wp--preset--font-size--display-sm);
	}
}
