/* -----------------------------------------------------------------------
 * Custom Projects Showcase — Masonry Grid
 * True masonry via CSS Grid (dense auto-flow) + JS-computed row spans.
 * -------------------------------------------------------------------- */

.pcs-masonry-grid {
	--pcs-columns: 4;
	--pcs-gap: 24px;
	--pcs-row-height: 10px;

	display: grid;
	grid-template-columns: repeat(var(--pcs-columns), 1fr);
	grid-auto-rows: var(--pcs-row-height);
	grid-auto-flow: dense;
	gap: var(--pcs-gap);
	width: 100%;
	box-sizing: border-box;
}

.pcs-masonry-item {
	overflow: hidden;
	border-radius: 6px;
	background-color: #161616;
}

.pcs-image-wrap {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 6px;
	text-decoration: none;
	background-color: #161616;
	/* Fallback aspect ratio before JS measures the real image;
	   overwritten inline once the image loads. */
	aspect-ratio: 4 / 3;
}

.pcs-image,
.pcs-image--placeholder {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.6s ease;
}

.pcs-image--placeholder {
	background: linear-gradient(135deg, #222 0%, #161616 100%);
}

.pcs-masonry-item:hover .pcs-image {
	transform: scale(1.035);
}

/* Bottom scrim so the label/title stay legible over any photo */
.pcs-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.82) 0%,
		rgba(0, 0, 0, 0.35) 32%,
		rgba(0, 0, 0, 0) 60%
	);
	pointer-events: none;
}

.pcs-content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px;
}

.pcs-label {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.6);
}

.pcs-title {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	color: #f5f5f5;
}

.pcs-empty {
	color: rgba(255, 255, 255, 0.6);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	padding: 24px 0;
}

/* -----------------------------------------------------------------------
 * Responsive column counts — collapse gracefully on smaller screens
 * regardless of the "columns" shortcode attribute.
 * -------------------------------------------------------------------- */
@media (max-width: 1024px) {
	.pcs-masonry-grid {
		grid-template-columns: repeat(min(3, var(--pcs-columns)), 1fr);
	}
}

@media (max-width: 700px) {
	.pcs-masonry-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.pcs-label {
		font-size: 10px;
	}
	.pcs-title {
		font-size: 14px;
	}
}

@media (max-width: 480px) {
	.pcs-masonry-grid {
		grid-template-columns: 1fr;
	}
}
