/* ==========================================================================
   Tarhee — blog.css
   Single post, post category page, post cards (vertical / horizontal / overlay),
   table of contents, related posts. Loaded only on those pages.
   ========================================================================== */

/* ---------- Single post ---------- */
.tarhee-post { max-width: 860px; margin-inline: auto; padding: 28px 0 24px; }
.tarhee-post__header { margin-bottom: 20px; }
.tarhee-post__cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.tarhee-post__cats a {
	display: inline-block;
	padding: 3px 14px;
	background: var(--gold-soft);
	border-radius: 999px;
	color: var(--gold-dark);
	font-size: .78rem;
	font-weight: var(--fw-strong);
	transition: background-color .2s, color .2s;
}
.tarhee-post__cats a:hover,
.tarhee-post__cats a:focus-visible { background: var(--gold); color: var(--navy); }
.tarhee-post__title { margin: 0 0 14px; font-size: 1.9rem; line-height: 1.6; }
.tarhee-post__meta { flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.tarhee-post__thumb { margin: 0 0 24px; box-shadow: var(--shadow); }
.tarhee-post__thumb img { display: block; width: 100%; height: auto; }
.tarhee-post__thumb figcaption { padding: 8px 14px; background: var(--card); font-size: .8rem; color: var(--muted); }

.tarhee-post__content { font-size: 1.04rem; line-height: 2; overflow-wrap: anywhere; }
.tarhee-post__content > * + * { margin-top: 1.2em; }
.tarhee-post__content :is(h2, h3, h4) { scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--header-h) + 16px); }
.tarhee-post__content h2 { padding-inline-start: 14px; border-inline-start: 4px solid var(--gold); font-size: 1.45rem; }
.tarhee-post__content h3 { font-size: 1.2rem; }
.tarhee-post__content img,
.tarhee-post__content video,
.tarhee-post__content iframe { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.tarhee-post__content figcaption { margin-top: 6px; font-size: .82rem; color: var(--muted); text-align: center; }
.tarhee-post__content table { display: block; max-width: 100%; overflow-x: auto; }
.tarhee-post__content pre { max-width: 100%; padding: 14px 16px; overflow-x: auto; background: var(--bg-2); border-radius: var(--radius-sm); direction: ltr; text-align: left; }

.tarhee-post__footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.tarhee-post__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tarhee-post__tags a {
	display: inline-block;
	padding: 4px 14px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: .82rem;
	transition: border-color .2s, background-color .2s;
}
.tarhee-post__tags a:hover,
.tarhee-post__tags a:focus-visible { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Share ---------- */
.tarhee-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin-top: 28px;
	padding: 14px 18px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.tarhee-share__title { font-size: .92rem; font-weight: var(--fw-heading); color: var(--navy); }
.tarhee-share__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tarhee-share__btn {
	display: inline-block;
	padding: 4px 14px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text);
	font: inherit;
	font-size: .82rem;
	font-weight: var(--fw-label);
	line-height: 1.8;
	cursor: pointer;
	transition: border-color .2s, background-color .2s;
}
.tarhee-share__btn:hover,
.tarhee-share__btn:focus-visible { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Table of contents ---------- */
.tarhee-toc {
	margin: 0 0 28px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}
.tarhee-toc details { padding: 0 20px; }
.tarhee-toc__title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 0;
	font-weight: var(--fw-heading);
	color: var(--navy);
	cursor: pointer;
	list-style: none;
}
.tarhee-toc__title::-webkit-details-marker { display: none; }
.tarhee-toc__title::after {
	content: '';
	flex: none;
	width: 8px;
	height: 8px;
	border: solid currentColor;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	transition: transform .2s;
}
.tarhee-toc details[open] > .tarhee-toc__title::after { transform: rotate(-135deg); }
.tarhee-toc details[open] > .tarhee-toc__title { border-bottom: 1px solid var(--border); }
.tarhee-toc ol { margin: 0; padding: 0; list-style: none; }
.tarhee-toc__list { padding: 12px 0 16px; counter-reset: toc; }
.tarhee-toc li { margin: 0; padding: 3px 0; line-height: 1.8; }
.tarhee-toc li > ol { margin-top: 3px; padding-inline-start: 22px; counter-reset: toc; }
.tarhee-toc a { color: var(--text); font-size: .94rem; transition: color .2s; }
.tarhee-toc a:hover,
.tarhee-toc a:focus-visible { color: var(--gold-dark); }
.tarhee-toc.has-numbers li { counter-increment: toc; }
.tarhee-toc.has-numbers li > a::before { content: counters(toc, '.') '. '; color: var(--gold-dark); font-weight: var(--fw-strong); }

/* ---------- Related posts ---------- */
.tarhee-related { margin: 24px 0 8px; }
.tarhee-related__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
	font-size: 1.35rem;
	font-weight: var(--fw-heading);
	color: var(--navy);
}
.tarhee-related__title::before {
	content: '';
	flex: none;
	width: 6px;
	height: 24px;
	border-radius: 3px;
	background: linear-gradient(180deg, var(--gold), var(--gold-light));
}

