.w-gallery.magic-gallery-rows .w-gallery-list {
	display: grid !important;
	grid-template-columns: repeat(var(--magic-gallery-columns, 1), minmax(0, 1fr));
	grid-template-rows: repeat(var(--magic-gallery-rows, 2), var(--magic-gallery-row-height, auto));
	grid-auto-flow: column dense;
	gap: var(--items-gap, 0);
}

.w-gallery.magic-gallery-rows .w-gallery-item {
	position: relative !important;
	top: auto !important;
	left: auto !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	transform: none !important;
	aspect-ratio: auto !important;
	min-height: 0;
	grid-row: span 1 !important;
	overflow: hidden;
}

.w-gallery.magic-gallery-rows .w-gallery-item.magic-gallery-item-tall {
	grid-row: span var(--magic-gallery-rows, 2) !important;
}

.w-gallery.magic-gallery-rows .w-gallery-item-img,
.w-gallery.magic-gallery-rows .w-gallery-item-img img {
	width: 100%;
	height: 100%;
	min-height: 0;
}

.w-gallery.magic-gallery-rows .w-gallery-item-img img {
	display: block;
	object-fit: cover;
}

.w-gallery.magic-gallery-style-photo .w-gallery-item-img {
	box-sizing: border-box;
	border: 0.6vw solid #fff;
}

@media (max-width: 800px) {
	.w-gallery.magic-gallery-style-photo .w-gallery-item-img {
		border-width: 8px;
	}
}

/* Opt-in carousel viewport: add gallery-carousel to the Gallery parent wrapper. */
.gallery-carousel {
	--magic-gallery-arrow-size: 2.5vw;
	position: relative;
	height: 100vh;
	min-width: 0;
	box-sizing: border-box;
	overflow: visible;
}

.gallery-carousel > .w-gallery.magic-gallery-rows {
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.gallery-carousel > .w-gallery.magic-gallery-rows:not(.magic-gallery-carousel-ready) .w-gallery-list {
	visibility: hidden;
}

.gallery-carousel > .w-gallery.magic-gallery-rows .w-gallery-list {
	grid-template-columns: repeat(var(--magic-gallery-columns, 1), var(--magic-gallery-column-width, 1px));
	width: max-content;
	height: 100%;
	padding-right: 3vw;
	box-sizing: content-box;
	cursor: grab;
	touch-action: pan-y;
	user-select: none;
	transition: transform 450ms cubic-bezier(.22, .61, .36, 1);
	will-change: transform;
}

.gallery-carousel > .w-gallery.magic-gallery-rows.is-dragging .w-gallery-list,
.gallery-carousel > .w-gallery.magic-gallery-rows.is-dragging .w-gallery-list * {
	cursor: grabbing !important;
}

.gallery-carousel .magic-gallery-arrow {
	position: absolute;
	z-index: 5;
	top: 50%;
	width: var(--magic-gallery-arrow-size);
	height: var(--magic-gallery-arrow-size);
	padding: 0;
	border: 0.18vw solid var(--mt-back-to-top-color, currentColor);
	border-radius: var(--magic-radius-full) !important;
	background: transparent !important;
	color: var(--mt-back-to-top-color, currentColor) !important;
	box-shadow: none !important;
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity .2s, background-color .2s, color .2s;
}

.gallery-carousel .magic-gallery-arrow::before {
	content: "";
	position: absolute;
	inset: 24%;
	background-color: currentColor;
	-webkit-mask: url("../../img/icons/arrowup.svg") center / contain no-repeat;
	mask: url("../../img/icons/arrowup.svg") center / contain no-repeat;
}

.gallery-carousel .magic-gallery-arrow-prev {
	left: calc((var(--magic-gallery-arrow-size) + 0.5vw) * -1);
}

.gallery-carousel .magic-gallery-arrow-prev::before {
	transform: rotate(-90deg);
}

.gallery-carousel .magic-gallery-arrow-next {
	right: 1vw;
}

.gallery-carousel .magic-gallery-arrow-next::before {
	transform: rotate(90deg);
}

.gallery-carousel .magic-gallery-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

.gallery-carousel .magic-gallery-arrow:not(:disabled):hover,
.gallery-carousel .magic-gallery-arrow:not(:disabled):focus-visible {
	border-color: #182034;
	color: #182034 !important;
}

@media (max-width: 800px) {
	.gallery-carousel {
		--magic-gallery-arrow-size: 50px;
	}

	.gallery-carousel .magic-gallery-arrow {
		border-width: 3px;
	}
}
