/*
 * Coastal Supply — Blog Posts block.
 *
 * Full-width section with a 4-column card grid of curated WordPress posts.
 * Each card: featured image, category tag, title, excerpt, Keep Reading link.
 * Background colour is editor-controlled via --csbp-bg (inline style on the
 * section). Inner content is capped at 1440px following the same pattern used
 * by money-saving-deals and feature-products.
 */

.coastal-blog-posts {
	--csbp-bg:            #ffffff;
	--csbp-card-bg:       #ffffff;
	--csbp-card-radius:   12px;
	--csbp-card-shadow:   0 2px 12px rgba(15, 23, 42, 0.07);
	--csbp-text:          #1f2937;
	--csbp-muted:         #212529;
	--csbp-brand:         #2c2c75;
	--csbp-tag-color:     #6b7280;
	--csbp-grid-gap:      24px;
	--csbp-cols:          4;
	--csbp-section-py:    64px;
	--csbp-img-height:    220px;

	width: 100%;
	background-color: var(--csbp-bg);
	color: var(--csbp-text);
	padding-top: var(--csbp-section-py);
	padding-bottom: var(--csbp-section-py);
	font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.coastal-blog-posts--padding-compact  { --csbp-section-py: 40px; }
.coastal-blog-posts--padding-spacious { --csbp-section-py: 96px; }

/* Inner: 1440px cap, !important beats Astra's page-builder grandchild rule. */
.coastal-blog-posts .coastal-blog-posts__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: 1440px !important;
	margin-inline: auto;
	padding: 0 45px;
}

@media (max-width: 768px) {
	.coastal-blog-posts .coastal-blog-posts__inner {
		padding: 0 24px;
	}
}

/* ── Header ──────────────────────────────────────────────────────────── */

.coastal-blog-posts__header {
	text-align: center;
	margin-bottom: 48px;
}

.coastal-blog-posts__eyebrow {
	margin: 0 0 8px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--csbp-brand);
}

.coastal-blog-posts .coastal-blog-posts__heading {
	margin: 0 0 12px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 800;
	font-size: clamp(28px, 3vw, 40px);
	line-height: 1.15;
	color: var(--csbp-brand);
}

.coastal-blog-posts__subheading {
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 400;
	margin: 0 auto;
	max-width: 870px;
	font-size: 18px;
	line-height: 1.6;
	color: black;
}

/* ── Grid ────────────────────────────────────────────────────────────── */

.coastal-blog-posts__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(var(--csbp-cols), minmax(0, 1fr));
	gap: var(--csbp-grid-gap);
}

@media (max-width: 1024px) {
	.coastal-blog-posts__grid {
		--csbp-cols: 2;
	}
}

@media (max-width: 540px) {
	.coastal-blog-posts__grid {
		--csbp-cols: 1;
	}
}

/* ── Card ────────────────────────────────────────────────────────────── */

.coastal-blog-posts__card {
	display: flex;
	flex-direction: column;
	background: var(--csbp-card-bg);
	border-radius: var(--csbp-card-radius);
	box-shadow: var(--csbp-card-shadow);
	overflow: hidden;
	height: 100%;
}

/* ── Image ───────────────────────────────────────────────────────────── */

.coastal-blog-posts__media-link {
	display: block;
	flex-shrink: 0;
}

.coastal-blog-posts__media {
	width: 100%;
	height: var(--csbp-img-height);
	overflow: hidden;
	background: #e5e7eb;
}

.coastal-blog-posts__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 350ms ease;
}

.coastal-blog-posts__media-link:hover .coastal-blog-posts__media img,
.coastal-blog-posts__media-link:focus-visible .coastal-blog-posts__media img {
	transform: scale(1.04);
}

.coastal-blog-posts__media--no-image {
	background: #e5e7eb;
}

/* ── Body ────────────────────────────────────────────────────────────── */

.coastal-blog-posts__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 20px 20px 24px;
	gap: 6px;
}

/* Category tag */
.coastal-blog-posts__tag {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--csbp-tag-color);
}

/* Title */
.coastal-blog-posts .coastal-blog-posts__title {
	margin: 4px 0 0;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	font-size: 17px;
	line-height: 1.3;
	color: var(--csbp-text);
}

.coastal-blog-posts .coastal-blog-posts__title a {
	color: inherit;
	text-decoration: none;
}

.coastal-blog-posts .coastal-blog-posts__title a:hover,
.coastal-blog-posts .coastal-blog-posts__title a:focus-visible {
	color: var(--csbp-brand);
	outline: none;
}

/* Excerpt */
.coastal-blog-posts__excerpt {
	margin: 6px 0 0;
	font-size: 16px;
	line-height: 1.55;
	color: var(--csbp-muted);
	flex: 1 1 auto;

	/* Clamp to 3 lines */
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Keep Reading link */
.coastal-blog-posts__read-more {
	margin-top: 12px;
	display: inline-block;
	font-size: 14px;
	font-weight: 600;
	color: var(--csbp-brand);
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
	align-self: flex-start;
}

.coastal-blog-posts__read-more:hover,
.coastal-blog-posts__read-more:focus-visible {
	color: #1f1f5a;
	text-decoration-style: solid;
	outline: none;
}

/* ── Placeholder (editor preview) ────────────────────────────────────── */

.coastal-blog-posts__card--placeholder {
	opacity: 0.5;
	pointer-events: none;
}

.coastal-blog-posts__media--placeholder {
	background: linear-gradient(110deg, #e5e7eb 30%, #f3f4f6 50%, #e5e7eb 70%);
	background-size: 200% 100%;
	animation: csbp-shimmer 1.4s linear infinite;
}

@keyframes csbp-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ── View-all CTA ────────────────────────────────────────────────────── */

.coastal-blog-posts__view-all-wrap {
	display: flex;
	justify-content: center;
	margin-top: 48px;
}

.coastal-blog-posts__view-all {
	text-decoration: none !important;
}