/* ---------- Previous / next ---------- */
.post-navigation { max-width: 860px; margin: 24px auto 0; }
.post-navigation .nav-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; justify-content: stretch; }
.post-navigation .nav-links > div { min-width: 0; }
.post-navigation a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	padding: 14px 18px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	transition: border-color .2s, background-color .2s;
}
.post-navigation a:hover,
.post-navigation a:focus-visible { border-color: var(--gold); background: var(--gold-soft); }
.post-navigation .nav-subtitle { font-size: .76rem; color: var(--muted); }
.post-navigation .nav-title { font-weight: var(--fw-strong); line-height: 1.6; }
.post-navigation .nav-next { text-align: end; }
.single .comments-area { max-width: 860px; margin-inline: auto; }

/* ---------- Post category page ---------- */
.tarhee-pcat { padding-block: 8px 24px; --pcols: 3; --pcols-t: 2; --pcols-m: 1; }
.tarhee-pcat__header { padding: 20px 0 8px; }
.tarhee-pcat__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 1.7rem;
	font-weight: var(--fw-heading);
	line-height: 1.5;
	color: var(--navy);
}
.tarhee-pcat__title::before {
	content: '';
	flex: none;
	width: 6px;
	height: 28px;
	border-radius: 3px;
	background: linear-gradient(180deg, var(--gold), var(--gold-light));
}
.tarhee-pcat__count { margin: 0 0 12px; font-size: .86rem; color: var(--muted); }
.tarhee-pcat__subcats ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.tarhee-pcat__subcats a {
	display: inline-block;
	padding: 6px 16px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: .86rem;
	font-weight: var(--fw-label);
	transition: border-color .2s, background-color .2s;
}
.tarhee-pcat__subcats a:hover,
.tarhee-pcat__subcats a:focus-visible { border-color: var(--gold); background: var(--gold-soft); }
.tarhee-pcat__desc {
	margin-top: 8px;
	padding: 20px 22px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	line-height: 1.9;
	overflow-wrap: anywhere;
}
.tarhee-pcat__desc > :first-child { margin-top: 0; }
.tarhee-pcat__desc > :last-child { margin-bottom: 0; }
.tarhee-pcat > .tarhee-pcat__desc { margin-top: 32px; }
/* Collapsible description (setting «حالت نمایش»): text limited in height + show more button. */
.tarhee-pcat__desc-body { position: relative; }
.tarhee-pcat__desc-body > :first-child { margin-top: 0; }
.tarhee-pcat__desc-body > :last-child { margin-bottom: 0; }
.tarhee-pcat__desc.is-collapsed .tarhee-pcat__desc-body { max-height: var(--pcat-desc-h, 140px); overflow: hidden; }
.tarhee-pcat__desc.is-collapsed .tarhee-pcat__desc-body::after {
	content: '';
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	height: 56px;
	background: linear-gradient(to bottom, transparent, var(--card));
	pointer-events: none;
}
.tarhee-pcat__desc-toggle {
	display: inline-flex;
	align-items: center;
	margin-top: 12px;
	padding: 8px 20px;
	background: var(--card);
	border: 1px solid var(--gold);
	border-radius: 999px;
	color: var(--gold-dark);
	font-size: .86rem;
	font-weight: var(--fw-strong);
	transition: background-color .2s, color .2s;
}
.tarhee-pcat__desc-toggle[hidden] { display: none; }
.tarhee-pcat__desc-toggle:hover,
.tarhee-pcat__desc-toggle:focus-visible { background: var(--gold); color: var(--navy); }

