/* ── Blog archive — hero, category filter, card grid ─────────────────────── */

/* ── Hero banner ──────────────────────────────────────────────────────────── */

.blog-archive-hero {
	margin-top: 0 !important;
}

.blog-archive-hero p,
.blog-archive-hero h1,
.blog-archive-hero h2 {
	color: #ffffff;
}

/* ── Category filter ──────────────────────────────────────────────────────── */

.blog-cat-filter {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 2rem;
	padding-top: 2rem;
}

.blog-cat-filter__label {
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	color: var(--wp--preset--color--navy);
	white-space: nowrap;
	margin-right: 0.25rem;
}

.blog-cat-filter__btn {
	display: inline-block;
	padding: 0.375rem 1.125rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 20px;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
	white-space: nowrap;
}

.blog-cat-filter__btn:hover {
	border-color: var(--wp--preset--color--blue);
	color: var(--wp--preset--color--blue);
}

.blog-cat-filter__btn.is-active {
	background: #2050ce;
	border-color: #2050ce;
	color: #ffffff;
}

/* Ensure bottom padding isn't stripped by WordPress layout resets */
main.blog-archive-content,
main.customer-archive-content,
main.partner-archive-content,
main.ebook-archive-content {
	padding-bottom: 4rem !important;
}

main.customer-archive-content,
main.partner-archive-content,
main.ebook-archive-content {
	padding-top: var(--wp--preset--spacing--8) !important;
}

/* ── Customer / Partner / E-Book archive grids ───────────────────────────── */

.customer-archive-content .wp-block-post-template.is-layout-grid,
.customer-further-reading .wp-block-post-template.is-layout-grid,
.partner-archive-content .wp-block-post-template.is-layout-grid,
.partner-further-reading .wp-block-post-template.is-layout-grid,
.ebook-archive-content .wp-block-post-template.is-layout-grid,
.ebook-further-reading .wp-block-post-template.is-layout-grid {
	grid-template-columns: repeat(3, 1fr) !important;
	gap: 1.5rem !important;
	align-items: stretch;
}

/* ── Post grid ────────────────────────────────────────────────────────────── */

.blog-archive-content .wp-block-post-template.is-layout-grid {
	grid-template-columns: repeat(3, 1fr) !important;
	gap: 1.5rem !important;
	align-items: stretch;
}

/* First post spans all three columns */
.blog-archive-content .wp-block-post-template > li:first-child {
	grid-column: 1 / -1;
}

/* First card: CSS Grid so image fills full height, body+footer stack on the right */
.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) {
	display: grid !important;
	grid-template-columns: 55% 1fr;
	grid-template-rows: 1fr auto;
	grid-template-areas:
		"image body"
		"image footer";
	gap: 0 !important; /* no column gap — left padding on body creates the visual space */
}

/* Image spans both rows — aspect-ratio drives card height, no cropping */
.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image {
	grid-area: image;
	aspect-ratio: 870 / 499 !important;
	position: relative !important;
	inset: auto !important;
	width: 100% !important;
	height: auto !important;
	overflow: hidden !important;
}

.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image a,
.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image figure,
.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
}

.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .blog-grid-card__body {
	grid-area: body;
	padding: 2rem 2rem 0.75rem !important;
	width: 100%;
}

.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .blog-grid-card__footer {
	grid-area: footer;
	padding: 0 2rem 2rem !important;
}

/* Gradient starts at the image column boundary so it doesn't paint over the image */
.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card)::after {
	left: 55%;
}

/* Non-featured cards: tighten space below image and below excerpt */
.blog-archive-content .wp-block-post-template > li:not(:first-child) .blog-grid-card__body {
	padding-top: 0.5rem !important;
	gap: 0.2rem !important;
}

.blog-archive-content .wp-block-post-template > li:not(:first-child) .blog-grid-card__footer {
	padding-top: 0.25rem !important;
}

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

