/* ==========================================================================
   Post (single-post.php) — scoped under .rpd-post-page
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.rpd-post-page {
	background: var(--rpd-color-surface);
}

.rpd-post-body {
	display: grid;
	grid-template-columns: 1fr 22rem;
	gap: var(--rpd-space-12);
	padding-top: var(--rpd-space-12);
	padding-bottom: var(--rpd-space-16);
	align-items: start;
}

.rpd-post-body__main {
	min-width: 0;
}

.rpd-post-body__sidebar {
	position: sticky;
	top: 6rem;
	align-self: start;
	height: fit-content;
}

.rpd-post-body--no-sidebar {
	grid-template-columns: 1fr;
	max-width: var(--rpd-container-md);
	margin-left: auto;
	margin-right: auto;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.rpd-post-hero {
	background: var(--gradient-navy);
	color: var(--rpd-white);
	padding: var(--rpd-space-16) 0 var(--rpd-space-12);
}

.rpd-post-hero__inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--rpd-space-12);
	align-items: center;
}

.rpd-post-hero--no-image .rpd-post-hero__inner,
.rpd-post-hero--default:not(:has(.rpd-post-hero__image-wrap)) .rpd-post-hero__inner,
.rpd-post-hero--bg-image .rpd-post-hero__inner,
.rpd-post-hero--bg-color .rpd-post-hero__inner {
	grid-template-columns: 1fr;
	max-width: var(--rpd-container-md);
}

/* Center text when no side image — matches Salient's default centered post header */
.rpd-post-hero--no-image .rpd-post-hero__content,
.rpd-post-hero--default:not(:has(.rpd-post-hero__image-wrap)) .rpd-post-hero__content,
.rpd-post-hero--bg-image .rpd-post-hero__content,
.rpd-post-hero--bg-color .rpd-post-hero__content {
	text-align: center;
	align-items: center;
}

.rpd-post-hero--no-image .rpd-post-hero__cats,
.rpd-post-hero--default:not(:has(.rpd-post-hero__image-wrap)) .rpd-post-hero__cats,
.rpd-post-hero--bg-image .rpd-post-hero__cats,
.rpd-post-hero--bg-color .rpd-post-hero__cats {
	justify-content: center;
}

.rpd-post-hero--no-image .rpd-post-hero__dek,
.rpd-post-hero--default:not(:has(.rpd-post-hero__image-wrap)) .rpd-post-hero__dek,
.rpd-post-hero--bg-image .rpd-post-hero__dek,
.rpd-post-hero--bg-color .rpd-post-hero__dek {
	margin-left: auto;
	margin-right: auto;
}

.rpd-post-hero--no-image .rpd-post-hero__meta,
.rpd-post-hero--default:not(:has(.rpd-post-hero__image-wrap)) .rpd-post-hero__meta,
.rpd-post-hero--bg-image .rpd-post-hero__meta,
.rpd-post-hero--bg-color .rpd-post-hero__meta {
	justify-content: center;
}

/* Featured image as hero background — Salient "Featured Image Header" equivalent */
.rpd-post-hero--bg-image {
	position: relative;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Solid background color override */
.rpd-post-hero--bg-color {
	position: relative;
}

.rpd-post-hero__overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.rpd-post-hero--bg-image .rpd-container,
.rpd-post-hero--bg-color .rpd-container {
	position: relative;
	z-index: 1;
}

.rpd-post-hero--image-right .rpd-post-hero__inner {
	grid-template-columns: 1fr 1fr;
}

.rpd-post-hero__cats {
	display: flex;
	flex-wrap: wrap;
	gap: var(--rpd-space-2);
	margin-bottom: var(--rpd-space-4);
}

.rpd-post-hero .rpd-tag {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 8px;
	border: 1.5px solid rgba(255, 255, 255, 0.4);
	color: var(--rpd-white);
	background: rgba(255, 255, 255, 0.12);
	font-size: var(--rpd-font-size-sm);
	font-weight: 600;
	text-decoration: none;
	letter-spacing: 0.02em;
}

.rpd-post-hero__title {
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-3xl);
	font-weight: 800;
	line-height: var(--rpd-line-height-heading);
	color: var(--rpd-white);
	margin: 0 0 var(--rpd-space-4);
}

