.wp-block-crunchr-photo-mosaic.crunchr-photo-mosaic {
	--mosaic-column-gap: clamp(12px, 1.5vw, 20px);
	--mosaic-row-gap: clamp(12px, 1.65vw, 22px);

	box-sizing: border-box;
	container-type: inline-size;
}

.crunchr-photo-mosaic__grid {
	display: flex;
	flex-direction: column;
	gap: var(--mosaic-row-gap);
	width: 100%;
	max-width: 1360px;
	margin-inline: auto;
}

.crunchr-photo-mosaic__row {
	display: grid;
	column-gap: var(--mosaic-column-gap);
	aspect-ratio: 1360 / 358;
}

.crunchr-photo-mosaic__row--top {
	grid-template-columns: minmax(0, 480fr) minmax(0, 860fr);
}

.crunchr-photo-mosaic__row--bottom {
	grid-template-columns: minmax(0, 860fr) minmax(0, 480fr);
}

.crunchr-photo-mosaic__row--three {
	grid-template-columns: minmax(0, 276fr) minmax(0, 564fr) minmax(0, 480fr);
}

.crunchr-photo-mosaic__item {
	position: relative;
	min-width: 0;
	min-height: 0;
	margin: 0;
	overflow: hidden;
	border-radius: 16px;
	background: var(--wp--preset--color--neutral-50, #f2f4f7);
}

.crunchr-photo-mosaic__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--mosaic-focal-x, 50%) var(--mosaic-focal-y, 50%);
}

/* Switch only when the narrow column no longer gives the subject enough room. */
@container (max-width: 34rem) {
	.crunchr-photo-mosaic__grid {
		grid-template-columns: 1fr;
		display: grid;
		gap: 12px;
	}

	.crunchr-photo-mosaic__row {
		display: contents;
	}

	.crunchr-photo-mosaic__item {
		aspect-ratio: 4 / 3;
		border-radius: 12px;
	}

	.crunchr-photo-mosaic__item--large {
		aspect-ratio: 16 / 10;
	}

	.crunchr-photo-mosaic--three .crunchr-photo-mosaic__row--three {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		aspect-ratio: auto;
		gap: 12px;
	}

	.crunchr-photo-mosaic--three .crunchr-photo-mosaic__item:nth-child(1) {
		grid-column: 1;
		grid-row: 1;
	}

	.crunchr-photo-mosaic--three .crunchr-photo-mosaic__item:nth-child(2) {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.crunchr-photo-mosaic--three .crunchr-photo-mosaic__item:nth-child(3) {
		grid-column: 2;
		grid-row: 1;
	}
}

/* Editor-only image controls sit over each tile without affecting the frontend. */
.crunchr-photo-mosaic__editor-button {
	position: absolute;
	z-index: 2;
	inset: auto 12px 12px auto;
}

.crunchr-photo-mosaic__placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	padding: 16px;
	text-align: center;
}
