/**
 * Skeleton Screens - Loading State UI
 * ========================================
 *
 * Modern skeleton screen implementation for My Tarot Today
 * Reduces perceived load time by 20-30% with progressive loading UI
 *
 * Features:
 * - Shimmer animation with mystical theme
 * - Multiple skeleton types (card, grid)
 * - Responsive design
 * - Accessible with prefers-reduced-motion support
 */

/* ============================================
   BASE SKELETON STYLES
   ============================================ */

.skeleton {
	background: linear-gradient(
		90deg,
		rgba(147, 112, 219, 0.1) 0%,
		rgba(147, 112, 219, 0.2) 50%,
		rgba(147, 112, 219, 0.1) 100%
	);
	background-size: 200% 100%;
	animation: shimmer 2s ease-in-out infinite;
	border-radius: 8px;
	position: relative;
	overflow: hidden;
}

.skeleton::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 215, 0, 0.15),
		transparent
	);
	transform: translateX(-100%);
	animation: shimmer-wave 2s ease-in-out infinite;
}

/* ============================================
   SHIMMER ANIMATIONS
   ============================================ */

@keyframes shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

@keyframes shimmer-wave {
	0% {
		transform: translateX(-100%);
	}
	50% {
		transform: translateX(100%);
	}
	100% {
		transform: translateX(100%);
	}
}

/* ============================================
   SKELETON CARD COMPONENTS
   ============================================ */

/* Deck Selection Card Skeleton */
.skeleton-deck-card {
	background: rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(10px);
	border: 2px solid rgba(212, 175, 55, 0.3);
	border-radius: 15px;
	padding: 20px;
	text-align: center;
	position: relative;
	overflow: hidden;
}

.skeleton-deck-card .skeleton-preview {
	width: 100%;
	aspect-ratio: 2/3;
	background: rgba(147, 112, 219, 0.2);
	border-radius: 8px;
	margin-bottom: 15px;
	position: relative;
}

.skeleton-deck-card .skeleton-title {
	width: 80%;
	height: 24px;
	background: rgba(147, 112, 219, 0.2);
	border-radius: 4px;
	margin: 10px auto;
}

/* Gallery Grid Skeleton */
.skeleton-gallery-item {
	aspect-ratio: 2/3;
	background: rgba(147, 112, 219, 0.15);
	border: 2px solid rgba(212, 175, 55, 0.2);
	border-radius: 10px;
	position: relative;
	overflow: hidden;
}

.skeleton-gallery-item::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 215, 0, 0.15),
		transparent
	);
	transform: translateX(-100%);
	animation: shimmer-wave 2s ease-in-out infinite;
	animation-delay: calc(var(--skeleton-delay, 0) * 0.1s);
}

/* ============================================
   SPECIFIC PAGE IMPLEMENTATIONS
   ============================================ */

/* Index Page - Deck Selection Skeleton */
.skeleton-deck-selection {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	padding: 40px 20px;
}

@media (max-width: 768px) {
	.skeleton-deck-selection {
		grid-template-columns: repeat(3, 1fr);
		gap: 10px;
		padding: 20px 10px;
	}
}

/* Gallery Page - Deck Grid Skeleton */
.skeleton-deck-grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 20px;
	padding: 20px;
}

@media (max-width: 1440px) {
	.skeleton-deck-grid {
		grid-template-columns: repeat(5, 1fr);
	}
}

@media (max-width: 1024px) {
	.skeleton-deck-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 768px) {
	.skeleton-deck-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 15px;
	}
}

@media (max-width: 480px) {
	.skeleton-deck-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
}

/* Dictionary Page - Card Grid Skeleton */
.skeleton-dictionary-card {
	width: 100%;
	background: rgba(0, 0, 0, 0.3);
	border: 2px solid rgba(212, 175, 55, 0.3);
	border-radius: 12px;
	padding: 15px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.skeleton-dictionary-card .skeleton-image {
	width: 100%;
	aspect-ratio: 2/3;
	background: rgba(147, 112, 219, 0.2);
	border-radius: 8px;
}

.skeleton-dictionary-card .skeleton-name {
	width: 70%;
	height: 20px;
	background: rgba(147, 112, 219, 0.2);
	border-radius: 4px;
	margin: 0 auto;
}

.skeleton-dictionary-card .skeleton-keywords {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.skeleton-dictionary-card .skeleton-keyword {
	width: 60px;
	height: 16px;
	background: rgba(147, 112, 219, 0.15);
	border-radius: 4px;
}

.skeleton-dictionary-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	padding: 20px;
}

@media (max-width: 768px) {
	.skeleton-dictionary-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 15px;
	}
}

@media (max-width: 480px) {
	.skeleton-dictionary-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
	display: none !important;
}

.loaded {
	opacity: 1;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
	.skeleton,
	.skeleton::after,
	.skeleton-gallery-item::after {
		animation: none;
	}

	.skeleton {
		background: rgba(147, 112, 219, 0.15);
	}
}

/* Screen reader support */
.skeleton[aria-hidden="true"] {
	pointer-events: none;
}

.skeleton-loading-text {
	position: absolute;
	left: -10000px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ============================================
   PROGRESSIVE ENHANCEMENT
   ============================================ */

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
	.skeleton-deck-card {
		background: rgba(0, 0, 0, 0.5);
	}
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
	.skeleton {
		background: linear-gradient(
			90deg,
			rgba(147, 112, 219, 0.15) 0%,
			rgba(147, 112, 219, 0.25) 50%,
			rgba(147, 112, 219, 0.15) 100%
		);
	}

	.skeleton-gallery-item {
		background: rgba(147, 112, 219, 0.2);
		border-color: rgba(212, 175, 55, 0.3);
	}
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
	.skeleton,
	[class*="skeleton-"] {
		display: none !important;
	}
}
