/* =====================================================
   Blog Archive Styles
   RTL-first. Uses CSS custom properties for easy theming.
   ===================================================== */

.blog-archive {
	--tak-gap: 24px;
	--tak-radius: 14px;
	--tak-color-text: #1c1c1c;
	--tak-color-muted: #6b7280;
	--tak-color-border: #ececec;
	--tak-color-accent: var(--ntic-primary, #E80545);
	--tak-color-bg-card: #ffffff;

	max-width: 1280px;
	margin: 0 auto;
	padding: 45px 40px;
	color: var(--tak-color-text);
}

@media (max-width: 1024px) {
	.blog-archive {
		padding: 40px 24px;
	}
}

@media (max-width: 600px) {
	.blog-archive {
		padding: 32px 16px;
	}
}

/* ---------- Hero ---------- */
.blog-hero {
	margin-bottom: 32px;
}

.blog-hero__title {
	font-size: 22px;
	font-weight: 800;
	margin: 0;
}

@media (max-width: 600px) {
	.blog-hero__title {
		font-size: 18px;
	}
}

/* ---------- Section headers (shared) ---------- */
.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.section-header h2 {
	font-size: 19px;
	font-weight: 800;
	margin: 0;
}

.section-header h2 a {
	color: inherit;
	text-decoration: none;
}

.btn-view-all {
	font-size: 13px;
	font-weight: 600;
	color: var(--tak-color-accent);
	border: 1px solid var(--tak-color-border);
	border-radius: 999px;
	padding: 6px 16px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.btn-view-all:hover {
	background-color: #f7f2e8;
}

/* ---------- Post grid ---------- */
.post-grid-section {
	margin-bottom: 48px;
}

.post-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--tak-gap);
}

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

