.acf-media-gallery {
	position: relative;
	width: 100%;
	direction: rtl;
}

.acf-media-gallery *,
.acf-media-gallery *::before,
.acf-media-gallery *::after {
	box-sizing: border-box;
}

.acf-media-gallery__viewport {
	width: 100%;
	overflow: hidden;
}

.acf-media-gallery__track {
	display: flex;
	gap: 18px;
	transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform;
}

.acf-media-gallery--grid .acf-media-gallery__viewport {
	overflow: visible;
}

.acf-media-gallery--grid .acf-media-gallery__track {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
	transform: none !important;
}

.acf-media-gallery--slider .acf-media-gallery__item {
	flex: 0 0 calc((100% - 36px) / 3);
}

.acf-media-gallery__item {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	padding: 0;
	border: 0;
	border-radius: 18px;
	overflow: hidden;
	background: #111;
	cursor: pointer;
}

.acf-media-gallery__thumb {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
}

.acf-media-gallery__video-thumb {
	background: #111;
}

.acf-media-gallery__plus {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 46px;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: translate(-50%, -50%) scale(0.9);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 34px;
	font-weight: 300;
	line-height: 1;
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.25s ease,
		transform 0.25s ease,
		background 0.25s ease;
}

.acf-media-gallery__item:hover .acf-media-gallery__plus {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.acf-media-gallery__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #111;
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
	transition:
		background 0.25s ease,
		opacity 0.25s ease;
}

.acf-media-gallery__nav:hover {
	background: #fff;
}

.acf-media-gallery__nav--prev {
	right: 14px;
}

.acf-media-gallery__nav--next {
	left: 14px;
}

.acf-media-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.92);
	direction: ltr;
}

.acf-media-modal.is-open {
	display: flex;
}

.acf-media-modal__body {
	position: relative;
	width: min(1100px, calc(100vw - 120px));
	height: min(720px, calc(100vh - 120px));
	display: flex;
	align-items: center;
	justify-content: center;
}

.acf-media-modal__slide {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}

.acf-media-modal__slide.is-active {
	display: flex;
}

.acf-media-modal__image,
.acf-media-modal__video {
	max-width: 100%;
	max-height: 100%;
	border-radius: 14px;
	display: block;
}

.acf-media-modal__video {
	width: min(100%, 1000px);
	background: #000;
}

.acf-media-modal .plyr {
	width: min(100%, 1000px);
	max-height: 100%;
	border-radius: 14px;
	overflow: hidden;
}

.acf-media-modal__close {
	position: absolute;
	top: 24px;
	right: 24px;
	z-index: 4;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
}

.acf-media-modal__arrow {
	position: absolute;
	top: 50%;
	z-index: 4;
	width: 54px;
	height: 54px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 42px;
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
}

.acf-media-modal__arrow--prev {
	left: 24px;
}

.acf-media-modal__arrow--next {
	right: 24px;
}

.acf-media-modal__counter {
	position: absolute;
	left: 50%;
	bottom: 24px;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 14px;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	transform: translateX(-50%);
}

body.acf-media-modal-open {
	overflow: hidden;
}

@media (max-width: 1024px) {
	.acf-media-gallery--grid .acf-media-gallery__track {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.acf-media-gallery--slider .acf-media-gallery__item {
		flex-basis: calc((100% - 18px) / 2);
	}
}

@media (max-width: 768px) {
	.acf-media-gallery__track {
		gap: 12px;
	}

	.acf-media-gallery--grid .acf-media-gallery__track {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.acf-media-gallery--slider .acf-media-gallery__item {
		flex-basis: 82%;
	}

	.acf-media-gallery__item {
		border-radius: 14px;
	}

	.acf-media-gallery__plus {
		width: 38px;
		height: 38px;
		font-size: 28px;
		opacity: 1;
		background: rgba(255, 255, 255, 0.82);
	}

	.acf-media-gallery__nav {
		width: 38px;
		height: 38px;
		font-size: 30px;
	}

	.acf-media-modal__body {
		width: calc(100vw - 32px);
		height: calc(100vh - 120px);
	}

	.acf-media-modal__close {
		top: 16px;
		right: 16px;
		width: 40px;
		height: 40px;
		font-size: 28px;
	}

	.acf-media-modal__arrow {
		width: 42px;
		height: 42px;
		font-size: 34px;
	}

	.acf-media-modal__arrow--prev {
		left: 12px;
	}

	.acf-media-modal__arrow--next {
		right: 12px;
	}

	.acf-media-modal__counter {
		bottom: 16px;
		font-size: 12px;
	}
}