/* ==========================================================================
   apc/success-check
   ========================================================================== */

.apc-sc {
	--apc-sc-accent: #155DFC;
	--apc-sc-check: #ffffff;
	--apc-sc-size: 96px;
	--apc-sc-ease: cubic-bezier(0.65, 0, 0.35, 1);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.apc-sc__icon {
	flex: none;
	width: var(--apc-sc-size);
	height: var(--apc-sc-size);
}

.apc-sc__svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.apc-sc__svg g,
.apc-sc__svg path,
.apc-sc__svg circle {
	transform-box: view-box;
	transform-origin: 50% 50%;
}

/* --- Initial (pre-animation) state -------------------------------------- */

.apc-sc__outline {
	fill: none;
	stroke: var(--apc-sc-accent);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}

.apc-sc__disc {
	fill: var(--apc-sc-accent);
	transform: scale(0);
}

.apc-sc__check {
	fill: none;
	stroke: var(--apc-sc-check);
	stroke-width: 6;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}

.apc-sc__ring {
	fill: none;
	stroke: var(--apc-sc-accent);
	stroke-width: 2;
	opacity: 0;
}

.apc-sc__track {
	fill: none;
	stroke: var(--apc-sc-accent);
	stroke-width: 4;
	opacity: 0;
}

.apc-sc__arc {
	fill: none;
	stroke: var(--apc-sc-accent);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-dasharray: 22 78;
	opacity: 0;
}

.apc-sc__confetti rect {
	fill: var(--apc-sc-accent);
	opacity: 0;
	transform-box: fill-box;
	transform-origin: center;
}

/* --- Loading phase (style: loading) ------------------------------------- */

.apc-sc.is-loading .apc-sc__track {
	opacity: 0.15;
}

.apc-sc.is-loading .apc-sc__arc {
	opacity: 1;
	animation: apc-sc-spin 0.9s linear infinite;
}

/* --- Success phase (all styles) ----------------------------------------- */

.apc-sc.is-animating .apc-sc__outline {
	animation: apc-sc-draw 0.6s var(--apc-sc-ease) forwards;
}

.apc-sc.is-animating .apc-sc__disc {
	animation: apc-sc-scale 0.4s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.apc-sc.is-animating .apc-sc__check {
	animation: apc-sc-draw 0.35s 0.8s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.apc-sc.is-animating .apc-sc__badge {
	animation: apc-sc-pop 0.45s 1.1s ease-out;
}

.apc-sc.is-animating .apc-sc__ring {
	animation: apc-sc-ring 0.9s 1.1s ease-out;
}

.apc-sc.is-animating .apc-sc__confetti rect {
	animation: apc-sc-burst 0.9s 1.1s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Spinner fades out as the success circle draws in */
.apc-sc--loading.is-animating .apc-sc__track {
	opacity: 0.15;
	animation: apc-sc-out 0.25s forwards;
}

.apc-sc--loading.is-animating .apc-sc__arc {
	opacity: 1;
	animation: apc-sc-spin 0.9s linear infinite, apc-sc-out 0.25s forwards;
}

/* --- Final static state (reduced motion) -------------------------------- */

.apc-sc.is-done .apc-sc__outline,
.apc-sc.is-done .apc-sc__check {
	stroke-dashoffset: 0;
}

.apc-sc.is-done .apc-sc__disc {
	transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
	.apc-sc.is-animating .apc-sc__outline,
	.apc-sc.is-animating .apc-sc__check,
	.apc-sc.is-animating .apc-sc__disc,
	.apc-sc.is-animating .apc-sc__badge,
	.apc-sc.is-animating .apc-sc__ring,
	.apc-sc.is-animating .apc-sc__confetti rect {
		animation: none;
	}

	.apc-sc.is-animating .apc-sc__outline,
	.apc-sc.is-animating .apc-sc__check {
		stroke-dashoffset: 0;
	}

	.apc-sc.is-animating .apc-sc__disc {
		transform: scale(1);
	}
}

/* --- Keyframes ---------------------------------------------------------- */

@keyframes apc-sc-draw {
	to { stroke-dashoffset: 0; }
}

@keyframes apc-sc-scale {
	to { transform: scale(1); }
}

@keyframes apc-sc-pop {
	0%, 100% { transform: scale(1); }
	45% { transform: scale(1.08); }
}

@keyframes apc-sc-ring {
	0% { opacity: 0.5; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.5); }
}

@keyframes apc-sc-burst {
	0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
	100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(0.5); }
}

@keyframes apc-sc-spin {
	to { transform: rotate(360deg); }
}

@keyframes apc-sc-out {
	to { opacity: 0; }
}
