/*
 * MDS Project Gallery Carousel
 */

.mds-project-gallery {
	--mds-gallery-gap: 24px;
	--mds-gallery-slide-width: min(66vw, 1135px);
	--mds-gallery-arrow-size: 64px;

	/*
	 * Center the navigation arrows in the gaps immediately
	 * outside the primary centered slide.
	 */
	--mds-gallery-arrow-offset: calc(
		50%
		- (var(--mds-gallery-slide-width) / 2)
		- (var(--mds-gallery-gap) / 2)
		- (var(--mds-gallery-arrow-size) / 2)
	);

	position: relative;

	width: 100vw;
	max-width: none;
	margin-right: 0;
	margin-left: calc(50% - 50vw);

	overflow: hidden;
}


/*
 * Viewport and track.
 */

.mds-project-gallery__viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
	outline: none;
	touch-action: pan-y;
}

.mds-project-gallery--interactive .mds-project-gallery__viewport {
	cursor: grab;
}

.mds-project-gallery.is-dragging .mds-project-gallery__viewport {
	cursor: grabbing;
}

.mds-project-gallery__track {
	display: flex;
	align-items: stretch;
	gap: var(--mds-gallery-gap);

	width: max-content;
	margin: 0;
	padding: 0;

	transform: translate3d(0, 0, 0);
	transition: transform 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
}

.mds-project-gallery__slide {
	position: relative;
	flex: 0 0 var(--mds-gallery-slide-width);

	overflow: hidden;
	margin: 0;
	padding: 0;

	aspect-ratio: 16 / 9;

	background: #e4e4e4;
	line-height: 0;
	user-select: none;
}


.mds-project-gallery__image {
	display: block;

	width: 100%;
	height: 100%;

	margin: 0;

	object-fit: cover;
	object-position: center;

	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
}

/*
 * One image: centered, with no controls.
 */

.mds-project-gallery--single .mds-project-gallery__track {
	justify-content: center;
	width: 100%;
	padding-right: 24px;
	padding-left: 24px;
	box-sizing: border-box;
}

.mds-project-gallery--single .mds-project-gallery__slide {
	flex-basis: var(--mds-gallery-slide-width);
}

/*
 * Two images: both visible, with no controls.
 */

.mds-project-gallery--two .mds-project-gallery__track {
	width: 100%;
	padding-right: 12px;
	padding-left: 12px;
	box-sizing: border-box;
}

.mds-project-gallery--two .mds-project-gallery__slide {
	flex: 1 1 0;
	min-width: 0;
}

/*
 * Circular navigation arrows.
 */

.mds-project-gallery__arrow {
	position: absolute;
	z-index: 5;
	top: 50%;

	display: inline-flex;
	align-items: center;
	justify-content: center;

	width: var(--mds-gallery-arrow-size);
	height: var(--mds-gallery-arrow-size);
	margin: 0;
	padding: 0;

	border: 0;
	border-radius: 50%;

	background: #ffffff;
	box-shadow: none;

	color: #8b8b8b;
	cursor: pointer;

	transform: translateY(-50%);
	transition:
		color 180ms ease,
		background-color 180ms ease,
		transform 180ms ease;
}

.mds-project-gallery__arrow--previous {
	left: max(10px, var(--mds-gallery-arrow-offset));
}

.mds-project-gallery__arrow--next {
	right: max(10px, var(--mds-gallery-arrow-offset));
}

.mds-project-gallery__arrow svg {
	display: block;

	width: 24px;
	height: 24px;

	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.mds-project-gallery__arrow:hover {
	color: #222222;
	transform: translateY(-50%) scale(1.05);
}

.mds-project-gallery__arrow:focus-visible {
	outline: 3px solid #222222;
	outline-offset: 4px;
	color: #222222;
}

/*
 * Keyboard focus on the carousel itself.
 */

.mds-project-gallery__viewport:focus-visible {
	outline: 3px solid #222222;
	outline-offset: -3px;
}

/*
 * Tablet.
 */
 
 .mds-project-gallery__slide > .mds-project-gallery__image {
	position: absolute;
	inset: 0;

	display: block;

	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	min-height: 100% !important;

	margin: 0 !important;
	padding: 0 !important;

	object-fit: cover !important;
	object-position: center center !important;

	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
}

.mds-project-gallery img.mds-project-gallery__image {
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}

@media (max-width: 1199px) {

	.mds-project-gallery {
		--mds-gallery-gap: 18px;
		--mds-gallery-slide-width: 72vw;
		--mds-gallery-arrow-size: 56px;
	}
}

/*
 * Mobile.
 */

@media (max-width: 767px) {

	.mds-project-gallery {
		--mds-gallery-gap: 12px;
		--mds-gallery-slide-width: 86vw;
		--mds-gallery-arrow-size: 48px;
	}

	.mds-project-gallery--single .mds-project-gallery__track {
		padding-right: 12px;
		padding-left: 12px;
	}

	/*
	 * On mobile, two images remain visible beside one another. Each image
	 * receives half of the available width.
	 */
	.mds-project-gallery--two .mds-project-gallery__track {
		gap: 10px;
		padding-right: 8px;
		padding-left: 8px;
	}

	.mds-project-gallery__arrow--previous {
		left: 8px;
	}

	.mds-project-gallery__arrow--next {
		right: 8px;
	}

	.mds-project-gallery__arrow svg {
		width: 20px;
		height: 20px;
	}
}

/*
 * Very small phones.
 */

@media (max-width: 420px) {

	.mds-project-gallery {
		--mds-gallery-slide-width: 88vw;
		--mds-gallery-arrow-size: 44px;
	}
}

/*
 * Reduced-motion support.
 */

@media (prefers-reduced-motion: reduce) {

	.mds-project-gallery__track,
	.mds-project-gallery__arrow {
		transition: none;
	}
}

.mds-project-gallery__arrow--previous {
	left: max(10px, var(--mds-gallery-arrow-offset));
}

.mds-project-gallery__arrow--next {
	right: max(10px, var(--mds-gallery-arrow-offset));
}