/* Галерея, её обрезанная область и режим полного раскрытия. */

.section-gallery {
	position: relative;
}

.mansory-bg {
	margin: 60px 0 60px 0;
	background: #f7f8f4;
}

.container-full {
	width: 100%;
	max-width: calc(100% - 145px);
	margin-right: auto;
	margin-left: auto;
}

.masonry-container {
	position: relative;
	overflow: visible;
}

/* Именно этот блок обрезает галерею */
.masonry-viewport {
	position: relative;
	overflow: hidden;
	max-height: calc(100dvh - 125px);
	transition: max-height 0.7s ease;

	-webkit-mask-image: linear-gradient(
			to bottom,
			#000 0%,
			#000 calc(100% - 180px),
			rgba(0, 0, 0, 0) 100%
	);
	mask-image: linear-gradient(
			to bottom,
			#000 0%,
			#000 calc(100% - 180px),
			rgba(0, 0, 0, 0) 100%
	);
}

/* После раскрытия убираем градиентное затухание. */
.masonry-container.active .masonry-viewport {
	-webkit-mask-image: none;
	mask-image: none;
}

.grid-wrapper {
	columns: 300px;
	transform-origin: top;
	transform: perspective(1000px) rotateX(-25deg);
	transition: transform 0.4s ease;
}

.masonry-container.active .grid-wrapper {
	transform: perspective(1000px) rotateX(0deg);
}

.grid-wrapper > a {
	display: block;
	cursor: pointer;
	margin-bottom: 1rem;
}

.grid-wrapper > a > img {
	width: 100%;
	height: 100%;
	max-height: 520px;
	object-fit: cover;
	border-radius: 5px;
}

.grid-wrapper .lazy-js {
	display: block;
	opacity: 0;
	transform-origin: center center;
	will-change: transform, opacity;
	border: none;
	user-select: none;
}
.grid-wrapper a[data-fancybox^="gallery-"],
.grid-wrapper a[data-fancybox^="gallery-"]:focus,
.grid-wrapper a[data-fancybox^="gallery-"]:active,
.grid-wrapper a[data-fancybox^="gallery-"]:focus-visible {
	outline: none !important;
	box-shadow: none !important;
	border-color: transparent !important;
	-webkit-tap-highlight-color: transparent;
}
.grid-wrapper .lazy-js:active{
	border: none !important;
	user-select: none !important;
}
.grid-wrapper .lazy-js img {
	transition: ease 0.3s;
}

.grid-wrapper .lazy-js img:hover {
	scale: 0.9;
	opacity: 1;
}

/* Липкая кнопка остаётся видимой у нижней границы галереи. */
.grid-masonry__more {
	position: sticky;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 5;
	bottom: 25px;
	cursor: pointer;
}

.gallery-video {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 5px;
	background: #000;
}

.gallery-video video {
	display: block;
	width: 100%;
	height: 100%;
	max-height: 520px;
	object-fit: cover;
	border-radius: 5px;
}

.gallery-video__play {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 64px;
	height: 64px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	z-index: 2;
}

.gallery-video__play::before {
	content: "";
	position: absolute;
	left: 25px;
	top: 19px;
	width: 0;
	height: 0;
	border-top: 13px solid transparent;
	border-bottom: 13px solid transparent;
	border-left: 20px solid #111;
}
.grid-wrapper .gallery-video{
	transition: ease 0.3s;
}
.grid-wrapper .gallery-video:hover{
	scale: 0.9;
	opacity: 1;
}

@media (max-width: 680px) {
	.container-full {
		max-width: calc(100% - 24px);
	}

	.grid-wrapper {
		columns: 1;
	}
}