.blog-grid-card {
	position: relative;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100%;
	transition: transform 0.22s ease, box-shadow 0.22s ease;
}

/* Gradient bar pinned to bottom of card */
.blog-grid-card::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 16px;
	background: linear-gradient(93deg, #2050ce 0%, #40ffd3 100%);
}

/* Keep gradient below the featured image */
.blog-grid-card .wp-block-post-featured-image {
	position: relative;
	z-index: 1;
}

/* Hover — lift with deeper shadow */
.blog-grid-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.13);
}


/* ── Featured image ───────────────────────────────────────────────────────── */

/* Blog pages: featured image — match Railway Union RFC image proportions (1360×628) */
.blog-grid-card .wp-block-post-featured-image {
	overflow: hidden;
	flex-shrink: 0;
}

.blog-grid-card .wp-block-post-featured-image a,
.blog-grid-card .wp-block-post-featured-image figure {
	display: block;
	margin: 0;
}

.blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 870 / 499;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

/* Press clipping archive: fixed height so every screenshot crops consistently */
body.post-type-archive-press_clipping .blog-grid-card .wp-block-post-featured-image {
	position: relative !important;
	width: 100% !important;
	height: 220px !important;
	aspect-ratio: unset !important;
	overflow: hidden !important;
	flex-shrink: 0 !important;
}

body.post-type-archive-press_clipping .blog-grid-card .wp-block-post-featured-image a,
body.post-type-archive-press_clipping .blog-grid-card .wp-block-post-featured-image figure {
	display: block !important;
	position: absolute !important;
	inset: 0 !important;
	margin: 0 !important;
	height: 100% !important;
}

body.post-type-archive-press_clipping .blog-grid-card .wp-block-post-featured-image img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	object-position: top center !important;
	display: block !important;
	transition: transform 0.3s ease;
}

.blog-grid-card:hover .wp-block-post-featured-image img {
	transform: scale(1.03);
}

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

.blog-grid-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.blog-grid-card .wp-block-post-date {
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--muted);
	margin: 0;
}

.blog-grid-card .wp-block-post-title {
	font-size: 1.625rem !important;
	font-weight: 700;
	line-height: 1.3;
	margin: 0.3rem 0 0.5rem;
}

.blog-grid-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
	transition: color 0.15s;
}

/* Stretched link — expands the title anchor to cover the whole card */
.blog-grid-card .wp-block-post-title a::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
}

.blog-grid-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--blue);
}

/* Keep category pill clickable above the stretched link */
.blog-grid-card .blog-category {
	position: relative;
	z-index: 2;
}

.blog-grid-card .wp-block-post-excerpt {
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--muted);
	line-height: 1.6;
	flex: 1;
}

.blog-grid-card .wp-block-post-excerpt p {
	margin: 0;
}

/* ── Category pill ────────────────────────────────────────────────────────── */

.blog-grid-card .blog-category a,
.blog-grid-card .blog-category {
	display: inline-block;
	padding: 0.2rem 0.65rem;
	background: #F5F7FD;
	border-radius: 20px;
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--wp--preset--color--blue);
	text-decoration: none;
}

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

.blog-grid-card__footer,
.blog-grid-card .blog-grid-card__footer.is-layout-flex,
.blog-grid-card .blog-grid-card__footer.wp-block-group-is-layout-flex {
	flex-shrink: 0;
	display: flex !important;
	flex-direction: row !important;
	justify-content: space-between !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	/* extra bottom padding to clear the 16px gradient bar */
	padding-bottom: calc(var(--wp--preset--spacing--4) + 16px) !important;
}

.blog-grid-card .blog-reading-time {
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--blue);
	font-weight: 600;
}

/* ── Press clipping card header bar ──────────────────────────────────────── */

.blog-grid-card > .wp-block-shortcode:first-child {
	width: 100%;
	flex-shrink: 0;
}

.pc-card-bar {
	display: flex;
	align-items: center;
	padding: 0.625rem 1rem;
	flex-shrink: 0;
	width: 100%;
}

