:root {
	--blazor-load-percentage: 0%;
	--blazor-load-percentage-text: "0%";
	--period: 60s;
	--inc-h: 1px;
	--inc-w: 1px;
	--period-base: calc(var(--period) / 10);
	--period-p2: calc(var(--period-base) * 1);
	--period-p3: calc(var(--period-base) * 2);
	--period-p4: calc(var(--period-base) * 3);
	--period-p5: calc(var(--period-base) * 4);
	--load-hue: 0;
	/*calc(var(--blazor-load-percentage) * 3.6deg);*/
}

/* Hexeract Animation Logic */
.penteract-viewport {
	position: sticky;
	opacity: 1;
	filter: blur(.25em);
	/* The Magic: Overlapping asymmetrical animations */
	animation:
		pulse-width 7s alternate infinite,
		pulse-height 5s alternate infinite,
		drift-skew 12s alternate infinite;

	/* Ensure the 5D content stays centered during the chaos */
	display: flex;
	align-items: center;
	justify-content: space-evenly;
	transform-origin: center;
}

@keyframes loop-hue {
	0% {
		/* Starts at the current load color and adds 0deg */
		filter: blur(.1em) hue-rotate(var(--load-hue));
	}

	100% {
		/* Completes a full cycle from the current load color */
		filter: blur(.5em) hue-rotate(calc(var(--load-hue) + 180deg));
	}
}

/* Independent Width Flux */
@keyframes pulse-width {

	0%,
	100% {
		width: calc(100px + var(--inc-w));
	}

	33% {
		width: 100px;
	}

	66% {
		width: calc(100px - var(--inc-w));
	}
}

/* Independent Height Flux (Different duration/percentages) */
@keyframes pulse-height {

	0%,
	100% {
		height: 100px;
	}

	45% {
		height: calc(100px - var(--inc-h));
	}

	75% {
		height: calc(100px + var(--inc-h));
	}
}

/* Asymmetrical Skew and Rotation to break the "perfect" geometry */
@keyframes drift-skew {

	0%,
	100% {
		transform: skew(0deg, 0deg) rotate(0deg);
	}

	25% {
		transform: skew(10deg, -5deg) rotate(5deg);
	}

	50% {
		transform: skew(-5deg, 3deg) rotate(-2deg);
	}

	75% {
		transform: skew(10deg, -20deg) rotate(15deg);
	}
}

/* Ensure the Penteract inside scales with the parent */
.penteract {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	/*transition: all 1s alternate infinite;*/
	animation: penteract-drift 5s alternate infinite;
}

.axis {
	position: absolute;
	width: 100%;
	height: 100%;
	border: 1em solid var(--accent-primary);
	border-radius: 16;
	box-shadow: 0 0 15px var(--accent-primary);
	/* Clip-path creates the 5-axis vertex connections */
	clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
	animation: loop-hue 5s alternate infinite;
}

/* Offsetting each of the 5 dimensions by 360/5 degrees */
.p1 {
	transform: rotate(calc(360deg/5*0)) scale(0.9);
}

.p2 {
	transform: rotate(calc(360deg/5*1)) scale(0.85);
	animation: p-pulse var(--period) infinite var(--period-p2);
}

.p3 {
	transform: rotate(calc(360deg/5*2)) scale(0.8);
	animation: p-pulse var(--period) infinite var(--period-p3);
}

.p4 {
	transform: rotate(calc(360deg/5*3)) scale(0.75);
	animation: p-pulse var(--period) infinite var(--period-p4);
}

.p5 {
	transform: rotate(calc(360deg/5*4)) scale(0.7);
	animation: p-pulse var(--period) infinite var(--period-p5);
}

.penteract-core {
	width: 3em;
	height: 3em;
	background: radial-gradient(#0080FF);
	border-radius: 50%;
	/* Core glows brighter as the app loads */
	box-shadow: 0 0 calc(var(--blazor-load-percentage) * 10%) var(--bg-glass);
	opacity: calc(var(--blazor-load-percentage));
	filter: blur(1em);
}

@keyframes penteract-drift {

	0% {
		width: 400px;
		height: 400px;
		transform: rotate(0deg) scale(1);
	}

	50% {
		width: 20px;
		height: 20px;
		transform: rotate(20deg) scale(1.5);
	}

	100% {
		width: 150px;
		height: 150px;
		transform: rotate(0deg) scale(1);
	}

}

@keyframes p-pulse {

	0%,
	100% {
		opacity: 0.4;
	}

	50% {
		opacity: 0.8;
		border-width: 8px;
	}
}

@keyframes rotate6D {
	0% {
		transform: rotate(0deg) scale(1);
	}

	50% {
		transform: rotate(180deg) scale(1.2);
	}

	100% {
		transform: rotate(360deg) scale(1);
	}
}

/* Glass UI Integration */
.loading-wrapper {
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	align-items: center;
	width: 100%;
	height: 100vh;
	background: var(--bg-base);
}

.loading-card {
	width: 340px;
	position: relative;
	background: var(--bg-glass);
	backdrop-filter: blur(12px);
	border: 1px solid var(--border-glass);
	padding: 3.5rem 2rem 2.5rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-content: center;
	align-items: center;
	gap: 1.5rem;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.progress-ring-circle {
	fill: transparent;
	stroke: var(--accent-primary);
	stroke-width: 3;
	stroke-dasharray: 238.7;
	stroke-dashoffset: calc(238.7 - (238.7 * var(--blazor-load-percentage) / 100));
}

.status-subtitle::after {
	display: block;
	content: "Initializing...";
	font-size: 0.85rem;
	color: var(--text-muted);
	animation: status-steps linear forwards;
	animation-delay: calc(var(--blazor-load-percentage) * -1s);
	animation-duration: 100s;
	animation-play-state: paused;
}

@keyframes status-steps {

	0%,
	20% {
		content: "Waking Secure Enclave...";
	}

	21%,
	45% {
		content: "Deriving Root Keys...";
	}

	46%,
	70% {
		content: "Loading Identity Layer...";
	}

	71%,
	90% {
		content: "Syncing Local Vault...";
	}

	91%,
	100% {
		content: "Handshake Complete.";
	}
}

.mini-fill {
	height: 100%;
	width: var(--blazor-load-percentage);
	background: var(--accent-gradient);
}