/**
 * Articles.
 *
 * The single most important rule in this file is the measure: a line of Persian
 * prose wants roughly 65–75 characters. Wider than that and the eye loses the
 * start of the next line on the way back, which is exactly what an unstyled
 * full-width post does and exactly why it feels unreadable rather than merely
 * plain.
 *
 * Everything else here follows from that one decision.
 */

.mim-reading {
	--mim-read-ink: #25334E;
	--mim-read-muted: rgba(37, 51, 78, 0.6);
	--mim-read-line: #E4DFD5;
	--mim-read-cream: #F3EFE7;
	--mim-read-accent: #0466C8;
	--mim-read-measure: 44rem;
}

/* The theme's own column, whatever it calls it. Several names because this has
   to work without shipping a template per theme. */
.mim-reading .entry-content,
.mim-reading .post-content,
.mim-reading .site-main > article,
.mim-reading .mim-post {
	max-width: var(--mim-read-measure);
	margin-inline: auto;
}

.mim-reading .entry-header,
.mim-reading .entry-title,
.mim-reading .post-title {
	max-width: var(--mim-read-measure);
	margin-inline: auto;
}

.mim-reading .entry-title,
.mim-reading .post-title {
	font-size: clamp(26px, 5vw, 40px);
	font-weight: 800;
	line-height: 1.45;
	color: var(--mim-read-ink);
}

/* The cover is a cover — full bleed of the measure, not a thumbnail. */
.mim-reading .post-thumbnail img,
.mim-reading .wp-post-image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 460px;
	object-fit: cover;
	border-radius: 20px;
}

/* ═══════════════════════════════════════════════════════════
   The body
   ═══════════════════════════════════════════════════════════ */

.mim-post {
	font-family: var(--mim-font, inherit);
	color: var(--mim-read-ink);
}

.mim-post__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 22px;
	font-size: 13px;
	color: var(--mim-read-muted);
}

.mim-post__body {
	font-size: clamp(16px, 2.4vw, 17.5px);
	line-height: 2.15;
}

.mim-post__body > * + * {
	margin-block-start: 1.25em;
}

.mim-post__body h2 {
	margin-block-start: 2em;
	font-size: clamp(21px, 3.6vw, 27px);
	font-weight: 800;
	line-height: 1.55;
}

.mim-post__body h3 {
	margin-block-start: 1.7em;
	font-size: clamp(18px, 3vw, 21px);
	font-weight: 700;
	line-height: 1.6;
}

/* A rule above each section, so the structure is visible while scrolling
   rather than only while reading. */
.mim-post__body h2::before {
	content: '';
	display: block;
	width: 44px;
	height: 3px;
	margin-bottom: 14px;
	background: var(--mim-read-accent);
	border-radius: 3px;
}

.mim-post__body p {
	margin-block: 0;
}

.mim-post__body a {
	color: var(--mim-read-accent);
	text-underline-offset: 4px;
	text-decoration-thickness: 1px;
}

.mim-post__body ul,
.mim-post__body ol {
	padding-inline-start: 1.4em;
}

.mim-post__body li + li {
	margin-block-start: 0.5em;
}

.mim-post__body img {
	max-width: 100%;
	height: auto;
	border-radius: 16px;
}

.mim-post__body blockquote {
	margin-inline: 0;
	padding: 16px 20px;
	background: var(--mim-read-cream);
	border-inline-start: 4px solid var(--mim-read-accent);
	border-radius: 0 14px 14px 0;
	font-size: 0.97em;
}

[dir='ltr'] .mim-post__body blockquote {
	border-radius: 14px 0 0 14px;
}

/* Wide content scrolls inside itself; the page never scrolls sideways. */
.mim-post__body table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.94em;
}

.mim-post__body th,
.mim-post__body td {
	padding: 10px 12px;
	border: 1px solid var(--mim-read-line);
	text-align: start;
}

.mim-post__body th {
	background: var(--mim-read-cream);
	font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   The end of the article
   ═══════════════════════════════════════════════════════════ */

.mim-post__end {
	margin-block-start: 48px;
}

.mim-post__cta {
	padding: 26px;
	background: var(--mim-read-ink);
	border-radius: 22px;
	color: var(--mim-read-cream);
	text-align: center;
}

.mim-post__cta-title {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 800;
}

.mim-post__cta-text {
	margin: 0 0 18px;
	font-size: 14px;
	opacity: 0.78;
}

.mim-post__cta-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.mim-post__btn {
	display: inline-flex;
	align-items: center;
	padding: 11px 22px;
	background: var(--mim-read-cream);
	border: 1.5px solid var(--mim-read-cream);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	color: var(--mim-read-ink);
	text-decoration: none;
}

.mim-post__btn--ghost {
	background: transparent;
	color: var(--mim-read-cream);
}

.mim-post__btn:hover {
	opacity: 0.9;
}

/* ── Related ── */

.mim-post__related {
	margin-block-start: 40px;
}

.mim-post__related-title {
	margin: 0 0 16px;
	font-size: 19px;
	font-weight: 800;
}

.mim-post__related-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

.mim-post__card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-decoration: none;
	color: var(--mim-read-ink);
}

.mim-post__card-media {
	display: block;
	overflow: hidden;
	border-radius: 16px;
	line-height: 0;
}

.mim-post__card-media img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.mim-post__card:hover .mim-post__card-media img {
	transform: scale(1.04);
}

.mim-post__card-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.7;
}

@media (max-width: 560px) {
	.mim-post__related-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.mim-post__cta {
		padding: 22px 18px;
	}

	.mim-post__btn {
		flex: 1 1 100%;
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mim-post__card-media img {
		transition: none;
	}

	.mim-post__card:hover .mim-post__card-media img {
		transform: none;
	}
}
