/* =========================================================================
   HollaJack: the rail (2026-11-18)

   Framed pieces hung from a brass rod: they swing on their hooks, drift
   slowly past, carry a hanging edition tag, and show a caption when pointed
   at. Markup from hj_render_rail() (inc/rail.php). Used on the homepage hero
   and on product pages ("More from this artist").
   ========================================================================= */

.hj-rail {
	--hj-piece-w: 172px;
	--hj-gap: 52px;
	position: relative;
	/* The track is several screens wide; never let it widen the page. */
	overflow: hidden;
	overflow: clip;
	padding-bottom: 76px; /* the hanging tag and the caption sit below each frame */
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
}

.hj-rail--hero {
	margin-top: var(--hj-7);
}

.hj-rail__track {
	position: relative;
	display: flex;
	width: max-content;
}

/* The rod: one brass bar the full length of the track, so it travels with
   the pieces and never ends on screen. */
.hj-rail__track::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 5px;
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(180deg, #CDAA66 0%, var(--hj-brass) 50%, var(--hj-brass-deep) 100%);
	box-shadow: 0 3px 6px rgba(22, 19, 15, 0.14);
}

.hj-rail__set {
	display: flex;
	flex: none;
	gap: var(--hj-gap);
	margin: 0;
	padding: 0 calc(var(--hj-gap) / 2);
	list-style: none;
}

.hj-rail__piece {
	flex: none;
	width: var(--hj-piece-w);
	margin: 0;
}

.hj-rail__link {
	position: relative;
	display: block;
	padding-top: 50px; /* hook (22) + wire (28) */
	color: inherit;
	text-decoration: none;
	transform-origin: 50% 7px; /* swings from where the hook meets the rod */
	transition: rotate 1.2s cubic-bezier(0.3, 1.7, 0.45, 1);
}

.hj-rail__hook {
	position: absolute;
	top: 0;
	left: 50%;
	width: 16px;
	height: 22px;
	margin-left: -8px;
	fill: none;
	stroke: var(--hj-graphite);
	stroke-width: 1.6;
	stroke-linecap: round;
}

.hj-rail__wire {
	position: absolute;
	top: 22px;
	left: 0;
	width: 100%;
	height: 28px;
	fill: none;
	stroke: var(--hj-graphite);
	stroke-width: 1;
	opacity: 0.7;
}

.hj-rail__mat {
	padding: 10px;
	box-shadow: 0 16px 30px -20px rgba(22, 19, 15, 0.5);
	transition: transform 450ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 450ms ease, border-color var(--hj-fade);
}

.hj-rail__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.hj-rail__link:hover .hj-rail__mat,
.hj-rail__link:focus-visible .hj-rail__mat {
	transform: translateY(-4px) scale(1.025);
	border-color: var(--hj-line-strong);
	box-shadow: 0 26px 40px -22px rgba(22, 19, 15, 0.55);
}

/* The edition tag: a card label on a thread, hung off the frame. */
.hj-rail__tag {
	position: absolute;
	top: calc(100% + 8px);
	right: 14px;
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 4px 8px 5px;
	background: var(--hj-card);
	border: 1px solid var(--hj-line-strong);
	border-radius: var(--hj-radius-placard);
	transform: rotate(4deg);
	transform-origin: 50% -8px;
	white-space: nowrap;
}

.hj-rail__tag::before {
	content: '';
	position: absolute;
	left: 50%;
	top: -9px;
	width: 1px;
	height: 9px;
	background: var(--hj-graphite);
	opacity: 0.6;
}

.hj-rail__tag .hj-numeral {
	font-size: 0.95rem;
	line-height: 1;
}

.hj-rail__price {
	font-size: 0.6875rem;
	font-weight: 500;
	color: var(--hj-ink-soft);
}

/* Caption: shows when a piece is pointed at, like a wall label lit up. */
.hj-rail__cap {
	position: absolute;
	top: calc(100% + 44px);
	left: -12px;
	right: -12px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	text-align: center;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 250ms ease, transform 250ms ease;
	pointer-events: none;
}

.hj-rail__link:hover .hj-rail__cap,
.hj-rail__link:focus-visible .hj-rail__cap {
	opacity: 1;
	transform: none;
}

.hj-rail__name {
	font-family: var(--hj-display);
	font-size: 1rem;
	line-height: 1.2;
	color: var(--hj-ink);
}

.hj-rail__artist {
	font-size: 0.625rem;
	letter-spacing: var(--hj-track-eyebrow);
	text-transform: uppercase;
	color: var(--hj-stone);
}

/* Pre-launch: empty frames waiting for the first numbers. */
.hj-rail__mat--empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--hj-2);
	aspect-ratio: 4 / 5;
}

.hj-rail__mat--empty .hj-numeral {
	color: var(--hj-stone);
	font-size: 1.5rem;
}

.hj-rail__reserved-cap {
	font-size: 0.625rem;
	letter-spacing: var(--hj-track-eyebrow);
	text-transform: uppercase;
	color: var(--hj-stone);
}

@media (max-width: 760px) {
	.hj-rail {
		--hj-piece-w: 132px;
		--hj-gap: 34px;
		padding-bottom: 44px;
	}

	.hj-rail--hero {
		margin-top: var(--hj-6);
	}

	.hj-rail__mat {
		padding: 7px;
	}

	.hj-rail__cap {
		display: none;
	}
}

/* --- Motion: drift, swing, hang ------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
	.hj-rail__track {
		animation: hj-rail-drift var(--hj-rail-dur, 90s) linear infinite;
	}

	.hj-rail:hover .hj-rail__track,
	.hj-rail:focus-within .hj-rail__track {
		animation-play-state: paused;
	}

	.hj-rail__link {
		animation: hj-sway var(--hj-sway, 5s) ease-in-out var(--hj-sway-delay, 0s) infinite alternate;
	}

	.hj-rail__piece {
		animation: hj-hang 1000ms cubic-bezier(0.2, 0.9, 0.25, 1.12) var(--hj-drop, 0ms) both;
	}
}

@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
	.hj-rail__track {
		animation-duration: calc(var(--hj-rail-dur, 90s) * 0.67);
	}
}

@keyframes hj-rail-drift {
	from { transform: translateX(0); }
	to   { transform: translateX(calc(-100% / var(--hj-rail-sets, 2))); }
}

@keyframes hj-sway {
	from { transform: rotate(-1.5deg); }
	to   { transform: rotate(1.5deg); }
}

@keyframes hj-hang {
	from { opacity: 0; transform: translateY(-40px); }
	to   { opacity: 1; transform: none; }
}

/* Reduced motion: a still rail you can scroll sideways, one set only. */
@media (prefers-reduced-motion: reduce) {
	.hj-rail {
		overflow-x: auto;
		scroll-snap-type: x proximity;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.hj-rail__set[aria-hidden="true"] {
		display: none;
	}

	.hj-rail__piece {
		scroll-snap-align: center;
	}
}
