/* Preloader Styles */
.preloader-wrapper {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	background: #ffffff; /* Light mode default */
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10000;
	transition: background-color 0.3s ease;
}

.preloader-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
}

.progress-bar-container {
	width: 200px;
	height: 2px;
	position: relative;
	overflow: hidden;
	direction: ltr; /* Force left-to-right */
}

.progress-bar {
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.1);
	border-radius: 2px;
	overflow: hidden;
	position: relative;
	direction: ltr; /* Force left-to-right */
}

/* Dark mode progress bar background */
html.dark .progress-bar {
	background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
	height: 100%;
	width: 0%;
	background: #000;
	border-radius: 2px;
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
	direction: ltr; /* Force left-to-right */
	left: 0; /* Ensure it starts from the left */
	right: auto; /* Override RTL */
}

/* Liquid wave effect */
.progress-fill::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.3),
		transparent
	);
	animation: liquid-wave 2s infinite;
	transform: translateX(-100%);
}

/* Dark mode progress fill color */
html.dark .progress-fill {
	background: #fff;
}

html.dark .progress-fill::before {
	background: linear-gradient(
		90deg,
		transparent,
		rgba(0, 0, 0, 0.3),
		transparent
	);
}

@keyframes liquid-wave {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(200%);
	}
}

/* Dark mode preloader background */
html.dark .preloader-wrapper {
	background: var(--bg, #0f0f0f);
}

.loader {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: inline-block;
	border-top: 3px solid #000; /* Dark loader for light mode */
	border-right: 3px solid transparent;
	box-sizing: border-box;
	animation: rotation 1s linear infinite;
	transition: border-color 0.3s ease;
}

/* Dark mode loader color */
html.dark .loader {
	border-top-color: #fff; /* White loader for dark mode */
}

@keyframes rotation {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Hide body content initially */
body.preloader-active {
	overflow: hidden;
}

body.preloader-active header,
body.preloader-active main,
body.preloader-active section,
body.preloader-active footer {
	opacity: 0;
	visibility: hidden;
}
body.preloader-active .hero,
body.preloader-active .hero * {
	opacity: 1 !important;
	visibility: visible !important;
}

/* Ensure hero__sub is always visible for LCP */
body.preloader-active .hero__sub {
	opacity: 1 !important;
	visibility: visible !important;
	display: block !important;
}