/*
 * PureCSS.com
 * https://purecss.com/parallax-scrolling/
 * Background and foreground layers move at different speeds using scroll-driven animations.
 */

/*
 * The timeline is named rather than scroll(nearest). .parallax-inner below
 * uses overflow: hidden, which makes it a scroll container too, so "nearest"
 * resolved to that instead of this scene. It has nothing to scroll, so the
 * timeline was inactive and the layers never moved. A named timeline is
 * looked up on ancestors, so it binds to this element no matter what sits in
 * between.
 */
.demo-parallax-scrolling .parallax-scene {
		width: 100%;
		position: relative;
		height: 300px;
		overflow-y: scroll;
		overflow-x: hidden;
		border-radius: var(--radius-lg);
		scroll-behavior: smooth;
		scroll-timeline-name: --parallax;
	}

.demo-parallax-scrolling .parallax-inner {
		height: 600px;
		position: relative;
		overflow: hidden;
	}

.demo-parallax-scrolling .parallax-layer {
		position: absolute;
		inset: 0;
		will-change: transform;
	}

.demo-parallax-scrolling .layer-bg {
		background: radial-gradient(ellipse at 50% 20%, rgba(184, 255, 87, .08) 0%, transparent 60%),
		            linear-gradient(180deg, #0c0c0d 0%, #0f1a0a 100%);
		animation: parallax-bg linear both;
		animation-timeline: --parallax;
	}

.demo-parallax-scrolling .layer-mid {
		display: flex;
		align-items: flex-start;
		justify-content: center;
		padding-top: 100px;
		animation: parallax-mid linear both;
		animation-timeline: --parallax;
	}

.demo-parallax-scrolling .layer-front {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-end;
		padding-bottom: 2rem;
		animation: parallax-front linear both;
		animation-timeline: --parallax;
	}

.demo-parallax-scrolling .parallax-stars {
		position: absolute;
		inset: 0;
		background-image:
			radial-gradient(circle 1px at 15% 20%, var(--text-muted) 0%, transparent 100%),
			radial-gradient(circle 1px at 35% 45%, var(--text-muted) 0%, transparent 100%),
			radial-gradient(circle 2px at 55% 15%, var(--accent-in-palette) 0%, transparent 100%),
			radial-gradient(circle 1px at 70% 60%, var(--text-muted) 0%, transparent 100%),
			radial-gradient(circle 1px at 85% 30%, var(--text-muted) 0%, transparent 100%),
			radial-gradient(circle 2px at 25% 70%, var(--sky) 0%, transparent 100%),
			radial-gradient(circle 1px at 90% 75%, var(--text-muted) 0%, transparent 100%);
		animation: parallax-stars linear both;
		animation-timeline: --parallax;
	}

.demo-parallax-scrolling .parallax-moon {
		width: 80px;
		height: 80px;
		background: radial-gradient(circle at 35% 35%, var(--yellow), var(--orange));
		border-radius: 50%;
		box-shadow: 0 0 30px rgba(255, 212, 68, .3);
		position: absolute;
		top: 60px;
		right: 80px;
	}

.demo-parallax-scrolling .parallax-hills {
		width: 120%;
		height: 120px;
		background: var(--surface);
		border-radius: 50% 50% 0 0;
		margin-bottom: -20px;
	}

.demo-parallax-scrolling .parallax-text {
		position: relative;
		text-align: center;
		color: var(--text);
	}

:is(.demo-parallax-scrolling .parallax-text) h2 {
			font-size: 1.4rem;
			margin-bottom: .25rem;
		}

:is(.demo-parallax-scrolling .parallax-text) p {
			font-size: .85rem;
			color: var(--text-muted);
		}

.demo-parallax-scrolling .scroll-hint {
		position: sticky;
		bottom: .5rem;
		text-align: center;
		font-size: .72rem;
		color: var(--text-muted);
		pointer-events: none;
	}

@keyframes parallax-bg {
	from { transform: translateY(0); }
	to   { transform: translateY(-15%); }
}

@keyframes parallax-stars {
	from { transform: translateY(0); }
	to   { transform: translateY(-30%); }
}

@keyframes parallax-mid {
	from { transform: translateY(0); }
	to   { transform: translateY(-20%); }
}

@keyframes parallax-front {
	from { transform: translateY(0); }
	to   { transform: translateY(-5%); }
}

/* ── Variant: horizontal parallax bound to the x axis ── */

/* The demo wrapper is a centered flex box, so the strip needs its own width. */
.demo-parallax-scrolling .px-h {
		width: 100%;
	}

.demo-parallax-scrolling .px-h-scene {
		width: 100%;
		height: 170px;
		overflow-x: scroll;
		overflow-y: hidden;
		border-radius: var(--radius-lg);
		background: var(--surface);
		scroll-timeline-name: --parallax-x;
		/* A scroll timeline listens on the block axis by default, which is
		   vertical here. Without this the timeline never advances. */
		scroll-timeline-axis: x;
	}

.demo-parallax-scrolling .px-h-track {
		position: relative;
		width: 200%;
		height: 100%;
	}

.demo-parallax-scrolling .px-h-layer {
		position: absolute;
		inset: 0;
		will-change: transform;
	}

/* animation-timeline follows the shorthand in every rule below, never
   precedes it: the `animation` shorthand resets animation-timeline to auto,
   so a timeline declared first is thrown away. The layer then runs on the
   document timeline with a duration of 0s and snaps to its end offset. */
.demo-parallax-scrolling .px-h-back {
		background: repeating-linear-gradient(90deg, var(--surface-2) 0 26px, transparent 26px 52px);
		animation: px-back-x linear both;
		animation-timeline: --parallax-x;
	}

.demo-parallax-scrolling .px-h-mid {
		background:
			radial-gradient(circle 26px at 16% 44%, var(--sky) 98%, transparent 100%),
			radial-gradient(circle 18px at 40% 60%, var(--violet) 98%, transparent 100%),
			radial-gradient(circle 30px at 66% 38%, var(--accent-in-palette) 98%, transparent 100%),
			radial-gradient(circle 20px at 88% 58%, var(--yellow) 98%, transparent 100%);
		animation: px-mid-x linear both;
		animation-timeline: --parallax-x;
	}

.demo-parallax-scrolling .px-h-front {
		background: linear-gradient(180deg, transparent 74%, var(--border) 74%);
		animation: px-front-x linear both;
		animation-timeline: --parallax-x;
	}

.demo-parallax-scrolling .px-h-hint {
		margin-top: .6rem;
		text-align: center;
		font-size: .72rem;
		color: var(--text-muted);
	}

/* One timeline, three distances. Linear timing on purpose: an eased curve
   makes a layer speed up and slow down while the reader scrolls steadily. */
@keyframes px-back-x {
	to { transform: translateX(18%); }
}

@keyframes px-mid-x {
	to { transform: translateX(8%); }
}

@keyframes px-front-x {
	to { transform: translateX(3%); }
}

/* ── Variant: sticky layers, no scroll timeline ── */

.demo-parallax-scrolling .px-s-scene {
		position: relative;
		width: 100%;
		height: 240px;
		overflow-y: scroll;
		overflow-x: hidden;
		border-radius: var(--radius-lg);
		background: var(--surface);
	}

/* Zero height so the sticky box takes no space in the flow; the artwork
   inside it overflows and stays pinned while the cards scroll past. */
.demo-parallax-scrolling .px-s-pin {
		position: sticky;
		top: 0;
		height: 0;
		z-index: 0;
	}

.demo-parallax-scrolling .px-s-art {
		height: 240px;
		background:
			radial-gradient(circle 60px at 78% 30%, var(--yellow) 98%, transparent 100%),
			linear-gradient(180deg, #0a0e14 0%, #16233a 100%);
	}

.demo-parallax-scrolling .px-s-content {
		position: relative;
		z-index: 1;
		padding: 150px 1.25rem 1.25rem;
	}

.demo-parallax-scrolling .px-s-card {
		padding: 1rem;
		margin-bottom: .75rem;
		border: 1px solid var(--border);
		border-radius: var(--radius);
		background: var(--surface-2);
		font-size: .85rem;
		line-height: 1.7;
		color: var(--text-muted);
	}

/* Layers sliding against each other is a known vestibular trigger, so the
   offsets come off entirely when the reader asks for less motion. */
@media (prefers-reduced-motion: reduce) {
	.demo-parallax-scrolling .px-h-layer {
		animation: none;
	}
}
