/*
 * MG99CLUB — หน้าข่าวสารล่าสุด: การ์ดบทความ, กริด, breadcrumb, ปุ่มเปลี่ยนหน้า
 * (ใช้ร่วมกับหน้าแสดงบทความ เช่นการ์ดบทความที่เกี่ยวข้อง)
 */

:root {
	--mg-card-bg: linear-gradient(160deg, rgba(64, 10, 58, .55) 0%, rgba(14, 4, 18, .9) 100%);
	--mg-card-border: rgba(255, 255, 255, .09);
	--mg-radius: 18px;
}

body .mg-news,
body .mg-single {
	padding-top: 40px;
	padding-bottom: 72px;
	font-family: 'Kanit', sans-serif;
	color: var(--mg-text, #d2d2d2);
}

@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, .55);
}

body .mg-breadcrumb .mg-breadcrumb__item + .mg-breadcrumb__item::before {
	content: "›";
	margin: 0 8px;
	color: var(--mg-gold, #ecbd7b);
	opacity: .8;
}

body .mg-breadcrumb .mg-breadcrumb__item a {
	color: rgba(255, 255, 255, .78);
	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: 28px;
	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.7rem, 4vw, 2.5rem);
	font-weight: 600;
	line-height: 1.3;
}

body .mg-news .mg-news__title span {
	background-image: linear-gradient(180deg, #ffe7b5 10%, #dcb986 45%, #8a6339 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

body .mg-news .mg-news__title .mg-icon {
	color: var(--mg-gold, #ecbd7b);
	font-size: .9em;
	filter: drop-shadow(0 0 8px rgba(236, 189, 123, .45));
}

body .mg-news__head::after {
	content: "";
	display: block;
	width: 60%;
	max-width: 420px;
	height: 1px;
	margin: 18px auto 0;
	background: linear-gradient(90deg, transparent, #ecbd7b 30%, #ecbd7b 70%, transparent);
}

body .mg-news__intro {
	max-width: 680px;
	margin: 0 auto;
	color: #a0a0a0;
	font-size: 1rem;
	line-height: 1.8;
}

body .mg-news__intro p:last-child {
	margin-bottom: 0;
}

body .mg-news__page-no {
	margin: 8px 0 0;
	color: var(--mg-yellow, #f0df70);
	font-size: .9rem;
}

/* ---------- กริด: 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: 0 10px 30px -18px rgba(0, 0, 0, .9);
	transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

body .mg-card:hover,
body .mg-card:focus-within {
	border-color: rgba(253, 51, 134, .55);
	box-shadow: 0 0 0 1px rgba(253, 51, 134, .25), 0 18px 40px -16px rgba(241, 25, 98, .55);
	transform: translateY(-4px);
}

body .mg-cover {
	display: block;
	position: relative;
	overflow: hidden;
	background: #12030f;
}

body .mg-card .mg-card__media {
	aspect-ratio: 16 / 9;
}

body .mg-cover img,
body .mg-cover .mg-cover__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s ease;
}

body .mg-card:hover .mg-cover img {
	transform: scale(1.05);
}

/* ไม่มีรูป: โลโก้บนพื้นสีธีม */
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, .45), transparent 70%),
		linear-gradient(153deg, #020024 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: 3px 12px;
	color: #fff;
	font-size: .78rem;
	font-weight: 500;
	line-height: 1.5;
	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 0 6px 1px rgba(208, 30, 70, .9);
	transition: filter .2s ease;
}

body .mg-badge:hover {
	margin: 0;
	color: #fff;
	text-decoration: none;
	filter: brightness(1.15);
}

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;
}

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: #a0a0a0;
	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: #c4c4c4;
	font-size: .98rem;
	line-height: 1.8;
}

body .mg-card .mg-card__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	padding-top: 4px;
	color: var(--mg-gold, #ecbd7b);
	font-size: .92rem;
	font-weight: 500;
}

body .mg-card .mg-card__more .mg-icon {
	transition: transform .2s ease;
}

body .mg-card:hover .mg-card__more .mg-icon {
	transform: translateX(4px);
}

/* การ์ดใหญ่เต็มแถว (บทความล่าสุด) */
body .mg-card.mg-card--featured {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
	border-color: rgba(236, 189, 123, .3);
}

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: 32px 36px;
}

