/*
Theme Name: b4
Description: پوسته مجله‌ای ساده و سبک برای وردپرس فارسی؛ راست‌چین، با فونت وزیرمتن، حالت شب و روز، اسلایدر مطالب تازه و ردیف‌های دسته‌بندی.
Version: 1.0.0
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: b4
Tags: blog, news, rtl-language-support, custom-logo, custom-menu, featured-images, threaded-comments
*/

/* ==========================================================================
   فونت
   ========================================================================== */
@font-face {
	font-family: "Vazirmatn";
	src: url("assets/fonts/Vazirmatn-Variable.woff2") format("woff2-variations"),
		url("assets/fonts/Vazirmatn-Variable.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

/* ==========================================================================
   متغیرها: روز و شب
   ========================================================================== */
:root {
	--accent: #e63946;
	--accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
	--on-accent: #fff;

	--bg: #ffffff;
	--surface: #ffffff;
	--surface-2: #f3f4f6;
	--text: #14161a;
	--text-soft: #3d424b;
	--muted: #6b7280;
	--border: #e6e8ec;
	--shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 6px 20px rgb(16 24 40 / 6%);
	--shadow-lg: 0 16px 48px rgb(16 24 40 / 16%);
	--backdrop: rgb(10 12 16 / 50%);

	--font: "Vazirmatn", Tahoma, system-ui, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--radius: 16px;
	--radius-sm: 10px;
	--container: 1240px;
	--narrow: 760px;
	--gutter: 20px;
	--header-h: 68px;
	--ease: cubic-bezier(.2, .7, .2, 1);

	color-scheme: light;
}

:root[data-theme="dark"] {
	--accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
	--bg: #0d0f13;
	--surface: #15181e;
	--surface-2: #1c2028;
	--text: #eceef2;
	--text-soft: #c3c8d1;
	--muted: #8c94a2;
	--border: #262b34;
	--shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
	--shadow-lg: 0 16px 48px rgb(0 0 0 / 55%);
	--backdrop: rgb(0 0 0 / 60%);

	color-scheme: dark;
}

/* ==========================================================================
   پایه
   ========================================================================== */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
	margin: 0;
	font-family: var(--font);
	font-size: 1rem;
	line-height: 1.85;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	transition: background-color .25s ease, color .25s ease;
}

body.no-scroll {
	overflow: hidden;
}

img,
svg,
video {
	max-width: 100%;
	height: auto;
}

img {
	display: block;
}

a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	color: var(--accent);
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 .6em;
	line-height: 1.5;
	font-weight: 800;
	color: var(--text);
}

p {
	margin: 0 0 1em;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

::selection {
	background: var(--accent);
	color: var(--on-accent);
}

.site {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow-x: clip;
}

.site-main {
	flex: 1;
	padding-bottom: 64px;
}

.container {
	width: 100%;
	max-width: calc(var(--container) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container.narrow {
	max-width: calc(var(--narrow) + var(--gutter) * 2);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed !important;
	top: 12px;
	inset-inline-start: 12px;
	z-index: 9999;
	width: auto;
	height: auto;
	clip: auto;
	padding: 10px 16px;
	margin: 0;
	background: var(--accent);
	color: var(--on-accent);
	border-radius: var(--radius-sm);
}

.b4-icon {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

html:not([dir="rtl"]) .b4-icon--dir {
	transform: scaleX(-1);
}

.btn,
.comment-form .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 26px;
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: 700;
	transition: transform .15s ease, filter .15s ease;
}

.btn:hover,
.comment-form .submit:hover {
	color: var(--on-accent);
	filter: brightness(1.08);
}

.btn:active,
.comment-form .submit:active {
	transform: scale(.97);
}

.badge {
	position: relative;
	z-index: 2;
	display: inline-block;
	padding: 3px 12px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: .78rem;
	font-weight: 700;
	line-height: 1.8;
	transition: background-color .2s ease, color .2s ease;
}

.badge:hover {
	background: var(--accent);
	color: var(--on-accent);
}

.meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	font-size: .8rem;
	color: var(--muted);
}

.meta-sep {
	opacity: .6;
}

/* لینک کشیده: کل کارت قابل کلیک، بدون تودرتو شدن پیوندها */
.stretched-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.thumb-placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background:
		radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%),
		var(--surface-2);
	color: var(--muted);
}

