/**
 * Hayat posts list — tokens from systemdesign.md
 */

.hayat-posts-list {
	--hpl-brand: #47b369;
	--hpl-brand-hover: #368c51;
	--hpl-brand-soft: #ecf8f0;
	--hpl-text: #2b2b2b;
	--hpl-text-secondary: #555555;
	--hpl-text-muted: #8c8c8c;
	--hpl-border: #ececec;
	--hpl-surface: #ffffff;
	--hpl-surface-subtle: #f7f9f7;
	--hpl-radius-card: 16px;
	--hpl-radius-media: 12px;
	--hpl-radius-btn: 12px;
	--hpl-radius-pill: 999px;
	--hpl-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
	--hpl-gap: 24px;
	--hpl-columns: 3;
	--hpl-media-height: 180px;
	--hpl-excerpt-lines: 3;
	width: 100%;
	box-sizing: border-box;
	direction: rtl;
	font-family: peyda, Vazirmatn, sans-serif;
	color: var(--hpl-text);
}

.hayat-posts-list *,
.hayat-posts-list *::before,
.hayat-posts-list *::after {
	box-sizing: border-box;
}

.hayat-posts-list__grid {
	display: grid;
	grid-template-columns: repeat(var(--hpl-columns, 3), minmax(0, 1fr));
	gap: var(--hpl-gap);
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hayat-posts-list.is-list .hayat-posts-list__grid {
	grid-template-columns: minmax(0, 1fr);
}

.hayat-posts-list__item {
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hayat-posts-list__card {
	display: flex;
	flex-direction: column;
	position: relative;
	height: 100%;
	min-height: 0;
	padding: 20px;
	background: var(--hpl-surface);
	border: 1px solid var(--hpl-border);
	border-radius: var(--hpl-radius-card);
	box-shadow: var(--hpl-shadow);
	color: inherit;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.hayat-posts-list__card:hover {
	transform: translateY(-2px);
	border-color: #d9d9d9;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
	color: inherit;
	text-decoration: none;
}

.hayat-posts-list__card:focus {
	outline: none;
}

.hayat-posts-list__card:focus-visible {
	outline: 3px solid rgba(71, 179, 105, 0.35);
	outline-offset: 3px;
}

.hayat-posts-list.is-list .hayat-posts-list__card {
	flex-direction: row;
	align-items: stretch;
	gap: 20px;
}

.hayat-posts-list__media {
	position: relative;
	flex: 0 0 auto;
	width: 100%;
	height: var(--hpl-media-height);
	margin: 0 0 16px;
	overflow: hidden;
	border-radius: var(--hpl-radius-media);
	background: var(--hpl-surface-subtle);
}

.hayat-posts-list.is-list .hayat-posts-list__media {
	width: 240px;
	min-width: 240px;
	height: auto;
	min-height: 160px;
	margin: 0;
	align-self: stretch;
}

.hayat-posts-list__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.hayat-posts-list__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: inherit;
	color: var(--hpl-brand);
	background: var(--hpl-brand-soft);
}

.hayat-posts-list__placeholder svg {
	width: 36px;
	height: 36px;
}

.hayat-posts-list__badge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	max-width: calc(100% - 24px);
	padding: 4px 8px;
	border-radius: var(--hpl-radius-pill);
	background: var(--hpl-brand-soft);
	color: var(--hpl-brand-hover);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hayat-posts-list__card > .hayat-posts-list__badge {
	position: static;
	align-self: flex-start;
	margin-bottom: 4px;
}

.hayat-posts-list__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	gap: 8px;
}

.hayat-posts-list__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.55;
	color: var(--hpl-text);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

.hayat-posts-list__card:hover .hayat-posts-list__title {
	color: var(--hpl-brand);
}

.hayat-posts-list__excerpt {
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.7;
	color: var(--hpl-text-secondary);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--hpl-excerpt-lines, 3);
	overflow: hidden;
}

.hayat-posts-list__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	padding-top: 16px;
}

.hayat-posts-list__meta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	color: var(--hpl-text-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}

.hayat-posts-list__meta-sep {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.55;
	flex-shrink: 0;
}

.hayat-posts-list__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-shrink: 0;
	min-height: 44px;
	padding: 0 16px;
	border-radius: var(--hpl-radius-btn);
	background: var(--hpl-brand);
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.hayat-posts-list__card:hover .hayat-posts-list__cta {
	background: var(--hpl-brand-hover);
}

.hayat-posts-list__cta svg {
	display: block;
	width: 16px;
	height: 16px;
	transform: scaleX(-1);
}

.hayat-posts-list__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 40px 20px;
	text-align: center;
	background: var(--hpl-surface-subtle);
	border: 1px solid var(--hpl-border);
	border-radius: var(--hpl-radius-card);
}

.hayat-posts-list__empty-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.55;
	color: var(--hpl-text);
}

.hayat-posts-list__empty-text {
	margin: 0;
	max-width: 36em;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.7;
	color: var(--hpl-text-secondary);
}

.hayat-posts-list__pagination {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

.hayat-posts-list__pages {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	background: var(--hpl-brand-soft);
	border-radius: var(--hpl-radius-pill);
}

.hayat-posts-list__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border-radius: var(--hpl-radius-pill);
	color: var(--hpl-text-secondary);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.hayat-posts-list__page:hover:not(.is-active):not(.is-disabled) {
	background: rgba(71, 179, 105, 0.15);
	color: var(--hpl-text);
}

.hayat-posts-list__page.is-active {
	background: var(--hpl-brand);
	color: #ffffff;
}

.hayat-posts-list__page.is-disabled {
	opacity: 0.4;
	pointer-events: none;
}

.hayat-posts-list__page.is-ellipsis {
	pointer-events: none;
}

.hayat-posts-list__page:focus {
	outline: none;
}

.hayat-posts-list__page:focus-visible {
	outline: 3px solid rgba(71, 179, 105, 0.35);
	outline-offset: 2px;
}

@media (max-width: 1023px) {
	.hayat-posts-list {
		--hpl-columns: 2;
		--hpl-media-height: 160px;
	}

	.hayat-posts-list.is-list .hayat-posts-list__media {
		width: 200px;
		min-width: 200px;
	}
}

@media (max-width: 767px) {
	.hayat-posts-list {
		--hpl-columns: 1;
		--hpl-gap: 16px;
		--hpl-media-height: 180px;
	}

	.hayat-posts-list.is-list .hayat-posts-list__card {
		flex-direction: column;
		gap: 16px;
	}

	.hayat-posts-list.is-list .hayat-posts-list__media {
		width: 100%;
		min-width: 0;
		height: var(--hpl-media-height);
		min-height: 0;
	}

	.hayat-posts-list__cta {
		min-height: 44px;
	}

	.hayat-posts-list__page {
		min-width: 44px;
		height: 44px;
	}
}
