/* ============================================
   3D Effects & Animations for Blog Corner Theme
   ============================================ */

/* ============================================
   VARIABLES & GLOBAL SETTINGS
   ============================================ */
:root {
	--primary-color: #0073aa;
	--secondary-color: #f0f0f0;
	--transition-duration: 0.3s;
	--transform-scale: 1.05;
	--animation-timing: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enable 3D perspective */
html {
	perspective: 1000px;
}

body {
	perspective: 1000px;
}

/* ============================================
   CARD 3D HOVER EFFECTS
   ============================================ */

/* Post cards with 3D flip effect */
.post,
article,
.blog-item,
.entry-content {
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
}

.post:hover,
article:hover,
.blog-item:hover {
	transform: translateY(-8px) rotateX(5deg) rotateZ(1deg);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ============================================
   FADE IN ON LOAD ANIMATION
   ============================================ */

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.post,
article,
.blog-item,
.widget,
.comment {
	animation: fadeInUp 0.6s ease-out forwards;
}

/* Stagger animation for multiple items */
.post:nth-child(1) { animation-delay: 0.1s; }
.post:nth-child(2) { animation-delay: 0.2s; }
.post:nth-child(3) { animation-delay: 0.3s; }
.post:nth-child(n+4) { animation-delay: 0.4s; }

/* ============================================
   FEATURED IMAGE 3D EFFECTS
   ============================================ */

.post-thumbnail,
.featured-image,
.entry-header img,
.wp-post-image {
	position: relative;
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 8px;
	overflow: hidden;
}

.post:hover .post-thumbnail,
article:hover .featured-image,
.post:hover .wp-post-image {
	transform: scale(1.08) rotateX(-5deg);
	box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* Image zoom with parallax */
.post-thumbnail img,
.featured-image img,
.wp-post-image {
	transition: transform var(--transition-duration) ease-out;
	transform-style: preserve-3d;
}

.post:hover .post-thumbnail img,
article:hover .featured-image img,
.post:hover .wp-post-image {
	transform: scale(1.15);
}

/* ============================================
   TITLE & HEADING ANIMATIONS
   ============================================ */

@keyframes slideInLeft {
	from {
		opacity: 0;
		transform: translateX(-30px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideInRight {
	from {
		opacity: 0;
		transform: translateX(30px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

h1, h2, h3, h4, h5, h6 {
	animation: slideInLeft 0.6s ease-out;
	transition: all var(--transition-duration) ease-out;
}

.entry-title,
.post-title,
.page-title {
	animation: slideInLeft 0.7s ease-out;
	transition: color var(--transition-duration) ease-out, text-shadow var(--transition-duration) ease-out;
}

.entry-title:hover,
.post-title:hover,
.page-title:hover {
	color: var(--primary-color);
	text-shadow: 0 2px 10px rgba(0, 115, 170, 0.2);
}

/* ============================================
   BUTTON 3D EFFECTS
   ============================================ */

@keyframes buttonPush {
	0% {
		transform: translate(0, 0);
	}
	50% {
		transform: translate(-2px, -2px);
	}
	100% {
		transform: translate(0, 0);
	}
}

button,
.button,
a.button,
input[type="button"],
input[type="submit"],
.wp-block-button__link {
	position: relative;
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	cursor: pointer;
}

button:hover,
.button:hover,
a.button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover {
	transform: translateY(-4px) perspective(600px) rotateX(8deg);
	box-shadow: 0 8px 25px rgba(0, 115, 170, 0.3);
}

button:active,
.button:active,
a.button:active,
input[type="button"]:active,
input[type="submit"]:active {
	transform: translateY(-1px);
	animation: buttonPush 0.4s ease-out;
}

/* ============================================
   LINK ANIMATIONS
   ============================================ */

@keyframes underlineExpand {
	from {
		width: 0;
		left: 0;
	}
	to {
		width: 100%;
		left: 0;
	}
}

a {
	position: relative;
	transition: color var(--transition-duration) ease-out;
}

a::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 0;
	height: 2px;
	background: var(--primary-color);
	transition: width var(--transition-duration) ease-out;
}

a:hover::after {
	width: 100%;
}

/* ============================================
   NAVIGATION 3D EFFECTS
   ============================================ */

.main-navigation a,
.menu-item > a {
	position: relative;
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
}

.main-navigation a:hover,
.menu-item > a:hover {
	transform: rotateY(10deg) translateZ(10px);
	color: var(--primary-color);
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   SIDEBAR WIDGETS 3D
   ============================================ */

.widget {
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 8px;
}

.widget:hover {
	transform: translateY(-5px) rotateX(2deg);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.widget-title {
	position: relative;
	padding-bottom: 10px;
	transition: all var(--transition-duration) ease-out;
}

.widget-title::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--primary-color), rgba(0, 115, 170, 0));
	transition: width var(--transition-duration) ease-out;
}

.widget:hover .widget-title::after {
	width: 100%;
}

/* ============================================
   COMMENT SECTION ANIMATIONS
   ============================================ */

@keyframes slideUpFade {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.comment,
.comment-list li {
	animation: slideUpFade 0.5s ease-out forwards;
}

.comment:nth-child(1) { animation-delay: 0.1s; }
.comment:nth-child(2) { animation-delay: 0.2s; }
.comment:nth-child(n+3) { animation-delay: 0.3s; }

.comment:hover {
	background: rgba(0, 115, 170, 0.02);
	transform: translateX(8px);
	border-left: 4px solid var(--primary-color);
	padding-left: 16px;
}

/* ============================================
   FOOTER ANIMATIONS
   ============================================ */

.site-footer {
	animation: slideInUp 0.8s ease-out;
}

.footer-widget {
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
}

.footer-widget:hover {
	transform: rotateY(-5deg) translateZ(5px);
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

.loading,
.spinner {
	animation: spin 1s linear infinite;
}

.loading-pulse {
	animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   FORM INPUTS 3D EFFECTS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 4px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
	transform: translateY(-2px) perspective(600px) rotateX(5deg);
	box-shadow: 0 8px 20px rgba(0, 115, 170, 0.15);
	outline: none;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

@keyframes slideInUp {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.entry-content,
.single-content {
	animation: slideInUp 0.7s ease-out;
}

/* ============================================
   PAGINATION ANIMATIONS
   ============================================ */

.pagination a,
.page-numbers {
	position: relative;
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 4px;
}

.pagination a:hover,
.page-numbers:hover {
	transform: scale(1.1) rotateZ(2deg);
	box-shadow: 0 6px 15px rgba(0, 115, 170, 0.25);
}

/* ============================================
   BADGE & TAG ANIMATIONS
   ============================================ */

.tag,
.badge,
.category-badge,
.post-category {
	display: inline-block;
	transition: all var(--transition-duration) ease-out;
	transform-style: preserve-3d;
	border-radius: 20px;
}

.tag:hover,
.badge:hover,
.category-badge:hover,
.post-category:hover {
	transform: scale(1.15) rotateZ(-3deg);
	box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

/* ============================================
   PARALLAX SCROLL EFFECT
   ============================================ */

.parallax {
	background-attachment: fixed;
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	position: relative;
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */

@keyframes gradientShift {
	0% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0% 50%;
	}
}

.gradient-animated {
	background-size: 200% 200%;
	animation: gradientShift 6s ease infinite;
}

/* ============================================
   RESPONSIVE ANIMATIONS
   ============================================ */

@media (max-width: 768px) {
	/* Reduce 3D transforms on mobile for better performance */
	.post:hover,
	article:hover,
	.blog-item:hover {
		transform: translateY(-4px);
	}

	.post:hover .post-thumbnail,
	article:hover .featured-image,
	.post:hover .wp-post-image {
		transform: scale(1.04);
	}

	button:hover,
	.button:hover {
		transform: translateY(-2px);
	}

	/* Reduce animation delays on mobile */
	.post:nth-child(1) { animation-delay: 0.05s; }
	.post:nth-child(2) { animation-delay: 0.1s; }
	.post:nth-child(3) { animation-delay: 0.15s; }
}

@media (max-width: 480px) {
	/* Minimize animations on very small screens */
	h1, h2, h3, h4, h5, h6 {
		animation: none;
	}

	.post:hover,
	article:hover {
		transform: none;
	}
}

/* ============================================
   SMOOTH TRANSITIONS FOR ALL ELEMENTS
   ============================================ */

* {
	transition-timing-function: var(--animation-timing);
}

/* ============================================
   ACCESSIBILITY - REDUCE MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
