/* Loading page: burgundy screen, PesarKhaleh logo in a gold ring, Nastaliq line.
   Loop: logo pops in, ring draws from the top (90°), text reveals right to left, repeat. */
@font-face {
	font-family: "PK Nastaliq";
	src: url("../fonts/IranNastaliq-fa.woff2") format("woff2");
	font-display: block;
}

.pk-loader {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(4px, 1vw, 10px);
	background: #4f0f0e;
	transition: opacity .5s ease, visibility .5s ease;
}

.pk-loader.is-done {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.pk-loader__mark {
	position: relative;
	width: clamp(120px, 15vw, 190px);
	aspect-ratio: 1;
}

.pk-loader__ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	transform: rotate(-90deg); /* start the stroke at the top */
	overflow: visible;
}

.pk-loader__ring circle {
	fill: none;
	stroke: #a98355;
	stroke-width: 2.4;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
	animation: pk-loader-ring 3s ease-in-out infinite;
}

.pk-loader__logo {
	position: absolute;
	inset: 22%;
	width: 56%;
	height: 56%;
	object-fit: contain;
	animation: pk-loader-pop 3s ease-out infinite;
}

.pk-loader__text {
	margin: 0;
	direction: rtl;
	color: #f5ecd1;
	font: 400 clamp(26px, 3.6vw, 44px) / 1.6 "PK Nastaliq", serif;
	white-space: nowrap;
	animation: pk-loader-text 3s ease-in-out infinite;
}

@keyframes pk-loader-pop {
	0% { transform: scale(.4); opacity: 0; }
	14% { transform: scale(1.08); opacity: 1; }
	20%, 88% { transform: scale(1); opacity: 1; }
	100% { transform: scale(1); opacity: 0; }
}

@keyframes pk-loader-ring {
	0%, 16% { stroke-dashoffset: 100; opacity: 1; }
	52%, 88% { stroke-dashoffset: 0; opacity: 1; }
	100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes pk-loader-text {
	0%, 50% { clip-path: inset(0 0 0 100%); opacity: 1; }
	78%, 88% { clip-path: inset(0 0 0 0); opacity: 1; }
	100% { clip-path: inset(0 0 0 0); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.pk-loader__ring circle,
	.pk-loader__logo,
	.pk-loader__text { animation: none; }
	.pk-loader__ring circle { stroke-dashoffset: 0; }
}