.rpd-post-hero__dek {
	font-size: var(--rpd-font-size-md);
	line-height: var(--rpd-line-height-body);
	color: rgba(255, 255, 255, 0.82);
	margin: 0 0 var(--rpd-space-6);
	max-width: 54ch;
}

.rpd-post-hero__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--rpd-space-3) var(--rpd-space-5);
	font-size: var(--rpd-font-size-sm);
	color: rgba(255, 255, 255, 0.7);
}

.rpd-post-hero__byline {
	display: flex;
	align-items: center;
	gap: var(--rpd-space-2);
}

.rpd-post-hero__avatar {
	width: 36px;
	height: 36px;
	border-radius: var(--rpd-radius-pill);
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.3);
}

.rpd-post-hero__author {
	display: flex;
	flex-direction: column;
	line-height: 1.3;
	color: var(--rpd-white);
	font-weight: 600;
}

.rpd-post-hero__author-role {
	font-weight: 400;
	font-size: var(--rpd-font-size-xs);
	color: rgba(255, 255, 255, 0.65);
}

/* Dark text mode — for light backgrounds */
.rpd-post-hero--text-dark .rpd-post-hero__title {
	color: var(--rpd-navy);
}

.rpd-post-hero--text-dark .rpd-post-hero__dek {
	color: var(--rpd-body);
}

.rpd-post-hero--text-dark .rpd-post-hero__meta {
	color: var(--rpd-body);
}

.rpd-post-hero--text-dark .rpd-post-hero__author {
	color: var(--rpd-navy);
}

.rpd-post-hero--text-dark .rpd-post-hero__author-role {
	color: var(--rpd-body);
}

.rpd-post-hero--text-dark .rpd-post-hero__avatar {
	border-color: var(--rpd-navy);
}

.rpd-post-hero--text-dark .rpd-tag {
	border-color: rgba(35, 31, 88, 0.35);
	color: var(--rpd-navy);
	background: transparent;
}

.rpd-post-hero__image-wrap {
	border-radius: var(--rpd-radius);
	overflow: hidden;
	box-shadow: var(--rpd-shadow-lg);
}

.rpd-post-hero__image {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	aspect-ratio: 16 / 9;
}

/* --------------------------------------------------------------------------
   Post content
   -------------------------------------------------------------------------- */

.rpd-post-content {
	font-size: var(--rpd-font-size-md);
	line-height: 1.72;
	color: var(--rpd-color-text);
	overflow-wrap: anywhere;
	width: 100%;
	max-width: 46rem;
	margin-left: auto;
	margin-right: auto;
}

.rpd-post-content h2 {
	font-family: var(--font-heading);
	font-size: clamp(1.5rem, 1.9vw, 1.75rem);
	font-weight: 700;
	color: var(--rpd-color-heading);
	margin: 3.25rem 0 1.125rem;
	line-height: 1.2;
}

