/*
 * MG99CLUB — หน้าข่าวสารล่าสุด: การ์ดบทความ, กริด, breadcrumb, ปุ่มเปลี่ยนหน้า
 * (ใช้ร่วมกับหน้าแสดงบทความ เช่นการ์ดบทความที่เกี่ยวข้อง)
 */

:root {
	--mg-card-bg:
		radial-gradient(120% 80% at 0 0, rgba(241, 25, 98, .14), transparent 58%),
		linear-gradient(165deg, rgba(64, 10, 58, .5) 0%, rgba(12, 3, 14, .94) 72%, rgba(8, 1, 9, .96) 100%);
	--mg-card-border: rgba(255, 255, 255, .09);
	--mg-radius: 18px;
}

body .mg-news,
body .mg-single {
	position: relative;
	padding-top: 40px;
	padding-bottom: 72px;
	color: var(--mg-text, #d2d2d2);
	font-family: "Kanit", sans-serif;
}

/* แสงพื้นหลังจาง ๆ ให้หน้าดูมีมิติแบบเว็บเกม */
body .mg-news::before,
body .mg-latest::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 0;
	height: 420px;
	background:
		radial-gradient(60% 100% at 50% 0, rgba(241, 25, 98, .16), transparent 70%),
		radial-gradient(40% 80% at 85% 10%, rgba(236, 189, 123, .08), transparent 70%);
	pointer-events: none;
}

body .mg-news > .container,
body .mg-latest > .container {
	position: relative;
	z-index: 1;
}

@media (max-width: 767.98px) {
	body .mg-news,
	body .mg-single {
		padding-top: 24px;
		padding-bottom: 110px; /* เว้นที่ให้แถบเมนูล่างบนมือถือ */
	}
}

/* ---------- breadcrumb ---------- */
body .mg-breadcrumb {
	margin-bottom: 18px;
	font-size: .88rem;
}

body .mg-breadcrumb .mg-breadcrumb__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

body .mg-breadcrumb .mg-breadcrumb__item {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	color: rgba(255, 255, 255, .5);
}

