/* ==========================================================
   หน้าบทความ (single.php) — ใช้ร่วมกับ news.css (การ์ดบทความที่เกี่ยวข้อง)
   ========================================================== */
.cx-single {
	--cx-primary: #472c59;
	--cx-primary-2: #6b3f8a;
	--cx-gold: #ffb51e;
	--cx-gold-2: #ffcf3d;
	--cx-text: #1f1430;
	--cx-body: #3b3247;
	--cx-muted: #7a6d87;
	--cx-line: #ece5f2;
	--cx-bg: #f6f2fa;
	--cx-card: #fff;

	position: relative;
	z-index: 1;
	background: var(--cx-bg);
	color: var(--cx-body);
	padding: 1.5rem 0 4rem;
}

.cx-single .container {
	max-width: 1180px;
}

.cx-single a {
	text-decoration: none;
}

/* Breadcrumb */
.cx-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .25rem .5rem;
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
	font-size: .85rem;
}

.cx-crumbs li {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	color: var(--cx-muted);
	min-width: 0;
}

.cx-crumbs li + li::before {
	content: "\203A";
	color: #c4b6d1;
}

.cx-crumbs a {
	color: var(--cx-primary);
}

.cx-crumbs a:hover {
	color: var(--cx-gold);
}

.cx-crumbs [aria-current] span {
	display: inline-block;
	max-width: 32ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: bottom;
}

/* กล่องบทความ */
.cx-article {
	background: #fff;
	border-radius: 24px;
	box-shadow: 0 10px 40px rgba(71, 44, 89, .08);
	overflow: hidden;
}

.cx-article__head {
	padding: 2.5rem 3rem 1.75rem;
	max-width: 900px;
}

.cx-article__cat {
	display: inline-block;
	padding: .25rem .85rem;
	margin-bottom: 1rem;
	border-radius: 999px;
	background: linear-gradient(180deg, var(--cx-gold-2), var(--cx-gold));
	color: var(--cx-primary) !important;
	font-size: .8rem;
	font-weight: 600;
}

.cx-article__title {
	margin: 0 0 1rem;
	color: var(--cx-text);
	font-size: clamp(1.6rem, 3.6vw, 2.5rem);
	font-weight: 700;
	line-height: 1.35;
}

.cx-article__lead {
	margin: 0 0 1.25rem;
	color: var(--cx-muted);
	font-size: 1.1rem;
	line-height: 1.7;
}

.cx-article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .6rem 1.4rem;
	color: var(--cx-muted);
	font-size: .88rem;
}

.cx-meta {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
}

.cx-meta i {
	color: var(--cx-gold);
}

.cx-meta--author a {
	color: var(--cx-primary);
	font-weight: 600;
}

.cx-meta__avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 2px solid var(--cx-gold-2);
}

.cx-article__cover {
	margin: 0;
	padding: 0 3rem;
}

.cx-article__cover img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 620px;
	object-fit: cover;
	border-radius: 18px;
}

.cx-article__cover figcaption {
	margin-top: .6rem;
	text-align: center;
	color: var(--cx-muted);
	font-size: .82rem;
}

/* เนื้อหา + สารบัญด้านข้าง */
.cx-article__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: 3rem;
	padding: 2.25rem 3rem 3rem;
}

.cx-article__layout.-no-aside {
	grid-template-columns: minmax(0, 820px);
	justify-content: center;
}

.cx-article__main {
	min-width: 0;
}

/* สารบัญ */
.cx-toc {
	border: 1px solid var(--cx-line);
	border-radius: 16px;
	background: #fbf9fd;
}

.cx-toc--sticky {
	position: sticky;
	top: 90px;
	padding: 1.1rem 1rem;
	max-height: calc(100vh - 120px);
	overflow: auto;
}

.cx-toc__title,
.cx-toc summary {
	color: var(--cx-text);
	font-weight: 600;
	margin-bottom: .6rem;
}

.cx-toc__title i,
.cx-toc summary i {
	color: var(--cx-gold);
	margin-right: .3rem;
}

.cx-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cx-toc__list li.-h3 {
	padding-left: 1rem;
	font-size: .9em;
}

.cx-toc__list a {
	display: block;
	padding: .35rem .6rem;
	border-left: 2px solid transparent;
	border-radius: 0 8px 8px 0;
	color: var(--cx-body);
	font-size: .9rem;
	line-height: 1.5;
	transition: all .2s ease;
}

