/* =========================================================
   Zambezi Utilities — Project Marquee
   ---------------------------------------------------------
   Two rows of project cards drifting in opposite directions:
   the top row to the left, the bottom row to the right.

   The travel distance and duration are measured and set by
   zcu-marquee.js, which also clones the set until the track
   is wide enough to loop without a gap. Until that runs the
   rows are a plain horizontal scroller, so the content is
   reachable with no JavaScript at all.
   ========================================================= */

.zcu-marquee {
	--zcu-marquee-gap: clamp(14px, 1.6vw, 24px);
	--zcu-marquee-card: clamp(260px, 24vw, 360px);
	position: relative;
	display: grid;
	gap: var(--zcu-marquee-gap);

	/*
	 * The rows are deliberately wider than the page. Clipping on the x axis
	 * only keeps the drifting cards from widening the document, while leaving
	 * the card shadows free above and below.
	 */
	max-width: 100%;
	overflow: hidden;
	overflow-x: clip;
	overflow-y: visible;
}

.zcu-marquee__row {
	position: relative;
	overflow: hidden;
}

/* Before the script runs — and if it never does — each row is simply a
   scrollable strip rather than a stack of overflowing cards. */
.zcu-marquee:not(.is-ready) .zcu-marquee__row {
	overflow-x: auto;
	scrollbar-width: thin;
}

.zcu-marquee__track {
	display: flex;
	gap: var(--zcu-marquee-gap);
	width: max-content;
}

.zcu-marquee.is-ready .zcu-marquee__track {
	animation: zcu-marquee-left var(--zcu-marquee-duration, 60s) linear infinite;
}

.zcu-marquee.is-ready .zcu-marquee__row--reverse .zcu-marquee__track {
	animation-name: zcu-marquee-right;
}

@keyframes zcu-marquee-left {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		transform: translate3d(calc(-1 * var(--zcu-marquee-distance, 0px)), 0, 0);
	}
}

@keyframes zcu-marquee-right {
	from {
		transform: translate3d(calc(-1 * var(--zcu-marquee-distance, 0px)), 0, 0);
	}
	to {
		transform: translate3d(0, 0, 0);
	}
}

/*
 * Hold still while the pointer is over a row, so a card can be read and
 * clicked. Declared in CSS rather than tracked in script: a paused state the
 * browser owns cannot be left switched on by a missed event.
 */
@media (hover: hover) {
	.zcu-marquee.is-ready .zcu-marquee__row:hover .zcu-marquee__track,
	.zcu-marquee.is-ready .zcu-marquee__row:focus-within .zcu-marquee__track {
		animation-play-state: paused;
	}
}

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

.zcu-marquee__item {
	flex: 0 0 var(--zcu-marquee-card);
	display: block;
	width: var(--zcu-marquee-card);
	text-decoration: none;
	color: inherit;
	background: var(--zcu-background, #fff);
	border: 1px solid rgba(27, 33, 19, 0.08);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 14px 34px -22px rgba(27, 33, 19, 0.4);
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

a.zcu-marquee__item:hover {
	transform: translateY(-4px);
	box-shadow: 0 26px 50px -26px rgba(27, 33, 19, 0.5);
}

a.zcu-marquee__item:focus-visible {
	outline: 3px solid var(--zcu-accent, #f6a91a);
	outline-offset: 3px;
}

.zcu-marquee__shot {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: #18200f;
}

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

.zcu-marquee__body {
	display: block;
	padding: 16px 18px 18px;
}

.zcu-marquee__name {
	display: block;
	font-family: var(--zc-font-body, inherit);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--zcu-foreground, #18200f);
}

.zcu-marquee__text {
	/* Exactly two lines, so every card is the same height whatever the
	   description length. */
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin-top: 6px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--zcu-muted, #5c6353);
}

.zcu-marquee__host {
	display: block;
	margin-top: 10px;
	font-family: var(--zc-font-mono, ui-monospace, monospace);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--zcu-accent-alt, #c0491c);
}

/* ---------- edge fade ---------- */

/* Cards should drift out of sight rather than stop dead at the edge. */
.zcu-marquee.is-ready .zcu-marquee__row::before,
.zcu-marquee.is-ready .zcu-marquee__row::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 2;
	width: clamp(36px, 7vw, 110px);
	pointer-events: none;
}

.zcu-marquee.is-ready .zcu-marquee__row::before {
	left: 0;
	background: linear-gradient(90deg, var(--zcu-marquee-fade, #f7f4ee), transparent);
}

.zcu-marquee.is-ready .zcu-marquee__row::after {
	right: 0;
	background: linear-gradient(270deg, var(--zcu-marquee-fade, #f7f4ee), transparent);
}

@media (prefers-reduced-motion: reduce) {
	.zcu-marquee.is-ready .zcu-marquee__track {
		animation: none;
		transform: none;
	}

	.zcu-marquee.is-ready .zcu-marquee__row {
		overflow-x: auto;
	}

	.zcu-marquee__item {
		transition: none;
	}

	a.zcu-marquee__item:hover {
		transform: none;
	}
}
