/*
 * Project cards (cw_core_project_card()): the Large and Compact grid card, the List
 * view row and the Photo wall tile. Shared by cw/project-directory and
 * cw/related-projects. Each card is one link.
 */

/* ------------------------------------------------------------------ card */

.cw-project-card {
	display: block;
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.cw-project-card__image {
	margin: 0;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--cw-radius);
	background: var(--wp--preset--color--surface);
}

.cw-project-card--compact .cw-project-card__image {
	aspect-ratio: 1;
}

.cw-project-card__image img,
.cw-project-row__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.cw-project-card:hover .cw-project-card__image img,
.cw-project-card:focus-visible .cw-project-card__image img,
.cw-project-row:hover .cw-project-row__image img,
.cw-project-row:focus-visible .cw-project-row__image img {
	transform: scale(1.04);
}

.cw-project-card__title {
	margin: 15px 0 0;
	font-size: var(--wp--preset--font-size--heading-5);
	line-height: 1.4;
	color: var(--wp--preset--color--heading);
	transition: color 0.2s;
}

.cw-project-card--compact .cw-project-card__title {
	margin-block-start: 10px;
	font-size: var(--wp--preset--font-size--body);
	font-weight: 500;
}

.cw-project-card:hover .cw-project-card__title,
.cw-project-row:hover .cw-project-row__title {
	color: var(--wp--preset--color--hover);
}

.cw-project-card__meta,
.cw-project-row__meta {
	margin: 4px 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.cw-project-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.cw-project-card__tags li {
	padding: 4px 12px;
	border-radius: 30px;
	background: var(--cw-line-soft);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--wp--preset--color--heading);
}

/* ------------------------------------------------------------------ list row */

.cw-project-row {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: 30px;
	align-items: start;
	padding-block: 30px;
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.cw-directory__results--list > li:first-child .cw-project-row {
	padding-block-start: 0;
}

.cw-project-row__image {
	margin: 0;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	border-radius: var(--cw-radius);
	background: var(--wp--preset--color--surface);
}

.cw-project-row__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--heading-5);
	line-height: 1.4;
	color: var(--wp--preset--color--heading);
	transition: color 0.2s;
}

.cw-project-row__summary {
	margin: 12px 0 0;
}

.cw-project-row__details {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 10px 25px;
	margin: 18px 0 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.cw-project-row__details dt {
	color: var(--wp--preset--color--muted);
}

.cw-project-row__details dd {
	margin: 0;
	color: var(--wp--preset--color--text);
}

/* ------------------------------------------------------------------ photo wall tile */

.cw-project-tile {
	position: relative;
	display: block;
	overflow: hidden;
	color: var(--wp--preset--color--heading);
	text-decoration: none;
}

.cw-project-tile img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

.is-masonry-ready .cw-project-tile,
.is-masonry-ready .cw-project-tile img {
	height: 100%;
}

.is-masonry-ready .cw-project-tile img {
	object-fit: cover;
}

.cw-project-tile__title {
	position: absolute;
	inset: auto 0 0;
	margin: 0;
	padding: 40px 15px 12px;
	background: linear-gradient(transparent, rgb(0 0 0 / 0.7));
	font-size: var(--wp--preset--font-size--heading-6);
	line-height: 1.4;
	color: var(--wp--preset--color--heading);
	opacity: 0;
	transition: opacity 0.2s;
}

.cw-project-tile:hover .cw-project-tile__title,
.cw-project-tile:focus-visible .cw-project-tile__title {
	opacity: 1;
}

.cw-project-tile:focus-visible {
	outline-offset: -2px;
}

@media (hover: none) {
	.cw-project-tile__title {
		opacity: 1;
	}
}

@media (max-width: 767px) {
	.cw-project-row {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cw-project-card__image img,
	.cw-project-row__image img {
		transition: none;
	}

	.cw-project-card:hover .cw-project-card__image img,
	.cw-project-card:focus-visible .cw-project-card__image img,
	.cw-project-row:hover .cw-project-row__image img,
	.cw-project-row:focus-visible .cw-project-row__image img {
		transform: none;
	}
}
