/**
 * Related Posts Styles
 * Responsive grid layout for BlogPost related posts
 */

.blogpost-related-posts {
	margin: 72px 0 0;
	padding: 60px 48px;
	background: var(--paper);
	border-top: 2px solid var(--rule);
}

.related-posts-container {
	max-width: 1200px;
	margin: 0 auto;
}

/* Header */
.related-posts-header {
	text-align: center;
	margin-bottom: 48px;
}

.related-posts-header h2 {
	font-family: 'Cormorant Garamond', serif;
	font-size: clamp(32px, 5vw, 48px);
	font-weight: 700;
	color: var(--ink);
	margin-bottom: 12px;
	letter-spacing: -0.02em;
}

.related-posts-header p {
	font-family: 'Albert Sans', sans-serif;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--muted);
	display: none;
}

/* Grid Layout */
.related-posts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 32px;
	margin-bottom: 48px;
}

/* Post Card */
.related-post-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--rule);
	border-radius: 24px;
	padding: 16px;
	transition: all 0.3s ease;
	overflow: hidden;
	box-shadow: 0px 4px 6px -1px #0000001A, 0px 2px 4px -2px #0000001A;
}

.related-post-card:hover {
	transform: translateY(-4px);
	border-color: var(--primary);
}

/* Thumbnail */
.related-post-thumbnail {
	position: relative;
	overflow: hidden;
	background: var(--rule);
	border-radius: 8px;
	margin-bottom:16px
}

.related-post-thumbnail a {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
}

.related-post-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-thumbnail img {
	transform: scale(1.05);
	border-radius: 8px;
}

/* Content */
.related-post-content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.related-post-category {
	font-family: 'Albert Sans', sans-serif;
	font-size: 12px;
	letter-spacing: 0.1em;
	font-weight: 500;
	text-transform: uppercase;
	color: var(--primary);
	padding: 4px 2px 8px;
	display: none;
}

.related-post-tag {
	font-family: 'Space Mono', monospace;
	font-size: 8px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	background: var(--rule);
	padding: 3px 8px;
	border-radius: 2px;
	display: inline-block;
	width: max-content;
}

.related-post-title {
	font-family: 'Cormorant Garamond', serif;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 12px;
	color: var(--ink);
}

.related-post-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s;
}

.related-post-title a:hover {
	color: var(--primary);
}

.related-post-excerpt {
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: 15px;
	line-height: 1.6;
	color: var(--muted);
	margin-bottom: 16px;
	flex: 1;
}

.related-post-meta {
	font-family: 'Space Mono', monospace;
	font-size: 9px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	margin-top: auto;
}

/* Footer Button */
.related-posts-footer {
	text-align: center;
}

.related-posts-button {
	display: inline-block;
	font-family: 'Albert Sans', sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	background: var(--primary);
	padding: 12px 24px;
	text-decoration: none;
	transition: all 0.3s ease;
	border-radius: 56px;
}

.related-posts-button:hover {
	background: var(--paper);
	color: var(--ink);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(14, 12, 9, 0.15);
}

/* No Thumbnail State */
.related-post-card:not(:has(.related-post-thumbnail)) {
	border-top: 4px solid var(--primary);
}

/* Responsive Design */

/* Tablet */
@media (max-width: 1024px) {
	.related-posts-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 24px;
	}

	.blogpost-related-posts {
		padding: 48px 32px;
	}
}

/* Mobile */
@media (max-width: 620px) {
	.blogpost-related-posts {
		padding: 40px 22px;
	}

	.related-posts-header {
		margin-bottom: 32px;
	}

	.related-posts-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.related-post-card {
		max-width: 400px;
		margin: 0 auto;
	}

	.related-post-content {
		padding: 20px;
	}

	.related-post-title {
		font-size: 18px;
	}

	.related-posts-button {
		width: 100%;
		padding: 14px 32px;
	}
}

/* Loading State */
.related-posts-grid:empty::before {
	content: 'Loading related posts...';
	font-family: 'Space Mono', monospace;
	font-size: 12px;
	color: var(--muted);
	text-align: center;
	display: block;
	padding: 40px;
}

/* Animation for cards */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.related-post-card {
	animation: fadeInUp 0.5s ease backwards;
}

.related-post-card:nth-child(1) { animation-delay: 0.1s; }
.related-post-card:nth-child(2) { animation-delay: 0.2s; }
.related-post-card:nth-child(3) { animation-delay: 0.3s; }
.related-post-card:nth-child(4) { animation-delay: 0.4s; }
.related-post-card:nth-child(5) { animation-delay: 0.5s; }
.related-post-card:nth-child(6) { animation-delay: 0.6s; }
