/**
 * Project cards for the [projekte] shortcode.
 *
 * Colours and fonts come from the theme: borders and muted text are mixed
 * from currentColor, so the cards follow light and dark mode on their own.
 * Override the custom properties on .mg-projects to adjust them.
 */

.mg-projects {
	--mg-projects-gap: 1.5rem;
	--mg-projects-radius: 0.75rem;
	--mg-projects-border: color-mix(in srgb, currentColor 15%, transparent);
	--mg-projects-border-hover: color-mix(in srgb, currentColor 40%, transparent);
	--mg-projects-muted: color-mix(in srgb, currentColor 65%, transparent);

	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
	gap: var(--mg-projects-gap);
	margin: 2rem 0;
	padding: 0;
	list-style: none;
}

.mg-project {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--mg-projects-border);
	border-radius: var(--mg-projects-radius);
	transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.mg-project:hover,
.mg-project:focus-within {
	border-color: var(--mg-projects-border-hover);
	box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, currentColor 12%, transparent);
	transform: translateY(-2px);
}

.mg-project:focus-within {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.mg-project__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 2 / 1;
	object-fit: cover;
	margin: 0;
	border-bottom: 1px solid var(--mg-projects-border);
}

.mg-project__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem 1.25rem 1.25rem;
}

.mg-project__title {
	margin: 0;
	font-size: 1.125rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.mg-project__link {
	color: inherit;
	text-decoration: none;
}

/* Stretch the link over the whole card. */
.mg-project__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.mg-project__link:focus-visible {
	outline: none;
}

.mg-project__description {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.mg-project__meta {
	margin: auto 0 0;
	padding-top: 0.25rem;
	color: var(--mg-projects-muted);
	font-size: 0.8125rem;
	overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
	.mg-project {
		transition: none;
	}

	.mg-project:hover,
	.mg-project:focus-within {
		transform: none;
	}
}