.thumb-placeholder .b4-icon {
	width: 32px;
	height: 32px;
	opacity: .5;
}

/* ==========================================================================
   سربرگ
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	backdrop-filter: saturate(180%) blur(14px);
	border-bottom: 1px solid var(--border);
}

.admin-bar .site-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}

@media (max-width: 600px) {
	.admin-bar .site-header {
		top: 0;
	}
}

.header-inner {
	display: flex;
	align-items: center;
	gap: 28px;
	height: var(--header-h);
}

.site-branding {
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

.site-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
}

.site-brand:hover {
	color: var(--text);
}

.site-icon {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	object-fit: cover;
}

.site-title {
	font-size: 1.35rem;
	font-weight: 900;
	letter-spacing: -.01em;
	line-height: 1.4;
	white-space: nowrap;
}

.drawer-title .site-title {
	font-size: 1.1rem;
}

.drawer-title .site-icon {
	width: 30px;
	height: 30px;
}

.drawer-title .custom-logo {
	max-height: 36px;
}

.custom-logo {
	width: auto;
	max-height: 44px;
}

.logo-dark {
	display: none;
}

[data-theme="dark"] .has-dark-logo .logo-light {
	display: none;
}

[data-theme="dark"] .logo-dark {
	display: block;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	margin-inline-start: auto;
}

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--text);
	transition: background-color .2s ease, color .2s ease;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
	background: var(--surface-2);
	color: var(--accent);
}

/* آیکون دکمه حالت نمایش */
.mode-toggle .b4-icon {
	display: none;
}

[data-mode="system"] .mode-toggle .b4-icon--system,
[data-mode="light"] .mode-toggle .b4-icon--sun,
[data-mode="dark"] .mode-toggle .b4-icon--moon {
	display: block;
}

.mode-switch {
	position: relative;
}

.mode-menu {
	position: absolute;
	top: calc(100% + 8px);
	inset-inline-end: 0;
	z-index: 10;
	min-width: 180px;
	padding: 6px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow-lg);
	animation: b4-pop .18s var(--ease);
}

.mode-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	text-align: start;
	font-size: .9rem;
}

.mode-menu button .b4-icon {
	width: 19px;
	height: 19px;
	color: var(--muted);
}

.mode-menu button:hover {
	background: var(--surface-2);
}

.mode-menu button[aria-checked="true"] {
	color: var(--accent);
	font-weight: 700;
	background: var(--accent-soft);
}

.mode-menu button[aria-checked="true"] .b4-icon {
	color: var(--accent);
}

/* جستجو */
.search-panel {
	position: absolute;
	z-index: 2;
	top: 100%;
	inset-inline: 0;
	padding: 18px 0;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	animation: b4-drop .22s var(--ease);
}

.search-panel .search-form {
	max-width: 680px;
	margin-inline: auto;
}

.search-form {
	position: relative;
	display: flex;
}

.search-field {
	width: 100%;
	height: 50px;
	padding-inline: 20px 56px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface-2);
	outline: 0;
	transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.search-field::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.search-field:focus {
	border-color: var(--accent);
	background: var(--surface);
	box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-submit {
	position: absolute;
	inset-block: 5px;
	inset-inline-end: 5px;
	display: grid;
	place-items: center;
	width: 40px;
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: var(--on-accent);
}

.search-submit .b4-icon {
	width: 19px;
	height: 19px;
}

/* ==========================================================================
   منوی اصلی (آبشاری)
   ========================================================================== */
.main-nav {
	display: none;
	flex: 1;
	min-width: 0;
}

.main-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.main-nav > .menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px;
}

.main-nav li {
	position: relative;
}

.main-nav a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 13px;
	border-radius: 10px;
	font-size: .94rem;
	font-weight: 600;
	color: var(--text-soft);
	white-space: nowrap;
	transition: background-color .2s ease, color .2s ease;
}

.main-nav a:hover,
.main-nav li:hover > a,
.main-nav li.is-open > a {
	color: var(--accent);
	background: var(--surface-2);
}

.main-nav .current-menu-item > a,
.main-nav .current-menu-ancestor > a {
	color: var(--accent);
}

/* فلش زیرمنو */
.main-nav .menu-item-has-children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border: solid currentColor;
	border-width: 0 0 1.6px 1.6px;
	transform: rotate(-45deg);
	opacity: .7;
}

.main-nav .sub-menu .menu-item-has-children > a::after {
	margin-top: 0;
	transform: rotate(45deg);
}

