/* Layout follows how many images the "gallery_images" repeater has (max
   3), and changes again by screen size — see the .count-1/.count-2/.count-3
   rules below and their 991px/661px overrides. No JS anywhere in this
   block: it's a plain responsive grid throughout. */
.development-gallery-preview {
	display: grid;
	gap: 8px;
	width: 100%;

	&.count-1 {
		aspect-ratio: 21 / 9;
		grid-template-columns: 1fr;
	}

	&.count-2 {
		aspect-ratio: 21 / 9;
		grid-template-columns: 1fr 1fr;
	}

	/* Desktop: featured (left) + 2 stacked (right). */
	&.count-3 {
		aspect-ratio: 21 / 9;
		grid-template-columns: 2fr 1fr;
		grid-template-rows: 1fr 1fr;

		.development-gallery-tile:first-child {
			grid-column: 1;
			grid-row: 1 / 3;
		}
	}

	.development-gallery-tile {
		display: block;
		height: 100%;
		overflow: hidden;
		position: relative;
		width: 100%;

		img {
			display: block;
			height: 100%;
			object-fit: cover;
			width: 100%;
		}
	}

	/* Tablet: featured on top, the other 2 side by side underneath. */
	@media(width <= 991px) {
		&.count-3 {
			aspect-ratio: auto;
			grid-template-columns: 1fr 1fr;
			grid-template-rows: auto auto;

			.development-gallery-tile:first-child {
				aspect-ratio: 16 / 9;
				grid-column: 1 / 3;
				grid-row: 1;
				height: auto;
			}

			.development-gallery-tile:not(:first-child) {
				aspect-ratio: 1 / 1;
				height: auto;
			}
		}
	}

	/* Mobile: every count just stacks, one image per row. */
	@media(width <= 661px) {
		aspect-ratio: auto !important;
		grid-template-columns: 1fr !important;
		grid-template-rows: none !important;

		.development-gallery-tile {
			aspect-ratio: 16 / 9 !important;
			grid-column: auto !important;
			grid-row: auto !important;
			height: auto;
		}
	}
}