.cx-toc__list a:hover,
.cx-toc__list a.-active {
	color: var(--cx-primary);
	background: rgba(255, 181, 30, .12);
	border-left-color: var(--cx-gold);
}

.cx-toc--inline {
	display: none;
	padding: .9rem 1.1rem;
	margin-bottom: 1.75rem;
}

.cx-toc--inline summary {
	cursor: pointer;
	margin: 0;
	list-style: none;
}

.cx-toc--inline summary::-webkit-details-marker {
	display: none;
}

.cx-toc--inline summary::after {
	content: "\25BE";
	float: right;
	color: var(--cx-muted);
	transition: transform .2s ease;
}

.cx-toc--inline[open] summary::after {
	transform: rotate(180deg);
}

.cx-toc--inline[open] .cx-toc__list {
	margin-top: .6rem;
}

/* ตัวอักษรเนื้อหา */
.cx-prose {
	color: var(--cx-body);
	font-size: 1.06rem;
	line-height: 1.9;
	word-wrap: break-word;
}

.cx-prose > *:first-child {
	margin-top: 0;
}

.cx-prose p {
	margin: 0 0 1.35em;
}

.cx-prose h2,
.cx-prose h3,
.cx-prose h4 {
	color: var(--cx-text);
	font-weight: 700;
	line-height: 1.45;
	scroll-margin-top: 100px;
}

.cx-prose h2 {
	position: relative;
	margin: 2.2em 0 .8em;
	padding-left: 1rem;
	font-size: 1.55rem;
}

.cx-prose h2::before {
	content: "";
	position: absolute;
	left: 0;
	top: .2em;
	bottom: .2em;
	width: 5px;
	border-radius: 4px;
	background: linear-gradient(180deg, var(--cx-gold-2), var(--cx-gold));
}

.cx-prose h3 {
	margin: 1.8em 0 .6em;
	font-size: 1.25rem;
	color: var(--cx-primary);
}

.cx-prose h4 {
	margin: 1.5em 0 .5em;
	font-size: 1.08rem;
}

.cx-prose a {
	color: var(--cx-primary-2);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgba(255, 181, 30, .7);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.cx-prose a:hover {
	color: var(--cx-primary);
	text-decoration-color: var(--cx-gold);
}

.cx-prose strong {
	color: var(--cx-text);
}

.cx-prose ul,
.cx-prose ol {
	display: block;
	margin: 0 0 1.35em;
	padding-left: 1.4em;
}

.cx-prose li {
	margin-bottom: .45em;
}

.cx-prose ul li::marker {
	color: var(--cx-gold);
}

.cx-prose ol li::marker {
	color: var(--cx-primary);
	font-weight: 600;
}

.cx-prose img {
	max-width: 100%;
	height: auto;
	border-radius: 14px;
}

.cx-prose figure {
	margin: 1.8em 0;
	max-width: 100%;
}

.cx-prose figcaption,
.cx-prose .wp-caption-text {
	margin-top: .5em;
	text-align: center;
	color: var(--cx-muted);
	font-size: .85rem;
}

.cx-prose blockquote {
	margin: 1.8em 0;
	padding: 1.2rem 1.5rem;
	border-left: 4px solid var(--cx-gold);
	border-radius: 0 14px 14px 0;
	background: #fff8e8;
	color: var(--cx-text);
	font-size: 1.08rem;
}

.cx-prose blockquote p:last-child {
	margin-bottom: 0;
}

.cx-prose table {
	width: 100%;
	margin: 1.5em 0;
	border-collapse: collapse;
	font-size: .95rem;
	display: block;
	overflow-x: auto;
}

.cx-prose th,
.cx-prose td {
	padding: .7rem .9rem;
	border: 1px solid var(--cx-line);
	text-align: left;
}

.cx-prose th {
	background: var(--cx-primary);
	color: #fff;
	font-weight: 600;
}

.cx-prose tr:nth-child(even) td {
	background: #fbf9fd;
}

.cx-prose iframe,
.cx-prose video {
	max-width: 100%;
	border-radius: 14px;
}

.cx-prose .wp-block-embed__wrapper iframe,
.cx-prose iframe[src*="youtube"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

.cx-prose hr {
	margin: 2.5em 0;
	border: 0;
	height: 1px;
	background: var(--cx-line);
}

.cx-prose code {
	padding: .1em .4em;
	border-radius: 6px;
	background: #f3eef8;
	color: var(--cx-primary);
	font-size: .9em;
}

/* แท็ก */
.cx-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem;
	margin-top: 2.25rem;
}

.cx-tags__label {
	color: var(--cx-text);
	font-weight: 600;
	font-size: .9rem;
	margin-right: .25rem;
}

.cx-tags__label i {
	color: var(--cx-gold);
}

.cx-tags a {
	padding: .3rem .85rem;
	border-radius: 999px;
	background: #f3eef8;
	color: var(--cx-primary);
	font-size: .85rem;
	transition: all .2s ease;
}

.cx-tags a:hover {
	background: var(--cx-primary);
	color: #fff;
}

/* แชร์ */
.cx-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 2rem;
	padding: 1.1rem 1.4rem;
	border-radius: 16px;
	background: linear-gradient(135deg, var(--cx-primary), var(--cx-primary-2));
}