html:not([dir="rtl"]) .main-nav .sub-menu .menu-item-has-children > a::after {
	transform: rotate(-135deg);
}

/* زیرمنوها */
.main-nav .sub-menu {
	position: absolute;
	top: 100%;
	inset-inline-start: 0;
	z-index: 20;
	min-width: 220px;
	padding: 6px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .18s ease, transform .18s var(--ease), visibility 0s .18s;
}

/* پل نامرئی بین آیتم و زیرمنو تا هاور قطع نشود */
.main-nav .menu > li > .sub-menu {
	margin-top: 6px;
}

.main-nav .menu > li > .sub-menu::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 100%;
	height: 8px;
}

.main-nav .sub-menu .sub-menu {
	top: -7px;
	inset-inline-start: calc(100% + 4px);
}

.main-nav .sub-menu .sub-menu::before {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-end: 100%;
	width: 8px;
}

.main-nav .sub-menu a {
	justify-content: space-between;
	padding: 9px 12px;
	font-weight: 500;
	white-space: normal;
}

.main-nav li:hover > .sub-menu,
.main-nav li:focus-within > .sub-menu,
.main-nav li.is-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .18s ease, transform .18s var(--ease), visibility 0s;
}

/* اگر زیرمنو از صفحه بیرون بزند، طرف دیگر باز می‌شود */
.main-nav .menu > li.flip > .sub-menu {
	inset-inline-start: auto;
	inset-inline-end: 0;
}

.main-nav .sub-menu li.flip > .sub-menu {
	inset-inline-start: auto;
	inset-inline-end: calc(100% + 4px);
}

.main-nav .sub-menu li.flip > .sub-menu::before {
	inset-inline-end: auto;
	inset-inline-start: 100%;
}

@media (min-width: 1024px) {
	.main-nav {
		display: block;
	}

	.menu-toggle {
		display: none;
	}

	/* حالت «همیشه همبرگری» */
	.b4-menu-hamburger .main-nav {
		display: none;
	}

	.b4-menu-hamburger .menu-toggle {
		display: inline-grid;
	}
}

/* ==========================================================================
   منوی کشویی کناری
   ========================================================================== */
.drawer-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: var(--backdrop);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility 0s .3s;
}

.drawer-backdrop.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity .3s ease, visibility 0s;
}

.drawer {
	position: fixed;
	inset-block: 0;
	inset-inline-start: 0;
	z-index: 1001;
	display: flex;
	flex-direction: column;
	width: min(86vw, 380px);
	background: var(--surface);
	box-shadow: var(--shadow-lg);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform .35s var(--ease), visibility 0s .35s;
}

html:not([dir="rtl"]) .drawer {
	transform: translateX(-100%);
}

.drawer.is-open,
html:not([dir="rtl"]) .drawer.is-open {
	transform: none;
	visibility: visible;
	transition: transform .35s var(--ease), visibility 0s;
}

.admin-bar .drawer {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .drawer {
		top: 46px;
	}
}

.drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--border);
}

.drawer-title {
	font-weight: 800;
	font-size: 1.05rem;
}

.drawer-search {
	padding: 16px 20px 8px;
}

.drawer-search .search-field {
	height: 46px;
}

.drawer-nav {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 12px 32px;
}

.drawer-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.drawer-nav li {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
}

.drawer-nav a {
	display: block;
	padding: 11px 12px;
	border-radius: 10px;
	font-weight: 600;
	color: var(--text);
}

.drawer-nav a:hover,
.drawer-nav .current-menu-item > a {
	color: var(--accent);
	background: var(--surface-2);
}

.drawer-nav .sub-menu {
	grid-column: 1 / -1;
	display: none;
	margin-inline-start: 14px;
	padding-inline-start: 10px;
	border-inline-start: 2px solid var(--border);
}

.drawer-nav .sub-menu a {
	font-weight: 500;
	font-size: .94rem;
	color: var(--text-soft);
}

.drawer-nav li.is-open > .sub-menu {
	display: block;
	animation: b4-fade .2s ease;
}

.submenu-toggle {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--muted);
}

.submenu-toggle:hover {
	background: var(--surface-2);
	color: var(--accent);
}

.submenu-toggle .b4-icon {
	width: 18px;
	height: 18px;
	transition: transform .2s ease;
}

.is-open > .submenu-toggle .b4-icon {
	transform: rotate(180deg);
}