.rpd-post-content h3 {
	font-family: var(--font-heading);
	font-size: clamp(1.25rem, 1.5vw, 1.375rem);
	font-weight: 700;
	color: var(--rpd-color-heading);
	margin: 2.5rem 0 0.875rem;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.rpd-post-content > h2:first-child,
.rpd-post-content > h3:first-child {
	margin-top: 0;
}

.rpd-post-content p {
	margin: 0 0 var(--rpd-space-5);
}

.rpd-post-content ul,
.rpd-post-content ol {
	padding-left: var(--rpd-space-6);
	margin: 0 0 var(--rpd-space-5);
}

.rpd-post-content li {
	margin-bottom: var(--rpd-space-2);
}

.rpd-post-content a {
	color: var(--rpd-purple);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.rpd-post-content a:hover {
	color: var(--rpd-navy);
}

.rpd-post-content figure,
.rpd-post-content .wp-caption {
	width: 100% !important;
	max-width: 100%;
	margin: 2.5rem auto;
}

.rpd-post-content figure img:not(.emoji),
.rpd-post-content .wp-caption img:not(.emoji) {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	border-radius: var(--rpd-radius);
}

.rpd-post-content p:has(> img:not(.emoji)),
.rpd-post-content p:has(> a > img:not(.emoji)) {
	margin: 2.5rem 0;
}

.rpd-post-content p > img:not(.emoji),
.rpd-post-content p > a > img:not(.emoji) {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	border-radius: var(--rpd-radius);
}

.rpd-post-content p > img:not(.emoji)[srcset],
.rpd-post-content p > a > img:not(.emoji)[srcset] {
	width: min(100%, 36rem);
}

.rpd-post-content figcaption,
.rpd-post-content .wp-caption-text,
.rpd-post-content p[id^="caption-attachment"] {
	max-width: 42rem;
	margin: 0.75rem auto 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--rpd-color-text-muted);
	text-align: center;
}

.rpd-post-content p[id^="caption-attachment"] {
	margin-top: -1.75rem;
	margin-bottom: 2.5rem;
}

.rpd-post-content blockquote {
	border-left: 5px solid var(--rpd-gold);
	margin: 2.75rem 0;
	padding: 1.5rem 1.75rem;
	background: linear-gradient(135deg, var(--rpd-bg-soft-alt), var(--rpd-color-surface-soft));
	border-radius: 0 0.75rem 0.75rem 0;
	box-shadow: 0 0.25rem 1rem rgba(35, 31, 88, 0.06);
	font-size: clamp(1.125rem, 1.4vw, 1.3rem);
	line-height: 1.55;
	font-style: italic;
	color: var(--rpd-color-heading);
}

.rpd-post-content blockquote > :last-child {
	margin-bottom: 0;
}

.rpd-post-content blockquote cite {
	display: block;
	margin-top: var(--rpd-space-3);
	font-size: var(--rpd-font-size-sm);
	font-style: normal;
	font-weight: 600;
}

/* Section divider */

.rpd-post-content .rpd-post-divider {
	border: none;
	border-top: 1px solid var(--rpd-color-border);
	margin: var(--rpd-space-8) 0;
}

/* Strip WPBakery layout chrome — keep only the prose */
.rpd-post-content .vc_row,
.rpd-post-content .wpb_column,
.rpd-post-content .vc_column_container,
.rpd-post-content .vc_column-inner,
.rpd-post-content .wpb_wrapper {
	all: unset;
	display: block;
}

/* --------------------------------------------------------------------------
   Sidebar CTA
   -------------------------------------------------------------------------- */

.rpd-post-sidebar__cta {
	background: var(--rpd-bg-soft-alt);
	border: 1px solid var(--rpd-color-border);
	border-radius: var(--rpd-radius);
	padding: var(--rpd-space-6);
}

.rpd-post-sidebar__cta-title {
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-lg);
	font-weight: 700;
	color: var(--rpd-color-heading);
	margin: 0 0 var(--rpd-space-3);
	line-height: var(--rpd-line-height-heading);
}

.rpd-post-sidebar__cta-body {
	font-size: var(--rpd-font-size-sm);
	color: var(--rpd-color-text);
	line-height: var(--rpd-line-height-body);
	margin: 0 0 var(--rpd-space-5);
}

.rpd-btn--full {
	width: 100%;
	text-align: center;
}

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */

.rpd-post-faq {
	margin-top: var(--rpd-space-12);
	padding-top: var(--rpd-space-10);
	border-top: 1px solid var(--rpd-color-border);
}

.rpd-post-faq__heading {
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-xl);
	font-weight: 700;
	color: var(--rpd-color-heading);
	margin: 0 0 var(--rpd-space-6);
}

.rpd-post-faq__list {
	margin: 0;
	padding: 0;
}

.rpd-post-faq__item {
	border-bottom: 1px solid var(--rpd-color-border);
}

.rpd-post-faq__question {
	margin: 0;
}

.rpd-post-faq__toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: var(--rpd-space-5) 0;
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-base);
	font-weight: 600;
	color: var(--rpd-color-heading);
	cursor: pointer;
	gap: var(--rpd-space-4);
}

.rpd-post-faq__toggle:focus-visible {
	outline: 2px solid var(--rpd-color-focus);
	outline-offset: 2px;
}

.rpd-post-faq__icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: var(--rpd-radius-pill);
	border: 2px solid var(--rpd-color-border-strong);
	position: relative;
	transition: background var(--rpd-transition-fast), border-color var(--rpd-transition-fast);
}

