.rpal-layout {
	--rpal-accent-color: #1264a3;
	--rpal-active-bg: #e4f1f9;
	--rpal-active-text: #0b4f80;
	--rpal-active-border: #1264a3;
	--rpal-left-width: 240px;
	--rpal-right-width: 280px;
	display: grid;
	grid-template-columns: minmax(0, var(--rpal-left-width)) minmax(0, 1fr) minmax(0, var(--rpal-right-width));
	column-gap: var(--rpal-column-gap, 28px);
	row-gap: 24px;
	align-items: start;
	width: 100%;
	box-sizing: border-box;
}

.rpal-layout *,
.rpal-layout *::before,
.rpal-layout *::after {
	box-sizing: border-box;
}

.rpal-sidebar {
	position: sticky;
	top: 24px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 16px;
	border: 1px solid #e2e5e9;
	background: #fff;
	color: #25313c;
}

.rpal-sidebar-title {
	margin: 0 0 12px;
	font-size: 16px;
	line-height: 1.4;
}

.rpal-panel-title {
	text-align: center;
}

.rpal-series-list,
.rpal-toc-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rpal-series-item,
.rpal-toc-item {
	margin: 0;
	padding: 0;
}

.rpal-series-item a,
.rpal-toc-item a {
	display: block;
	padding: 7px 8px;
	color: inherit;
	font-size: 14px;
	line-height: 1.5;
	text-decoration: none;
	border-left: 3px solid transparent;
	border-radius: 4px;
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.rpal-series-item a:hover,
.rpal-toc-item a:hover,
.rpal-toc-item a:focus-visible,
.rpal-series-item a:focus-visible {
	color: var(--rpal-accent-color);
	background: #f1f6fa;
	outline: 2px solid var(--rpal-accent-color);
	outline-offset: 1px;
}

.rpal-series-item.rpal-is-current a,
.rpal-toc-item.rpal-is-active a {
	color: var(--rpal-active-text);
	font-weight: 600;
	background: var(--rpal-active-bg);
	border-left-color: var(--rpal-active-border);
	box-shadow: 0 1px 2px rgba(18, 100, 163, 0.12);
}

.rpal-recommend-list {
	display: grid;
	gap: 8px;
}

.rpal-recommend-card {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) 24px;
	gap: 8px;
	align-items: center;
	min-width: 0;
	padding: 8px;
	border: 1px solid #e2e5e9;
	border-radius: 10px;
	background: #fff;
	color: inherit;
	text-decoration: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.rpal-recommend-card:hover {
	border-color: #b8c9d6;
	box-shadow: 0 2px 8px rgba(37, 49, 60, 0.08);
	transform: translateY(-1px);
}

.rpal-recommend-card:focus-visible {
	outline: 2px solid #1264a3;
	outline-offset: 2px;
}

.rpal-recommend-card__media {
	display: block;
	width: 52px;
	height: 52px;
	overflow: hidden;
	border-radius: 7px;
	background: #eef2f5;
}

.rpal-recommend-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rpal-recommend-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: #eef2f5;
}

.rpal-recommend-card__label {
	display: -webkit-box;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	line-height: 1.4;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.rpal-recommend-card__arrow {
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #eef5f9;
	color: #1264a3;
	font-size: 16px;
	line-height: 1;
}

.rpal-toc-level-3 a {
	padding-left: 22px;
	font-size: 13px;
}

.rpal-content {
	min-width: 0;
}

.rpal-article-title {
	margin: 0 0 14px;
	font-size: clamp(1.75rem, 3vw, 2.35rem);
	line-height: 1.25;
	color: inherit;
}

.rpal-title-divider {
	width: 100%;
	height: 3px;
	margin: 0 0 24px;
	background: var(--rpal-accent-color);
	opacity: 0.85;
}

.rpal-article-content {
	min-width: 0;
}

.rpal-article-content h2,
.rpal-article-content h3 {
	/* RiPro-V5 uses a fixed/sticky header of about 60-80px. */
	scroll-margin-top: 96px;
}

.rpal-empty {
	margin: 0;
	color: #697681;
	font-size: 13px;
}

.rpal-mobile-controls {
	display: none;
}

/* RiPro-V5 keeps its own sidebar beside the content column. Collapse that
 * outer column only when this plugin has activated the article layout. */
body.rpal-layout-active .content-wrapper.col-lg-9 {
	width: 100%;
	max-width: 100%;
	flex: 0 0 100%;
	min-width: 0;
}

body.rpal-layout-active .sidebar-wrapper.col-lg-3 {
	display: none !important;
}

@media (max-width: 1024px) {
	.rpal-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.rpal-sidebar {
		position: static;
		max-height: none;
	}

	.rpal-sidebar-left,
	.rpal-sidebar-right {
		display: none;
	}

	.rpal-layout.rpal-nav-open-left .rpal-sidebar-left,
	.rpal-layout.rpal-nav-open-right .rpal-sidebar-right {
		display: block;
	}

	.rpal-mobile-controls {
		display: flex;
		gap: 8px;
		grid-row: 1;
	}

	.rpal-toggle {
		padding: 8px 12px;
		border: 1px solid #c8d0d7;
		border-radius: 4px;
		background: #fff;
		color: #25313c;
		cursor: pointer;
	}

	.rpal-toggle[aria-expanded="true"] {
		background: #eef5f9;
		border-color: #1264a3;
	}
}

@media (max-width: 767px) {
	.rpal-layout {
		gap: 12px;
	}

	.rpal-mobile-controls {
		position: sticky;
		top: 0;
		z-index: 2;
		padding: 8px 0;
		background: inherit;
	}

	.rpal-toggle {
		flex: 1;
		font-size: 13px;
	}

	.rpal-title-divider {
		height: 2px;
		margin-bottom: 18px;
	}
}
