.tm-mmg-grid {
	display: grid;
	grid-template-columns: repeat(var(--tm-mmg-columns, 3), minmax(0, 1fr));
}

.tm-mmg-item {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	text-align: inherit;
	font: inherit;
	color: inherit;
	min-width: 0;
}

button.tm-mmg-item {
	cursor: pointer;
}

.tm-mmg-thumb {
	position: relative;
	display: block;
	width: 100%;
	overflow: hidden;
	background: #151515;
}

.tm-mmg-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease;
}

.tm-mmg-hover-zoom-yes .tm-mmg-item:hover .tm-mmg-thumb img,
.tm-mmg-hover-zoom-yes .tm-mmg-item:focus-visible .tm-mmg-thumb img {
	transform: scale(1.05);
}

.tm-mmg-no-poster {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #161616, #323232);
}

.tm-mmg-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 72px;
	height: 72px;
	border-radius: 999px;
	background: rgba(0,0,0,.68);
	box-shadow: 0 6px 22px rgba(0,0,0,.28);
	pointer-events: none;
}

.tm-mmg-play::before {
	content: '';
	position: absolute;
	left: 54%;
	top: 50%;
	transform: translate(-42%, -50%);
	width: 0;
	height: 0;
	border-top-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: transparent;
	border-bottom-color: transparent;
	border-left-color: #fff;
	border-right: 0;
}

.tm-mmg-title {
	display: block;
	margin-top: 8px;
}

.tm-mmg-empty {
	padding: 20px;
	border: 1px dashed #c8c8c8;
	text-align: center;
}

.tm-mmg-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,.92);
	padding: 24px;
}

.tm-mmg-modal.is-open {
	display: flex;
}

.tm-mmg-modal__dialog {
	position: relative;
	width: min(1200px, 96vw);
	height: min(820px, 90vh);
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
}

.tm-mmg-modal__stage {
	min-height: 0;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tm-mmg-modal__stage img,
.tm-mmg-modal__stage video,
.tm-mmg-modal__stage iframe {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	border: 0;
}

.tm-mmg-modal__stage iframe {
	width: min(1200px, 90vw);
	aspect-ratio: 16 / 9;
}

.tm-mmg-modal__caption {
	flex: 0 0 auto;
	color: #fff;
	text-align: center;
	padding: 12px 56px 0;
	min-height: 24px;
}

.tm-mmg-modal__close,
.tm-mmg-modal__prev,
.tm-mmg-modal__next {
	position: absolute;
	z-index: 2;
	border: 0;
	background: rgba(0,0,0,.45);
	color: #fff;
	cursor: pointer;
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.tm-mmg-modal__close {
	right: 0;
	top: 0;
	width: 44px;
	height: 44px;
	font-size: 30px;
}

.tm-mmg-modal__prev,
.tm-mmg-modal__next {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	font-size: 34px;
}

.tm-mmg-modal__prev { left: 0; }
.tm-mmg-modal__next { right: 0; }

body.tm-mmg-no-scroll {
	overflow: hidden;
}

@media (max-width: 767px) {
	.tm-mmg-modal {
		padding: 12px;
	}
	.tm-mmg-modal__dialog {
		width: 100%;
		height: 88vh;
	}
	.tm-mmg-modal__prev,
	.tm-mmg-modal__next {
		width: 40px;
		height: 40px;
	}
	.tm-mmg-modal__caption {
		padding-left: 44px;
		padding-right: 44px;
	}
}
