/**
 * Blog single-post reading layout.
 *
 * Scoped entirely to `body.single-post .ra-blog-*`, so it cannot reach pages,
 * the Insight Report template or any existing block styling.
 *
 * Reminder: the theme sets html { font-size: 62.5% }, so 1rem = 10px.
 */

body.single-post {
	--ra-blog-rail-width: 24rem;
	--ra-blog-gap: 5.6rem;
	--ra-blog-sticky-top: 12rem;
}

/* -------------------------------------------------------------------------
 * Hero (client feedback 2026-11-12: "cut the top image at least in half")
 *
 * style.css gives the hero 180px/100px of padding plus another 60px top and
 * bottom on the overlay - ~400px of padding before any content. Overridden
 * here rather than in style.css so the original rules stay untouched (and
 * Insight Reports, which don't get .ra-blog-template, are unaffected).
 * ---------------------------------------------------------------------- */

body.ra-blog-template .single-post-template__hero {
	padding: 4.8rem 2rem;
}

body.ra-blog-template .single-post-template__hero-overlay {
	padding: 0;
}

/* Wider column + slightly smaller title: long titles wrap to 2 lines, not 3. */
body.ra-blog-template .single-post-template__hero-content {
	max-width: 96rem;
}

body.ra-blog-template .single-post-template__hero .category-label {
	margin-bottom: 0.8rem;
}

body.ra-blog-template .single-post-template__hero h1 {
	margin-bottom: 1.6rem;
	font-size: 4.4rem;
	line-height: 1.15;
}

body.ra-blog-template .single-post-template__hero .author-info {
	gap: 0;
}

@media (max-width: 767px) {
	body.ra-blog-template .single-post-template__hero {
		padding: 3.6rem 1.6rem;
	}

	body.ra-blog-template .single-post-template__hero h1 {
		font-size: 3.2rem;
	}
}

/* -------------------------------------------------------------------------
 * Container width
 *
 * The theme caps single posts at `max-width: 1200px; padding: 0 6rem`, i.e.
 * 1080px of usable width - noticeably narrower than the header, and far too
 * tight once a TOC rail and a CTA rail are taking their share. Match the
 * header's own container instead (`.wrap`: 92% / 1280px).
 *
 * `.ra-blog-template` is only on posts that actually use this layout, so
 * Insight Reports - which are posts too - keep the original 1200px.
 * ---------------------------------------------------------------------- */

body.ra-blog-template .inner-section,
body.ra-blog-template .single-post-template__top-row {
	width: var(--theme-wrap-width, 92%);
	max-width: var(--theme-wrap-max-width, 1280px);
	padding-left: 0;
	padding-right: 0;
	margin-left: auto;
	margin-right: auto;
}

/* -------------------------------------------------------------------------
 * Grid
 * ---------------------------------------------------------------------- */

/* Two columns: rail (contents + Exit Readiness card) | article. */
body.single-post .ra-blog-layout {
	display: grid;
	grid-template-columns: var(--ra-blog-rail-width) minmax(0, 1fr);
	gap: var(--ra-blog-gap);
	align-items: start;
}

body.single-post .ra-blog-main {
	min-width: 0;
}

/* The rail is sticky and never taller than the viewport. If a long post's
   contents would push the card off-screen, the list scrolls inside itself
   and the card stays in view. */
body.single-post .ra-blog-rail {
	position: sticky;
	top: var(--ra-blog-sticky-top);
	display: flex;
	flex-direction: column;
	gap: 3.2rem;
	max-height: calc(100vh - var(--ra-blog-sticky-top) - 2.4rem);
	/* Sticky elements keep their margin clear of the container's end, so the
	   rail stops 6rem short of the Exit Readiness card instead of touching it. */
	margin-bottom: 6rem;
}

body.single-post .ra-blog-rail .ra-blog-toc {
	display: flex;
	flex-direction: column;
	flex: 0 1 auto;
	min-height: 0;
}

