.icg {
	--icg-columns: 5;
	--icg-row-gap: 5vw;
	--icg-column-gap: 5vw;
	--icg-size: 15vw;
	--icg-mobile-size: 45vw;
	--icg-height: 100vh;
	--icg-background: #f4f3f1;
	--icg-radius: 0px;
	--icg-fit: contain;
	position: relative;
	width: 100%;
	height: var(--icg-height);
	min-height: 240px;
	background: var(--icg-background);
	overflow: hidden;
	isolation: isolate;
}

/* Full-width alignment should escape a theme's normal content column. */
.icg.alignfull {
	width: 100vw;
	max-width: none;
	margin-right: calc(50% - 50vw);
	margin-left: calc(50% - 50vw);
}

.icg__viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	cursor: grab;
	outline: none;
	overscroll-behavior: contain;
}

.icg__viewport:active,
.icg__viewport.is-dragging {
	cursor: grabbing;
}

.icg__viewport:focus-visible {
	box-shadow: inset 0 0 0 3px rgba(30, 95, 170, 0.85);
}

.icg__plane {
	display: grid;
	grid-auto-flow: row;
	width: max-content;
	height: max-content;
	will-change: transform;
	backface-visibility: hidden;
	transform: translate3d(0, 0, 0);
	pointer-events: none;
}

.icg__tile {
	display: grid;
	grid-template-columns: repeat(var(--icg-columns), var(--icg-size));
	grid-auto-rows: var(--icg-size);
	column-gap: var(--icg-column-gap);
	row-gap: var(--icg-row-gap);
	width: max-content;
	height: max-content;
	padding: calc(var(--icg-row-gap) / 2) calc(var(--icg-column-gap) / 2);
	box-sizing: border-box;
}

.icg__item {
	width: var(--icg-size);
	height: var(--icg-size);
	overflow: hidden;
	border-radius: var(--icg-radius);
	transform: translateZ(0);
}

.icg__item img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: var(--icg-fit);
	pointer-events: none;
	-webkit-user-drag: none;
}

.icg-empty {
	padding: 24px;
	border: 1px dashed #8c8f94;
	background: #f6f7f7;
	color: #50575e;
	text-align: center;
}

@media (max-width: 781px) {
	.icg__tile {
		grid-template-columns: repeat(var(--icg-columns), var(--icg-mobile-size));
		grid-auto-rows: var(--icg-mobile-size);
	}

	.icg__item {
		width: var(--icg-mobile-size);
		height: var(--icg-mobile-size);
	}
}

@media (prefers-reduced-motion: reduce) {
	.icg__plane {
		will-change: auto;
	}
}
