.mbpt-post-layout {
	--mbpt-blue: #2878e5;
	--mbpt-ink: #172235;
	--mbpt-muted: #536174;
	--mbpt-line: rgba(40, 120, 229, 0.3);

	width: min(100% - 2rem, 1160px);
	margin: clamp(2rem, 6vw, 5rem) auto;
	color: var(--mbpt-ink);
}

.mbpt-post-layout__image {
	overflow: hidden;
	width: min(100%, 840px);
	margin: 0 auto clamp(1.25rem, 3vw, 2rem);
	border-radius: 16px;
	background: #edf3fb;
	box-shadow: 0 16px 42px rgba(23, 34, 53, 0.1);
}

.mbpt-post-layout__image-element {
	display: block;
	width: 100%;
	height: auto;
	max-height: 540px;
	object-fit: cover;
}

.mbpt-post-layout__card {
	padding: clamp(1.5rem, 5vw, 3.5rem);
	border: 1px solid var(--mbpt-line);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 12px 36px rgba(23, 34, 53, 0.045);
}

.mbpt-post-layout__reading {
	width: min(100%, 840px);
	margin: 0 auto;
}

.mbpt-post-layout__reading--with-toc {
	display: grid;
	width: min(100%, 1120px);
	grid-template-columns: minmax(170px, 220px) minmax(0, 840px);
	gap: clamp(1.25rem, 3vw, 2.5rem);
	align-items: start;
}

.mbpt-post-layout__toc {
	position: sticky;
	top: 2rem;
	margin-top: 0.55rem;
	padding: 0.25rem 0 0.25rem 1rem;
	border-left: 2px solid var(--mbpt-line);
}

.mbpt-post-layout__toc-heading {
	margin: 0 0 0.75rem;
	color: var(--mbpt-ink);
	font-size: 0.8rem;
	font-weight: 750;
	letter-spacing: 0.02em;
}

.mbpt-post-layout__toc-list {
	display: grid;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: mbpt-toc;
}

.mbpt-post-layout__toc-item {
	margin: 0;
	padding: 0;
	counter-increment: mbpt-toc;
}

.mbpt-post-layout__toc-item a {
	display: grid;
	grid-template-columns: 1.7rem minmax(0, 1fr);
	gap: 0.4rem;
	align-items: start;
	padding: 0.55rem 0.5rem;
	border-radius: 9px;
	color: var(--mbpt-muted);
	font-size: 0.86rem;
	line-height: 1.45;
	text-decoration: none;
	transition: background-color 160ms ease, color 160ms ease;
}

.mbpt-post-layout__toc-item a::before {
	content: counter(mbpt-toc, decimal-leading-zero);
	padding-top: 0.08rem;
	color: #7896bf;
	font-size: 0.7rem;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}

.mbpt-post-layout__toc-item--level-3 {
	padding-left: 0.55rem;
}

.mbpt-post-layout__toc-item--level-4 {
	padding-left: 1.1rem;
}

.mbpt-post-layout__toc-item a:hover,
.mbpt-post-layout__toc-item a:focus-visible {
	background: #edf5ff;
	color: #1766cf;
}

.mbpt-post-layout__toc-item a:focus-visible {
	outline: 2px solid #1766cf;
	outline-offset: 2px;
}

.mbpt-post-layout__title {
	margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
	color: var(--mbpt-ink);
	font-size: clamp(2rem, 5vw, 3.5rem);
	font-weight: 750;
	letter-spacing: -0.045em;
	line-height: 1.08;
	text-wrap: balance;
}

.mbpt-post-layout__content {
	color: var(--mbpt-muted);
	font-size: clamp(1rem, 1.5vw, 1.125rem);
	line-height: 1.8;
	overflow-wrap: anywhere;
}

.mbpt-post-layout__content > :first-child {
	margin-top: 0;
}

.mbpt-post-layout__content > :last-child {
	margin-bottom: 0;
}

.mbpt-post-layout__content h2,
.mbpt-post-layout__content h3,
.mbpt-post-layout__content h4 {
	margin-top: 2em;
	margin-bottom: 0.65em;
	color: var(--mbpt-ink);
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.25;
	scroll-margin-top: 2rem;
}

.mbpt-post-layout__content h2 {
	font-size: clamp(1.5rem, 3vw, 2rem);
}

.mbpt-post-layout__content h3 {
	font-size: clamp(1.25rem, 2.5vw, 1.55rem);
}

.mbpt-post-layout__content p,
.mbpt-post-layout__content ul,
.mbpt-post-layout__content ol,
.mbpt-post-layout__content blockquote {
	margin-top: 0;
	margin-bottom: 1.4em;
}

.mbpt-post-layout__content a {
	color: #1766cf;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.mbpt-post-layout__content a:hover {
	color: #104b9b;
}

.mbpt-post-layout__content blockquote {
	padding: 0.25rem 0 0.25rem 1.25rem;
	border-left: 3px solid var(--mbpt-blue);
	color: var(--mbpt-ink);
}

.mbpt-post-layout__content img,
.mbpt-post-layout__content video {
	max-width: 100%;
	height: auto;
	border-radius: 10px;
}

.mbpt-post-layout__content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
}

