/*
 * MDS Featured Projects
 */

.mds-featured-projects {
	--mds-featured-gap: 24px;
	--mds-featured-card-width: min(26vw, 455px);
	--mds-featured-arrow-size: 62px;
	--mds-featured-amber: rgba(247, 181, 77, 0.9);

	position: relative;

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

	overflow: hidden;
}

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

.mds-featured-projects--interactive .mds-featured-projects__viewport {
	cursor: grab;
}

.mds-featured-projects.is-dragging .mds-featured-projects__viewport {
	cursor: grabbing;
}

.mds-featured-projects__track {
	display: flex;
	align-items: stretch;
	gap: var(--mds-featured-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-featured-projects__slide {
	position: relative;
	flex: 0 0 var(--mds-featured-card-width);

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

	aspect-ratio: 4 / 5;

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

.mds-featured-projects__link {
	position: absolute;
	inset: 0;

	display: block;
	overflow: hidden;

	color: #ffffff;
	text-decoration: none !important;
}

.mds-featured-projects__media,
.mds-featured-projects__placeholder {
	position: absolute;
	inset: 0;

	display: block;
	width: 100%;
	height: 100%;
}

.mds-featured-projects__slide img.mds-featured-projects__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;

	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;

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

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

	transform: scale(1);
	transition: transform 420ms ease;
}

.mds-featured-projects__placeholder {
	background:
		linear-gradient(
			135deg,
			#e3e3e3 0%,
			#f5f5f5 50%,
			#e3e3e3 100%
		);
}

/*
 * Bottom readability gradient. It only occupies the lower portion of the card.
 */

.mds-featured-projects__shade {
	position: absolute;
	z-index: 2;
	right: 0;
	bottom: 0;
	left: 0;

	height: 34%;

	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.82) 0%,
		rgba(0, 0, 0, 0.52) 42%,
		rgba(0, 0, 0, 0) 100%
	);

	pointer-events: none;
	transition: opacity 240ms ease;
}

/*
 * Amber hover overlay.
 */

.mds-featured-projects__amber {
	position: absolute;
	z-index: 3;
	inset: 0;

	background: var(--mds-featured-amber);
	opacity: 0;

	pointer-events: none;
	transition: opacity 250ms ease;
}

.mds-featured-projects__content {
	position: absolute;
	z-index: 4;
	right: 0;
	bottom: 0;
	left: 0;

	padding: 0 28px 28px;

	pointer-events: none;
}

.mds-featured-projects__title {
	display: flex;
	align-items: flex-end;
	gap: 9px;

	margin: 0;

	color: #ffffff;
	font-size: clamp(18px, 1.35vw, 26px);
	font-weight: 600;
	line-height: 1.25;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);

	transform: translateY(0);
	transition: transform 240ms ease;
}

.mds-featured-projects__title-arrow {
	flex: 0 0 auto;

	width: 20px;
	height: 20px;
	margin-bottom: 2px;

	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;

	opacity: 0;
	transform: translateX(-8px);
	transition:
		opacity 220ms ease,
		transform 220ms ease;
}

.mds-featured-projects__link:hover .mds-featured-projects__amber,
.mds-featured-projects__link:focus-visible .mds-featured-projects__amber {
	opacity: 1;
}

.mds-featured-projects__link:hover .mds-featured-projects__shade,
.mds-featured-projects__link:focus-visible .mds-featured-projects__shade {
	opacity: 0;
}

.mds-featured-projects__link:hover .mds-featured-projects__image,
.mds-featured-projects__link:focus-visible .mds-featured-projects__image {
	transform: scale(1.025);
}

.mds-featured-projects__link:hover .mds-featured-projects__title,
.mds-featured-projects__link:focus-visible .mds-featured-projects__title {
	transform: translateY(-4px);
}

.mds-featured-projects__link:hover .mds-featured-projects__title-arrow,
.mds-featured-projects__link:focus-visible .mds-featured-projects__title-arrow {
	opacity: 1;
	transform: translateX(0);
}

.mds-featured-projects__link:focus-visible {
	outline: 4px solid #ffffff;
	outline-offset: -8px;
}

