.cmsb-sidebar {
	min-width: 0;
}

.cmsb-sidebar-inner {
	display: grid;
	gap: 20px;
}

.cmsb-sidebar--sticky .cmsb-sidebar-inner {
	position: sticky;
	top: 24px;
}

.cm-sticky-header .cmsb-sidebar--sticky .cmsb-sidebar-inner {
	top: 96px;
}

.admin-bar.cm-sticky-header .cmsb-sidebar--sticky .cmsb-sidebar-inner {
	top: 128px;
}

.cmsb-section,
.cmsb-widget {
	overflow: hidden;
	background: var(--cm-surface);
	border: 1px solid var(--cm-line);
	border-radius: var(--cm-radius);
	box-shadow: var(--cm-shadow);
}

.cmsb-section::before {
	display: block;
	height: 3px;
	content: "";
	background: var(--cm-grass);
}

.cmsb-section--recent::before {
	background: var(--cm-wood);
}

.cmsb-section-title,
.cmsb-widget-title {
	margin: 0;
	padding: 14px 15px 12px;
	border-bottom: 1px solid var(--cm-line);
	font-size: 17px;
	letter-spacing: -.02em;
	line-height: 1.2;
}

.cmsb-list {
	display: grid;
}

.cmsb-item {
	display: grid;
	grid-template-columns: 86px minmax(0, 1fr);
	gap: 11px;
	padding: 13px 14px;
}

.cmsb-item + .cmsb-item {
	border-top: 1px solid var(--cm-line);
}

.cmsb-thumbnail {
	display: block;
	overflow: hidden;
	align-self: start;
	aspect-ratio: 16 / 9;
	background: var(--cm-surface-soft);
	border: 1px solid var(--cm-line);
	border-radius: 3px;
}

.cmsb-thumbnail img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .18s ease;
}

.cmsb-item:hover .cmsb-thumbnail img {
	transform: scale(1.025);
}

.cmsb-thumbnail-placeholder {
	display: grid;
	width: 100%;
	height: 100%;
	place-items: center;
	color: var(--cm-muted);
	background:
		linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px),
		linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
		#d9ded6;
	background-size: 12px 12px;
	font-size: 11px;
	font-weight: 800;
}

.cmsb-item-body {
	min-width: 0;
}

.cmsb-item-title {
	display: -webkit-box;
	overflow: hidden;
	margin: -2px 0 6px;
	font-size: 14px;
	letter-spacing: -.015em;
	line-height: 1.28;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.cmsb-item-title a {
	color: var(--cm-ink);
	text-decoration: none;
}

.cmsb-item-title a:hover,
.cmsb-item-title a:focus-visible {
	color: var(--cm-grass-dark);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cmsb-badges {
	display: flex;
	overflow: hidden;
	flex-wrap: nowrap;
	gap: 4px;
	margin-bottom: 5px;
}

.cmsb-badges:empty {
	display: none;
}

.cmsb-badges .cm-badge {
	min-height: 18px;
	padding: 2px 5px;
	font-size: 8px;
	white-space: nowrap;
}

.cmsb-date {
	display: block;
	color: var(--cm-muted);
	font-size: 10px;
	line-height: 1.25;
}

.cmsb-ad {
	min-width: 0;
}

.cmsb-widget {
	padding: 15px;
}

.cmsb-widget-title {
	margin: -15px -15px 15px;
}

.cmsb-widget > :first-child:not(.cmsb-widget-title) {
	margin-top: 0;
}

.cmsb-widget > :last-child {
	margin-bottom: 0;
}

/* The main column becomes narrower only when the plugin actually owns the slot. */
.cm-layout:not(.cm-layout--wide) > div > .cm-post-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1020px) {
	.cmsb-item {
		grid-template-columns: 76px minmax(0, 1fr);
		gap: 9px;
		padding-inline: 12px;
	}

	.cmsb-section-title {
		padding-inline: 13px;
	}
}

@media (max-width: 860px) {
	.cmsb-sidebar--sticky .cmsb-sidebar-inner,
	.cm-sticky-header .cmsb-sidebar--sticky .cmsb-sidebar-inner {
		position: static;
	}

	.cmsb-sidebar-inner {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.cmsb-ad {
		grid-column: 1 / -1;
	}
}

@media screen and (max-width: 782px) {
	.admin-bar.cm-sticky-header .cmsb-sidebar--sticky .cmsb-sidebar-inner {
		top: 142px;
	}
}

@media (max-width: 620px) {
	.cmsb-sidebar-inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.cmsb-item {
		grid-template-columns: 92px minmax(0, 1fr);
		padding: 13px;
	}

	.cm-layout:not(.cm-layout--wide) > div > .cm-post-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cmsb-thumbnail img {
		transition: none;
	}
}
