/**
 * Related Posts Widget Styles
 */

.custom-posts-widget {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	overflow-x: hidden;
}

/* List Style - Always 3 columns */
.custom-posts-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 30px;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* Square cards in list - always 3 columns */
.custom-posts-shape-square .custom-posts-list {
	grid-template-columns: repeat(3, 1fr);
}

.custom-posts-shape-square .custom-posts-list .custom-posts-item {
	width: 100%;
}

.custom-posts-item {
	position: relative;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	display: flex;
	align-items: flex-end;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* Rectangle Shape (default) - Horizontal/Landscape */
.custom-posts-shape-rectangle .custom-posts-item {
	aspect-ratio: 16 / 9;
	min-height: auto;
}

/* Square Shape */
.custom-posts-shape-square .custom-posts-item {
	aspect-ratio: 1 / 1;
	min-height: auto;
}

.custom-posts-item::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(173, 216, 230, 0.4) 0%, rgba(255, 255, 255, 0.95) 100%);
	z-index: 1;
	opacity: 0.8;
}

/* .custom-posts-item:hover {
	transform: translateY(-8px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
} */

.custom-posts-item:hover::before {
	opacity: 0.9;
}

.custom-posts-content {
	position: relative;
	z-index: 2;
	padding: 30px;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 15px;
}

/* Badge */
.custom-posts-badge {
	display: inline-block;
	padding: 6px 16px;
	border: 1px solid #1a1a1a;
	border-radius: 20px;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
	color: #1a1a1a;
	background: transparent;
	align-self: flex-start;
	margin-bottom: 5px;
}

/* Title */
.custom-posts-title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.custom-posts-title a {
	text-decoration: none;
	color: #1a1a1a;
	transition: color 0.3s ease;
}

.custom-posts-title a:hover {
	color: #0073aa;
}

/* Excerpt/Description */
.custom-posts-excerpt {
	margin: 0;
	color: #1a1a1a;
	font-size: 14px;
	line-height: 1.6;
	flex: 1;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Read More Button */
.custom-posts-read-more {
	display: inline-block;
	padding: 12px 24px;
	background-color: #1a1a1a;
	color: #ffffff;
	text-decoration: none;
	border-radius: 8px;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.4;
	transition: background-color 0.3s ease, transform 0.2s ease;
	align-self: flex-start;
	margin-top: 5px;
}

.custom-posts-read-more:hover {
	background-color: #0073aa;
	transform: translateY(-2px);
	color: #ffffff;
}

/* Responsive */
@media (max-width: 1024px) {
	.custom-posts-list {
		grid-template-columns: repeat(3, 1fr);
		gap: 25px;
	}
	
	.custom-posts-content {
		padding: 25px;
	}
	
	.custom-posts-title {
		font-size: 1.5rem;
	}
}

@media (max-width: 768px) {
	.custom-posts-list {
		grid-template-columns: repeat(2, 1fr);
		gap: 20px;
	}
	
	.custom-posts-content {
		padding: 20px;
		gap: 12px;
	}
	
	.custom-posts-title {
		font-size: 1.375rem;
	}
	
	.custom-posts-excerpt {
		font-size: 0.9375rem;
	}
	
	.custom-posts-read-more {
		padding: 10px 20px;
		font-size: 0.875rem;
	}
	
	/* Rectangle cards on mobile - adjust aspect ratio for more space and center content */
	.custom-posts-shape-rectangle .custom-posts-item {
		aspect-ratio: 1.3 / 1;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		align-items: center;
		justify-content: center;
	}
	
	.custom-posts-shape-rectangle .custom-posts-content {
		padding: 18px;
		gap: 10px;
		width: 100%;
	}
	
	.custom-posts-shape-rectangle .custom-posts-title {
		font-size: 1.125rem;
		line-height: 1.2;
	}
	
	.custom-posts-shape-rectangle .custom-posts-excerpt {
		font-size: 0.875rem;
		line-height: 1.4;
	}
	
	.custom-posts-shape-rectangle .custom-posts-read-more {
		padding: 8px 16px;
		font-size: 0.8125rem;
		margin-top: 0;
	}
}

@media (max-width: 480px) {
	.custom-posts-list {
		grid-template-columns: 1fr;
	}
	
	.custom-posts-content {
		padding: 18px;
	}
	
	.custom-posts-title {
		font-size: 1.25rem;
	}
	
	.custom-posts-badge {
		font-size: 0.8125rem;
		padding: 5px 12px;
	}
	
	/* Rectangle cards on small mobile - ensure content fits and center vertically */
	.custom-posts-shape-rectangle .custom-posts-item {
		aspect-ratio: 2 / 1;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		align-items: center;
		justify-content: center;
	}
	
	.custom-posts-shape-rectangle .custom-posts-content {
		padding: 15px;
		gap: 8px;
		width: 100%;
	}
	
	.custom-posts-shape-rectangle .custom-posts-title {
		font-size: 1rem;
		line-height: 1.2;
		margin-bottom: 4px;
	}
	
	.custom-posts-shape-rectangle .custom-posts-excerpt {
		font-size: 0.8125rem;
		line-height: 1.4;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		overflow: hidden;
	}
	
	.custom-posts-shape-rectangle .custom-posts-badge {
		font-size: 0.75rem;
		padding: 4px 10px;
		margin-bottom: 4px;
	}
	
	.custom-posts-shape-rectangle .custom-posts-read-more {
		padding: 8px 14px;
		font-size: 0.75rem;
		margin-top: 0;
	}
}

