/**
 * Nexza Pinned Projects widget.
 *
 * Default (no JS, reduced motion, editor): a sideways-scrolling row.
 * With .is-pinned (set by projects-pinned.js): the stage sticks to the
 * screen and the track moves with the page scroll, on every screen size.
 */

.nx-pin {
	padding-top: var(--nx-section);
	padding-bottom: var(--nx-section);
}

.nx-pin-stage {
	display: flex;
	flex-direction: column;
	gap: clamp(24px, 3.4vw, 52px);
}

.nx-pin-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
}

.nx-pin-head h2 {
	margin-top: 16px;
}

.nx-pin-count {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-variant-numeric: tabular-nums;
}

.nx-pin-count b {
	font-size: clamp(36px, 4vw, 64px);
	letter-spacing: -.04em;
	line-height: 1;
	color: var(--nx-sand);
}

.nx-pin-count span {
	color: var(--nx-taupe);
}

.nx-pin-count i {
	position: relative;
	display: block;
	align-self: center;
	width: 120px;
	height: 2px;
	margin-left: 12px;
	overflow: hidden;
	background: var(--nx-line-2);
}

.nx-pin-bar {
	position: absolute;
	inset: 0;
	background: var(--nx-copper);
	transform: scaleX(0);
	transform-origin: left;
}

/* Track: a scrollable row by default. */
.nx-pin-track {
	display: flex;
	gap: clamp(20px, 2.4vw, 40px);
	margin: 0;
	padding-top: 0;
	padding-bottom: 12px;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.nx-pin-track::-webkit-scrollbar {
	display: none;
}

.nx-pcard {
	flex: none;
	width: clamp(280px, 32vw, 500px);
	scroll-snap-align: start;
}

.nx-pcard > a {
	display: block;
	color: inherit;
}

.nx-pcard-img {
	position: relative;
	display: block;
	height: min(54vh, 540px);
	overflow: hidden;
	border-radius: var(--nx-radius-card);
	background: var(--nx-placeholder);
}

.nx-pcard:nth-child(even) .nx-pcard-img {
	background:
		radial-gradient(90% 80% at 88% 8%, rgba(255, 90, 31, .34), transparent 55%),
		radial-gradient(90% 90% at 0% 100%, rgba(251, 248, 244, .07), transparent 60%),
		linear-gradient(200deg, #20160E, #0B0907);
}

.nx-pcard-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

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

.nx-pcard-title {
	display: block;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -.02em;
	line-height: 1.15;
	color: var(--nx-sand);
}

.nx-pcard-meta small {
	display: block;
	margin-top: 4px;
	font-size: 14px;
	color: var(--nx-taupe);
}

/* Last card: round "All projects" link. */
.nx-pcard--more {
	display: flex;
	align-items: center;
	justify-content: center;
	width: auto;
	padding: 0 clamp(20px, 4vw, 60px);
}

.nx-pcard--more a {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: clamp(160px, 18vw, 260px);
	aspect-ratio: 1;
	border: 1px solid var(--nx-line-2);
	border-radius: 50%;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nx-sand);
	transition: transform .4s var(--nx-ease), background-color .3s, border-color .3s, color .3s;
}

.nx-pcard--more a:hover,
.nx-pcard--more a:focus-visible {
	background: var(--nx-copper);
	border-color: var(--nx-copper);
	color: var(--nx-ink);
	transform: scale(1.05);
}

/* ---------- Pinned mode ---------- */
.nx-pin.is-pinned {
	padding-top: 0;
	padding-bottom: 0;
}

.nx-pin.is-pinned .nx-pin-stage {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100svh;
	justify-content: center;
	overflow: hidden;
}

.nx-pin.is-pinned .nx-pin-track {
	width: max-content;
	overflow: visible;
	scroll-snap-type: none;
	will-change: transform;
}

/* ---------- Phones ---------- */
@media (max-width: 860px) {
	.nx-pcard {
		width: 78vw;
	}

	.nx-pcard-img {
		height: auto;
		aspect-ratio: 4 / 5;
	}

	/* Pinned on phones too: keep the cards short enough to fit with the heading. */
	.nx-pin.is-pinned .nx-pcard-img {
		aspect-ratio: auto;
		height: min(48svh, 104vw);
	}

	.nx-pin-count i {
		width: 72px;
	}

	.nx-pcard-title {
		font-size: 20px;
	}

	.nx-pcard--more a {
		width: 150px;
	}
}
