.ra-discovery {
	--ra-disc-accent: #5955d1;
	--ra-disc-accent-soft: #eeedff;
	--ra-disc-surface: var(--cs-layout-background, #fff);
	--ra-disc-ink: var(--cs-color-primary, #29294b);
	--ra-disc-muted: var(--cs-color-secondary, #696981);
	--ra-disc-border: var(--cs-color-border, #e1e1e8);
	--ra-disc-radius: var(--cs-thumbnail-border-radius, 16px);
	color: var(--ra-disc-ink);
	font-family: var(--cs-font-primary-family, "DM Sans"), sans-serif;
}

body[data-scheme="dark"] .ra-discovery {
	--ra-disc-accent: #9692ff;
	--ra-disc-accent-soft: #2f2d54;
}

.ra-discovery *,
.ra-discovery *::before,
.ra-discovery *::after {
	box-sizing: border-box;
}

.ra-discovery__heading {
	margin: 0 0 1.4rem;
	color: var(--ra-disc-ink);
	font-family: var(--cs-font-headings-family, "DM Sans"), sans-serif;
	font-size: clamp(1.35rem, 2.2vw, 2rem);
	font-weight: 750;
	letter-spacing: -0.04em;
	line-height: 1.15;
}

.ra-discovery__eyebrow {
	margin: 0 0 1.35rem;
	color: var(--ra-disc-muted);
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.13em;
	line-height: 1.2;
	text-transform: uppercase;
}

.ra-discovery__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.7rem;
	align-items: center;
	color: var(--ra-disc-muted);
	font-size: 0.74rem;
	line-height: 1.35;
}

.ra-discovery__meta time {
	white-space: nowrap;
}

.ra-discovery__category,
.ra-discovery a.ra-discovery__category {
	color: var(--ra-disc-accent);
	font-weight: 750;
	text-decoration: none;
}

.ra-discovery a:focus-visible,
.ra-featured__dots button:focus-visible {
	outline: 3px solid var(--ra-disc-accent);
	outline-offset: 3px;
}

.ra-discovery__image-fallback {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--ra-disc-accent-soft), var(--ra-disc-border));
}

/* Sidebar: editorial highlights. */
.cs-sidebar__inner .ra-discovery {
	width: 100%;
	margin-bottom: 2.25rem;
}

.cs-sidebar__inner .ra-discovery__heading {
	margin-bottom: 1.2rem;
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.ra-featured__track {
	position: relative;
}

.ra-featured__slide[hidden] {
	display: none;
}

.ra-featured__media {
	position: relative;
	min-height: 390px;
	overflow: hidden;
	background: #24223f;
	border-radius: calc(var(--ra-disc-radius) + 4px);
	box-shadow: 0 18px 44px rgba(var(--cs-color-box-shadow-rgb, 114, 114, 255), 0.13);
}

.ra-featured__media::after {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	content: "";
	background: linear-gradient(180deg, rgb(20 18 45 / 5%) 24%, rgb(20 18 45 / 88%) 100%);
}

.ra-featured__image-link {
	position: absolute;
	inset: 0;
}

.ra-featured__image,
.ra-featured__image-link .ra-discovery__image-fallback {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 360ms ease;
}

.ra-featured__media:hover .ra-featured__image {
	transform: scale(1.025);
}

.ra-featured__content {
	position: absolute;
	right: 1.35rem;
	bottom: 1.35rem;
	left: 1.35rem;
	z-index: 2;
}

.ra-featured__content .ra-discovery__meta {
	margin-bottom: 0.7rem;
	color: rgb(255 255 255 / 76%);
}

.ra-featured__badge {
	position: absolute;
	top: 1.25rem;
	left: 1.25rem;
	z-index: 2;
	max-width: 100%;
	padding: 0.42rem 0.7rem;
	overflow: hidden;
	color: #fff;
	font-size: 0.68rem;
	letter-spacing: 0.12em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
	background: rgb(255 255 255 / 17%);
	border: 1px solid rgb(255 255 255 / 17%);
	border-radius: 8px;
	backdrop-filter: blur(12px);
}

.ra-featured__badge:hover,
.ra-featured__badge:focus {
	color: #fff;
	text-decoration: none;
}

.ra-featured__content .ra-discovery__category {
	display: none;
}

.ra-featured__content h3 {
	margin: 0;
	font-size: clamp(1.15rem, 1.6vw, 1.42rem);
	font-weight: 750;
	letter-spacing: -0.035em;
	line-height: 1.18;
}

.ra-featured__content h3 a,
.ra-featured__content h3 a:hover {
	color: #fff;
	text-decoration: none;
}

.ra-featured__dots {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: center;
	min-height: 2rem;
	margin-top: 0.8rem;
}

.ra-featured__dots button {
	width: 0.52rem;
	height: 0.52rem;
	padding: 0;
	background: var(--ra-disc-ink);
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	opacity: 0.45;
	transition: width 180ms ease, opacity 180ms ease;
}

.ra-featured__dots button[aria-current="true"] {
	width: 2rem;
	opacity: 1;
}

/* Sidebar: same file. */
.ra-discovery--context {
	padding: 0.55rem 0.8rem;
	background: color-mix(in srgb, var(--ra-disc-surface) 98%, var(--ra-disc-accent-soft));
	border: 1px solid color-mix(in srgb, var(--ra-disc-border) 90%, var(--ra-disc-accent));
	border-radius: calc(var(--ra-disc-radius) + 6px);
	box-shadow: none;
}

.ra-context__list {
	display: block;
}

.ra-context__item {
	position: relative;
	padding: 0.9rem 0.72rem 0.95rem;
	transition: background-color 160ms ease, padding-left 160ms ease;
}

.ra-context__item + .ra-context__item {
	border-top: 0;
}

.ra-context__item + .ra-context__item::after {
	position: absolute;
	top: 0;
	right: 0.72rem;
	left: 0.72rem;
	height: 1px;
	background: color-mix(in srgb, var(--ra-disc-border) 88%, transparent);
	content: "";
}

.ra-context__item:hover,
.ra-context__item:focus-within {
	padding-left: 0.88rem;
	background: color-mix(in srgb, var(--ra-disc-accent-soft) 62%, transparent);
	border-radius: 0.72rem;
}

.ra-context__item .ra-discovery__meta {
	gap: 0.46rem;
	margin-bottom: 0.38rem;
	font-size: 0.68rem;
	letter-spacing: 0.01em;
}

.ra-context__item .ra-discovery__meta::before {
	width: 0.34rem;
	height: 0.34rem;
	background: var(--ra-disc-accent);
	border-radius: 999px;
	content: "";
	flex: 0 0 auto;
}

.ra-context__item .ra-discovery__category {
	font-weight: 800;
}

.ra-context__item .ra-discovery__meta time {
	padding: 0.08rem 0.34rem;
	font-size: 0.6rem;
	font-weight: 700;
	line-height: 1.35;
	background: color-mix(in srgb, var(--ra-disc-accent-soft) 72%, var(--ra-disc-surface));
	border-radius: 999px;
}

.ra-context__item h3 {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: 1.04rem;
	font-weight: 750;
	letter-spacing: -0.025em;
	line-height: 1.28;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.ra-context__item h3 a {
	color: var(--ra-disc-ink);
	text-decoration: none;
}

.ra-context__item h3 a:hover,
.ra-context__item h3 a:focus-visible {
	color: var(--ra-disc-accent);
	text-decoration: none;
}

.ra-context__item p {
	display: -webkit-box;
	margin: 0.42rem 0 0;
	overflow: hidden;
	color: var(--ra-disc-muted);
	font-size: 0.77rem;
	line-height: 1.48;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

/* Book detail sidebar: a flat, complete library with tactile cover thumbnails. */
.ra-discovery--book-library {
	position: sticky;
	top: calc(var(--cs-header-height, 88px) + var(--cs-wpadminbar-height, 0px) + 1.5rem);
	max-height: calc(100vh - var(--cs-header-height, 88px) - var(--cs-wpadminbar-height, 0px) - 3rem);
	padding: clamp(1.15rem, 2vw, 1.55rem);
	overflow-y: auto;
	box-shadow: none;
	overscroll-behavior: contain;
	scrollbar-color: var(--ra-disc-border) transparent;
	scrollbar-width: thin;
}

.ra-discovery--book-library .ra-discovery__eyebrow {
	margin-bottom: 0.75rem;
	color: var(--ra-disc-ink);
}

.ra-book-library__list {
	display: grid;
}

.ra-book-library__item {
	display: grid;
	grid-template-columns: 4.5rem minmax(0, 1fr);
	gap: 0.9rem;
	align-items: center;
	padding: 0.9rem 0;
	color: inherit;
	text-decoration: none;
	transition: color 160ms ease;
}

.ra-book-library__item + .ra-book-library__item {
	border-top: 1px solid var(--ra-disc-border);
}

.ra-book-library__cover {
	display: flex;
	width: 4.5rem;
	height: 6.25rem;
	align-items: center;
	justify-content: center;
	padding: 0;
	overflow: hidden;
	background: var(--ra-disc-border);
	border: 1px solid var(--ra-disc-border);
	border-radius: 0.6rem;
}

.ra-book-library__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
}

.ra-book-library__copy,
.ra-book-library__meta {
	display: grid;
}

.ra-book-library__copy {
	gap: 0.42rem;
	min-width: 0;
}

.ra-book-library__title {
	color: var(--ra-disc-ink);
	font-size: 0.97rem;
	font-weight: 750;
	letter-spacing: -0.025em;
	line-height: 1.25;
}

.ra-book-library__meta {
	gap: 0.12rem;
	color: var(--ra-disc-muted);
	font-size: 0.72rem;
	line-height: 1.35;
}

.ra-book-library__item.is-current .ra-book-library__title {
	color: var(--ra-disc-accent);
}

.ra-book-library__item:hover .ra-book-library__title,
.ra-book-library__item:focus-visible .ra-book-library__title {
	color: var(--ra-disc-accent);
}

.ra-book-library__item:focus-visible {
	border-radius: 0.55rem;
}

/* Article-aligned semantic similarity list. */
.ra-discovery--related {
	margin: clamp(3rem, 7vw, 5.5rem) 0 2rem;
	padding: clamp(1.25rem, 3vw, 2rem);
	background: var(--ra-disc-surface);
	border: 1px solid var(--ra-disc-border);
	border-radius: calc(var(--ra-disc-radius) + 6px);
	box-shadow: 0 18px 48px rgba(var(--cs-color-box-shadow-rgb, 114, 114, 255), 0.08);
}

.ra-related__list {
	display: grid;
	gap: 1.35rem;
}

.ra-related__item {
	display: grid;
	grid-template-columns: minmax(150px, 42%) minmax(0, 1fr);
	gap: clamp(1rem, 2.5vw, 1.5rem);
	align-items: center;
}

.ra-related__item + .ra-related__item {
	padding-top: 1.35rem;
	border-top: 1px solid var(--ra-disc-border);
}

.ra-related__image-link {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--ra-disc-accent-soft);
	border-radius: var(--ra-disc-radius);
}

.ra-related__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 260ms ease;
}

.ra-related__image-link:hover .ra-related__image {
	transform: scale(1.025);
}

.ra-related__content h3 {
	margin: 0.45rem 0 0.55rem;
	font-size: clamp(1.03rem, 2vw, 1.32rem);
	font-weight: 750;
	letter-spacing: -0.035em;
	line-height: 1.2;
}

.ra-related__content h3 a {
	color: var(--ra-disc-ink);
	text-decoration: none;
}

.ra-related__content h3 a:hover {
	color: var(--ra-disc-accent);
}

.ra-related__content > p {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--ra-disc-muted);
	font-size: 0.86rem;
	line-height: 1.55;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

/* Full-width final reading journey. */
.ra-discovery-full {
	margin: clamp(1.75rem, 3vw, 2.75rem) 0 clamp(3rem, 6vw, 5rem);
}

/* Revision leaves a large hand-off below article content by default. */
.single.ra-post-streamlined:not(.ra-book-single) .cs-site-content {
	margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* Book pages use an intentionally tighter hand-off from details to articles. */
body.ra-book-single .ra-discovery-full {
	margin-top: clamp(1.5rem, 3vw, 2.75rem);
}

.ra-read-next__header {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	justify-content: space-between;
	margin-bottom: clamp(1.35rem, 2.7vw, 2rem);
}

.ra-discovery--read-next .ra-discovery__heading {
	margin: 0;
	font-size: clamp(1.65rem, 3vw, 2.5rem);
}

.ra-read-next__grid {
	--ra-reading-gap: clamp(1.3rem, 2.4vw, 2rem);
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--ra-reading-gap);
}

.ra-discovery--read-next.is-carousel .ra-read-next__viewport {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.ra-discovery--read-next.is-carousel .ra-read-next__viewport::-webkit-scrollbar {
	display: none;
}

.ra-discovery--read-next.is-carousel .ra-read-next__viewport:focus-visible {
	outline: 3px solid var(--ra-disc-accent);
	outline-offset: 6px;
}

.ra-discovery--read-next.is-carousel .ra-read-next__grid {
	grid-template-columns: none;
	grid-auto-columns: calc((100% - (2 * var(--ra-reading-gap))) / 3);
	grid-auto-flow: column;
}

.ra-discovery--read-next.is-carousel .ra-read-next__item {
	scroll-snap-align: start;
}

.ra-read-next__item {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 1.15rem;
}

.ra-read-next__image-link {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--ra-disc-accent-soft);
	border-radius: var(--ra-disc-radius);
}

.ra-read-next__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 280ms ease;
}