/*
 * One or two featured projects remain centered and static.
 */

.mds-featured-projects--single .mds-featured-projects__track {
	justify-content: center;
	width: 100%;
	padding-right: 24px;
	padding-left: 24px;
	box-sizing: border-box;
}

.mds-featured-projects--two .mds-featured-projects__track {
	justify-content: center;
	width: 100%;
	padding-right: 24px;
	padding-left: 24px;
	box-sizing: border-box;
}

/*
 * Circular arrows. Their desktop placement sits between the side cards and
 * the three primary cards, matching the supplied reference.
 */

.mds-featured-projects__arrow {
	position: absolute;
	z-index: 10;
	top: 50%;

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

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

	border: 0;
	border-radius: 50%;

	background: #ffffff;
	box-shadow: none;

	color: #8c8c8c;
	cursor: pointer;

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

/*
 * Position the arrows in the gaps immediately outside the
 * three centered project cards.
 *
 * Calculation:
 * 50% of the carousel
 * - 1.5 card widths
 * - 1.5 gaps
 * - half of the arrow width
 */

.mds-featured-projects__arrow--previous {
	left: max(
		12px,
		calc(
			50%
			- var(--mds-featured-card-width)
			- (var(--mds-featured-card-width) / 2)
			- var(--mds-featured-gap)
			- (var(--mds-featured-gap) / 2)
			- (var(--mds-featured-arrow-size) / 2)
		)
	);
}

.mds-featured-projects__arrow--next {
	right: max(
		12px,
		calc(
			50%
			- var(--mds-featured-card-width)
			- (var(--mds-featured-card-width) / 2)
			- var(--mds-featured-gap)
			- (var(--mds-featured-gap) / 2)
			- (var(--mds-featured-arrow-size) / 2)
		)
	);
}

.mds-featured-projects__arrow svg {
	display: block;
	width: 22px;
	height: 22px;

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

.mds-featured-projects__arrow:hover {
	color: #222222;
	transform: translateY(-50%) scale(1.05);
	background:#fff!important;
}

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

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

/*
 * Tablet.
 */

@media (max-width: 1199px) {

	.mds-featured-projects {
		--mds-featured-gap: 18px;
		--mds-featured-card-width: 44vw;
		--mds-featured-arrow-size: 56px;
	}

	.mds-featured-projects__arrow--previous {
		left: 14px;
	}

	.mds-featured-projects__arrow--next {
		right: 14px;
	}

	.mds-featured-projects__content {
		padding: 0 22px 22px;
	}
}

/*
 * Mobile.
 */

@media (max-width: 767px) {

	.mds-featured-projects {
		--mds-featured-gap: 12px;
		--mds-featured-card-width: 82vw;
		--mds-featured-arrow-size: 48px;
	}

	.mds-featured-projects__content {
		padding: 0 20px 20px;
	}

	.mds-featured-projects__title {
		font-size: 19px;
	}

	.mds-featured-projects__arrow--previous {
		left: 8px;
	}

	.mds-featured-projects__arrow--next {
		right: 8px;
	}

	.mds-featured-projects__arrow svg {
		width: 20px;
		height: 20px;
	}

	.mds-featured-projects--single .mds-featured-projects__track,
	.mds-featured-projects--two .mds-featured-projects__track {
		padding-right: 12px;
		padding-left: 12px;
	}
}

@media (max-width: 420px) {

	.mds-featured-projects {
		--mds-featured-card-width: 86vw;
		--mds-featured-arrow-size: 44px;
	}
}

/*
 * Reduced-motion support.
 */

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

	.mds-featured-projects__track,
	.mds-featured-projects__image,
	.mds-featured-projects__shade,
	.mds-featured-projects__amber,
	.mds-featured-projects__title,
	.mds-featured-projects__title-arrow,
	.mds-featured-projects__arrow {
		transition: none;
	}

	.mds-featured-projects__link:hover .mds-featured-projects__image,
	.mds-featured-projects__link:focus-visible .mds-featured-projects__image,
	.mds-featured-projects__link:hover .mds-featured-projects__title,
	.mds-featured-projects__link:focus-visible .mds-featured-projects__title {
		transform: none;
	}
}