/* ==========================================================================
   بخش‌ها
   ========================================================================== */
.section {
	margin-top: 56px;
}

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border);
}

.section-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	font-size: 1.3rem;
}

.section-title::before {
	content: "";
	width: 5px;
	height: 1.15em;
	border-radius: 4px;
	background: var(--accent);
}

.section-head-main {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 14px;
	min-width: 0;
}

.section-updated {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: .8rem;
	color: var(--muted);
}

.section-updated .b4-icon {
	width: 15px;
	height: 15px;
}

.section-sub {
	font-size: .85rem;
	font-weight: 500;
	color: var(--muted);
}

.section-more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .88rem;
	font-weight: 600;
	color: var(--muted);
}

.section-more .b4-icon {
	width: 18px;
	height: 18px;
	transition: transform .2s ease;
}

.section-more:hover .b4-icon {
	transform: translateX(-3px);
}

html:not([dir="rtl"]) .section-more:hover .b4-icon {
	transform: scaleX(-1) translateX(-3px);
}

.admin-hint {
	margin: 40px 0 0;
	padding: 16px 20px;
	border: 1.5px dashed var(--border);
	border-radius: var(--radius);
	color: var(--muted);
	font-size: .92rem;
}

.admin-hint a {
	color: var(--accent);
	font-weight: 700;
}

/* ==========================================================================
   ردیف افقی اسکرول‌خور (در صفحه‌های کوچک‌تر از دسکتاپ)
   ========================================================================== */
.h-scroll {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: min(78%, 300px);
	gap: 16px;
	margin-inline: calc(var(--gutter) * -1);
	padding-inline: var(--gutter);
	padding-bottom: 12px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--gutter);
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
}

.h-scroll > * {
	scroll-snap-align: start;
}

@media (min-width: 640px) {
	.h-scroll {
		grid-auto-columns: 42%;
	}
}

@media (min-width: 1024px) {
	.h-scroll {
		grid-auto-flow: row;
		margin-inline: 0;
		padding: 0;
		overflow: visible;
	}
}

/* ==========================================================================
   ۵ مطلب آخر: یک بزرگ + دو ستون دوتایی
   ========================================================================== */
.hero {
	margin-top: 28px;
}

.hero-grid > .card {
	height: 300px;
}

@media (max-width: 1023px) {
	.hero-grid .card-excerpt {
		display: none;
	}
}

@media (min-width: 1024px) {
	.hero-grid {
		grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
		grid-template-rows: repeat(2, minmax(0, 1fr));
		grid-auto-flow: column;
		height: clamp(420px, 34vw, 480px);
	}

	.hero-grid > .card {
		height: auto;
	}

	.hero-grid > .is-featured {
		grid-row: span 2;
	}
}

/* ==========================================================================
   کارت‌ها
   ========================================================================== */
.card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.card-media {
	position: relative;
	aspect-ratio: 16 / 10;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface-2);
}

.card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s var(--ease);
}

.card:hover .card-media img {
	transform: scale(1.05);
}

.card-body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	min-width: 0;
}

.card-title {
	margin: 0;
	font-size: 1.08rem;
	line-height: 1.65;
	font-weight: 800;
}

.card-title a {
	transition: color .2s ease;
}

.card:hover .card-title a {
	color: var(--accent);
}

.card-excerpt {
	margin: 0;
	font-size: .9rem;
	line-height: 1.9;
	color: var(--muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* کارت با متن روی تصویر */
.card--overlay {
	justify-content: flex-end;
	gap: 0;
	min-height: 200px;
	border-radius: var(--radius);
	overflow: hidden;
	background: #111;
	isolation: isolate;
}

.card--overlay .card-media {
	position: absolute;
	inset: 0;
	z-index: -1;
	aspect-ratio: auto;
	border-radius: 0;
}

.card--overlay .card-media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgb(0 0 0 / 88%) 0%, rgb(0 0 0 / 42%) 50%, rgb(0 0 0 / 0%) 82%);
}

.card--overlay .thumb-placeholder {
	background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 70%, #000), #1b1e25);
	color: #fff;
}

.card--overlay .card-body {
	gap: 6px;
	padding: 18px 20px;
}