.pc-card-bar__logo {
	max-height: 50px;
	width: auto;
	display: block;
	object-fit: contain;
	object-position: left center;
}

/* ── Press clipping archive overrides ────────────────────────────────────── */

/* Press clipping archive: restore top and bottom padding (main reset zeroes it) */
.post-type-archive-press_clipping .blog-archive-content {
	padding-top: var(--wp--preset--spacing--8) !important;
	padding-bottom: var(--wp--preset--spacing--10) !important;
}

/* Cards stretch to equal row height — all cards identical in size */
.post-type-archive-press_clipping .wp-block-post-template.is-layout-grid {
	align-items: stretch !important;
}

/* Remove the WordPress block-gap between card children (header bar → image → body) */
.press-clipping-card {
	gap: 0 !important;
}

/* Belt-and-suspenders: no margin on the image itself */
.press-clipping-card .wp-block-post-featured-image {
	margin: 0 !important;
}

/* Body expands to fill remaining card height, footer stays pinned to bottom */
.press-clipping-card .blog-grid-card__body {
	flex: 1 !important;
}

/* Compact footer — just enough padding to clear the 16px gradient bar */
.press-clipping-card .blog-grid-card__footer {
	padding-bottom: calc(0.5rem + 16px) !important;
}

/* Press clipping archive: all cards equal — no featured first card */
.post-type-archive-press_clipping .wp-block-post-template > li:first-child {
	grid-column: auto !important;
}

.post-type-archive-press_clipping .wp-block-post-template > li:first-child .blog-grid-card {
	display: flex !important;
	flex-direction: column !important;
	grid-template-columns: unset !important;
	grid-template-areas: unset !important;
}

.post-type-archive-press_clipping .wp-block-post-template > li:first-child .blog-grid-card .wp-block-post-featured-image {
	aspect-ratio: unset !important;
	height: 220px !important;
	flex: none !important;
	width: 100% !important;
}

.post-type-archive-press_clipping .wp-block-post-template > li:first-child .blog-grid-card__body {
	grid-area: unset !important;
	padding: 0.5rem var(--wp--preset--spacing--4) var(--wp--preset--spacing--3) !important;
}

.post-type-archive-press_clipping .wp-block-post-template > li:first-child .blog-grid-card__footer {
	grid-area: unset !important;
	padding: 0.25rem var(--wp--preset--spacing--4) var(--wp--preset--spacing--4) !important;
}

/* ── Customer / Partner / E-Book card — read-more link ───────────────────── */

.customer-archive-content .wp-block-read-more,
.customer-archive-content .customer-read-more,
.customer-further-reading .wp-block-read-more,
.customer-further-reading .customer-read-more,
.partner-archive-content .wp-block-read-more,
.partner-archive-content .partner-read-more,
.partner-further-reading .wp-block-read-more,
.partner-further-reading .partner-read-more,
.ebook-archive-content .wp-block-read-more,
.ebook-archive-content .ebook-read-more,
.ebook-further-reading .wp-block-read-more,
.ebook-further-reading .ebook-read-more {
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	color: var(--wp--preset--color--blue);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	position: relative;
	z-index: 2;
	transition: color 0.15s;
}

.customer-archive-content .wp-block-read-more::before,
.customer-archive-content .customer-read-more::before,
.customer-further-reading .wp-block-read-more::before,
.customer-further-reading .customer-read-more::before,
.partner-archive-content .wp-block-read-more::before,
.partner-archive-content .partner-read-more::before,
.partner-further-reading .wp-block-read-more::before,
.partner-further-reading .partner-read-more::before,
.ebook-archive-content .wp-block-read-more::before,
.ebook-archive-content .ebook-read-more::before,
.ebook-further-reading .wp-block-read-more::before,
.ebook-further-reading .ebook-read-more::before {
	content: '›';
	font-size: 1.15em;
	line-height: 1;
}

