/**
 * Nexza Projects Grid widget.
 */

.nx-pgrid-head {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(24px, 3vw, 48px);
	align-items: end;
	margin-bottom: 48px;
}

.nx-pgrid-head > * {
	min-width: 0;
}

.nx-pgrid-head h2,
.nx-pgrid-head p {
	margin: 0;
}

.nx-pgrid-head p {
	color: var(--nx-muted-dark);
}

/* Filter buttons: only with JavaScript (without it every project shows). */
.nx-pgrid-filters {
	display: none;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 40px;
}

.nx-js .nx-pgrid-filters {
	display: flex;
}

.nx-pgrid-filters button {
	padding: 10px 18px;
	border: 1px solid var(--nx-line-2);
	border-radius: var(--nx-radius-pill);
	background: none;
	font: inherit;
	font-size: 13px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nx-muted-dark);
	cursor: pointer;
	transition: background-color .3s, border-color .3s, color .3s;
}

.nx-pgrid-filters button:hover {
	border-color: var(--nx-copper);
	color: var(--nx-sand);
}

.nx-pgrid-filters button[aria-pressed="true"] {
	background: var(--nx-copper);
	border-color: var(--nx-copper);
	color: var(--nx-ink);
}

/* Grid of mixed widths (12 columns). */
.nx-pgrid-list {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	gap: clamp(20px, 2.4vw, 36px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nx-pgrid-item {
	min-width: 0;
}

.nx-span-4 { grid-column: span 4; }
.nx-span-5 { grid-column: span 5; }
.nx-span-7 { grid-column: span 7; }
.nx-span-8 { grid-column: span 8; }
.nx-span-12 { grid-column: span 12; }

/* Filtered: three equal cards per row. */
.nx-pgrid-list.is-filtered .nx-pgrid-item {
	grid-column: span 4;
}

.nx-pgrid-item[hidden] {
	display: none;
}

.nx-pgrid-item a {
	display: block;
	color: inherit;
}

.nx-pgrid-img {
	display: block;
	aspect-ratio: 4 / 3;
}

.nx-pgrid-list:not(.is-filtered) .nx-span-12 .nx-pgrid-img {
	aspect-ratio: 21 / 9;
}

.nx-pgrid-img img {
	transition: transform .6s var(--nx-ease);
}

.nx-pgrid-item a:hover .nx-pgrid-img img {
	transform: scale(1.04);
}

.nx-pgrid-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-top: 18px;
}

.nx-pgrid-title {
	min-width: 0;
	font-size: clamp(20px, 1.8vw, 28px);
	font-weight: 700;
	letter-spacing: -.02em;
	line-height: 1.15;
	color: var(--nx-sand);
	transition: color .3s;
}

.nx-pgrid-item a:hover .nx-pgrid-title,
.nx-pgrid-item a:focus-visible .nx-pgrid-title {
	color: var(--nx-ember);
}

@media (max-width: 1080px) {
	.nx-pgrid-list.is-filtered .nx-pgrid-item {
		grid-column: span 6;
	}
}

@media (max-width: 860px) {
	.nx-pgrid-head {
		grid-template-columns: 1fr;
		gap: 16px;
		margin-bottom: 32px;
	}

	.nx-pgrid-item,
	.nx-pgrid-list.is-filtered .nx-pgrid-item {
		grid-column: span 12;
	}

	.nx-pgrid-list:not(.is-filtered) .nx-span-12 .nx-pgrid-img {
		aspect-ratio: 4 / 3;
	}

	/* Filter buttons scroll sideways instead of stacking many rows. */
	.nx-js .nx-pgrid-filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin-right: calc(-1 * var(--nx-gutter));
		padding-right: var(--nx-gutter);
		scrollbar-width: none;
	}

	.nx-pgrid-filters button {
		flex: none;
	}

	.nx-pgrid-meta {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
	}
}
