/**
 * A post's page (single.php, inc/blog-post.php), after magnet-blog-home.css (its tokens, cards and products band).
 * The text sits in a 720px column with a sticky rail beside it from 1100px; below that the rail goes and the text's own
 * «آنچه در این مقاله می‌خوانید» box stays.
 */

/* Reading bar */
.mp-progress {
	position: fixed;
	inset: 0 0 auto;
	z-index: 1000;
	height: 3px;
	pointer-events: none;
}

.mp-progress span {
	display: block;
	height: 100%;
	background: linear-gradient(90deg, #60a5fa, #2563eb);
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.1s linear;
}

/* 1. Head -------------------------------------------------------------------------------------------------- */

.mp-head {
	max-width: 52rem;
	padding: 2rem 0 1.75rem;
}

.mp-crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
	color: #cbd5e1;
	font-size: 0.85rem;
}

.mp-crumbs a {
	color: var(--mb-muted) !important;
	font-weight: 600;
}

/* «خانه / دسته / نام مقاله», as small as the blog home's «خانه / بلاگ». */
.mp-crumbs__here {
	color: var(--mb-text);
}

.mp-crumbs a:hover {
	color: var(--mb-blue) !important;
}

.mp-title {
	margin: 0;
	color: var(--mb-ink);
	font-size: clamp(1.65rem, 1.2rem + 1.6vw, 2.6rem);
	font-weight: 800;
	line-height: 1.5;
}

.mp-lead {
	margin: 1rem 0 0;
	color: var(--mb-text);
	font-size: clamp(1rem, 0.95rem + 0.25vw, 1.15rem);
	line-height: 2;
}

.mp-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-top: 1.5rem;
	color: var(--mb-muted);
	font-size: 0.88rem;
}

/* The theme sets every <time> to 16px / 600; here it is the size of the line it is in. */
.mp-meta time {
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: inherit;
}

.mp-meta > * + *::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 4px;
	margin-inline-end: 1rem;
	border-radius: 50%;
	background: #cbd5e1;
	vertical-align: middle;
}

.mp-meta__author {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--mb-ink) !important;
	font-weight: 700;
}

.mp-meta__avatar {
	width: 2.5rem !important;
	height: 2.5rem !important;
	border-radius: 50%;
}

/* 2. Cover ------------------------------------------------------------------------------------------------- */

.mp-cover {
	margin: 0 0 2.75rem;
	overflow: hidden;
	border-radius: 24px;
	background: var(--mb-blue-soft);
	aspect-ratio: 16 / 9;
}

.mp-cover__img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
}

/* 3. Text and rail ----------------------------------------------------------------------------------------- */

.mp-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 3.5rem;
}

.mp-body {
	min-width: 0;
	max-width: 45rem;
}

.mp-content {
	color: var(--mb-text);
	font-size: 1.0625rem;
	line-height: 2.1;
}

.mp-content > * {
	margin-top: 0;
	margin-bottom: 1.4rem;
}

.mp-content h2,
.mp-content h3,
.mp-content h4 {
	color: var(--mb-ink);
	font-weight: 800;
	line-height: 1.6;
	scroll-margin-top: 6rem;
}

.mp-content h2 {
	margin: 2.75rem 0 1rem;
	font-size: clamp(1.3rem, 1.15rem + 0.5vw, 1.55rem);
}

.mp-content h3 {
	margin: 2.1rem 0 0.75rem;
	font-size: 1.2rem;
}

.mp-content h4 {
	margin: 1.75rem 0 0.6rem;
	font-size: 1.05rem;
}

.mp-content a:not(.wp-block-button__link) {
	color: var(--mb-blue) !important;
	text-decoration: underline;
	text-decoration-color: rgb(37 99 235 / 0.35);
	text-underline-offset: 0.3em;
	background: none !important;
}

.mp-content a:not(.wp-block-button__link):hover {
	text-decoration-color: currentColor;
}

.mp-content ul,
.mp-content ol {
	padding-inline-start: 1.4rem;
}

.mp-content li {
	margin-bottom: 0.5rem;
}

.mp-content li::marker {
	color: var(--mb-blue);
	font-weight: 700;
}

.mp-content img {
	max-width: 100%;
	height: auto;
	border-radius: 16px;
}

.mp-content figure {
	margin-inline: 0;
}

.mp-content figcaption {
	margin-top: 0.6rem;
	color: var(--mb-muted);
	font-size: 0.85rem;
	text-align: center;
}

/* «پرسش‌های متداول» (inc/faq-box.php): each question a closed box, its answer below it once opened. */
.mp-content .lw-faq {
	display: grid;
	gap: 0.75rem;
}

.mp-content .lw-faq__item {
	margin: 0;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 6px 18px -12px rgb(15 23 42 / 0.18);
}

