/* "เรื่องที่คุณอาจสนใจ" below a post in the new look (switch pr_next_related; markup pr_fw_related_next()).
   Loaded on single posts next to Pixwell's main.css; dark mode follows Pixwell's [data-theme='dark']. */
.pr-rel {
	--rel-bg: #fff;
	--rel-line: rgba(0, 0, 0, .08);
	--rel-text: #1f2328;
	--rel-muted: #6b7280;
	--rel-chip: rgba(0, 0, 0, .05);
	--rel-media: #f1f2f4;
	--rel-accent: var(--g-color, #ff8763);
	margin: 8px 0 48px;
	padding-top: 32px;
	border-top: 1px solid var(--rel-line);
}

[data-theme='dark'] .pr-rel {
	--rel-bg: #1e1f22;
	--rel-line: rgba(255, 255, 255, .1);
	--rel-text: #f3f4f6;
	--rel-muted: #a1a1aa;
	--rel-chip: rgba(255, 255, 255, .08);
	--rel-media: #2a2b2f;
}

.pr-rel__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.pr-rel__title {
	position: relative;
	margin: 0;
	padding-left: 14px;
	font-size: 22px;
	line-height: 1.35;
	color: var(--rel-text);
}

.pr-rel__title::before {
	content: "";
	position: absolute;
	top: .2em;
	bottom: .2em;
	left: 0;
	width: 4px;
	border-radius: 4px;
	background: var(--rel-accent);
}

.pr-rel__all {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 2px;
	font-size: 15px;
	color: var(--rel-text);
	text-decoration: none;
}

.pr-rel__all:hover,
.pr-rel__all:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.pr-rel__all svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: var(--rel-accent);
	stroke-width: 2.25;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pr-rel__list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pr-rel__item {
	display: flex;
	margin: 0;
	padding: 0;
}

.pr-rel__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	border: 1px solid var(--rel-line);
	border-radius: 14px;
	background: var(--rel-bg);
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.pr-rel__card:hover,
.pr-rel__card:focus-within {
	transform: translateY(-3px);
	border-color: transparent;
	box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}

[data-theme='dark'] .pr-rel__card:hover,
[data-theme='dark'] .pr-rel__card:focus-within {
	box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}

.pr-rel__media {
	aspect-ratio: 2 / 1;
	overflow: hidden;
	background: var(--rel-media);
}

.pr-rel__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease;
}

.pr-rel__card:hover .pr-rel__media img {
	transform: scale(1.04);
}

.pr-rel__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 14px 16px 16px;
}

.pr-rel__cat {
	max-width: 100%;
	overflow: hidden;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--rel-chip);
	font-size: 12px;
	line-height: 1.6;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--rel-muted);
}

.pr-rel__name {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.pr-rel__name a {
	color: var(--rel-text);
	text-decoration: none;
}

/* The whole card is the title link. */
.pr-rel__name a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 14px;
}

.pr-rel__name a:focus-visible {
	outline: none;
}

.pr-rel__name a:focus-visible::after {
	outline: 2px solid var(--rel-text);
	outline-offset: 2px;
}

.pr-rel__card:hover .pr-rel__name a {
	text-decoration: underline;
	text-decoration-color: var(--rel-accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

/* No thumbnail: a text card with the accent bar on top. */
.pr-rel__card.is-text {
	border-top: 4px solid var(--rel-accent);
}

.pr-rel__card.is-text .pr-rel__body {
	padding-top: 18px;
}

.pr-rel__card.is-text .pr-rel__name {
	-webkit-line-clamp: 4;
}

.pr-rel__date {
	margin-top: auto;
	font-size: 13px;
	color: var(--rel-muted);
}

@media (max-width: 1023px) {
	.pr-rel__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Phones: a compact list (thumbnail left, title right), all 4 posts visible without sideways scrolling. */
@media (max-width: 767px) {
	.pr-rel {
		margin-bottom: 36px;
		padding-top: 24px;
	}

	.pr-rel__head {
		margin-bottom: 14px;
	}

	.pr-rel__title {
		font-size: 19px;
	}

	.pr-rel__list {
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
	}

	.pr-rel__card {
		flex-direction: row;
		align-items: center;
		border-radius: 12px;
	}

	.pr-rel__name a::after {
		border-radius: 12px;
	}

	.pr-rel__media {
		flex: 0 0 42%;
		align-self: stretch;
		aspect-ratio: auto;
		min-height: 76px;
	}

	.pr-rel__body {
		gap: 6px;
		padding: 10px 12px;
	}

	.pr-rel__cat {
		display: none;
	}

	.pr-rel__name {
		font-size: 15px;
		line-height: 1.45;
	}

	.pr-rel__card.is-text .pr-rel__name {
		-webkit-line-clamp: 3;
	}

	.pr-rel__card.is-text {
		border-top: 1px solid var(--rel-line);
		border-left: 4px solid var(--rel-accent);
	}

	.pr-rel__card.is-text .pr-rel__body {
		padding: 12px 14px;
	}

	.pr-rel__date {
		margin-top: 0;
		font-size: 12px;
	}

	.pr-rel__card:hover,
	.pr-rel__card:focus-within {
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pr-rel__card,
	.pr-rel__media img {
		transition: none;
	}

	.pr-rel__card:hover,
	.pr-rel__card:hover .pr-rel__media img {
		transform: none;
	}
}