.ra-read-next__image-link:hover .ra-read-next__image {
	transform: scale(1.025);
}

.ra-read-next__content h3 {
	margin: 0.6rem 0 0.7rem;
	font-size: clamp(1.08rem, 1.8vw, 1.4rem);
	font-weight: 750;
	letter-spacing: -0.035em;
	line-height: 1.22;
}

.ra-read-next__content h3 a {
	color: var(--ra-disc-ink);
	text-decoration: none;
}

.ra-read-next__content h3 a:hover {
	color: var(--ra-disc-accent);
}

.ra-read-next__content > p {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--ra-disc-muted);
	font-size: 0.9rem;
	line-height: 1.55;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.ra-read-next__controls {
	display: flex;
	flex: 0 0 auto;
	gap: 0.65rem;
}

.ra-read-next__button {
	display: inline-flex;
	width: 2.75rem;
	height: 2.75rem;
	align-items: center;
	justify-content: center;
	padding: 0;
	color: var(--ra-disc-ink);
	font-size: 1.15rem;
	line-height: 1;
	background: transparent;
	border: 1px solid var(--ra-disc-border);
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.ra-read-next__button:hover,
.ra-read-next__button:focus-visible {
	color: #fff;
	background: var(--ra-disc-accent);
	border-color: var(--ra-disc-accent);
}

.ra-read-next__button:focus-visible {
	outline: 3px solid var(--ra-disc-accent-soft);
	outline-offset: 2px;
}

.ra-read-next__button:disabled {
	cursor: default;
	opacity: 0.32;
}

@media (min-width: 1248px) {
	.single.ra-post-streamlined:not(.ra-book-single) .cs-sidebar__inner {
		position: relative;
		top: auto;
		column-count: auto;
	}

	.single.ra-post-streamlined:not(.ra-book-single) .ra-discovery--context {
		position: sticky;
		top: calc(var(--cs-header-height, 88px) + var(--cs-wpadminbar-height, 0px) + 1.5rem);
	}
}

.ra-discovery-block {
	margin-top: 2rem;
	margin-bottom: 2rem;
}

@media (max-width: 991px) {
	.ra-discovery--book-library {
		position: static;
		max-height: none;
		overflow: visible;
	}

	.ra-featured__media {
		min-height: 340px;
	}

	.ra-read-next__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ra-discovery--read-next.is-carousel .ra-read-next__grid {
		grid-template-columns: none;
		grid-auto-columns: calc((100% - var(--ra-reading-gap)) / 2);
	}

	.ra-discovery--read-next:not(.is-carousel) .ra-read-next__item:last-child {
		grid-column: 1 / -1;
		max-width: calc(50% - 0.75rem);
	}

	.ra-book-library__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0 1.5rem;
	}

	.ra-book-library__item:nth-child(2) {
		border-top: 0;
	}
}