/* ---------- Post cards ---------- */
.tarhee-pgrid { display: grid; grid-template-columns: repeat(var(--pcols-m, 1), minmax(0, 1fr)); gap: 16px; padding: 20px 0 8px; }
.tarhee-related .tarhee-pgrid { padding-top: 0; --pcols-m: 1; --pcols-t: 2; }
.pcard {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.pcard:hover { transform: translateY(-5px); box-shadow: 0 20px 44px rgba(13, 26, 56, .14); }
.pcard__media { display: block; overflow: hidden; background: var(--bg-2); }
.pcard__media img { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .6s var(--ease); }
.pcard:hover .pcard__media img { transform: scale(1.06); }
.pcard__media--empty { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; color: var(--muted); }
.pcard__body { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 18px 18px; }
.pcard__cat {
	position: relative;
	z-index: 2;
	padding: 2px 12px;
	background: var(--gold-soft);
	border-radius: 999px;
	color: var(--gold-dark);
	font-size: .74rem;
	font-weight: var(--fw-strong);
}
.pcard__title { margin: 0; font-size: 1rem; font-weight: var(--fw-strong); line-height: 1.7; color: var(--navy); }
.pcard__title a:hover,
.pcard__title a:focus-visible { color: var(--gold-dark); }
.pcard__excerpt { margin: 0; font-size: .88rem; line-height: 1.8; color: var(--muted); }
.pcard__date { margin-top: auto; font-size: .76rem; color: var(--muted); }

/* Horizontal: image beside the text (right side in RTL). */
.tarhee-pgrid--horizontal { --pcols-m: 1; }
.pcard--horizontal { flex-direction: row; align-items: stretch; }
.pcard--horizontal:hover { transform: none; }
.pcard--horizontal .pcard__media { position: relative; flex: 0 0 38%; max-width: 240px; min-height: 120px; }
/* The image fills the media box (which is as tall as the card), so it never depends on a percentage height. */
.pcard--horizontal .pcard__media img { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
.pcard--horizontal .pcard__media--empty { aspect-ratio: auto; }
.pcard--horizontal:hover .pcard__media img { transform: none; }
.pcard--horizontal .pcard__body { min-width: 0; padding: 14px 16px; }
.pcard--horizontal .pcard__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Overlay: title over the image. */
.pcard--overlay { background: var(--navy); border: 0; }
.pcard--overlay .pcard__media { position: absolute; inset: 0; }
.pcard--overlay .pcard__media img,
.pcard--overlay .pcard__media--empty { height: 100%; aspect-ratio: auto; }
.pcard--overlay::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(13, 26, 56, .92) 0%, rgba(13, 26, 56, .08) 65%);
	pointer-events: none;
}
.pcard--overlay .pcard__body { position: relative; z-index: 2; justify-content: flex-end; min-height: 280px; padding: 18px; pointer-events: none; }
.pcard--overlay .pcard__title,
.pcard--overlay .pcard__date { color: #fff; }
.pcard--overlay .pcard__date { opacity: .8; }
.pcard--overlay .pcard__title a,
.pcard--overlay .pcard__cat { pointer-events: auto; }
.pcard--overlay .pcard__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.pcard--overlay .pcard__cat { background: var(--gold); color: var(--navy); }
.pcard--overlay .pcard__title a:hover,
.pcard--overlay .pcard__title a:focus-visible { color: var(--gold-light); }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
	.tarhee-pgrid { grid-template-columns: repeat(var(--pcols-t, 2), minmax(0, 1fr)); gap: 18px; }
	.tarhee-pgrid--horizontal { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1024px) {
	.tarhee-pgrid { grid-template-columns: repeat(var(--pcols, 3), minmax(0, 1fr)); gap: 20px; }
	.tarhee-pgrid--horizontal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tarhee-pcat__title { font-size: 1.9rem; }
}
@media (max-width: 640px) {
	.tarhee-post__title { font-size: 1.4rem; }
	.tarhee-post__content { font-size: 1rem; }
	.tarhee-post__content h2 { font-size: 1.25rem; }
	.post-navigation .nav-links { grid-template-columns: minmax(0, 1fr); }
	.pcard--horizontal .pcard__media { flex-basis: 34%; }
	.pcard--overlay .pcard__body { min-height: 220px; }
}
@media (max-width: 560px) {
	.tarhee-pcat__title { font-size: 1.35rem; }
	.tarhee-pcat__desc { padding: 16px; }
}
@media (hover: none) {
	.pcard:hover { transform: none; box-shadow: none; }
	.pcard:hover .pcard__media img { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.pcard,
	.pcard__media img,
	.tarhee-toc__title::after { transition: none; }
}