.mp-content .lw-faq__q {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	color: var(--mb-ink);
	font-weight: 700;
	line-height: 1.8;
	list-style: none;
	cursor: pointer;
}

.mp-content .lw-faq__q::-webkit-details-marker {
	display: none;
}

.mp-content .lw-faq__q::after {
	content: "";
	flex: none;
	width: 0.55rem;
	height: 0.55rem;
	margin-inline-end: 0.25rem;
	border-right: 2px solid #64748b;
	border-bottom: 2px solid #64748b;
	transform: translateY(-25%) rotate(45deg);
	transition: transform 0.2s;
}

.mp-content .lw-faq__item[open] .lw-faq__q::after {
	transform: translateY(25%) rotate(-135deg);
}

.mp-content .lw-faq__q:focus-visible {
	outline: 2px solid var(--mb-blue);
	outline-offset: 2px;
	border-radius: 14px;
}

.mp-content .lw-faq__a {
	padding: 0 1.25rem 1rem;
}

.mp-content .lw-faq__a > * {
	margin: 0 0 0.75rem;
}

.mp-content .lw-faq__a > :last-child {
	margin-bottom: 0;
}

.mp-content blockquote {
	margin-inline: 0;
	padding: 1.25rem 1.5rem;
	border: 0;
	border-inline-start: 4px solid var(--mb-blue);
	border-radius: 0 14px 14px 0;
	background: var(--mb-blue-soft);
	color: var(--mb-ink);
	font-size: 1.05rem;
}

.mp-content blockquote p:last-child {
	margin-bottom: 0;
}

.mp-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.mp-content th,
.mp-content td {
	padding: 0.7rem 0.9rem;
	border: 1px solid #e2e8f0;
	text-align: start;
}

.mp-content thead th,
.mp-content thead td,
.mp-content table:not(:has(thead)) tr:first-child > * {
	background: #eef2ff;
	color: var(--mb-ink);
	font-weight: 700;
}

.mp-content tbody tr:nth-child(even) > *,
.mp-content table:not(:has(thead)) tr:nth-child(even):not(:first-child) > * {
	background: #f8fafc;
}

.mp-content .wp-block-table {
	overflow-x: auto;
}

.mp-content pre,
.mp-content code {
	direction: ltr;
	font-size: 0.9em;
}

.mp-content pre {
	overflow-x: auto;
	padding: 1rem 1.25rem;
	border-radius: 14px;
	background: #0f172a;
	color: #e2e8f0;
	text-align: left;
}

/* The text's own contents box, in this page's look */
.mp-content .magnet-toc-box {
	margin: 1.75rem 0 2rem;
	border: 1px solid var(--mb-line);
	border-radius: var(--mb-radius);
	background: #f8fafc;
}

.mp-content .magnet-toc-list a {
	color: var(--mb-text) !important;
	text-decoration: none;
}

/* The rail */
.mp-rail {
	display: none;
}

.mp-toc__title {
	margin: 0 0 0.75rem;
	color: var(--mb-ink);
	font-size: 0.95rem;
	font-weight: 800;
}

.mp-toc__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-inline-start: 2px solid var(--mb-line);
}

.mp-toc__list li {
	margin: 0;
}

.mp-toc__list a {
	display: block;
	margin-inline-start: -2px;
	padding: 0.4rem 0.9rem;
	border-inline-start: 2px solid transparent;
	color: var(--mb-muted) !important;
	font-size: 0.88rem;
	line-height: 1.7;
	transition: color 0.15s, border-color 0.15s;
}

.mp-toc__h3 a {
	padding-inline-start: 1.7rem;
	font-size: 0.82rem;
}

.mp-toc__list a:hover {
	color: var(--mb-ink) !important;
}

.mp-toc__list a.is-current {
	border-inline-start-color: var(--mb-blue);
	color: var(--mb-blue) !important;
	font-weight: 700;
}

/* Sharing */
.mp-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.mp-share__label {
	color: var(--mb-muted);
	font-size: 0.85rem;
	font-weight: 700;
}

.mp-share__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.mp-share__btn {
	display: inline-grid;
	place-items: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 1px solid var(--mb-line);
	border-radius: 50%;
	background: #fff;
	color: var(--mb-text) !important;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.mp-share__btn:hover {
	border-color: var(--mb-blue);
	color: var(--mb-blue) !important;
}

.mp-share__copy.is-done {
	border-color: #16a34a;
	background: #f0fdf4;
	color: #16a34a !important;
}

.mp-share--rail {
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--mb-line);
}

/* 4. After the text ---------------------------------------------------------------------------------------- */

.mp-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem;
	margin-top: 2.5rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--mb-line);
}

.mp-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.mp-tags a {
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	background: #f1f5f9;
	color: var(--mb-text) !important;
	font-size: 0.85rem;
	font-weight: 600;
}