body .mg-card.mg-card--featured .mg-card__title {
	font-size: clamp(1.35rem, 2.4vw, 1.85rem);
	font-weight: 600;
	line-height: 1.45;
	-webkit-line-clamp: 3;
}

body .mg-card.mg-card--featured .mg-card__more {
	margin-top: 6px;
	padding: 8px 20px;
	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 0 10px 2px #d01e46;
}

body .mg-card.mg-card--featured::before {
	content: "ล่าสุด";
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	padding: 2px 12px;
	color: #3b2a00;
	font-size: .78rem;
	font-weight: 600;
	background: var(--mg-grad-gold, radial-gradient(100% 100% at 50% 0, #ffed7b 0, #f0df70 44%, #564b00 100%));
	border-radius: 999px;
	box-shadow: 0 4px 12px -2px rgba(0, 0, 0, .6);
}

@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: 44px;
}

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: rgba(255, 255, 255, .06);
	border: 1px solid rgba(255, 255, 255, .14);
	border-radius: 999px;
	transition: background-color .2s ease, border-color .2s ease, color .2s 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);
}

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 6px 18px -4px rgba(241, 25, 98, .7), inset 0 0 8px 1px rgba(255, 255, 255, .2);
}

body .mg-pagination .page-numbers.dots {
	min-width: 28px;
	padding: 0;
	background: none;
	border: 0;
}

body .mg-pagination .prev,
body .mg-pagination .next {
	color: var(--mg-gold, #ecbd7b);
	border-color: rgba(236, 189, 123, .4);
}

@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: 20px;
}

body .mg-section-head .mg-section-head__title {
	position: relative;
	margin: 0;
	padding-left: 16px;
	color: #fff;
	font-size: clamp(1.25rem, 3vw, 1.55rem);
	font-weight: 600;
}

body .mg-section-head .mg-section-head__title::before {
	content: "";
	position: absolute;
	top: .2em;
	bottom: .2em;
	left: 0;
	width: 4px;
	background: linear-gradient(180deg, #ffed7b, #ecbd7b 50%, #8a6339);
	border-radius: 4px;
}

body .mg-section-head .mg-section-head__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	color: var(--mg-gold, #ecbd7b);
	font-size: .92rem;
	text-decoration: none;
}

body .mg-section-head .mg-section-head__more:hover {
	margin: 0;
	color: var(--mg-yellow, #f0df70);
	text-decoration: none;
}

/* ---------- บทความล่าสุด (หน้าแรก / เพจ) ---------- */
body .mg-latest {
	padding: 56px 0 64px;
	font-family: 'Kanit', sans-serif;
}

body .mg-latest .mg-latest__footer {
	margin-top: 32px;
	text-align: center;
}

body .mg-latest .mg-latest__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: auto;
	min-width: 220px;
	padding: 12px 28px;
	color: #fff;
	font-size: 1rem;
	text-decoration: none;
	transition: filter .2s ease, transform .2s ease;
}

body .mg-latest .mg-latest__btn:hover {
	margin: 0;
	color: #fff;
	text-decoration: none;
	background-image: radial-gradient(100% 100% at 50% 0, #ff7aa7 0, #f11962 44%, #9a0957 100%);
	filter: brightness(1.1);
	transform: translateY(-2px);
}

@media (max-width: 767.98px) {
	body .mg-latest {
		padding: 40px 0 110px; /* เว้นที่ให้แถบเมนูล่างบนมือถือ */
	}
}

/* ---------- ไม่มีบทความ ---------- */
body .mg-empty {
	padding: 48px 20px;
	text-align: center;
	background: var(--mg-card-bg);
	border: 1px dashed rgba(236, 189, 123, .35);
	border-radius: var(--mg-radius);
}

body .mg-empty .mg-empty__btn {
	display: inline-flex;
	justify-content: center;
	width: auto;
	padding: 10px 28px;
	color: #fff;
	text-decoration: none;
}