body .mg-breadcrumb .mg-breadcrumb__item + .mg-breadcrumb__item::before {
	content: "›";
	margin: 0 8px;
	color: var(--mg-gold, #ecbd7b);
	opacity: .75;
}

body .mg-breadcrumb .mg-breadcrumb__item a {
	color: rgba(255, 255, 255, .76);
	text-decoration: none;
	transition: color .2s ease;
}

body .mg-breadcrumb .mg-breadcrumb__item a:hover {
	margin: 0;
	color: var(--mg-yellow, #f0df70);
	text-decoration: none;
}

body .mg-breadcrumb .mg-breadcrumb__item[aria-current] span,
body .mg-breadcrumb .mg-breadcrumb__item[aria-current] {
	overflow: hidden;
	max-width: 100%;
	color: rgba(255, 255, 255, .5);
	white-space: nowrap;
	text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
	body .mg-breadcrumb .mg-breadcrumb__item[aria-current] span {
		max-width: 60vw;
	}
}

/* ---------- ส่วนหัวหน้าข่าวสาร ---------- */
body .mg-news__head {
	margin-bottom: 32px;
	text-align: center;
}

body .mg-news__head .mg-breadcrumb__list {
	justify-content: center;
}

body .mg-news .mg-news__title {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 10px;
	font-size: clamp(1.8rem, 4.2vw, 2.65rem);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -.01em;
}

body .mg-news .mg-news__title span {
	background-image: var(--mg-grad-text-gold, linear-gradient(180deg, #ffe7b5 6%, #ecbd7b 46%, #a8794a 100%));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	filter: drop-shadow(0 2px 10px rgba(236, 189, 123, .22));
}

body .mg-news .mg-news__title .mg-icon {
	color: var(--mg-gold, #ecbd7b);
	font-size: .9em;
	filter: drop-shadow(0 0 10px rgba(236, 189, 123, .55));
}

body .mg-news__head::after {
	content: "";
	display: block;
	width: 60%;
	max-width: 440px;
	height: 1px;
	margin: 20px auto 0;
	background: var(--mg-hairline, linear-gradient(90deg, transparent, #ecbd7b 30%, #ecbd7b 70%, transparent));
}

body .mg-news__intro {
	max-width: 680px;
	margin: 0 auto;
	color: #a7a1ab;
	font-size: 1rem;
	font-weight: 300;
	line-height: 1.85;
}

body .mg-news__intro p:last-child {
	margin-bottom: 0;
}

body .mg-news__page-no {
	display: inline-flex;
	align-items: center;
	margin: 12px 0 0;
	padding: 4px 14px;
	color: var(--mg-yellow, #f0df70);
	font-size: .85rem;
	background: rgba(240, 223, 112, .08);
	border: 1px solid rgba(240, 223, 112, .22);
	border-radius: 999px;
}

/* ---------- กริด: 3 / 2 / 1 คอลัมน์ ---------- */
body .mg-news__grid,
body .mg-related__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

@media (max-width: 991.98px) {
	body .mg-news__grid,
	body .mg-related__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 18px;
	}
}

@media (max-width: 575.98px) {
	body .mg-news__grid,
	body .mg-related__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}
}

/* ---------- การ์ดบทความ ---------- */
body .mg-card {
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
	min-width: 0;
	margin: 0;
	background: var(--mg-card-bg);
	border: 1px solid var(--mg-card-border);
	border-radius: var(--mg-radius);
	box-shadow: var(--mg-shadow-card, 0 18px 44px -26px rgba(0, 0, 0, .95)), inset 0 1px 0 rgba(255, 255, 255, .06);
	transition:
		transform .3s var(--mg-ease, ease),
		border-color .3s var(--mg-ease, ease),
		box-shadow .3s var(--mg-ease, ease);
}

/* เส้นนีออนบนหัวการ์ด */
body .mg-card::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 3;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--mg-neon, #fd3386) 25%, var(--mg-gold, #ecbd7b) 75%, transparent);
	opacity: .35;
	transition: opacity .3s var(--mg-ease, ease);
	pointer-events: none;
}

body .mg-card:hover,
body .mg-card:focus-within {
	border-color: rgba(253, 51, 134, .5);
	box-shadow:
		0 0 0 1px rgba(253, 51, 134, .22),
		0 26px 54px -24px rgba(241, 25, 98, .6),
		inset 0 1px 0 rgba(255, 255, 255, .1);
	transform: translateY(-6px);
}

body .mg-card:hover::after,
body .mg-card:focus-within::after {
	opacity: 1;
}

body .mg-cover {
	display: block;
	position: relative;
	overflow: hidden;
	background: #12030f;
}

body .mg-card .mg-card__media {
	aspect-ratio: 16 / 9;
}

/* เงาไล่สีบนรูป ให้ตัวอักษรอ่านง่ายและดูมีมิติ */
body .mg-cover::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		linear-gradient(180deg, rgba(8, 1, 9, .3) 0%, transparent 32%),
		linear-gradient(0deg, rgba(8, 1, 9, .45) 0%, transparent 46%);
	opacity: .9;
	transition: opacity .3s var(--mg-ease, ease);
	pointer-events: none;
}

/* แสงกวาดผ่านรูปตอน hover */
body .mg-cover::after {
	content: "";
	position: absolute;
	top: -20%;
	bottom: -20%;
	left: -70%;
	z-index: 2;
	width: 45%;
	background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .22), transparent);
	opacity: 0;
	transform: skewX(-16deg);
	pointer-events: none;
}

body .mg-card:hover .mg-cover::after {
	animation: mg-cover-sheen .9s var(--mg-ease, ease) forwards;
}

@keyframes mg-cover-sheen {
	0% {
		left: -70%;
		opacity: 0;
	}

	30% {
		opacity: 1;
	}

	100% {
		left: 120%;
		opacity: 0;
	}
}

body .mg-cover img,
body .mg-cover .mg-cover__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s var(--mg-ease, ease), filter .4s ease;
}

body .mg-card:hover .mg-cover img {
	filter: saturate(1.08);
	transform: scale(1.06);
}

/* ไม่มีรูป: โลโก้บนพื้นสีธีม */
body .mg-cover .mg-cover__fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 12%;
	background:
		radial-gradient(70% 90% at 50% 0, rgba(255, 122, 167, .42), transparent 70%),
		linear-gradient(153deg, #1a0320 0%, #600030 100%);
}

body .mg-cover .mg-cover__fallback img {
	width: auto;
	max-width: 70%;
	height: auto;
	max-height: 70%;
	object-fit: contain;
	filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .6));
}

