/*--------------------------------------------------------------
>>> BLOG LAYOUTS - BASE STYLES
--------------------------------------------------------------*/

/* CSS Variables for Blog Layouts */
:root {
	--abr-blog-columns-desktop: 3;
	--abr-blog-columns-tablet: 2;
	--abr-blog-columns-mobile: 1;
	--abr-blog-gap: 30px;
	--abr-blog-image-ratio: 16 / 9;
	--abr-blog-radius: var(--abr-radius-lg, 12px);
	--abr-blog-radius-mobile: 8px;
	--abr-blog-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	--abr-blog-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
	--abr-blog-overlay-gradient: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
	--abr-blog-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	--abr-blog-card-bg: var(--abr-color-white, #ffffff);
	--abr-blog-card-padding: var(--abr-space-md, 20px);
	--abr-blog-container-padding: 10px;
	--abr-blog-title-fs: var(--abr-fs-xl, 1.25rem);
	--abr-blog-excerpt-fs: var(--abr-fs-sm, 0.875rem);
	--abr-blog-meta-fs: var(--abr-fs-xs, 0.75rem);
}

/* Dark Mode Support */
[data-theme="dark"] {
	--abr-blog-card-bg: var(--abr-color-gray-900, #1a1a2e);
	--abr-blog-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	--abr-blog-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/*--------------------------------------------------------------
# Blog Container
--------------------------------------------------------------*/
.abr-blog-wrapper {
	width: 100%;
}

.abr-blog-header {
	margin-bottom: 10px;
}

.abr-blog-header .page-title {
	font-size: var(--abr-fs-3xl, 2.5rem);
	font-weight: 600;
	margin-bottom: var(--abr-space-sm, 10px);
	background: linear-gradient(135deg, var(--abr-color-primary) 0%, var(--abr-color-secondary, #6366f1) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.abr-blog-header .archive-description {
	font-size: var(--abr-fs-lg, 1.125rem);
	color: var(--abr-color-gray, #6b7280);
	max-width: 600px;
}

/*--------------------------------------------------------------
# Post Card Base
--------------------------------------------------------------*/
.abr-post-card {
	position: relative;
	background: var(--abr-blog-card-bg);
	border-radius: var(--abr-blog-radius);
	overflow: hidden;
	box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
	transition: var(--abr-blog-transition);
	height: auto;
	/* Default base height */
	display: flex;
	flex-direction: column;
	border-top: var(--abr-blog-border-top, 1px solid #e5e7eb);
	border-bottom: var(--abr-blog-border-bot, 1px solid #e5e7eb);
	border-left: var(--abr-blog-border-left, 1px solid #e5e7eb);
	border-right: var(--abr-blog-border-right, 1px solid #e5e7eb);
}

.abr-post-card:hover {
	transform: translateY(-10px);
	box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
	border-color: var(--abr-color-primary);
}

/*--------------------------------------------------------------
# Post Thumbnail
--------------------------------------------------------------*/
.abr-post-thumbnail {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--abr-blog-image-ratio);
	height: auto;
	/* Allow natural height if ratio is auto */
}

.abr-post-thumbnail a {
	display: block;
	width: 100%;
	height: 100%;
}

.abr-post-thumbnail img {
	width: 100%;
	height: auto;
	/* Fallback to natural height */
	object-fit: cover;
	transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
	display: block;
}

.abr-post-card:hover .abr-post-thumbnail img {
	transform: scale(1.1);
}

/* Category Badge - Glassmorphism style */
.abr-post-category {
	position: absolute;
	top: 15px;
	left: 15px;
	z-index: 2;
}

.abr-post-category a {
	display: inline-block;
	padding: 6px 16px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #fff;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50px;
	text-decoration: none;
	transition: all 0.3s ease;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.abr-post-category a:hover {
	background: var(--abr-color-primary);
	border-color: var(--abr-color-primary);
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/*--------------------------------------------------------------
# Post Content
--------------------------------------------------------------*/
.abr-post-content {
	padding: var(--abr-blog-card-padding);
	flex: 0 0 auto;
	/* Don't stretch by default */
	display: flex;
	flex-direction: column;
	gap: var(--abr-blog-item-gap, 10px);
}

/*--------------------------------------------------------------
# Post Meta
--------------------------------------------------------------*/
.abr-post-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--abr-space-sm, 12px);
	margin-bottom: var(--abr-space-sm, 12px);
	font-size: var(--abr-blog-meta-fs);
	color: var(--abr-color-gray, #6b7280);
}

.abr-post-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.abr-post-meta-item svg {
	width: 14px;
	height: 14px;
	opacity: 0.7;
}


.abr-post-author {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.abr-post-author img {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	object-fit: cover;
}

/*--------------------------------------------------------------
# Post Title
--------------------------------------------------------------*/
.abr-blog-wrapper .abr-post-title {
	font-size: var(--abr-blog-title-fs);
	font-weight: 500;
	line-height: 1.4;
	margin-bottom: var(--abr-space-sm, 12px);
}

.abr-post-title a {
	color: var(--abr-color-heading, #1f2937);
	text-decoration: none;
	transition: color 0.3s ease;
}

.abr-blog-wrapper .abr-post-title a:hover {
	color: var(--abr-color-primary);
	background: none;
	text-decoration: none;
}

/*--------------------------------------------------------------
# Post Excerpt
--------------------------------------------------------------*/
.abr-post-excerpt {
	font-size: var(--abr-blog-excerpt-fs);
	line-height: 1.7;
	color: var(--abr-color-gray, #6b7280);
	margin-bottom: var(--abr-space-md, 16px);
	flex-grow: 0;
	/* No more stretching by default */
}

/*--------------------------------------------------------------
# Post Footer
--------------------------------------------------------------*/
.abr-post-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: var(--abr-space-md, 16px);
	border-top: 1px solid var(--abr-color-border, #e5e7eb);
}

/*--------------------------------------------------------------
# Read More Button
--------------------------------------------------------------*/
.abr-read-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: var(--abr-fs-sm, 0.875rem);
	font-weight: 600;
	color: var(--abr-color-primary);
	text-decoration: none;
	transition: var(--abr-blog-transition);
}

.abr-read-more svg,
.abr-read-more .arrow {
	width: 18px;
	height: 18px;
	transition: transform 0.3s ease;
}

.abr-read-more:hover {
	gap: 12px;
}

.abr-read-more:hover svg,
.abr-read-more:hover .arrow {
	transform: translateX(4px);
}

/*--------------------------------------------------------------
# Comments Count
--------------------------------------------------------------*/
.abr-post-comments {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: var(--abr-fs-xs, 0.75rem);
	color: var(--abr-color-gray, #6b7280);
}

.abr-post-comments svg {
	width: 16px;
	height: 16px;
}

/*--------------------------------------------------------------
# Animations
--------------------------------------------------------------*/
@keyframes abr-fade-up {
	from {
		opacity: 0;
		transform: translateY(30px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes abr-fade-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes abr-slide-left {
	from {
		opacity: 0;
		transform: translateX(30px);
	}

	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes abr-scale-in {
	from {
		opacity: 0;
		transform: scale(0.95);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Animation Classes */
.abr-animate {
	animation-duration: 0.6s;
	animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	animation-fill-mode: both;
}

.abr-animate-fade-up {
	animation-name: abr-fade-up;
}

.abr-animate-fade-in {
	animation-name: abr-fade-in;
}

.abr-animate-slide-left {
	animation-name: abr-slide-left;
}

.abr-animate-scale-in {
	animation-name: abr-scale-in;
}

/* Staggered Delays */
.abr-animate-delay-1 {
	animation-delay: 0.1s;
}

.abr-animate-delay-2 {
	animation-delay: 0.2s;
}

.abr-animate-delay-3 {
	animation-delay: 0.3s;
}

.abr-animate-delay-4 {
	animation-delay: 0.4s;
}

.abr-animate-delay-5 {
	animation-delay: 0.5s;
}

.abr-animate-delay-6 {
	animation-delay: 0.6s;
}

/*--------------------------------------------------------------
# Pagination Styles
--------------------------------------------------------------*/
.abr-pagination {
	margin-top: var(--abr-space-2xl, 60px);
	margin-bottom: var(--abr-space-xl, 40px);
	display: flex;
	justify-content: center;
}

.abr-pagination .nav-links {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: var(--abr-space-xs, 8px);
	flex-wrap: wrap;
}

.abr-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 16px;
	font-size: var(--abr-fs-sm, 0.875rem);
	font-weight: 600;
	color: var(--abr-color-gray, #6b7280);
	background: var(--abr-color-white, #fff);
	border: 1px solid var(--abr-color-border, #e5e7eb);
	border-radius: 10px;
	text-decoration: none;
	transition: var(--abr-blog-transition);
}

.abr-pagination .page-numbers:hover,
.abr-pagination .page-numbers.current {
	color: #fff;
	background: var(--abr-color-primary);
	border-color: var(--abr-color-primary);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.abr-pagination .prev,
.abr-pagination .next {
	padding: 0 20px;
	background: linear-gradient(135deg, var(--abr-color-primary) 0%, var(--abr-color-secondary, #6366f1) 100%);
	color: #fff;
	border: none;
}

.abr-pagination .dots {
	border: none;
	background: transparent;
}

/* Load More Button */
.abr-load-more {
	display: flex;
	justify-content: center;
	margin-top: var(--abr-space-2xl, 60px);
}

.abr-load-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 16px 40px;
	font-size: var(--abr-fs-base, 1rem);
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, var(--abr-color-primary) 0%, var(--abr-color-secondary, #6366f1) 100%);
	border: none;
	border-radius: 50px;
	cursor: pointer;
	transition: var(--abr-blog-transition);
	box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.abr-load-more-btn:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.abr-load-more-btn .spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

.abr-load-more-btn.loading .spinner {
	display: block;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/*--------------------------------------------------------------
# No Posts Found
--------------------------------------------------------------*/
.abr-no-posts {
	text-align: center;
	padding: var(--abr-space-3xl, 80px) var(--abr-space-lg, 24px);
}

.abr-no-posts-icon {
	width: 80px;
	height: 80px;
	margin: 0 auto var(--abr-space-lg, 24px);
	opacity: 0.3;
}

.abr-no-posts h2 {
	font-size: var(--abr-fs-2xl, 1.5rem);
	margin-bottom: var(--abr-space-sm, 12px);
}

.abr-no-posts p {
	color: var(--abr-color-gray, #6b7280);
	max-width: 400px;
	margin: 0 auto;
}

/*--------------------------------------------------------------
# Responsive
--------------------------------------------------------------*/
@media (max-width: 991px) {
	.abr-blog-header .page-title {
		font-size: var(--abr-fs-2xl, 2rem);
	}
}

/* Extra small screens optimization */
@media (max-width: 479px) {
	:root {
		--abr-blog-card-padding: 5px;
	}
}


/* Other Mobile Styles */
@media (max-width: 639px) {

	.abr-post-title {
		font-size: var(--abr-blog-title-fs);
		line-height: 1.3;
	}

	/* Universal Meta Management for Mobile */
	.abr-post-meta {
		display: flex;
		flex-wrap: wrap;
		/* Allow wrapping to prevent horizontal overlap */
		gap: 8px;
		font-size: var(--abr-blog-meta-fs);
	}

	.abr-post-meta-item,
	.abr-post-author {
		gap: 4px;
	}

	.abr-post-author img {
		width: 18px;
		height: 18px;
	}

	/* Responsive Thumbnail Optimization */
	.abr-post-thumbnail {
		overflow: hidden;
	}

	/* Interaction Tweaks */
	.abr-read-more {
		font-size: 11px;
	}

	.abr-read-more svg {
		width: 14px;
		height: 14px;
	}

	.abr-post-footer {
		padding-top: 8px;
	}

	.abr-pagination .page-numbers {
		min-width: 40px;
		height: 40px;
		padding: 0 12px;
	}
}

/*--------------------------------------------------------------
# Empty State Cleanup — Hide leftover separators & spaces
# when meta elements are hidden via Blog Layout Customizer
--------------------------------------------------------------*/

/* Footer: remove border-top line & padding when readmore + comments are both hidden */
.abr-post-card .abr-post-footer:empty {
	display: none;
}

/* Meta: remove margin gap when date + author are both hidden */
.abr-post-card .abr-post-meta:empty {
	display: none;
}

/* Header: collapse when meta + title are both hidden */
.abr-post-card .abr-post-header:empty {
	display: none;
}

/* Excerpt: safety net (PHP already prevents output, but covers edge cases) */
.abr-post-card .abr-post-excerpt:empty {
	display: none;
}

/* Content area: remove padding when everything inside is hidden */
.abr-post-card .abr-post-content:empty {
	padding: 0;
}

/*--------------------------------------------------------------
# RTL Support
--------------------------------------------------------------*/
[dir="rtl"] .abr-post-category {
	left: auto;
	right: var(--abr-space-sm, 12px);
}

[dir="rtl"] .abr-read-more svg,
[dir="rtl"] .abr-read-more .arrow {
	transform: scaleX(-1);
}

[dir="rtl"] .abr-read-more:hover svg,
[dir="rtl"] .abr-read-more:hover .arrow {
	transform: scaleX(-1) translateX(-4px);
}

[dir="rtl"] .abr-post-title a {
	text-decoration: none;
}

/* Meta Visibility Utilities */
@media (min-width: 640px) {
	#primary .abr-blog-wrapper .abr-hide-desktop {
		display: none;
	}
}

@media (max-width: 639px) {
	#primary .abr-blog-wrapper .abr-hide-mobile {
		display: none;
	}
}

/* Disable Hover Effects on Touch Devices */
@media (hover: none) {
	.abr-post-card:hover {
		transform: none;
		box-shadow: var(--abr-blog-shadow);
	}

	.abr-post-thumbnail img:hover {
		transform: none;
	}

	.abr-read-more:hover {
		transform: none;
	}
}