.customer-archive-content .wp-block-read-more:hover,
.customer-archive-content .customer-read-more:hover,
.customer-further-reading .wp-block-read-more:hover,
.customer-further-reading .customer-read-more:hover,
.partner-archive-content .wp-block-read-more:hover,
.partner-archive-content .partner-read-more:hover,
.partner-further-reading .wp-block-read-more:hover,
.partner-further-reading .partner-read-more:hover,
.ebook-archive-content .wp-block-read-more:hover,
.ebook-archive-content .ebook-read-more:hover,
.ebook-further-reading .wp-block-read-more:hover,
.ebook-further-reading .ebook-read-more:hover {
	color: var(--wp--preset--color--navy);
}

/* Customer / Partner / E-Book — responsive grid ─────────────────────────── */

@media (min-width: 640px) and (max-width: 1023px) {
	.customer-archive-content .wp-block-post-template.is-layout-grid,
	.customer-further-reading .wp-block-post-template.is-layout-grid,
	.partner-archive-content .wp-block-post-template.is-layout-grid,
	.partner-further-reading .wp-block-post-template.is-layout-grid,
	.ebook-archive-content .wp-block-post-template.is-layout-grid,
	.ebook-further-reading .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 639px) {
	.customer-archive-content .wp-block-post-template.is-layout-grid,
	.customer-further-reading .wp-block-post-template.is-layout-grid,
	.partner-archive-content .wp-block-post-template.is-layout-grid,
	.partner-further-reading .wp-block-post-template.is-layout-grid,
	.ebook-archive-content .wp-block-post-template.is-layout-grid,
	.ebook-further-reading .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
		padding-inline: 1.25rem !important;
	}
}

/* ── Client Stories archive: compensate for absent category filter ───────── */

.post-type-archive-client_story .blog-archive-content {
	padding-top: 4rem !important;
}

/* ── Archive header band ──────────────────────────────────────────────────── */

.blog-archive-band {
	margin-top: 0 !important;
}

.blog-archive-band .wp-block-query-title {
	color: #ffffff;
	font-size: var(--wp--preset--font-size--3xl);
	font-weight: 700;
	margin: 0;
}

/* ── Tablet ───────────────────────────────────────────────────────────────── */

@media (min-width: 640px) and (max-width: 1023px) {
	.blog-archive-content .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child {
		grid-column: 1 / -1;
	}
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

/* Below 1320px: single-column grid, first blog card matches regular card layout */
@media (max-width: 1319px) {
	.blog-archive-content .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) {
		display: flex !important;
		flex-direction: column !important;
		grid-template-columns: unset !important;
		grid-template-rows: unset !important;
		grid-template-areas: unset !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .wp-block-post-featured-image {
		grid-area: unset !important;
		flex: none !important;
		width: 100% !important;
		aspect-ratio: 870 / 499 !important;
		position: relative !important;
		inset: auto !important;
		height: auto !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .blog-grid-card__body {
		grid-area: unset !important;
		padding: 0.5rem var(--wp--preset--spacing--4) 0 !important;
		gap: 0.2rem !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card) .blog-grid-card__footer {
		grid-area: unset !important;
		padding-top: 0.25rem !important;
		padding-left: var(--wp--preset--spacing--4) !important;
		padding-right: var(--wp--preset--spacing--4) !important;
	}

	/* Gradient spans full width in stacked layout */
	.blog-archive-content .wp-block-post-template > li:first-child .blog-grid-card:not(.press-clipping-card)::after {
		left: 0;
	}
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 639px) {
	.blog-archive-content .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
		padding-inline: 1.25rem !important;
	}

	.blog-archive-content .wp-block-post-template > li:first-child {
		grid-column: 1;
	}

	.blog-cat-filter {
		padding-inline: 1.25rem;
	}

	.blog-archive-band .wp-block-query-title {
		font-size: 2.5rem !important;
	}
}