.card--overlay .card-title {
	font-size: 1rem;
	line-height: 1.7;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card--overlay .card-title a,
.card--overlay:hover .card-title a {
	color: #fff;
}

.card--overlay .badge {
	background: var(--accent);
	color: var(--on-accent);
}

.card--overlay .badge:hover {
	background: #fff;
	color: var(--accent);
}

.card--overlay .meta {
	color: rgb(255 255 255 / 75%);
}

.card--overlay .card-excerpt {
	color: rgb(255 255 255 / 80%);
}

.card--overlay.is-featured .card-body {
	gap: 10px;
	padding: 28px;
}

.card--overlay.is-featured .card-title {
	font-size: clamp(1.15rem, .9rem + 1.1vw, 1.75rem);
	line-height: 1.5;
}

/* شبکه مطالب */
.posts-grid {
	display: grid;
	gap: 36px 28px;
}

@media (min-width: 640px) {
	.posts-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.posts-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ردیف دسته‌بندی */
.cat-row .card-title {
	font-size: 1rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

@media (min-width: 1024px) {
	.cat-row {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 28px;
	}
}

/* ==========================================================================
   صفحه‌بندی
   ========================================================================== */
.pagination {
	margin-top: 48px;
}

.nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 42px;
	height: 42px;
	padding-inline: 14px;
	border: 1px solid var(--border);
	border-radius: 999px;
	font-weight: 600;
	font-size: .92rem;
	transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.page-numbers .b4-icon {
	width: 18px;
	height: 18px;
}

a.page-numbers:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.page-numbers.current {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
}

.page-numbers.dots {
	border-color: transparent;
	min-width: auto;
	padding-inline: 4px;
}

/* ==========================================================================
   بایگانی، جستجو و ۴۰۴
   ========================================================================== */
.archive-header {
	margin: 40px 0 36px;
	padding: 36px 28px;
	border-radius: var(--radius);
	background:
		radial-gradient(ellipse at top left, var(--accent-soft), transparent 60%),
		var(--surface-2);
	text-align: center;
}

.archive-label {
	display: inline-block;
	margin-bottom: 6px;
	font-size: .85rem;
	font-weight: 700;
	color: var(--accent);
}

.archive-title {
	margin: 0 0 8px;
	font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.4rem);
}

.archive-description {
	max-width: 620px;
	margin: 0 auto 10px;
	color: var(--text-soft);
}

.archive-description p:last-child {
	margin-bottom: 0;
}

.archive-count {
	font-size: .85rem;
	color: var(--muted);
}

.archive-search {
	max-width: 520px;
	margin: 20px auto 0;
}

.empty-state {
	padding: 48px 20px;
	text-align: center;
}

.empty-state .search-form {
	max-width: 480px;
	margin: 20px auto 0;
}

.empty-state a {
	color: var(--accent);
	font-weight: 700;
}

.error-404 {
	padding-top: 72px;
	text-align: center;
}

.error-code {
	margin: 0;
	font-size: clamp(5rem, 3rem + 10vw, 9rem);
	font-weight: 900;
	line-height: 1;
	color: var(--accent);
}

.error-404 h1 {
	margin-top: 12px;
	font-size: 1.6rem;
}

.error-404 p {
	color: var(--muted);
}

.error-404 .search-form {
	max-width: 480px;
	margin: 28px auto;
}

/* ==========================================================================
   صفحه مطلب
   ========================================================================== */
.entry-header {
	margin-top: 44px;
	margin-bottom: 28px;
}

.entry-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 14px;
}

.entry-title {
	margin: 0 0 14px;
	font-size: clamp(1.6rem, 1.15rem + 1.8vw, 2.5rem);
	line-height: 1.5;
	font-weight: 900;
}

.entry-lead {
	margin-bottom: 18px;
	font-size: 1.1rem;
	line-height: 2;
	color: var(--text-soft);
}

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	font-size: .88rem;
	color: var(--muted);
}

.entry-author {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	color: var(--text);
}

.entry-author img {
	width: 36px;
	height: 36px;
	border-radius: 999px;
}

.entry-meta a:hover {
	color: var(--accent);
}

.entry-thumb {
	margin-block: 0 36px;
}

.entry-thumb img {
	width: 100%;
	max-height: 460px;
	object-fit: cover;
	border-radius: var(--radius);
}

.entry-thumb figcaption {
	margin-top: 10px;
	text-align: center;
	font-size: .85rem;
	color: var(--muted);
}

/* محتوای مطلب */
.entry-content {
	font-size: 1.07rem;
	line-height: 2.05;
	color: var(--text-soft);
	overflow-wrap: break-word;
}