@media (max-width: 560px) {
	.post-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- Post card ---------- */
.post-card {
	background: var(--tak-color-bg-card);
	border: 1px solid var(--tak-color-border);
	border-radius: var(--tak-radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.post-card:hover {
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.post-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.post-card__thumb {
	position: relative;
	aspect-ratio: 4 / 3;
	background-color: #f2f2f2;
	overflow: hidden;
}

.post-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.post-card__body {
	padding: 14px 16px 12px;
}

.post-card__title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.6;
	margin: 0 0 10px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.post-card__meta {
	font-size: 12px;
	color: var(--tak-color-muted);
}

/* ---------- تگ‌های دسته‌بندی پایین کارت (مشابه limoo.host/blog) ---------- */
.post-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px 16px;
}

.post-card__tag {
	display: inline-flex;
	align-items: center;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	padding: 6px 10px;
	border-radius: 999px;
	background-color: #f2f2f2; /* fallback برای مرورگرهای قدیمی‌تر */
	background-color: color-mix(in srgb, var(--tak-color-accent) 12%, white);
	color: var(--tak-color-accent);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.post-card__tag:hover {
	background-color: var(--tak-color-accent);
	color: #fff;
}

/* ---------- Carousels ---------- */
.carousel-section {
	margin-bottom: 48px;
}

.carousel {
	position: relative;
}

.carousel-track {
	display: flex;
	gap: var(--tak-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding-bottom: 4px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
	display: none;
}

.carousel-item {
	flex: 0 0 auto;
	width: 260px;
	scroll-snap-align: start;
}

@media (max-width: 560px) {
	.carousel-item {
		width: 220px;
	}
}

.carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--tak-color-border);
	background: #fff;
	color: var(--tak-color-text);
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.carousel-btn:hover {
	background-color: var(--tak-color-accent);
	color: #fff;
	border-color: var(--tak-color-accent);
}

/* ---------- Inline SVG chevron icon (used in carousel buttons AND header menu) ---------- */
.icon-chevron {
	display: block;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

/* برای دکمه "بعدی" آیکون ۱۸۰ درجه می‌چرخد و جهتش برعکس می‌شود؛
   دقیقاً همان یک آیکون، بدون نیاز به دو فایل SVG جدا */
.icon-chevron--flip {
	transform: rotate(180deg);
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.carousel-btn--prev {
	right: -14px;
}

.carousel-btn--next {
	left: -14px;
}

@media (max-width: 700px) {
	.carousel-btn {
		display: none; /* در موبایل کشیدن انگشتی (touch swipe) کافیست */
	}
}

/* ---------- Pagination ---------- */
.blog-pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 32px;
}

.blog-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--tak-color-border);
	border-radius: 8px;
	text-decoration: none;
	color: var(--tak-color-text);
	font-size: 13px;
}

.blog-pagination .page-numbers.current {
	background: var(--tak-color-accent);
	border-color: var(--tak-color-accent);
	color: #fff;
}

/* =====================================================
   هدر اختصاصی صفحه آرشیو وبلاگ
   چیدمان: منو (راست) — لوگو (وسط) — جستجو (چپ)
   با grid-template-columns و justify-self، خودش با RTL هماهنگ می‌شود.
   ===================================================== */
.site-header {
	border-bottom: 1px solid #ececec;
	background: #fff;
}

.site-header__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 14px 40px;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 20px;
}

@media (max-width: 1024px) {
	.site-header__inner {
		padding: 12px 24px;
	}
}

@media (max-width: 780px) {
	.site-header__inner {
		grid-template-columns: auto 1fr auto;
		padding: 12px 16px;
	}
}

/* ---------- لوگو (وسط) ---------- */
.site-header__logo {
	justify-self: center;
	text-align: center;
}

.site-header__logo a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.site-header__logo img {
	display: block;
	height: 40px;
	width: auto;
	max-width: 190px;
	object-fit: contain;
}

.site-header__logo-text {
	font-size: 18px;
	font-weight: 800;
	color: var(--tak-color-text, #1c1c1c);
}

/* ---------- منوی دسته‌بندی (راست) ---------- */
.site-header__nav {
	justify-self: start;
}

.nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	color: #1c1c1c;
	padding: 6px;
}

.primary-menu {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
}

.primary-menu__item {
	position: relative;
}

.primary-menu__link {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 12px;
	color: #1c1c1c;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	border-radius: 8px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.primary-menu__link:hover,
.primary-menu__item.is-open > .primary-menu__link {
	background-color: var(--ntic-primary-soft, #fff3f2);
	color: var(--tak-color-accent, #E80545);
}

/* هاور یا باز شدن → آیکون فلش ۱۸۰ درجه می‌چرخد (رو به بالا) */
.primary-menu__item:hover .icon-chevron,
.primary-menu__item.is-open .icon-chevron {
	transform: rotate(180deg);
}

/* زیرمنو: فقط یک سطح (اولین زیردسته‌ها)، زیر آیتم مادر باز می‌شود */
.submenu {
	position: absolute;
	top: 100%;
	right: 0; /* در RTL از سمت راست هم‌تراز با لینک باز می‌شود */
	min-width: 220px;
	background: #fff;
	border: 1px solid #ececec;
	border-radius: 10px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
	padding: 8px;
	list-style: none;
	margin: 6px 0 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	z-index: 30;
}

.primary-menu__item:hover .submenu,
.primary-menu__item.is-open .submenu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.submenu a {
	display: block;
	padding: 8px 10px;
	border-radius: 6px;
	color: #444;
	text-decoration: none;
	font-size: 13px;
}

.submenu a:hover {
	background-color: var(--ntic-primary-soft, #fff3f2);
	color: var(--tak-color-accent, #E80545);
}

/* ---------- باکس جستجوی زنده (چپ) ---------- */
.site-header__search {
	justify-self: end;
	width: 100%;
	max-width: 260px;
}

.live-search {
	position: relative;
}

.live-search__input {
	width: 100%;
	height: 42px;
	border: 1px solid #e5e5e5;
	border-radius: 999px;
	background: #f7f7f8;
	padding: 0 40px 0 16px; /* فضای آیکون در سمت راست ورودی، چون سایت راست‌به‌چپ است */
	font-size: 13px;
	color: #1c1c1c;
	outline: none;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.live-search__input:focus {
	border-color: var(--tak-color-accent, #E80545);
	background: #fff;
}

.icon-search {
	position: absolute;
	top: 50%;
	right: 14px; /* سمت راست باکس، مطابق جهت‌خوانی راست‌به‌چپ */
	transform: translateY(-50%);
	color: #9aa0a6;
	pointer-events: none;
}

.live-search__results {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	left: 0;
	background: #fff;
	border: 1px solid #ececec;
	border-radius: 12px;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
	overflow: hidden;
	z-index: 40;
}

.live-search__result {
	display: block;
	padding: 12px 16px;
	font-size: 13px;
	color: #1c1c1c;
	text-decoration: none;
	border-bottom: 1px solid #f1f1f1; /* خط کم‌رنگ جداکننده بین نتایج */
}

.live-search__result:last-child {
	border-bottom: none;
}

.live-search__result:hover {
	background-color: var(--ntic-primary-soft, #fff3f2);
	color: var(--tak-color-accent, #E80545);
}

.live-search__empty,
.live-search__loading {
	padding: 14px 16px;
	font-size: 13px;
	color: var(--tak-color-muted, #6b7280);
	text-align: center;
}

/* ---------- ریسپانسیو موبایل ---------- */
@media (max-width: 780px) {
	.nav-toggle {
		display: inline-flex;
		align-items: center;
	}

	.primary-menu {
		display: none;
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		flex-direction: column;
		align-items: stretch;
		background: #fff;
		border-top: 1px solid #ececec;
		box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
		padding: 8px;
		z-index: 50;
	}

	.site-header__nav.is-open .primary-menu {
		display: flex;
	}

	.site-header {
		position: relative;
	}

	.primary-menu__item {
		width: 100%;
	}

	.primary-menu__link {
		width: 100%;
		justify-content: space-between;
	}

	.submenu {
		position: static;
		box-shadow: none;
		border: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		display: none;
		padding-right: 16px;
	}

	.primary-menu__item.is-open .submenu {
		display: block;
	}

	.site-header__logo {
		justify-self: center;
	}

	.site-header__search {
		max-width: 160px;
	}
}
