/**
 * Post archive companion stylesheet.
 *
 * Scoped styles for the reclaimed native blog archive layout (PLAN_POSTS.md §5).
 * Reuses directory-archive.css as a base dependency; provides dedicated styling
 * for category pills navigation, search & sort toolbar, post cards (grid & list),
 * load more button, and responsive adaptations.
 *
 * @package RayTheme
 */

/* Container */
.post-archive-container {
	max-width: 1440px;
	margin: 0 auto;
	padding: 0 20px 60px;
	width: 100%;
	box-sizing: border-box;
	direction: rtl;
	font-family: 'IRANYekanXFaNum', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Archive Header */
.post-archive-header {
	margin: 24px 0 24px;
}

.post-archive-title-wrap {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.post-archive-title {
	font-size: 26px;
	font-weight: 800;
	color: #17181b;
	line-height: 1.35;
	margin: 0;
}

.post-archive-count-badge {
	display: inline-flex;
	align-items: center;
	background-color: #f1f5f9;
	color: #475569;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	border: 1px solid #e2e8f0;
}

/* Category Navigation Pills */
.post-archive-cat-nav {
	margin: 16px 0 24px;
	position: relative;
}

.post-archive-cat-scroll {
	display: flex;
	align-items: center;
	gap: 10px;
	overflow-x: auto;
	padding: 4px 0 10px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.post-archive-cat-scroll::-webkit-scrollbar {
	height: 4px;
}

.post-archive-cat-scroll::-webkit-scrollbar-thumb {
	background-color: #cbd5e1;
	border-radius: 4px;
}

.post-archive-cat-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background-color: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 9999px;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	transition: all 0.2s ease;
	cursor: pointer;
}

.post-archive-cat-pill:hover {
	background-color: var(--blue-gray-50, #f1f4f9);
	border-color: #cbd5e1;
	color: var(--ink-900, #080f1d);
}

.post-archive-cat-pill.is-active {
	background-color: var(--ink-900, #080f1d);
	border-color: var(--ink-900, #080f1d);
	color: var(--yellow-500, #ffd305);
	box-shadow: 0 4px 14px rgba(8, 15, 29, 0.18);
}

.post-archive-cat-pill .pill-count {
	font-size: 11px;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 10px;
	background-color: var(--blue-gray-50, #f1f4f9);
	color: var(--gray-600, #6b6f77);
	transition: background-color 0.2s, color 0.2s;
}

.post-archive-cat-pill.is-active .pill-count {
	background-color: rgba(255, 211, 5, 0.18);
	color: var(--yellow-500, #ffd305);
}

/* Toolbar: Search, Sorter, View Modes */
.post-archive-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 20px 0 28px;
	flex-wrap: wrap;
	padding-bottom: 20px;
	border-bottom: 1px solid #f1f5f9;
}

.post-archive-search-box {
	position: relative;
	display: flex;
	align-items: center;
	width: 320px;
	max-width: 100%;
}

.post-search-icon {
	position: absolute;
	right: 14px;
	color: #94a3b8;
	pointer-events: none;
}

.post-search-input {
	width: 100%;
	height: 44px;
	padding: 0 42px 0 36px;
	background-color: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	font-size: 13px;
	font-family: inherit;
	color: #1e293b;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.post-search-input:focus {
	border-color: var(--ink-900, #080f1d);
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 211, 5, 0.25);
}

.post-search-input::-webkit-search-cancel-button,
.post-search-input::-webkit-search-decoration,
.post-search-input::-webkit-search-results-button,
.post-search-input::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.post-search-clear {
	position: absolute;
	left: 10px;
	background: none;
	border: none;
	font-size: 18px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
	padding: 4px 6px;
}

.post-search-clear:hover {
	color: #ef4444;
}

.post-archive-toolbar-actions {
	display: flex;
	align-items: center;
	gap: 16px;
}

.post-archive-sort-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.post-sort-label {
	font-size: 13px;
	color: #64748b;
	white-space: nowrap;
}

.post-sort-select-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.post-sort-select {
	appearance: none;
	-webkit-appearance: none;
	height: 40px;
	padding: 0 14px 0 32px;
	background-color: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	font-size: 13px;
	font-family: inherit;
	color: #1e293b;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.post-sort-select:focus {
	border-color: var(--ink-900, #080f1d);
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 211, 5, 0.25);
}

.select-chevron {
	position: absolute;
	left: 10px;
	pointer-events: none;
	color: #64748b;
}

/* Post Cards (Grid View) */
.card-result.card-post {
	background-color: #ffffff;
	border-radius: 20px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	border: 1px solid #edf0f4;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	position: relative;
	overflow: hidden;
}

.card-result.card-post:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

.card-post-top {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.card-post-thumb-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 14px;
	overflow: hidden;
	background-color: #f1f5f9;
}

.card-post-thumb-link {
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
	overflow: hidden;
}

.card-post-thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

/* Ad / Sponsored Badge (post-ad-label) */
.card-post-sponsor-badge,
.card-post-ad-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background-color: var(--yellow-500, #ffd305);
	color: var(--ink-900, #080f1d);
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	pointer-events: none;
	line-height: 1.3;
}

.card-result.card-post:hover .card-post-thumb-img {
	transform: scale(1.06);
}

.card-post-thumb-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #cbd5e1;
	background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.card-post-category-wrap {
	margin-bottom: 8px;
}

.card-post-category-badge {
	display: inline-flex;
	align-items: center;
	background-color: var(--blue-gray-50, #f1f4f9);
	color: var(--navy-700, #262d44);
	padding: 3px 10px;
	border-radius: 6px;
	font-size: 11px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s ease;
	width: fit-content;
}

.card-post-category-badge:hover {
	background-color: var(--ink-900, #080f1d);
	color: var(--yellow-500, #ffd305);
}

.card-post-content {
	display: flex;
	flex-direction: column;
	margin-top: 14px;
	flex: 1;
}

.card-post-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.55;
	color: #17181b;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 48px;
}

.card-post-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.card-post-title a:hover {
	color: var(--navy-700, #262d44);
}

.card-post-title .badge[data-label],
.badge[data-label] {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-left: 6px;
}

.card-post-title .badge[data-label]::before,
.badge[data-label]::before {
	content: attr(data-label);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: var(--yellow-500, #ffd305);
	color: var(--ink-900, #080f1d);
	font-size: 11px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 4px;
	line-height: 1.3;
}

.card-post-excerpt {
	font-size: 13px;
	line-height: 1.65;
	color: #64748b;
	margin: 10px 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 42px;
}

.card-post-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid #f1f5f9;
	font-size: 12px;
	color: #94a3b8;
}

.card-post-meta-details {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 10px;
}

.card-post-date,
.card-post-reading-time {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	color: #94a3b8;
}

.card-post-meta-details .meta-icon {
	color: #94a3b8;
	flex-shrink: 0;
}

/* Pagination Section */
.post-archive-pagination-wrap {
	margin-top: 36px;
	display: flex;
	justify-content: center;
	align-items: center;
}

.post-archive-pagination {
	margin-top: 0;
}

/* Loading Overlay for Container */
.content-items.is-updating {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* Description Accordion at the bottom */
.post-archive-description-section {
	margin-top: 48px;
}

.post-archive-description-section .directory-archive-read-more-btn {
	background-color: var(--blue-gray-50, #f1f4f9);
	color: var(--navy-700, #262d44);
	border: 1px solid #e2e8f0;
}

.post-archive-description-section .directory-archive-read-more-btn:hover {
	background-color: var(--ink-900, #080f1d);
	color: var(--yellow-500, #ffd305);
	border-color: var(--ink-900, #080f1d);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
	.content-items {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.post-archive-container {
		padding: 0 16px 40px;
	}

	.post-archive-title {
		font-size: 22px;
	}

	.post-archive-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
	}

	.post-archive-search-box {
		width: 100%;
	}

	.post-archive-toolbar-actions {
		justify-content: space-between;
		width: 100%;
	}

	.content-items {
		grid-template-columns: 1fr;
		gap: 16px;
	}
}