.cx-share__label {
	color: #fff;
	font-weight: 600;
}

.cx-share__btns {
	display: flex;
	gap: .55rem;
}

.cx-share__btns a,
.cx-share__btns button {
	width: 42px;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	color: #fff;
	font-size: 1.05rem;
	cursor: pointer;
	transition: transform .2s ease, filter .2s ease;
}

.cx-share__btns a:hover,
.cx-share__btns button:hover {
	color: #fff;
	transform: translateY(-2px);
	filter: brightness(1.1);
}

.cx-share__btns .-fb { background: #1877f2; }
.cx-share__btns .-line { background: #06c755; }
.cx-share__btns .-x { background: #111; }
.cx-share__btns .-copy { background: linear-gradient(180deg, var(--cx-gold-2), var(--cx-gold)); color: var(--cx-primary); }
.cx-share__btns .-copy.-done { background: #06c755; color: #fff; }

/* ก่อนหน้า / ถัดไป */
.cx-postnav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-top: 2rem;
}

.cx-postnav__item {
	display: flex;
	flex-direction: column;
	gap: .35rem;
	padding: 1.1rem 1.25rem;
	border: 1px solid var(--cx-line);
	border-radius: 16px;
	background: #fff;
	transition: all .25s ease;
}

.cx-postnav__item.-next {
	text-align: right;
	grid-column: 2;
}

.cx-postnav__item:hover {
	border-color: var(--cx-gold);
	box-shadow: 0 8px 24px rgba(71, 44, 89, .1);
	transform: translateY(-2px);
}

.cx-postnav__dir {
	color: var(--cx-muted);
	font-size: .8rem;
}

.cx-postnav__title {
	color: var(--cx-text);
	font-weight: 600;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* บทความที่เกี่ยวข้อง */
.cx-related {
	margin-top: 3.5rem;
}

.cx-related__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.cx-related__head h2 {
	margin: 0;
	color: var(--cx-text);
	font-size: 1.6rem;
	font-weight: 700;
}

.cx-related__head h2::after {
	content: "";
	display: block;
	width: 48px;
	height: 4px;
	margin-top: .5rem;
	border-radius: 4px;
	background: linear-gradient(90deg, var(--cx-gold-2), var(--cx-gold));
}

.cx-related__head a {
	color: var(--cx-primary);
	font-weight: 600;
	font-size: .9rem;
	white-space: nowrap;
}

.cx-related .cx-card__title {
	font-size: 1.02rem;
}

/* ความคิดเห็น */
.cx-comments {
	margin-top: 3.5rem;
	padding: 2.25rem 3rem;
	background: #fff;
	border-radius: 24px;
	box-shadow: 0 10px 40px rgba(71, 44, 89, .06);
	color: var(--cx-body);
}

.cx-comments .comments-title,
.cx-comments .comment-reply-title {
	color: var(--cx-text);
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 1.25rem;
}

.cx-comments .comments-title i,
.cx-comments .comment-reply-title i {
	color: var(--cx-gold);
}

.cx-comments .comment-reply-title small {
	margin-left: .75rem;
	font-size: .85rem;
}

.cx-comments .comment-list,
.cx-comments .comment-list .children {
	display: block;
	list-style: none;
	margin: 0;
	padding: 0;
}

.cx-comments .comment-list .children {
	padding-left: 2.5rem;
}

.cx-comments .comment-body {
	padding: 1.1rem 0;
	border-bottom: 1px solid var(--cx-line);
}

.cx-comments .comment-author {
	display: flex;
	align-items: center;
	gap: .6rem;
	color: var(--cx-text);
	font-weight: 600;
}

.cx-comments .comment-author .avatar {
	border-radius: 50%;
}

.cx-comments .comment-author .says {
	display: none;
}

.cx-comments .comment-metadata {
	margin: .2rem 0 .5rem 3.4rem;
	font-size: .8rem;
}

.cx-comments .comment-metadata a {
	color: var(--cx-muted);
}

.cx-comments .comment-content,
.cx-comments .reply {
	margin-left: 3.4rem;
}

.cx-comments .comment-reply-link {
	color: var(--cx-primary);
	font-size: .85rem;
	font-weight: 600;
}

.cx-comments .comment-respond {
	margin-top: 1.5rem;
}

.cx-comments .comment-notes,
.cx-comments .logged-in-as {
	color: var(--cx-muted);
	font-size: .88rem;
}

.cx-comments .logged-in-as a {
	color: var(--cx-primary);
	margin-right: .5rem;
}

.cx-comments .required {
	color: #e5484d;
}

.cx-comments label {
	display: block;
	margin-bottom: .35rem;
	color: var(--cx-text);
	font-weight: 500;
	font-size: .9rem;
}

.cx-comments textarea,
.cx-comments input[type="text"],
.cx-comments input[type="email"],
.cx-comments input[type="url"] {
	width: 100%;
	padding: .8rem 1rem;
	border: 1.5px solid var(--cx-line);
	border-radius: 12px;
	background: #fbf9fd;
	color: var(--cx-text);
	font-family: inherit;
	font-size: 1rem;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.cx-comments textarea:focus,
.cx-comments input:focus {
	outline: 0;
	border-color: var(--cx-primary-2);
	box-shadow: 0 0 0 4px rgba(107, 63, 138, .12);
	background: #fff;
}

.cx-comments .comment-form-cookies-consent {
	display: flex;
	align-items: center;
	gap: .5rem;
	font-size: .85rem;
}

.cx-comments .comment-form-cookies-consent label {
	display: inline;
	margin: 0;
	font-weight: 400;
}

.cx-comments .form-submit .submit {
	padding: .75rem 2rem;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(180deg, var(--cx-gold-2), var(--cx-gold));
	color: var(--cx-primary);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(255, 181, 30, .35);
	transition: transform .2s ease;
}

.cx-comments .form-submit .submit:hover {
	transform: translateY(-2px);
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
	.cx-article__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		padding: 2rem;
	}

	.cx-article__aside {
		display: none;
	}

	.cx-toc--inline {
		display: block;
	}

	.cx-article__head {
		padding: 2rem 2rem 1.5rem;
	}

	.cx-article__cover {
		padding: 0 2rem;
	}

	.cx-comments {
		padding: 2rem;
	}
}

@media (max-width: 575.98px) {
	.cx-single {
		padding: 1rem 0 3rem;
	}

	.cx-single .container {
		padding-left: 12px;
		padding-right: 12px;
	}

	.cx-crumbs [aria-current] span {
		max-width: 18ch;
	}

	.cx-article {
		border-radius: 18px;
	}

	.cx-article__head {
		padding: 1.5rem 1.15rem 1.25rem;
	}

	.cx-article__meta {
		gap: .5rem 1rem;
		font-size: .82rem;
	}

	.cx-article__cover {
		padding: 0;
	}

	.cx-article__cover img {
		border-radius: 0;
	}

	.cx-article__layout {
		padding: 1.5rem 1.15rem 1.75rem;
	}

	.cx-prose {
		font-size: 1rem;
		line-height: 1.85;
	}

	.cx-prose h2 {
		font-size: 1.3rem;
	}

	.cx-prose h3 {
		font-size: 1.12rem;
	}

	.cx-share {
		flex-direction: column;
		text-align: center;
	}

	.cx-postnav {
		grid-template-columns: 1fr;
	}

	.cx-postnav__item.-next {
		grid-column: 1;
	}

	.cx-related__head h2 {
		font-size: 1.3rem;
	}

	.cx-comments {
		padding: 1.5rem 1.15rem;
		border-radius: 18px;
	}

	.cx-comments .comment-list .children {
		padding-left: 1rem;
	}

	.cx-comments .comment-metadata,
	.cx-comments .comment-content,
	.cx-comments .reply {
		margin-left: 0;
	}
}
