/**
 * Bricksify: Step Wipe.
 *
 * Base state is an honest vertical stack of full-height panels that reads fine
 * with no JavaScript. `is-ready` collapses the stack onto one pinned stage.
 */

.bxc-wipe {
	position: relative;
	width: 100%;
}

.bxc-wipe__stage {
	position: relative;
	width: 100%;
}

.bxc-wipe__step {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	min-height: 100dvh;
	overflow: hidden;
}

.bxc-wipe__bg {
	position: absolute;
	inset: 0;
	background: linear-gradient(160deg, var(--color-surface-sunk, #ebf0ff) 0%, var(--color-wash-peach, #fff3ea) 100%);
}

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

.bxc-wipe__card {
	position: relative;
	width: min(1100px, 76vw);
	aspect-ratio: 16 / 10;
	border-radius: 20px;
	overflow: hidden;
	background: var(--color-surface, #fff);
	box-shadow: 0 2px 8px rgba(23, 28, 61, .06);
}

.bxc-wipe__media {
	width: 100%;
	height: 100%;
}

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

/* Text: never clipped, always above the visuals. */
.bxc-wipe__meta {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
}

.bxc-wipe__title,
.bxc-wipe__num,
.bxc-wipe__desc {
	position: absolute;
	font-family: Satoshi, sans-serif;
	color: var(--color-ink, #171c3d);
}

.bxc-wipe__title {
	top: 40px;
	left: 40px;
	font-size: clamp(28px, 3vw, 44px);
	font-weight: 700;
	letter-spacing: -.02em;
	line-height: 1;
}

.bxc-wipe__num {
	bottom: 40px;
	left: 40px;
	font-size: clamp(48px, 6vw, 84px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.04em;
}

.bxc-wipe__desc {
	bottom: 48px;
	right: 40px;
	max-width: 34ch;
	font-size: 15px;
	line-height: 1.6;
	color: var(--color-ink-muted, #5b628c);
	text-align: right;
}

/* Progress track, pinned to the top of the stage. */
.bxc-wipe__track {
	position: absolute;
	top: 24px;
	left: 40px;
	right: 40px;
	height: 1px;
	background: var(--color-border, #dfe3ef);
	z-index: 4;
}

.bxc-wipe__fill {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--color-ink, #171c3d);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

/* Enhanced: one pinned stage, every step laid on top of the first. */
.bxc-wipe.is-ready .bxc-wipe__stage {
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

.bxc-wipe.is-ready .bxc-wipe__layers {
	position: absolute;
	inset: 0;
}

.bxc-wipe.is-ready .bxc-wipe__step {
	position: absolute;
	inset: 0;
	min-height: 0;

	/* No z-index, no opacity, no transform: the step must not become a
	   stacking context, or the rule below cannot reach across steps. */
	z-index: auto;
}

/*
 * Order by role, not by step.
 *
 * Grouped per step, the incoming background sits above the outgoing card.
 * Both clip by the same percentage, but the card is centred, so its edge
 * travels fewer pixels; past halfway the background edge overtakes it and
 * leaves a band where the old card is already covered and the new one has
 * not arrived. A hole.
 *
 * Lifting every card above every background removes it: the previous card
 * stays visible until the new one wipes over it.
 */
.bxc-wipe.is-ready .bxc-wipe__bg {
	z-index: 1;
}

.bxc-wipe.is-ready .bxc-wipe__card {
	z-index: 2;
}

.bxc-wipe.is-ready .bxc-wipe__meta {
	z-index: 3;
}

@media (max-width: 767px) {
	.bxc-wipe__title,
	.bxc-wipe__num {
		left: 20px;
	}

	.bxc-wipe__desc {
		right: 20px;
		left: 20px;
		max-width: none;
		bottom: 24px;
		text-align: left;
	}

	.bxc-wipe__num {
		bottom: 110px;
	}

	.bxc-wipe__track {
		left: 20px;
		right: 20px;
	}

	.bxc-wipe__card {
		width: 86vw;
		aspect-ratio: 4 / 5;
	}
}
