/* Home page project list with the "lights on" scroll effect */

.projects {
	display: flex;
	flex-direction: column;
	gap: 100px;
	padding-bottom: 79px;
}

.project {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 100px;
	align-items: center;
	min-height: 512px;
}

.project__text {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding-left: 120px;
}

.project__title {
	font-size: 40px;
	line-height: normal;
}

.project__desc {
	font-size: 24px;
	line-height: 32px;
	color: var(--color-desc);
}

.project__tags {
	font-size: 20px;
	line-height: 32px;
	color: var(--color-tags);
}

/* Both images sit in the same grid cell, on top of each other. */
.project__media {
	display: grid;
	width: 100%;
	max-width: 660px;
}

.project__img {
	grid-area: 1 / 1;
	width: 100%;
	height: auto;
}

/* Without JS only the lit image shows. */
.project__img--off {
	opacity: 0;
	/* Fade the dark background's edges into the page so no rectangle shows. */
	--fade: radial-gradient(ellipse 50% 50% at 50% 50%, #000 60%, transparent 100%);
	-webkit-mask-image: var(--fade);
	mask-image: var(--fade);
}

/* Scroll-driven "lights on": the project in the middle of the screen swaps to its lit image. */
.js .project__desc {
	transition: color var(--light-fade) ease;
}

.js .project__img {
	transition: opacity var(--light-fade) ease;
}

.js .project:not(.is-active) .project__desc {
	color: var(--color-muted);
}

.js .project:not(.is-active) .project__img--off {
	opacity: 1;
}

.js .project:not(.is-active) .project__img--on {
	opacity: 0;
}

@media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
	html {
		scroll-snap-type: y proximity;
	}

	.project {
		scroll-snap-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.js .project__desc,
	.js .project__img {
		transition: none;
	}
}

@media (max-width: 1200px) {
	.project {
		column-gap: 48px;
	}

	.project__text {
		padding-left: var(--gutter);
	}
}

@media (max-width: 899px) {
	.projects {
		gap: 64px;
	}

	.project {
		grid-template-columns: 1fr;
		row-gap: 24px;
		min-height: 0;
		padding: 0 var(--gutter);
	}

	.project__text {
		order: 2;
		padding-left: 0;
	}

	.project__title {
		font-size: 28px;
	}

	.project__desc {
		font-size: 18px;
		line-height: 28px;
	}

	.project__tags {
		font-size: 16px;
		line-height: 24px;
	}
}