body.single-post .ra-blog-rail .ra-blog-toc__list {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

/* -------------------------------------------------------------------------
 * Exit Readiness card - full width, above the "Stay Ahead With Monthly M&A
 * Insights" subscribe section (client feedback 2026-11-12).
 * ---------------------------------------------------------------------- */

body.single-post .ra-blog-cta-bottom {
	width: var(--theme-wrap-width, 92%);
	max-width: var(--theme-wrap-max-width, 1280px);
	margin: 0 auto 8rem;
}

body.single-post .ra-blog-cta-card--wide {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2.4rem 4.8rem;
	padding: 4rem 4.8rem;
}

body.single-post .ra-blog-cta-card--wide .ra-blog-cta-card__text {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 72rem;
}

body.single-post .ra-blog-cta-card--wide .ra-blog-cta-card__title {
	font-size: 2.8rem;
}

body.single-post .ra-blog-cta-card--wide .ra-blog-cta-card__copy {
	margin-bottom: 0;
	font-size: 1.7rem;
}

body.single-post .ra-blog-cta-card.ra-blog-cta-card--wide a.ra-blog-cta-card__btn {
	flex: 0 0 auto;
	width: auto;
	padding: 1.6rem 3.2rem;
	white-space: nowrap;
}

@media (max-width: 767px) {
	body.single-post .ra-blog-cta-bottom {
		margin-bottom: 6rem;
	}

	body.single-post .ra-blog-cta-card--wide {
		flex-direction: column;
		align-items: stretch;
		padding: 3.2rem 2.4rem;
	}

	body.single-post .ra-blog-cta-card--wide .ra-blog-cta-card__title {
		font-size: 2.4rem;
	}

	body.single-post .ra-blog-cta-card.ra-blog-cta-card--wide a.ra-blog-cta-card__btn {
		width: 100%;
		white-space: normal;
	}
}

/* The article keeps owning its own spacing; the rails should not inherit the
   theme's generic first/last-child resets in a way that misaligns them. */
body.single-post .ra-blog-rail > *:first-child {
	margin-top: 0;
}

/* -------------------------------------------------------------------------
 * Table of contents (left)
 * ---------------------------------------------------------------------- */

body.single-post .ra-blog-toc {
	border-left: 2px solid #E4E6EC;
	padding: 0 0 0 2rem;
}

body.single-post .ra-blog-toc__title {
	margin: 0 0 1.6rem;
	padding: 0;
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--roadmap-primary-green, #000033);
}

/* The toggle is the mobile-only control; hidden on desktop. */
body.single-post .ra-blog-toc__toggle {
	display: none;
}

body.single-post .ra-blog-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

body.single-post .ra-blog-toc__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

body.single-post .ra-blog-toc__item::before {
	content: none;
}

body.single-post .ra-blog-toc__item a {
	display: block;
	padding: 0.7rem 0;
	font-size: 1.5rem;
	line-height: 1.4;
	color: #5A6072;
	text-decoration: none;
	border-bottom: 0;
	transition: color 0.15s ease;
}

body.single-post .ra-blog-toc__item a:hover,
body.single-post .ra-blog-toc__item a:focus {
	color: var(--roadmap-teal-green, #2E9CCA);
	text-decoration: none;
}

body.single-post .ra-blog-toc__item--sub a {
	padding-left: 1.4rem;
	font-size: 1.4rem;
	color: #7A8092;
}

body.single-post .ra-blog-toc__item.is-active > a {
	color: var(--roadmap-primary-green, #000033);
	font-weight: 700;
}

/* -------------------------------------------------------------------------
 * CTA card (right)
 * ---------------------------------------------------------------------- */

body.single-post .ra-blog-cta-card {
	background-color: var(--roadmap-primary-green, #000033);
	border-radius: 1.2rem;
	padding: 3.2rem 2.8rem;
	color: #FFFFFF;
}

body.single-post .ra-blog-cta-card__eyebrow {
	margin: 0 0 1.2rem;
	padding: 0;
	font-size: 1.2rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--roadmap-teal-green, #2E9CCA);
}

body.single-post .ra-blog-cta-card__title {
	margin: 0 0 1.2rem;
	padding: 0;
	font-size: 2.2rem;
	line-height: 1.3;
	font-weight: 700;
	color: #FFFFFF;
}

body.single-post .ra-blog-cta-card__copy {
	margin: 0 0 2.4rem;
	padding: 0;
	font-size: 1.5rem;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.82);
}

body.single-post .ra-blog-cta-card a.ra-blog-cta-card__btn {
	display: block;
	width: 100%;
	padding: 1.4rem 2rem;
	border: 0;
	border-radius: 0.6rem;
	background-color: var(--roadmap-teal-green, #2E9CCA);
	color: #FFFFFF;
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

body.single-post .ra-blog-cta-card a.ra-blog-cta-card__btn:hover,
body.single-post .ra-blog-cta-card a.ra-blog-cta-card__btn:focus {
	background-color: #1F7FA8;
	color: #FFFFFF;
	text-decoration: none;
}

/* -------------------------------------------------------------------------
 * Mid-article CTA banner
 * ---------------------------------------------------------------------- */

body.single-post .ra-blog-midcta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2.4rem 3.2rem;
	flex-wrap: wrap;
	margin: 4.8rem 0;
	padding: 3.2rem;
	border-radius: 1.2rem;
	background-color: var(--roadmap-primary-green, #000033);
	color: #FFFFFF;
}

body.single-post .ra-blog-midcta__text {
	flex: 1 1 32rem;
	min-width: 0;
}

body.single-post .ra-blog-midcta__title {
	margin: 0 0 0.8rem;
	padding: 0;
	font-size: 2.4rem;
	line-height: 1.3;
	font-weight: 700;
	color: #FFFFFF;
}

body.single-post .ra-blog-midcta__copy {
	margin: 0;
	padding: 0;
	font-size: 1.7rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.82);
}

body.single-post .ra-blog-midcta a.ra-blog-midcta__btn {
	flex: 0 0 auto;
	display: inline-block;
	padding: 1.5rem 3.2rem;
	border: 0;
	border-radius: 0.6rem;
	background-color: var(--roadmap-teal-green, #2E9CCA);
	color: #FFFFFF;
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease;
}

body.single-post .ra-blog-midcta a.ra-blog-midcta__btn:hover,
body.single-post .ra-blog-midcta a.ra-blog-midcta__btn:focus {
	background-color: #1F7FA8;
	color: #FFFFFF;
	text-decoration: none;
}

/* Headings sit under a sticky header on anchor jumps. */
body.single-post .ra-blog-main h2[id],
body.single-post .ra-blog-main h3[id] {
	scroll-margin-top: 11rem;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

/* Narrower desktop: tighten the rail. */
@media (max-width: 1200px) {
	body.single-post {
		--ra-blog-rail-width: 22rem;
		--ra-blog-gap: 4rem;
	}
}

/* Tablet and down: single column. The contents become a collapsible grey
   box above the article. */
@media (max-width: 1024px) {
	body.single-post .ra-blog-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 3.2rem;
	}

	body.single-post .ra-blog-rail {
		position: static;
		max-height: none;
		margin-bottom: 0; /* Not sticky here - the grid gap already spaces it. */
	}

	body.single-post .ra-blog-rail .ra-blog-toc__list {
		overflow: visible;
	}

	body.single-post .ra-blog-toc {
		border-left: 0;
		border-radius: 1.2rem;
		background-color: #F5F6F9;
		padding: 2.4rem 2.8rem;
	}

	body.single-post .ra-blog-toc__title {
		display: none;
	}

	body.single-post .ra-blog-toc__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1.6rem;
		width: 100%;
		padding: 0;
		border: 0;
		background: transparent;
		font-family: inherit;
		font-size: 1.3rem;
		font-weight: 700;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--roadmap-primary-green, #000033);
		cursor: pointer;
	}

	body.single-post .ra-blog-toc__toggle::after {
		content: "";
		width: 0.9rem;
		height: 0.9rem;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(45deg);
		transform-origin: center;
		transition: transform 0.15s ease;
	}

	body.single-post .ra-blog-toc__toggle[aria-expanded="true"]::after {
		transform: rotate(-135deg);
	}

	body.single-post .ra-blog-toc__list {
		display: none;
		margin-top: 1.6rem;
	}

	body.single-post .ra-blog-toc__toggle[aria-expanded="true"] + .ra-blog-toc__list {
		display: block;
	}

	body.single-post .ra-blog-midcta {
		margin: 3.6rem 0;
		padding: 2.8rem 2.4rem;
	}

	body.single-post .ra-blog-midcta a.ra-blog-midcta__btn {
		width: 100%;
		text-align: center;
	}
}