body .mg-card:hover .mg-cover__fallback img {
	transform: scale(1.04);
}

body .mg-card .mg-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	padding: 18px 20px 20px;
}

body .mg-badge {
	display: inline-flex;
	align-items: center;
	position: relative;
	z-index: 2;
	padding: 4px 13px;
	color: #fff;
	font-size: .76rem;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: .02em;
	text-decoration: none;
	background: var(--mg-grad-pink, radial-gradient(100% 100% at 50% 0, #ff7aa7 0, #f11962 44%, #9a0957 100%));
	border-radius: 999px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 6px 1px rgba(208, 30, 70, .9), 0 6px 16px -8px rgba(241, 25, 98, .8);
	transition: filter .2s ease, transform .2s var(--mg-ease, ease);
}

body .mg-badge:hover {
	margin: 0;
	color: #fff;
	text-decoration: none;
	filter: brightness(1.15);
	transform: translateY(-1px);
}

body .mg-card .mg-card__title {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	color: #fff;
	font-size: 1.1rem;
	font-weight: 500;
	line-height: 1.55;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	transition: color .2s ease;
}

body .mg-card .mg-card__link {
	color: inherit;
	text-decoration: none;
}

/* ทำให้คลิกได้ทั้งการ์ด */
body .mg-card .mg-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

body .mg-card .mg-card__link:hover,
body .mg-card .mg-card__link:focus {
	margin: 0;
	color: var(--mg-yellow, #f0df70);
	text-decoration: none;
}

body .mg-card .mg-card__link:focus-visible {
	outline: none;
}

body .mg-card:has(.mg-card__link:focus-visible) {
	outline: 2px solid var(--mg-yellow, #f0df70);
	outline-offset: 2px;
}

body .mg-card .mg-card__date {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #9a93a1;
	font-size: .85rem;
}

body .mg-card .mg-card__date .mg-icon {
	color: var(--mg-gold, #ecbd7b);
}

body .mg-card .mg-card__excerpt {
	margin: 0;
	color: #bdb7c2;
	font-size: .98rem;
	font-weight: 300;
	line-height: 1.8;
}

body .mg-card .mg-card__more {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: auto;
	padding-top: 6px;
	color: var(--mg-gold, #ecbd7b);
	font-size: .92rem;
	font-weight: 500;
	transition: color .2s ease;
}

body .mg-card .mg-card__more .mg-icon {
	transition: transform .25s var(--mg-ease, ease);
}

body .mg-card:hover .mg-card__more {
	color: var(--mg-yellow, #f0df70);
}

body .mg-card:hover .mg-card__more .mg-icon {
	transform: translateX(5px);
}

/* การ์ดใหญ่เต็มแถว (บทความล่าสุด) */
body .mg-card.mg-card--featured {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
	border-color: rgba(236, 189, 123, .28);
}

body .mg-card.mg-card--featured .mg-card__media {
	aspect-ratio: auto;
	min-height: 340px;
}

body .mg-card.mg-card--featured .mg-card__media > img {
	position: absolute;
	inset: 0;
}

body .mg-card.mg-card--featured .mg-card__body {
	justify-content: center;
	gap: 14px;
	padding: 34px 38px;
	background: radial-gradient(90% 120% at 100% 0, rgba(241, 25, 98, .12), transparent 62%);
}

body .mg-card.mg-card--featured .mg-card__title {
	font-size: clamp(1.4rem, 2.4vw, 1.9rem);
	font-weight: 600;
	line-height: 1.45;
	-webkit-line-clamp: 3;
}

body .mg-card.mg-card--featured .mg-card__more {
	margin-top: 6px;
	padding: 10px 24px;
	color: #fff;
	background: var(--mg-grad-pink, radial-gradient(100% 100% at 50% 0, #ff7aa7 0, #f11962 44%, #9a0957 100%));
	border-radius: 30px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 10px 2px #d01e46, 0 12px 26px -10px rgba(241, 25, 98, .8);
	transition: filter .2s ease, transform .25s var(--mg-ease, ease), box-shadow .25s var(--mg-ease, ease);
}

body .mg-card.mg-card--featured:hover .mg-card__more {
	color: #fff;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 12px 2px #d01e46, 0 16px 32px -10px rgba(241, 25, 98, .95);
	filter: brightness(1.08);
}

body .mg-card.mg-card--featured::before {
	content: "ล่าสุด";
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 4;
	padding: 3px 14px;
	color: #3b2a00;
	font-size: .76rem;
	font-weight: 600;
	letter-spacing: .02em;
	background: var(--mg-grad-gold, radial-gradient(100% 100% at 50% 0, #ffed7b 0, #f0df70 44%, #564b00 100%));
	border-radius: 999px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 16px -4px rgba(0, 0, 0, .7), 0 0 18px -4px rgba(240, 223, 112, .7);
}

@media (max-width: 767.98px) {
	body .mg-card.mg-card--featured {
		display: flex;
	}

	body .mg-card.mg-card--featured .mg-card__media {
		min-height: 0;
		aspect-ratio: 16 / 9;
	}

	body .mg-card.mg-card--featured .mg-card__media > img {
		position: static;
	}

	body .mg-card.mg-card--featured .mg-card__body {
		padding: 20px;
	}

	body .mg-card.mg-card--featured .mg-card__excerpt {
		display: -webkit-box;
		overflow: hidden;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
	}
}

/* ---------- ปุ่มเปลี่ยนหน้า ---------- */
body .mg-pagination {
	margin-top: 48px;
}

body .mg-pagination .mg-pagination__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body .mg-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	color: #e9e9e9;
	font-size: .95rem;
	text-decoration: none;
	background: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .03));
	border: 1px solid rgba(255, 255, 255, .13);
	border-radius: 999px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
	transition:
		background-color .2s ease,
		border-color .2s ease,
		color .2s ease,
		box-shadow .25s var(--mg-ease, ease),
		transform .2s var(--mg-ease, ease);
}

body .mg-pagination a.page-numbers:hover {
	margin: 0;
	color: #fff;
	text-decoration: none;
	background: rgba(255, 255, 255, .14);
	border-color: rgba(253, 51, 134, .6);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 10px 22px -12px rgba(241, 25, 98, .9);
	transform: translateY(-2px);
}

body .mg-pagination .page-numbers.current {
	color: #fff;
	font-weight: 600;
	background: var(--mg-grad-pink, radial-gradient(100% 100% at 50% 0, #ff7aa7 0, #f11962 44%, #9a0957 100%));
	border-color: transparent;
	box-shadow: 0 12px 26px -8px rgba(241, 25, 98, .8), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 8px 1px rgba(208, 30, 70, .7);
}

body .mg-pagination .page-numbers.dots {
	min-width: 28px;
	padding: 0;
	background: none;
	border: 0;
	box-shadow: none;
}

body .mg-pagination .prev,
body .mg-pagination .next {
	color: var(--mg-gold, #ecbd7b);
	border-color: rgba(236, 189, 123, .38);
}

@media (max-width: 575.98px) {
	body .mg-pagination .page-numbers {
		min-width: 40px;
		height: 40px;
		padding: 0 12px;
	}

	body .mg-pagination .mg-pagination__label {
		position: absolute;
		overflow: hidden;
		clip: rect(1px, 1px, 1px, 1px);
		width: 1px;
		height: 1px;
		white-space: nowrap;
	}
}

/* ---------- หัวข้อส่วน (บทความล่าสุด / ที่เกี่ยวข้อง) ---------- */
body .mg-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 22px;
}

body .mg-section-head .mg-section-head__title {
	position: relative;
	margin: 0;
	padding-left: 18px;
	color: #fff;
	font-size: clamp(1.3rem, 3vw, 1.6rem);
	font-weight: 600;
	letter-spacing: -.01em;
}

body .mg-section-head .mg-section-head__title::before {
	content: "";
	position: absolute;
	top: .15em;
	bottom: .15em;
	left: 0;
	width: 5px;
	background: linear-gradient(180deg, #ffed7b, #ecbd7b 45%, var(--mg-pink, #f11962));
	border-radius: 4px;
	box-shadow: 0 0 14px rgba(236, 189, 123, .55);
}

body .mg-section-head .mg-section-head__more {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	gap: 7px;
	padding: 7px 16px;
	color: var(--mg-gold, #ecbd7b);
	font-size: .92rem;
	text-decoration: none;
	background: rgba(255, 255, 255, .04);
	border: 1px solid rgba(236, 189, 123, .26);
	border-radius: 999px;
	transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s var(--mg-ease, ease);
}

body .mg-section-head .mg-section-head__more .mg-icon {
	transition: transform .25s var(--mg-ease, ease);
}

body .mg-section-head .mg-section-head__more:hover {
	margin: 0;
	color: var(--mg-yellow, #f0df70);
	text-decoration: none;
	background: rgba(240, 223, 112, .1);
	border-color: rgba(240, 223, 112, .45);
	transform: translateY(-1px);
}

body .mg-section-head .mg-section-head__more:hover .mg-icon {
	transform: translateX(4px);
}

/* ---------- บทความล่าสุด (หน้าแรก / เพจ) ---------- */
body .mg-latest {
	position: relative;
	padding: 60px 0 68px;
	font-family: "Kanit", sans-serif;
}

body .mg-latest .mg-latest__footer {
	margin-top: 34px;
	text-align: center;
}

body .mg-latest .mg-latest__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	width: auto;
	min-width: 230px;
	padding: 13px 30px;
	color: #fff;
	font-size: 1rem;
	font-weight: 500;
	text-decoration: none;
	transition: filter .2s ease, transform .25s var(--mg-ease, ease), box-shadow .25s var(--mg-ease, ease);
}

body .mg-latest .mg-latest__btn:hover {
	margin: 0;
	color: #fff;
	text-decoration: none;
	background-image: var(--mg-grad-pink, radial-gradient(100% 100% at 50% 0, #ff7aa7 0, #f11962 44%, #9a0957 100%));
	filter: brightness(1.08);
	transform: translateY(-2px);
}

@media (max-width: 767.98px) {
	body .mg-latest {
		padding: 40px 0 110px; /* เว้นที่ให้แถบเมนูล่างบนมือถือ */
	}
}

/* ---------- ไม่มีบทความ ---------- */
body .mg-empty {
	padding: 52px 20px;
	text-align: center;
	background: var(--mg-card-bg);
	border: 1px dashed rgba(236, 189, 123, .32);
	border-radius: var(--mg-radius);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

body .mg-empty .mg-empty__btn {
	display: inline-flex;
	justify-content: center;
	width: auto;
	padding: 11px 30px;
	color: #fff;
	font-weight: 500;
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	body .mg-card,
	body .mg-cover img,
	body .mg-card .mg-card__more .mg-icon {
		transition: none;
	}

	body .mg-card:hover,
	body .mg-card:focus-within {
		transform: none;
	}

	body .mg-card:hover .mg-cover img {
		transform: none;
	}

	body .mg-card:hover .mg-cover::after {
		animation: none;
	}
}
