/**
 * Стили плагина Related Posts
 *
 * Блок перелинковки с похожими записями.
 * Карточки в горизонтальной прокрутке.
 *
 * @package PLG_Related_Posts
 */

/* Блок перелинковки */
.related-posts {
	position: relative;
	z-index: 10;
	margin: 30px 0;
	padding: 0;
}

/* Выход за пределы контейнера только на широких экранах (от 1200px) */
@media (min-width: 1200px) {
	.related-posts {
		margin-left: calc(-50vw + 50%);
		margin-right: calc(-50vw + 50%);
	}
}

.related-posts__title {
	font-family: 'EB Garamond', Georgia, serif;
	font-size: 22px;
	font-weight: 600;
	color: #343444;
	margin-bottom: 5px;
	/* Заголовки в пределах контейнера (900px как #primary на десктопе) */
	max-width: 900px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 20px;
	padding-right: 20px;
}

.related-posts__subtitle {
	font-family: 'EB Garamond', Georgia, serif;
	font-size: 16px;
	font-style: italic;
	color: #6b6b6b;
	margin-bottom: 15px;
	max-width: 900px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 20px;
	padding-right: 20px;
}

.related-posts__grid {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding-left: 20px;
	padding-right: 20px;
}

/* На средних экранах (841-1199px) — центрирование через padding */
@media (min-width: 841px) and (max-width: 1199px) {
	.related-posts__grid {
		/* 3 карточки по 265px + 2 gap по 10px = 815px */
		padding-left: max(20px, calc((100% - 815px) / 2));
		padding-right: max(20px, calc((100% - 815px) / 2));
	}
}

/* На широких экранах — центрирование через padding от viewport */
@media (min-width: 1200px) {
	.related-posts__grid {
		padding-left: calc((100vw - 815px) / 2);
		padding-right: calc((100vw - 815px) / 2);
	}
}

.related-posts__grid::-webkit-scrollbar {
	display: none;
}

/* Карточка */
.related-card {
	flex: 0 0 265px; /* Фиксированная ширина */
	display: flex;
	flex-direction: row;
	align-items: center;
	text-align: left;
	text-decoration: none;
	color: inherit;
	padding: 12px 12px 12px 20px;
	gap: 12px;
	height: 150px;
	border-radius: 8px;
	background-size: 100% 100%;
	transition: transform 0.15s ease;
}

/* Эффект приподнятия только на десктопе */
@media (min-width: 841px) {
	.related-card:hover {
		transform: translateY(-3px);
	}
}

.related-card__image-wrap {
	width: auto;
	flex-shrink: 0;
}

.related-card__image {
	width: 100px;
	height: 100px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.related-card__content {
	display: flex;
	flex-direction: column;
	flex: 1;
	justify-content: center;
	align-items: center;
	text-align: center;
	gap: 8px;
}

.related-card__title {
	font-family: 'EB Garamond', Georgia, serif;
	font-size: 0.9rem;
	font-weight: 600;
	color: #4a3520;
	line-height: 1.3;
}

/* Планшет и мобильные */
@media (max-width: 840px) {
	.related-posts {
		overflow: hidden; /* Предотвращает плавание страницы при скролле карточек */
	}
	.related-posts__title,
	.related-posts__subtitle {
		padding-left: 15px;
		padding-right: 15px;
	}
	.related-posts__grid {
		padding-left: 10px;
		padding-right: 10px;
	}
}