.rpd-post-faq__icon::before,
.rpd-post-faq__icon::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--rpd-purple);
	transition: transform var(--rpd-transition-fast), opacity var(--rpd-transition-fast);
}

.rpd-post-faq__icon::before {
	width: 10px;
	height: 2px;
	transform: translate(-50%, -50%);
}

.rpd-post-faq__icon::after {
	width: 2px;
	height: 10px;
	transform: translate(-50%, -50%);
}

.rpd-post-faq__toggle[aria-expanded="true"] .rpd-post-faq__icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
	opacity: 0;
}

.rpd-post-faq__answer {
	margin: 0;
	padding: 0 0 var(--rpd-space-5);
	font-size: var(--rpd-font-size-base);
	line-height: var(--rpd-line-height-body);
	color: var(--rpd-color-text);
}

.rpd-post-faq__answer[hidden] {
	display: none;
}

/* --------------------------------------------------------------------------
   Related learning
   -------------------------------------------------------------------------- */

.rpd-post-related {
	background: var(--rpd-color-surface-soft);
	padding: var(--rpd-space-16) 0;
}

.rpd-post-related__heading {
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-2xl);
	font-weight: 800;
	color: var(--rpd-color-heading);
	margin: 0 0 var(--rpd-space-8);
	text-align: center;
}

.rpd-post-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	justify-content: center;
	gap: var(--rpd-space-6);
}

.rpd-post-related__grid--1 {
	grid-template-columns: minmax(0, 33.333%);
}

.rpd-post-related__grid--2 {
	grid-template-columns: repeat(2, minmax(0, 33.333%));
}

.rpd-post-related__card {
	position: relative;
	display: block;
	height: 240px;
	border-radius: var(--rpd-radius);
	overflow: hidden;
	background: var(--gradient-navy);
	background-size: cover;
	background-position: center;
	text-decoration: none;
	transition: transform var(--rpd-transition);
}

.rpd-post-related__card:hover {
	transform: translateY(-3px);
}

.rpd-post-related__card-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(26, 23, 68, 0.92) 0%, rgba(26, 23, 68, 0.45) 55%, rgba(26, 23, 68, 0.1) 100%);
}

.rpd-post-related__card-body {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: var(--rpd-space-5);
	display: flex;
	flex-direction: column;
	gap: var(--rpd-space-2);
	z-index: 1;
}

.rpd-post-related__card .rpd-tag {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 6px;
	border: 1.5px solid rgba(255, 255, 255, 0.35);
	color: var(--rpd-white);
	background: rgba(255, 255, 255, 0.1);
	font-size: var(--rpd-font-size-xs);
	font-weight: 600;
	text-decoration: none;
	letter-spacing: 0.02em;
	align-self: flex-start;
}

.rpd-post-related__card-title {
	font-family: var(--font-heading);
	font-size: var(--rpd-font-size-base);
	font-weight: 700;
	color: var(--rpd-white);
	margin: 0;
	line-height: var(--rpd-line-height-heading);
}

.rpd-post-related__card-date {
	font-size: var(--rpd-font-size-xs);
	color: rgba(255, 255, 255, 0.6);
}

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

@media (max-width: 1024px) {
	.rpd-post-body {
		grid-template-columns: 1fr;
	}

	.rpd-post-body__sidebar {
		position: static;
		order: -1;
	}

	.rpd-post-hero__inner {
		grid-template-columns: 1fr;
	}

	.rpd-post-hero__image-wrap {
		display: none;
	}

}

@media (max-width: 768px) {
	.rpd-post-hero__title {
		font-size: var(--rpd-font-size-2xl);
	}

	.rpd-post-related__grid {
		grid-template-columns: 1fr;
	}

	.rpd-post-body {
		padding-top: var(--rpd-space-8);
		padding-bottom: var(--rpd-space-10);
	}

	.rpd-post-content h2 {
		margin-top: 2.75rem;
	}

	.rpd-post-content h3 {
		margin-top: 2.125rem;
	}

	.rpd-post-content blockquote {
		margin: 2rem 0;
		padding: 1.25rem;
	}
}
