/* ChargePoint plug in / plug out (from the 2026 brand story). Driven by cp-motion.js. */

/* Full-screen sweep: glowing line + haze */
.cpm-charge-sweep {
	position: fixed;
	inset: 0 0 auto;
	height: 0;
	z-index: 100000;
	pointer-events: none;
	opacity: 0;
	transform: translateY(100vh);
}

.cpm-charge-sweep::before {
	content: '';
	position: absolute;
	inset: -2px 0 auto;
	height: 3px;
	background: linear-gradient(90deg, var(--color-orange, #FF7A14), var(--color-purple, #8866CC));
	box-shadow:
		0 0 14px 2px color-mix(in srgb, var(--color-orange, #FF7A14) 60%, transparent),
		0 0 44px 12px color-mix(in srgb, var(--color-purple, #8866CC) 50%, transparent);
}

.cpm-charge-sweep::after {
	content: '';
	position: absolute;
	inset: 1px 0 auto;
	height: 34vh;
	background: linear-gradient(180deg,
			color-mix(in srgb, var(--color-purple, #8866CC) 55%, transparent),
			color-mix(in srgb, var(--color-orange, #FF7A14) 32%, transparent) 42%,
			transparent);
}

/* Line under AfterNow's header, filled to the battery level while charging */
.cpm-charge-line {
	position: absolute;
	left: 0;
	bottom: -1px;
	z-index: 2;
	width: 100%;
	height: 3px;
	pointer-events: none;
	background: linear-gradient(90deg, var(--color-orange, #FF7A14), var(--color-purple, #8866CC));
	box-shadow: 0 0 18px 2px color-mix(in srgb, var(--color-purple, #8866CC) 55%, transparent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 1.8s cubic-bezier(.22, .8, .26, 1);
}

html.cpm-charging .cpm-charge-line {
	transform: scaleX(var(--cpm-lvl, 1));
}

@media (prefers-reduced-motion: no-preference) {
	html.cpm-plug-in .cpm-charge-sweep {
		animation: cpm-plug-in 1.7s cubic-bezier(.3, .65, .25, 1) forwards;
	}

	html.cpm-plug-out .cpm-charge-sweep {
		animation: cpm-plug-out 1.2s cubic-bezier(.55, 0, .75, .3) forwards;
	}
}

@keyframes cpm-plug-in {
	0% { transform: translateY(102vh); opacity: 0; }
	8% { opacity: 1; }
	88% { opacity: 1; }
	100% { transform: translateY(-36vh); opacity: 0; }
}

@keyframes cpm-plug-out {
	0% { transform: translateY(-2vh) scaleY(-1); opacity: 0; }
	10% { opacity: .75; }
	85% { opacity: .75; }
	100% { transform: translateY(102vh) scaleY(-1); opacity: 0; }
}

/* Reduce motion: no sweep, the header line just appears */
@media (prefers-reduced-motion: reduce) {
	.cpm-charge-sweep { display: none; }
	.cpm-charge-line { transition: none; }
}