.entry-content::after {
	content: "";
	display: table;
	clear: both;
}

.entry-content > * {
	margin-block: 0 1.4em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
	margin-top: 1.8em;
	margin-bottom: .7em;
	color: var(--text);
}

.entry-content h2 { font-size: 1.55rem; }
.entry-content h3 { font-size: 1.3rem; }
.entry-content h4 { font-size: 1.12rem; }

.entry-content a:not(.wp-element-button):not(.wp-block-button__link) {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 5px;
}

.entry-content a:not(.wp-element-button):not(.wp-block-button__link):hover {
	text-decoration-thickness: 2px;
}

.entry-content strong {
	color: var(--text);
}

.entry-content ul,
.entry-content ol {
	padding-inline-start: 1.4em;
}

.entry-content li {
	margin-bottom: .4em;
}

.entry-content li::marker {
	color: var(--accent);
}

.entry-content blockquote,
.entry-content .wp-block-quote {
	margin-inline: 0;
	padding: 18px 24px;
	border-inline-start: 4px solid var(--accent);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	background: var(--surface-2);
	font-size: 1.1rem;
	color: var(--text);
}

[dir="rtl"] .entry-content blockquote,
[dir="rtl"] .entry-content .wp-block-quote {
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

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

.entry-content blockquote cite {
	display: block;
	margin-top: 8px;
	font-size: .88rem;
	font-style: normal;
	color: var(--muted);
}

.entry-content .wp-block-pullquote {
	padding: 28px 0;
	border-block: 3px solid var(--accent);
	text-align: center;
}

.entry-content .wp-block-pullquote blockquote {
	border: 0;
	background: none;
}

.entry-content img {
	border-radius: var(--radius-sm);
}

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

.entry-content figcaption,
.entry-content .wp-element-caption {
	margin-top: 8px;
	text-align: center;
	font-size: .85rem;
	color: var(--muted);
}

.entry-content hr {
	margin-block: 2.5em;
	border: 0;
	border-top: 1px solid var(--border);
}

.entry-content code,
.entry-content kbd {
	direction: ltr;
	unicode-bidi: embed;
	padding: 2px 6px;
	border-radius: 6px;
	background: var(--surface-2);
	font-family: var(--mono);
	font-size: .88em;
}

.entry-content pre {
	direction: ltr;
	text-align: left;
	padding: 18px 20px;
	border-radius: var(--radius-sm);
	background: #0f1117;
	color: #e6e8ee;
	overflow-x: auto;
	font-family: var(--mono);
	font-size: .9rem;
	line-height: 1.7;
}

.entry-content pre code {
	padding: 0;
	background: none;
	color: inherit;
}

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

.entry-content th,
.entry-content td {
	padding: 10px 14px;
	border: 1px solid var(--border);
	text-align: start;
}

.entry-content th {
	background: var(--surface-2);
	color: var(--text);
}

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

.entry-content .alignleft {
	float: left;
	margin: .4em 0 1em 1.5em;
}

.entry-content .alignright {
	float: right;
	margin: .4em 1.5em 1em 0;
}

.entry-content .aligncenter {
	margin-inline: auto;
	text-align: center;
}

.entry-content .alignwide {
	width: min(1100px, 100vw - var(--gutter) * 2);
	max-width: none;
	margin-inline: calc(50% - min(550px, 50vw - var(--gutter)));
}

.entry-content .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline: calc(50% - 50vw);
}

.entry-content .alignfull img {
	border-radius: 0;
}

.entry-content iframe {
	max-width: 100%;
}

/* جدول راه‌راه: رنگ ثابت روشن وردپرس در حالت شب خوانا نیست */
.entry-content .wp-block-table.is-style-stripes {
	border-bottom-color: var(--border);
}

.entry-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--surface-2);
}

/* دکمه‌ها */
:is(.entry-content, .cta-bar) .wp-block-button__link,
:is(.entry-content, .cta-bar) .wp-element-button {
	text-decoration: none;
	font-weight: 700;
	transition: transform .15s ease, filter .15s ease, box-shadow .2s ease;
}

:is(.entry-content, .cta-bar) .wp-block-button__link:hover,
:is(.entry-content, .cta-bar) .wp-element-button:hover {
	filter: brightness(1.08);
}

:is(.entry-content, .cta-bar) .wp-block-button:not(.is-style-outline) > .wp-block-button__link:not(.has-text-color) {
	color: #fff;
}

