/* Prevent scrolling while the loader is active. */
body.skeleton-loading {
	overflow: hidden;
}

/* Full-screen skeleton container. */
.site-skeleton-loader {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 20px;
	background: #ffffff;
	opacity: 1;
	visibility: visible;
	transition:
		opacity 0.35s ease,
		visibility 0.35s ease;
}

/* Hide loader after the page has loaded. */
.site-skeleton-loader.is-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.site-skeleton-inner {
	width: 100%;
	max-width: 1200px;
}

/* Base skeleton style. */
.skeleton-item {
	position: relative;
	overflow: hidden;
	background: #e8e8e8;
	border-radius: 8px;
}

/* Shimmer animation. */
.skeleton-item::after {
	content: "";
	position: absolute;
	inset: 0;
	transform: translateX(-100%);
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.65),
		transparent
	);
	animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer {
	100% {
		transform: translateX(100%);
	}
}

.skeleton-header {
	height: 70px;
	margin-bottom: 30px;
}

.skeleton-hero {
	height: 380px;
	margin-bottom: 35px;
}

.skeleton-title {
	width: 55%;
	height: 34px;
	margin-bottom: 18px;
}

.skeleton-text {
	width: 100%;
	height: 16px;
	margin-bottom: 12px;
}

.skeleton-text.short {
	width: 70%;
}

.skeleton-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	margin-top: 35px;
}

.skeleton-card {
	height: 280px;
}

@media (max-width: 767px) {
	.site-skeleton-loader {
		padding: 20px 15px;
	}

	.skeleton-header {
		height: 55px;
	}

	.skeleton-hero {
		height: 230px;
	}

	.skeleton-grid {
		grid-template-columns: 1fr;
	}

	.skeleton-card {
		height: 220px;
	}
}

/* Accessibility: disable animation when requested. */
@media (prefers-reduced-motion: reduce) {
	.skeleton-item::after {
		animation: none;
	}
}

/* =========================================================
   INDIVIDUAL LAZY-LOADED IMAGE SKELETON
   ========================================================= */

/*
 * WordPress normally adds loading="lazy" to eligible images.
 * The image's width and height attributes reserve its space.
 */
img[loading="lazy"]:not(.lazy-image-loaded):not(.lazy-image-error) {
	color: transparent;
	background-color: #e8e8e8;
	background-image: linear-gradient(
		90deg,
		#e8e8e8 0%,
		#f5f5f5 50%,
		#e8e8e8 100%
	);
	background-size: 200% 100%;
	animation: lazy-image-shimmer 1.4s infinite linear;
}

/* Stop the animation after loading or failure. */
img.lazy-image-loaded,
img.lazy-image-error {
	animation: none;
	background-image: none;
}

/* Optional smooth image appearance. */
img[loading="lazy"] {
	transition: filter 0.3s ease;
}

img[loading="lazy"]:not(.lazy-image-loaded):not(.lazy-image-error) {
	filter: brightness(0.98);
}

img[loading="lazy"].lazy-image-loaded {
	filter: none;
}

@keyframes lazy-image-shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

/* Accessibility. */
@media (prefers-reduced-motion: reduce) {
	img[loading="lazy"]:not(.lazy-image-loaded):not(.lazy-image-error) {
		animation: none;
	}
}