/* ==========================================================================
   Mobile First Theme - Animations & Transitions
   ========================================================================== */

/* Fade in animation */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeInDown {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeInLeft {
	from {
		opacity: 0;
		transform: translateX(-20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes fadeInRight {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Slide animations */
@keyframes slideInUp {
	from {
		transform: translateY(100%);
	}
	to {
		transform: translateY(0);
	}
}

@keyframes slideInDown {
	from {
		transform: translateY(-100%);
	}
	to {
		transform: translateY(0);
	}
}

/* Bounce animation */
@keyframes bounce {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-10px);
	}
}

/* Pulse animation */
@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* Spin animation */
@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* Scale animations */
@keyframes scaleIn {
	from {
		transform: scale(0.95);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes scaleUp {
	from {
		transform: scale(1);
	}
	to {
		transform: scale(1.05);
	}
}

/* Apply animations to elements */
article {
	animation: fadeInUp 0.6s ease-out;
}

.entry-header {
	animation: fadeInDown 0.6s ease-out 0.1s both;
}

.btn,
button,
input[type="button"],
input[type="submit"],
a.button {
	position: relative;
	overflow: hidden;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before,
button::before,
input[type="button"]::before,
input[type="submit"]::before,
a.button::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.5);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.btn:active::before,
button:active::before,
input[type="button"]:active::before,
input[type="submit"]:active::before,
a.button:active::before {
	animation: ripple 0.6s ease-out;
}

@keyframes ripple {
	to {
		width: 300px;
		height: 300px;
		opacity: 0;
	}
}

/* Link hover effects */
a {
	position: relative;
	transition: color 0.3s ease;
}

a:not(.btn):not(.button)::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 0;
	height: 2px;
	background-color: var(--primary-color);
	transition: width 0.3s ease;
}

a:not(.btn):not(.button):hover::after {
	width: 100%;
}

/* Form animations */
input:focus,
textarea:focus,
select:focus {
	animation: scaleIn 0.2s ease-out;
}

/* Image hover effects */
.post-thumbnail img,
img.attachment {
	transition: transform 0.3s ease, filter 0.3s ease;
}

.post-thumbnail:hover img,
a:hover img.attachment {
	transform: scale(1.05);
	filter: brightness(1.1);
}

/* Card hover effects */
article.post-archive {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

article.post-archive:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-lg);
}

/* Mobile menu animation */
.main-navigation {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

.main-navigation.active {
	max-height: 1000px;
	animation: slideInDown 0.3s ease-out;
}

/* Bottom navigation animation */
.bottom-navigation {
	animation: slideInUp 0.3s ease-out;
}

/* Loading spinner */
.spinner {
	animation: spin 1s linear infinite;
}

/* Pulse effect for important elements */
.pulse {
	animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth page transitions */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* Glow effect for primary elements */
.glow {
	box-shadow: 0 0 10px rgba(99, 102, 241, 0.3),
		0 0 20px rgba(99, 102, 241, 0.2);
	animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
	0%, 100% {
		box-shadow: 0 0 10px rgba(99, 102, 241, 0.3),
			0 0 20px rgba(99, 102, 241, 0.2);
	}
	50% {
		box-shadow: 0 0 20px rgba(99, 102, 241, 0.5),
			0 0 30px rgba(99, 102, 241, 0.3);
	}
}

/* Shake animation for alerts */
@keyframes shake {
	0%, 100% {
		transform: translateX(0);
	}
	10%, 30%, 50%, 70%, 90% {
		transform: translateX(-5px);
	}
	20%, 40%, 60%, 80% {
		transform: translateX(5px);
	}
}

.shake {
	animation: shake 0.5s;
}

/* Success animation */
@keyframes successPop {
	0% {
		transform: scale(0.8);
		opacity: 0;
	}
	50% {
		transform: scale(1.1);
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

.success {
	animation: successPop 0.5s ease-out;
}

/* Smooth transitions for theme switching */
body,
body * {
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Disable transitions during animation to avoid conflicts */
body.transitioning,
body.transitioning * {
	transition: none !important;
}