:is(.entry-content, .cta-bar) .wp-block-button:not(.is-style-outline) > .wp-block-button__link:not(.has-background) {
	background: var(--accent);
	color: var(--on-accent);
}

:is(.entry-content, .cta-bar) .is-style-outline > .wp-block-button__link:not(.has-text-color) {
	color: var(--text);
}

/* اولین ردیف دکمه‌های مطلب: برجسته */
.entry-content .b4-cta {
	gap: 12px;
	padding: 22px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background:
		radial-gradient(ellipse at top, var(--accent-soft), transparent 70%),
		var(--surface-2);
}

.entry-content .b4-cta:not([class*="is-content-justification"]) {
	justify-content: center;
}

.entry-content .b4-cta .wp-block-button__link {
	position: relative;
	overflow: hidden;
	padding: 14px 34px;
	font-size: 1.05rem;
	font-weight: 800;
	box-shadow: 0 10px 24px -10px rgb(0 0 0 / 55%);
}

.entry-content .b4-cta .wp-block-button__link:hover {
	transform: translateY(-2px);
}

.entry-content .b4-cta .wp-block-button__link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / 32%) 50%, transparent 65%);
	transform: translateX(-130%);
	animation: b4-shine 3.5s ease-in-out infinite;
	pointer-events: none;
}

/* نوار چسبان دکمه‌ها زیر سربرگ */
.cta-bar {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	z-index: 1;
	padding: 10px 0;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: opacity .25s ease, transform .25s var(--ease), visibility 0s .25s;
}

.cta-bar.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .25s ease, transform .25s var(--ease), visibility 0s;
}

.cta-bar .wp-block-buttons {
	display: flex;
	flex-wrap: nowrap;
	justify-content: center;
	gap: 10px;
	margin: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.cta-bar .wp-block-button {
	flex-shrink: 0;
	margin: 0;
}

.cta-bar .wp-block-button__link {
	display: inline-block;
	padding: 8px 24px;
	font-size: .92rem;
	font-weight: 800;
	text-decoration: none;
	white-space: nowrap;
}

.page-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	font-weight: 700;
}

.page-links a,
.page-links > .post-page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 36px;
	height: 36px;
	border: 1px solid var(--border);
	border-radius: 999px;
	text-decoration: none;
}

/* برچسب‌ها */
.entry-footer {
	margin-top: 8px;
}

.entry-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.entry-tags a {
	padding: 5px 14px;
	border-radius: 999px;
	background: var(--surface-2);
	font-size: .85rem;
	color: var(--text-soft);
	transition: background-color .2s ease, color .2s ease;
}

.entry-tags a::before {
	content: "#";
	margin-inline-end: 2px;
	opacity: .5;
}

.entry-tags a:hover {
	background: var(--accent);
	color: var(--on-accent);
}

/* مطلب قبلی و بعدی */
.post-nav {
	display: grid;
	gap: 14px;
	margin-top: 48px;
}

@media (min-width: 640px) {
	.post-nav {
		grid-template-columns: 1fr 1fr;
	}

	.post-nav-next {
		grid-column: 2;
		flex-direction: row-reverse;
		text-align: end;
	}
}

.post-nav-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: border-color .2s ease, box-shadow .2s ease;
}

.post-nav-item:hover {
	border-color: transparent;
	box-shadow: var(--shadow);
	color: inherit;
}

.post-nav-thumb {
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	border-radius: 12px;
	overflow: hidden;
}

.post-nav-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.post-nav-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.post-nav-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .8rem;
	font-weight: 700;
	color: var(--accent);
}

.post-nav-next .post-nav-label {
	flex-direction: row-reverse;
	justify-content: flex-start;
}

.post-nav-label .b4-icon {
	width: 16px;
	height: 16px;
}

.post-nav-title {
	font-weight: 700;
	font-size: .95rem;
	line-height: 1.7;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ==========================================================================
   دیدگاه‌ها
   ========================================================================== */
.comments-area {
	margin-top: 56px;
	padding-top: 40px;
	border-top: 1px solid var(--border);
}

.comments-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.3rem;
}

.comments-title .b4-icon {
	color: var(--accent);
}

.comment-list,
.comment-list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.comment-list {
	margin-bottom: 40px;
}

.comment-list .children {
	margin-inline-start: 28px;
	padding-inline-start: 18px;
	border-inline-start: 2px solid var(--border);
}