.mbpt-post-layout__content th,
.mbpt-post-layout__content td {
	padding: 0.65rem 0.8rem;
	border: 1px solid #dce5f0;
	text-align: left;
}

.mbpt-post-layout__content pre {
	max-width: 100%;
	overflow-x: auto;
	padding: 1rem 1.2rem;
	border-radius: 10px;
	background: #f2f6fc;
	font-size: 0.9em;
	line-height: 1.6;
}

.mbpt-post-layout__content .wp-block-image,
.mbpt-post-layout__content .wp-block-gallery,
.mbpt-post-layout__content .wp-block-embed {
	margin-top: 2rem;
	margin-bottom: 2rem;
}

.mbpt-post-grid {
	--mbpt-grid-blue: rgba(40, 120, 229, 0.3);
	--mbpt-grid-ink: #172235;
	--mbpt-grid-muted: #536174;

	width: min(100%, 1120px);
	margin: clamp(2rem, 5vw, 4rem) auto;
}

.mbpt-post-grid__items {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-auto-rows: 1fr;
	gap: clamp(1rem, 2vw, 1.5rem);
	align-items: stretch;
}

.mbpt-post-grid__card {
	display: flex;
	min-width: 0;
	min-height: 380px;
	height: 100%;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--mbpt-grid-blue);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 10px 28px rgba(23, 34, 53, 0.05);
	transition: transform 180ms ease, box-shadow 180ms ease;
}

.mbpt-post-grid__card:hover {
	transform: translateY(-3px);
	box-shadow: 0 16px 36px rgba(23, 34, 53, 0.11);
}

.mbpt-post-grid__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	background: #edf3fb;
}

.mbpt-post-grid__image,
.mbpt-post-grid__image-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 250ms ease;
}

.mbpt-post-grid__card:hover .mbpt-post-grid__image {
	transform: scale(1.035);
}

.mbpt-post-grid__image-placeholder {
	background: linear-gradient(135deg, #edf3fb, #d9e8fa);
}

.mbpt-post-grid__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	padding: 1.2rem;
}

.mbpt-post-grid__title {
	display: -webkit-box;
	min-height: 2.75em;
	overflow: hidden;
	margin: 0 0 0.65rem;
	color: var(--mbpt-grid-ink);
	font-size: 1.15rem;
	font-weight: 720;
	line-height: 1.35;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.mbpt-post-grid__title a {
	color: inherit;
	text-decoration: none;
}

.mbpt-post-grid__title a:hover,
.mbpt-post-grid__title a:focus-visible {
	color: #1766cf;
}

.mbpt-post-grid__excerpt {
	display: -webkit-box;
	min-height: 4.8em;
	overflow: hidden;
	margin: 0 0 1rem;
	color: var(--mbpt-grid-muted);
	font-size: 0.94rem;
	line-height: 1.6;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.mbpt-post-grid__read-more {
	margin-top: auto;
	color: #1766cf;
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none;
}

.mbpt-post-grid__read-more:hover,
.mbpt-post-grid__read-more:focus-visible {
	color: #104b9b;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.mbpt-post-grid__empty {
	width: min(100% - 2rem, 1120px);
	margin: 2rem auto;
	padding: 1rem 1.25rem;
	border: 1px solid var(--mbpt-grid-blue);
	border-radius: 12px;
	color: var(--mbpt-grid-muted);
}

@media (prefers-reduced-motion: reduce) {
	.mbpt-post-grid__card,
	.mbpt-post-grid__image {
		transition: none;
	}
}

@media (max-width: 900px) {
	.mbpt-post-grid__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.mbpt-post-layout__reading--with-toc {
		grid-template-columns: minmax(155px, 190px) minmax(0, 1fr);
		gap: 1.25rem;
	}
}

@media (max-width: 760px) {
	.mbpt-post-layout {
		width: min(100% - 1.25rem, 1160px);
	}

	.mbpt-post-layout__reading--with-toc {
		grid-template-columns: minmax(0, 1fr);
		gap: 1rem;
	}

	.mbpt-post-layout__toc {
		position: static;
		margin: 0;
		padding: 1rem;
		border: 1px solid var(--mbpt-line);
		border-left: 3px solid var(--mbpt-blue);
		border-radius: 14px;
		background: linear-gradient(145deg, #f6faff, #fff);
		box-shadow: 0 8px 24px rgba(23, 34, 53, 0.045);
	}

	.mbpt-post-layout__toc-heading {
		margin-bottom: 0.65rem;
		font-size: 0.92rem;
	}

	.mbpt-post-layout__toc-list {
		max-height: 220px;
		gap: 0.15rem;
		overflow-y: auto;
		padding-right: 0.25rem;
		scrollbar-width: thin;
	}

	.mbpt-post-layout__toc-item a {
		padding: 0.55rem 0.4rem;
		font-size: 0.85rem;
	}

	.mbpt-post-layout__image,
	.mbpt-post-layout__card {
		border-radius: 12px;
	}
}

@media (max-width: 600px) {
	.mbpt-post-grid__items {
		grid-template-columns: minmax(0, 1fr);
	}

	.mbpt-post-grid__card {
		min-height: 0;
	}
}