.mp-tags a:hover {
	background: var(--mb-blue-soft);
	color: var(--mb-blue) !important;
}

.mp-author {
	display: flex;
	align-items: flex-start;
	gap: 1.25rem;
	margin-top: 2.5rem;
	padding: 1.5rem;
	border: 1px solid var(--mb-line);
	border-radius: var(--mb-radius);
	background: linear-gradient(135deg, #f8fafc, #eff6ff);
}

.mp-author__avatar {
	flex-shrink: 0;
	width: 4.5rem !important;
	height: 4.5rem !important;
	border-radius: 50%;
	box-shadow: 0 0 0 4px #fff;
}

.mp-author__text p {
	margin: 0;
}

.mp-author__kicker {
	color: var(--mb-blue);
	font-size: 0.8rem;
	font-weight: 700;
}

.mp-author__name {
	margin-top: 0.15rem !important;
	color: var(--mb-ink);
	font-size: 1.1rem;
	font-weight: 800;
}

.mp-author__bio {
	margin-top: 0.5rem !important;
	color: var(--mb-muted);
	font-size: 0.92rem;
	line-height: 1.9;
}

.mp-author__link {
	display: inline-block;
	margin-top: 0.75rem;
	color: var(--mb-blue) !important;
	font-size: 0.88rem;
	font-weight: 700;
}

.mp-body .lw-nl {
	margin-top: 2rem;
}

.mp-post .mb-latest {
	margin-top: 4rem;
	padding-top: 3rem;
	border-top: 1px solid var(--mb-line);
}

/* Comments: the theme's form and list in a quiet box */
.mp-comments {
	max-width: 45rem;
	margin-top: 4rem;
}

.mp-comments .cs-entry__comments,
.mp-comments #comments {
	margin: 0;
	padding: 0;
	border: 0;
}

.mp-comments .comment-respond {
	padding: 1.5rem;
	border: 1px solid var(--mb-line);
	border-radius: var(--mb-radius);
	background: #f8fafc;
}

.mp-comments textarea,
.mp-comments input[type='text'],
.mp-comments input[type='email'],
.mp-comments input[type='url'] {
	border: 1px solid var(--mb-line) !important;
	border-radius: 12px !important;
	background: #fff !important;
}

.mp-comments textarea:focus,
.mp-comments input:focus {
	border-color: var(--mb-blue) !important;
	outline: none;
	box-shadow: 0 0 0 4px rgb(37 99 235 / 0.12);
}

.mp-comments .submit,
.mp-comments input[type='submit'] {
	border-radius: 999px !important;
	background: var(--mb-blue) !important;
}

/* Wider screens -------------------------------------------------------------------------------------------- */

@media (min-width: 1100px) {
	.mp-layout {
		grid-template-columns: 17.5rem minmax(0, 1fr);
		gap: 3rem;
	}

	/* The rail is on the right; in the page's source the text still comes first. */
	.mp-rail {
		display: block;
		grid-row: 1;
		grid-column: 1;
	}

	.mp-body {
		grid-row: 1;
		grid-column: 2;
		max-width: none;
	}

	/* The theme caps the text at 800px; here it ends where the boxes under it do. */
	.mp-content {
		--cs-entry-content-medium-width: 100%;
	}

	.mp-rail__inner {
		position: sticky;
		top: 6.5rem;
		max-height: calc(100vh - 8rem);
		overflow-y: auto;
		scrollbar-width: thin;
	}

	/* The rail lists the headings, so the box inside the text goes. */
	.mp-has-toc .mp-content .magnet-toc-box {
		display: none;
	}

	.mp-share--foot .mp-share__label {
		display: none;
	}
}

@media (max-width: 639px) {
	.mp-head {
		padding-top: 1.25rem;
	}

	.mp-cover {
		margin-inline: -1rem;
		border-radius: 0;
	}

	.mp-content {
		font-size: 1rem;
		line-height: 2.05;
	}

	.mp-author {
		flex-direction: column;
		gap: 0.9rem;
	}

	.mp-foot {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* The cover is wide but not a whole screen tall on a desktop. */
@media (min-width: 900px) {
	.mp-cover {
		aspect-ratio: 2 / 1;
	}
}

/* The theme gives the comments area a grey slab; here it sits on the page. */
.mp-comments > *,
.mp-comments .cs-entry__comments-inner,
.mp-comments .comments-area {
	padding: 0 !important;
	background: none !important;
}

.mp-comments .comment-list {
	margin: 0 0 2rem;
	padding: 0;
}

.mp-comments .comment-body {
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--mb-line);
}

.mp-comments .comment-reply-link {
	border: 1px solid var(--mb-line) !important;
	background: #fff !important;
	color: var(--mb-blue) !important;
}

.mp-comments .comment-reply-link:hover {
	border-color: var(--mb-blue) !important;
}