.comment-body {
	margin-top: 20px;
	padding: 18px 20px;
	border-radius: var(--radius);
	background: var(--surface-2);
}

.comment-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
	margin-bottom: 8px;
}

.comment-author {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 800;
}

.comment-author .avatar {
	width: 40px;
	height: 40px;
	border-radius: 999px;
}

.comment-author .says {
	display: none;
}

.comment-metadata {
	font-size: .8rem;
	color: var(--muted);
}

.comment-metadata .edit-link {
	margin-inline-start: 8px;
}

.comment-content {
	font-size: .97rem;
	color: var(--text-soft);
}

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

.comment-awaiting-moderation {
	display: block;
	margin-top: 6px;
	font-size: .85rem;
	color: var(--accent);
}

.bypostauthor > .comment-body {
	box-shadow: inset 3px 0 0 var(--accent);
}

[dir="rtl"] .bypostauthor > .comment-body {
	box-shadow: inset -3px 0 0 var(--accent);
}

.reply {
	margin-top: 10px;
}

.comment-reply-link {
	font-size: .85rem;
	font-weight: 700;
	color: var(--accent);
}

.comment-respond {
	margin-top: 24px;
}

.comment-reply-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 1.2rem;
}

.comment-reply-title small a {
	font-size: .85rem;
	font-weight: 600;
	color: var(--muted);
}

.comment-notes,
.logged-in-as {
	font-size: .88rem;
	color: var(--muted);
}

.logged-in-as a {
	color: var(--accent);
}

.comment-form {
	display: grid;
	gap: 4px 16px;
}

.comment-form > p {
	margin: 0 0 12px;
}

@media (min-width: 640px) {
	.comment-form {
		grid-template-columns: repeat(3, 1fr);
	}

	.comment-form > p {
		grid-column: 1 / -1;
	}

	.comment-form .comment-form-author,
	.comment-form .comment-form-email,
	.comment-form .comment-form-url {
		grid-column: auto;
	}
}

.comment-form label {
	display: block;
	margin-bottom: 6px;
	font-size: .88rem;
	font-weight: 700;
}

.comment-form .required {
	color: var(--accent);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	outline: 0;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.comment-form input[dir="ltr"] {
	text-align: left;
}

.comment-form textarea {
	min-height: 150px;
	resize: vertical;
	line-height: 1.9;
}

.comment-form input:focus,
.comment-form textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 4px var(--accent-soft);
}

.comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.comment-form-cookies-consent input {
	margin-top: 7px;
	accent-color: var(--accent);
}

.comment-form-cookies-consent label {
	margin: 0;
	font-weight: 500;
	color: var(--muted);
}

.no-comments {
	color: var(--muted);
}

.comment-navigation .nav-links {
	justify-content: space-between;
	margin-bottom: 24px;
}

/* ==========================================================================
   فوتر
   ========================================================================== */
.site-footer {
	border-top: 1px solid var(--border);
	background: var(--surface-2);
}

.footer-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding-block: 28px;
	text-align: center;
}

.copyright {
	margin: 0;
	font-size: .88rem;
	color: var(--muted);
}

.footer-menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.footer-menu a {
	display: block;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: .88rem;
	font-weight: 600;
	color: var(--text-soft);
	transition: background-color .2s ease, color .2s ease;
}

.footer-menu a:hover {
	background: var(--surface);
	color: var(--accent);
}

@media (min-width: 768px) {
	.footer-inner {
		flex-direction: row;
		justify-content: space-between;
		text-align: start;
	}
}

/* ==========================================================================
   ریسپانسیو کلی
   ========================================================================== */
@media (max-width: 639px) {
	:root {
		--gutter: 16px;
		--header-h: 60px;
	}

	.section {
		margin-top: 44px;
	}

	.hero {
		margin-top: 16px;
	}

	.archive-header {
		padding: 28px 18px;
	}
}

/* ==========================================================================
   انیمیشن‌ها
   ========================================================================== */
@keyframes b4-pop {
	from { opacity: 0; transform: translateY(-4px) scale(.98); }
	to { opacity: 1; transform: none; }
}

@keyframes b4-drop {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: none; }
}

@keyframes b4-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes b4-rise {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: none; }
}

@keyframes b4-shine {
	0%, 55% { transform: translateX(-130%); }
	100% { transform: translateX(130%); }
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
