/*
 * HSH Posts Grid — [hsh_posts] shortcode.
 *
 * Pure CSS card grid, no JavaScript. Scoped under .hsh-posts; colors follow
 * the HSH brand with custom-property overrides available:
 * --hsh-pg-cols (set inline by the shortcode's columns attribute),
 * --hsh-pg-title, --hsh-pg-accent, --hsh-pg-badge-bg, --hsh-pg-text.
 */

.hsh-posts {
	--hsh-pg-title: #2f4b3f;
	--hsh-pg-accent: #eec95c;
	--hsh-pg-badge-bg: #faf6ec;
	--hsh-pg-text: #6b6b6b;
	--hsh-pg-meta: #5c6f66;
	display: grid;
	grid-template-columns: repeat(var(--hsh-pg-cols, 3), minmax(0, 1fr));
	gap: 48px 28px;
}

.hsh-posts__card {
	position: relative; /* containing block for the screen-reader-text spans */
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* ---- Media ---- */

.hsh-posts__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2.2; /* reserves space before lazy image loads: zero CLS */
	border-radius: 10px;
	overflow: hidden;
	background: #e8e4da;
	margin-bottom: 22px;
}

.hsh-posts__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.hsh-posts__card:hover .hsh-posts__media img {
	transform: scale(1.04);
}

.hsh-posts__badge {
	position: absolute;
	top: 16px;
	left: 16px;
	background: var(--hsh-pg-badge-bg);
	color: #333;
	font-size: 13px;
	line-height: 1;
	padding: 9px 15px;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---- Text ---- */

.hsh-posts__date {
	color: var(--hsh-pg-meta);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	margin-bottom: 10px;
}

.hsh-posts__title {
	margin: 0 0 14px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(22px, 2vw, 30px);
	font-weight: 500;
	line-height: 1.25;
}

.hsh-posts__title a {
	color: var(--hsh-pg-title);
	text-decoration: none;
}

.hsh-posts__title a:hover,
.hsh-posts__title a:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.hsh-posts__excerpt {
	margin: 0 0 20px;
	color: var(--hsh-pg-text);
	font-size: 15px;
	line-height: 1.65;
}

.hsh-posts__more {
	color: #333;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 2px solid var(--hsh-pg-accent);
	padding-bottom: 4px;
	margin-top: auto;
	transition: color 0.2s ease;
}

.hsh-posts__more:hover,
.hsh-posts__more:focus-visible {
	color: var(--hsh-pg-title);
}

/* ---- Responsive: 3 → 2 → 1 (capped by the columns attribute) ---- */

@media (max-width: 1024px) {
	.hsh-posts {
		grid-template-columns: repeat(min(var(--hsh-pg-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.hsh-posts {
		grid-template-columns: 1fr;
		gap: 40px;
	}
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
	.hsh-posts__media img {
		transition: none;
	}

	.hsh-posts__card:hover .hsh-posts__media img {
		transform: none;
	}
}

/* ---- Related Articles ([hsh_related_posts]) ---- */

.hsh-related {
	border-top: 1px solid rgba(47, 75, 63, 0.35);
	border-bottom: 1px solid rgba(47, 75, 63, 0.35);
	padding: 34px 0 44px;
}

.hsh-related__title {
	margin: 0 0 28px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(26px, 2.4vw, 34px);
	font-weight: 500;
	line-height: 1.2;
	color: var(--hsh-pg-title, #2f4b3f);
}

/* Related cards: compact uppercase titles, tighter rhythm. */
.hsh-posts--related {
	gap: 40px 28px;
}

.hsh-posts--related .hsh-posts__media {
	margin-bottom: 16px;
}

.hsh-posts--related .hsh-posts__date {
	margin-bottom: 8px;
}

.hsh-posts--related .hsh-posts__title {
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.45;
}
