.tm-ente-gallery {
	margin: 2rem 0;
}

.tm-ente-gallery__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
	gap: 1rem;
}

.tm-ente-gallery__item {
	margin: 0;
	min-width: 0;
}

.tm-ente-gallery__link {
	display: block;
	overflow: hidden;
	background: #eee;
	color: inherit;
}

.tm-ente-gallery__image {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transition: transform 180ms ease;
}

.tm-ente-gallery__link:hover .tm-ente-gallery__image,
.tm-ente-gallery__link:focus-visible .tm-ente-gallery__image {
	transform: scale(1.02);
}

.tm-ente-gallery__link:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.tm-ente-gallery__caption {
	padding-top: 0.5rem;
	font-size: 0.9em;
	line-height: 1.45;
}

.tm-ente-gallery__lightbox {
	width: min(96vw, 100rem);
	height: min(94vh, 70rem);
	max-width: none;
	max-height: none;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.94);
	color: #fff;
}

.tm-ente-gallery__lightbox::backdrop {
	background: rgba(0, 0, 0, 0.8);
}

.tm-ente-gallery__lightbox[open] {
	display: grid;
	grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem;
	align-items: center;
}

.tm-ente-gallery__lightbox-content {
	display: flex;
	min-width: 0;
	height: 100%;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.tm-ente-gallery__lightbox-image {
	display: block;
	max-width: 100%;
	max-height: calc(94vh - 4rem);
	object-fit: contain;
}

.tm-ente-gallery__lightbox-caption {
	min-height: 1.5rem;
	margin: 0.75rem 1rem 0;
	text-align: center;
}

.tm-ente-gallery__close,
.tm-ente-gallery__previous,
.tm-ente-gallery__next {
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 2.5rem;
	line-height: 1;
}

.tm-ente-gallery__close {
	position: absolute;
	top: 0.5rem;
	right: 0.75rem;
	z-index: 1;
}

.tm-ente-gallery__previous,
.tm-ente-gallery__next {
	height: 100%;
}

@media (max-width: 640px) {
	.tm-ente-gallery__grid {
		grid-template-columns: 1fr;
	}

	.tm-ente-gallery__lightbox[open] {
		grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
	}
}