@media (max-width: 767px) {
	.ra-discovery--related {
		padding: 1.15rem;
	}

	.ra-related__item {
		grid-template-columns: 132px minmax(0, 1fr);
		gap: 1rem;
	}

	.ra-related__content > p {
		display: none;
	}

	.ra-read-next__grid {
		grid-template-columns: 1fr;
	}

	.ra-discovery--read-next.is-carousel .ra-read-next__grid {
		grid-template-columns: none;
		grid-auto-columns: minmax(82%, 1fr);
	}

	.ra-discovery--read-next:not(.is-carousel) .ra-read-next__item:last-child {
		grid-column: auto;
		max-width: none;
	}

	.ra-book-library__list {
		grid-template-columns: 1fr;
	}

	.ra-book-library__item:nth-child(2) {
		border-top: 1px solid var(--ra-disc-border);
	}
}

@media (max-width: 560px) {
	.ra-read-next__header {
		align-items: flex-end;
	}

	.ra-read-next__button {
		width: 2.45rem;
		height: 2.45rem;
	}

	.ra-discovery--read-next.is-carousel .ra-read-next__grid {
		grid-auto-columns: 88%;
	}
}

@media (max-width: 420px) {
	.ra-related__item {
		grid-template-columns: 108px minmax(0, 1fr);
	}

	.ra-related__content h3 {
		font-size: 0.98rem;
	}

	.ra-related__content .ra-discovery__category {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ra-featured__image,
	.ra-featured__dots button,
	.ra-related__image,
	.ra-read-next__image,
	.ra-discovery--read-next.is-carousel .ra-read-next__viewport {
		transition: none;
		scroll-behavior: auto;
	}
}
