/*
 * YottaMaster – AJAX Continuous Navigation Styles
 *
 * Uses the theme's own CSS custom properties so colours always match the
 * active palette / dark-mode without any extra effort:
 *
 *   --theme-palette-color-1  → accent / primary colour
 *   --theme-palette-color-7  → light surface (shimmer highlight)
 *   --theme-palette-color-8  → ultra-light surface (skeleton base)
 *   --theme-border-color     → subtle border used as skeleton background
 *   --theme-text-color       → body text colour
 */

/* ============================================================
   TOP PROGRESS BAR
   ============================================================ */

#yottamaster-progress-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	z-index: 9999999;

	/* --progress-color is injected by JS via inline style;
	   falls back to the theme's primary accent colour */
	background: var(--progress-color, var(--theme-palette-color-1, #2af598));
	box-shadow:
		0 0 10px var(--progress-color, var(--theme-palette-color-1, #2af598)),
		0 0 5px  var(--progress-color, var(--theme-palette-color-1, #2af598));

	transition: width 0.4s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.3s ease-in-out;
	pointer-events: none;
	opacity: 0;
	will-change: width, opacity;
}

#yottamaster-progress-bar.active {
	opacity: 1;
}

#yottamaster-progress-bar.complete {
	width: 100% !important;
	opacity: 0;
	transition: width 0.2s linear, opacity 0.3s ease-out 0.2s;
}

/* ============================================================
   MAIN CONTENT – FADE TRANSITION
   ============================================================ */

main {
	transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

main.ajax-transitioning {
	opacity: 0.12;
	pointer-events: none;
	user-select: none;
}

/* While the skeleton is visible keep main from growing taller
   than the viewport so it never bleeds over the footer */
main.ajax-skeleton-active {
	overflow: hidden;
	/* Limit height during skeleton phase – footer stays in place */
	max-height: 100vh;
}

/* ============================================================
   SKELETON WRAPPER
   ============================================================ */

.yottamaster-skeleton-wrapper {
	width: 100%;
	/* Respect whatever width main already has – no fixed max-width */
	box-sizing: border-box;
	padding: 30px 0;

	display: flex;
	flex-direction: column;
	gap: 24px;

	/* Prevent the skeleton from overflowing the main element */
	max-height: 88vh;
	overflow: hidden;

	animation: ym-skeleton-appear 0.25s ease-out both;
}

@keyframes ym-skeleton-appear {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   BASE SKELETON ELEMENT
   Uses --theme-border-color which is always harmonious with
   the current palette and light/dark mode.
   ============================================================ */

.ym-skeleton {
	/* Slightly darker than the border colour for visual weight */
	background-color: var(--theme-border-color, rgba(0, 0, 0, 0.07));
	border-radius: 6px;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

/* ============================================================
   ANIMATION STYLES
   ============================================================ */

/* 1 · Premium Shimmer – moving highlight using palette colours */
.ym-skeleton-shimmer::after {
	content: "";
	position: absolute;
	inset: 0;
	transform: translateX(-100%);
	background-image: linear-gradient(
		90deg,
		transparent                                               0%,
		var(--theme-palette-color-7, rgba(255, 255, 255, 0.25)) 40%,
		var(--theme-palette-color-8, rgba(255, 255, 255, 0.50)) 60%,
		transparent                                              100%
	);
	animation: ym-shimmer 1.6s infinite;
}

@keyframes ym-shimmer {
	100% { transform: translateX(100%); }
}

/* 2 · Sleek Pulse – opacity pulse */
.ym-skeleton-pulse {
	animation: ym-pulse 1.6s ease-in-out infinite;
}

@keyframes ym-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.45; }
}

/* 3 · Gentle Fade – brightness fluctuation */
.ym-skeleton-fade {
	animation: ym-fade 2s ease-in-out infinite;
}

@keyframes ym-fade {
	0%, 100% { filter: brightness(1); }
	50%       { filter: brightness(0.82); }
}

/* ============================================================
   SKELETON LAYOUT BLOCKS
   ============================================================ */

/* Hero / featured-image placeholder */
.ym-skeleton-hero {
	height: 200px;
	width: 100%;
	border-radius: 10px;
}

/* Two-column row: content + sidebar */
.ym-skeleton-row {
	display: flex;
	gap: 28px;
	width: 100%;
	flex: 1;
	min-height: 0;
}

.ym-skeleton-main {
	flex: 3;
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

.ym-skeleton-sidebar {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 200px;
	max-width: 280px;
}

@media (max-width: 768px) {
	.ym-skeleton-row {
		flex-direction: column;
	}
	.ym-skeleton-sidebar {
		display: none;
	}
}

/* Individual placeholder shapes */
.ym-skeleton-title {
	height: 32px;
	width: 68%;
}

.ym-skeleton-meta {
	height: 16px;
	width: 38%;
}

.ym-skeleton-text {
	height: 13px;
	width: 100%;
}

.ym-skeleton-text.short {
	width: 82%;
}

.ym-skeleton-image {
	height: 240px;
	width: 100%;
	border-radius: 8px;
}

.ym-skeleton-widget-title {
	height: 22px;
	width: 52%;
}

.ym-skeleton-widget-item {
	height: 15px;
	width: 88%;
}
