/* ============================================================
   History & Dean List — Modern Design
   Scoped to .rx-history
   Palette: faculty green #3a491f + gold #d4af37
   ============================================================ */
.article-title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin: 0 auto 24px;
	font-size: 22px;
	font-weight: 700;
	color: var(--rh-primary-dark, #273115);
	text-align: center;
}

/* เส้นขีดสีทองทั้งสองข้าง */
.article-title::before,
.article-title::after {
	content: '';
	flex: 1;
	max-width: 60px;
	/* ความยาวของเส้นขีดขนาบข้าง */
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--rh-accent, #d4af37));
}

.article-title::after {
	background: linear-gradient(90deg, var(--rh-accent, #d4af37), transparent);
}

.rx-history {
	--rh-primary: #3a491f;
	--rh-primary-light: #4c5f2b;
	--rh-primary-dark: #273115;
	--rh-accent: #d4af37;
	--rh-accent-dark: #b8940f;
	--rh-text: #2b302c;
	--rh-muted: #6e7671;
	--rh-tint: #fafaf5;
	--rh-shadow: 0 4px 14px rgba(58, 73, 31, 0.07);
	--rh-shadow-lg: 0 14px 30px rgba(58, 73, 31, 0.14);
	font-family: 'Sarabun', 'Inter', sans-serif;
	color: var(--rh-text);
	line-height: 1.8;
	padding: 10px 0;
}

/* บังคับให้ย่อหน้าใน .rx-history ใช้ฟอนต์เดียวกับหัวข้อ (Sarabun)
   เพราะ .content-box p จาก layout.css บังคับ Tahoma + text-indent 30px */
.rx-history p,
.rx-history p *,
.rx-history li,
.rx-history li * {
	font-family: 'Sarabun', 'Inter', sans-serif !important;
}

.rx-history p {
	text-indent: 0 !important;
	text-align: center;
}

/* ---------- Page Header ---------- */
.rx-history-header {
	text-align: center;
	padding: 30px 20px 26px;
	background: radial-gradient(circle at 50% 0%, #4c5f2b 0%, #273115 100%);
	border-radius: 24px;
	margin-bottom: 36px;
	position: relative;
	overflow: hidden;
	outline: 1px solid rgba(212, 175, 55, 0.3);
	outline-offset: -6px;
	/* เส้นกรอบทองลอยด้านใน */
	box-shadow: 0 14px 28px rgba(39, 49, 21, 0.15);
}

.rx-history-header h2 {
	margin: 0 0 6px;
	font-size: 24px;
	font-weight: 700;
	color: #ffffff;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rx-history-header p {
	margin: 0;
	display: inline-block;
	padding: 2px 16px;
	background: rgba(212, 175, 55, 0.15);
	border-radius: 20px;
	font-size: 12px;
	color: var(--rh-accent);
	letter-spacing: 1px;
}

/* ---------- Zigzag History Sections ---------- */
.rx-zigzag {
	position: relative;
	padding: 20px 0;
	margin-bottom: 28px;
}

/* Vertical center line */
.rx-zigzag::before {
	content: '';
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 0;
	width: 3px;
	background: linear-gradient(180deg, var(--rh-accent), var(--rh-primary), var(--rh-accent));
	border-radius: 2px;
	transform: translateX(-50%);
}

.rx-history-card {
	position: relative;
	width: 60%;
	padding: 20px 22px;
	background: #fff;
	border: 1px solid rgba(58, 73, 31, 0.08);
	border-radius: 12px;
	box-shadow: var(--rh-shadow);
	transition: all 0.3s ease;
	margin-bottom: 30px;
	opacity: 0;
	transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Animation: odd = slide from left, even = slide from right */
.rx-history-card:nth-child(odd) {
	margin-left: 0;
	margin-right: auto;
	transform: translateX(-40px);
}

.rx-history-card:nth-child(even) {
	margin-left: auto;
	margin-right: 0;
	transform: translateX(40px);
}

/* Visible state */
.rx-history-card.rx-visible {
	opacity: 1;
	transform: translateX(0);
}

/* Stagger delays */
.rx-history-card:nth-child(1) {
	transition-delay: 0.05s;
}

.rx-history-card:nth-child(2) {
	transition-delay: 0.1s;
}

.rx-history-card:nth-child(3) {
	transition-delay: 0.15s;
}

.rx-history-card:nth-child(4) {
	transition-delay: 0.2s;
}

.rx-history-card:nth-child(5) {
	transition-delay: 0.25s;
}

@media (prefers-reduced-motion: reduce) {
	.rx-history-card {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

.rx-history-card:hover {
	box-shadow: var(--rh-shadow-lg);
	transform: translateY(-3px);
	border-color: rgba(212, 175, 55, 0.4);
}

/* Connector dot on center line */
.rx-history-card::before {
	content: '';
	position: absolute;
	top: 28px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--rh-accent);
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
	z-index: 2;
}

.rx-history-card:nth-child(odd)::before {
	right: -7px;
	transform: translateX(50%);
}

.rx-history-card:nth-child(even)::before {
	left: -7px;
	transform: translateX(-50%);
}

/* Connector line to center */
.rx-history-card::after {
	content: '';
	position: absolute;
	top: 34px;
	width: calc(50% - 46% + 7px);
	height: 2px;
	background: rgba(212, 175, 55, 0.4);
	z-index: 1;
}

.rx-history-card:nth-child(odd)::after {
	right: -7px;
}

.rx-history-card:nth-child(even)::after {
	left: -7px;
}

/* Card color accent */
.rx-history-card-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 700;
	color: var(--rh-primary);
}

.rx-history-card-title .rx-icon {
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--rh-primary), var(--rh-primary-light));
	color: #fff;
	font-size: 13px;
}

.rx-history-card p {
	margin: 0;
	font-size: 15px;
	/* ปรับขนาดตัวอักษรขึ้นนิดหน่อยเพื่อให้อ่านง่ายขึ้น */
	line-height: 1.75;
	/* จัดระยะห่างระหว่างบรรทัดให้พอดี ไม่ห่างเกินไป */
	color: var(--rh-text);
	text-align: left;
	/* จัดชิดซ้าย ป้องกันปัญหาตัวอักษรเคาะเว้นวรรคห่างผิดปกติ */
	letter-spacing: 0.1px;
	/* ปรับระยะห่างระหว่างตัวอักษรให้อ่านสบายตา */
	word-break: break-word;
	/* ป้องกันข้อความหรือชื่อยาวๆ ทะลุขอบการ์ด */
}

.rx-history-card strong {
	color: var(--rh-primary-dark);
	font-weight: 700;
	/* เน้นตัวหนาให้เน้นย้ำชื่อและวันที่ได้ชัดเจน */
}

/* ---------- Section Title ---------- */
.rx-history-section-title {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 32px 0 20px;
	padding-bottom: 12px;
	border-bottom: 2px solid rgba(58, 73, 31, 0.1);
}

/* เส้นคาดทองบางๆ ทับเส้นใต้หัวข้อ ให้ดูมีมิติ */
.rx-history-section-title::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 140px;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--rh-accent) 0%, rgba(212, 175, 55, 0) 100%);
}

.rx-history-section-title .rx-icon {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--rh-primary), var(--rh-primary-light));
	color: #fff;
	font-size: 16px;
	box-shadow: 0 4px 10px rgba(58, 73, 31, 0.25);
}

.rx-history-section-title h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--rh-primary);
}

.rx-history-section-title h3 small {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: var(--rh-muted);
	letter-spacing: 1px;
	text-transform: uppercase;
	margin-top: 2px;
}

/* ---------- Dean List (การ์ดคณบดี — แถวละคน เรียง 1 → 7 ลงมา) ---------- */
.rx-dean-list {
	list-style: none;
	margin: 0 !important;
	padding: 20px !important;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	background: linear-gradient(160deg, #fbfbf6 0%, #f1f4e7 100%);
	border: 1px solid rgba(58, 73, 31, 0.08);
	border-radius: 18px;
}

/* การ์ดแถวยาว — รูปอยู่ซ้าย ข้อความอยู่ขวา (ทุกคนรูปแบบเดียวกัน) */
.rx-dean-item {
	position: relative;
	display: flex;
	flex-direction: row;
	align-items: center;
	margin: 0;
	background: #fff;
	border: 1px solid rgba(58, 73, 31, 0.09);
	border-radius: 16px;
	box-shadow: var(--rh-shadow);
	overflow: hidden;
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* แถบสีเขียว-ทองบางๆ ด้านบนการ์ด
   (ใช้ ::after เพราะ ::before ถูกใช้ลบเลขลำดับที่ layout.css แทรกไว้) */
.rx-dean-item::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	z-index: 5;
	background: linear-gradient(90deg, var(--rh-primary) 0%, var(--rh-primary-light) 45%, var(--rh-accent) 100%);
}

.rx-dean-item.rx-visible {
	opacity: 1;
	transform: translateY(0);
}

.rx-dean-item:nth-child(1) {
	transition-delay: 0.05s;
}

.rx-dean-item:nth-child(2) {
	transition-delay: 0.1s;
}

.rx-dean-item:nth-child(3) {
	transition-delay: 0.15s;
}

.rx-dean-item:nth-child(4) {
	transition-delay: 0.2s;
}

.rx-dean-item:nth-child(5) {
	transition-delay: 0.25s;
}

.rx-dean-item:nth-child(6) {
	transition-delay: 0.3s;
}

.rx-dean-item:nth-child(7) {
	transition-delay: 0.35s;
}

.rx-dean-item:nth-child(8) {
	transition-delay: 0.4s;
}

@media (prefers-reduced-motion: reduce) {
	.rx-dean-item {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

.rx-dean-item:hover {
	box-shadow: var(--rh-shadow-lg);
	transform: translateY(-5px);
	border-color: rgba(212, 175, 55, 0.55);
}

/* ---------- Dean List resets ---------- */
/* เอาเลขลำดับที่ layout.css แทรกด้วย ::before ของ li ออก
   (แสดงแค่เลขในวงกลม .rx-dean-number วงเดียวพอ) */
.rx-dean-list>li::before {
	content: none !important;
}

.rx-dean-list>li {
	margin-left: 0 !important;
	margin-top: 0 !important;
	color: var(--rh-text) !important;
}

/* Number badge — อยู่มุมบนซ้ายของการ์ด
   (วางไว้นอกกรอบรูป เพราะรูปวงกลมใช้ overflow: hidden
   ถ้าไว้ในวงจะถูกตัดขอบ) */
.rx-dean-number {
	position: absolute;
	top: 14px;
	left: 16px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	padding: 4px 12px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--rh-accent) 0%, var(--rh-accent-dark) 100%);
	color: var(--rh-primary-dark);
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	border: 2px solid rgba(255, 255, 255, 0.92);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	transition: transform 0.35s ease;
	letter-spacing: 0.03em;
}

.rx-dean-item:hover .rx-dean-number {
	transform: scale(1.12) rotate(-6deg);
}

/* Photo — วงกลมมีแหวนทองบางรอบ อยู่ซ้ายการ์ด */
.rx-dean-photo {
	position: relative;
	flex: none;
	width: 170px;
	height: 170px;
	margin: 22px 0 22px 26px;
	border-radius: 50%;
	border: 4px solid #fff;
	overflow: hidden;
	background: radial-gradient(circle at 50% 25%, #f0f3e6 0%, #dee4cd 100%);
	box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.45), 0 8px 20px rgba(58, 73, 31, 0.16);
}

.rx-dean-photo img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: none;
	object-fit: cover;
	object-position: center 22%;
	transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.rx-dean-item:hover .rx-dean-photo img {
	transform: scale(1.06);
}

/* ม่านเงาใต้รูป ช่วยให้เลขลำดับอ่านชัด */
.rx-dean-photo::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(180deg, rgba(39, 49, 21, 0) 42%, rgba(39, 49, 21, 0.55) 100%);
}

/* แสงวิ่งผ่านรูปตอน hover */
.rx-dean-photo::before {
	content: '';
	position: absolute;
	top: 0;
	left: -70%;
	width: 45%;
	height: 100%;
	z-index: 2;
	pointer-events: none;
	transform: skewX(-18deg);
	background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
	transition: left 0.75s ease;
}

.rx-dean-item:hover .rx-dean-photo::before {
	left: 125%;
}

/* Info — ชิดซ้ายถัดจากรูป */
.rx-dean-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	text-align: left;
	padding: 22px 26px;
}

/* ทับค่า text-align: center ของ .rx-history p ให้ข้อความชิดซ้าย */
.rx-dean-item .rx-dean-info p {
	text-align: left;
}

.rx-dean-name {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--rh-primary-dark);
	text-align: left;
}

/* เส้นคาดทองบางๆ ใต้ชื่อ */
.rx-dean-name::after {
	content: '';
	display: block;
	width: 65px;
	height: 2px;
	margin: 9px 0 0;
	border-radius: 2px;
	background: linear-gradient(90deg, rgba(212, 175, 55, 0) 0%, var(--rh-accent) 50%, rgba(212, 175, 55, 0) 100%);
}

/* ป้ายตำแหน่ง */
.rx-dean-position {
	display: inline-block;
	margin: 0 0 10px;
	padding: 4px 14px;
	font-size: 12px;
	font-weight: 600;
	color: var(--rh-primary);
	background: rgba(58, 73, 31, 0.08);
	border-radius: 999px;
}

/* ช่วงเวลาดำรงตำแหน่ง */
.rx-dean-period {
	display: block !important;
	/* บังคับให้เป็นบล็อกเพื่อรับค่า margin ชัดเจน */
	margin-top: 10px !important;
	/* บังคับเว้นระยะห่างด้านบน 10px */
	font-size: 12px;
	line-height: 1.6;
	color: var(--rh-muted);
	font-style: normal;
}

.rx-dean-period::before {
	font-family: 'FontAwesome';
	content: '\f073';
	margin-right: 6px;
	color: var(--rh-accent-dark);
}

/* ---------- Dean variants ---------- */
/* ผู้รักษาการแทนคณบดี — กรอบเส้นประ + ป้ายสีทอง */
.rx-dean-item--acting {
	border-style: dashed;
	border-color: rgba(184, 148, 15, 0.45);
}

.rx-dean-item--acting .rx-dean-position {
	color: var(--rh-accent-dark);
	background: rgba(212, 175, 55, 0.16);
}

/* คณบดีคนปัจจุบัน — รูปแบบเดียวกับคนอื่น ต่างกันแค่ขอบการ์ดและแหวนทองรอบรูป */
.rx-dean-item--current {
	background: linear-gradient(180deg, #ffffff 0%, #fdfbef 100%);
	border-color: rgba(212, 175, 55, 0.6);
	box-shadow: 0 10px 26px rgba(58, 73, 31, 0.13), 0 0 0 3px rgba(212, 175, 55, 0.14);
}

.rx-dean-item--current .rx-dean-photo {
	box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.8), 0 10px 22px rgba(58, 73, 31, 0.2);
}

/* ป้าย "ปัจจุบัน" */
.rx-dean-flag {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 4;
	padding: 5px 14px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--rh-accent) 0%, var(--rh-accent-dark) 100%);
	color: var(--rh-primary-dark);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

/* ---------- Tablet ---------- */
/* layout.css บังคับ .content-box img { width/height: auto !important } ใน media 991px
   จึงต้องประกาศทับด้วย !important ไม่งั้นรูปคณบดีจะไม่เต็มกรอบการ์ด */
@media (max-width: 991px) {
	.rx-dean-photo img {
		width: 100% !important;
		height: 100% !important;
		max-width: none !important;
	}
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.rx-history-header h2 {
		font-size: 18px;
	}

	/* Zigzag becomes single column on mobile */
	.rx-zigzag::before {
		left: 20px;
	}

	.rx-history-card {
		width: calc(100% - 50px);
		margin-left: 50px !important;
		margin-right: 0 !important;
	}

	.rx-history-card:nth-child(odd),
	.rx-history-card:nth-child(even) {
		transform: translateX(-30px);
	}

	.rx-history-card.rx-visible {
		transform: translateX(0);
	}

	.rx-history-card::before {
		left: -35px;
		right: auto;
		transform: translateX(0);
	}

	.rx-history-card::after {
		left: -21px;
		right: auto;
		width: 21px;
	}

	/* คณบดีบนมือถือ — การ์ดกลับมาเรียงบน-ล่าง ข้อความจัดกลาง */
	.rx-dean-list {
		grid-template-columns: 1fr;
		gap: 14px;
		padding: 14px !important;
	}

	.rx-dean-item {
		flex-direction: column;
		align-items: center;
		padding: 18px 14px 20px;
	}

	.rx-dean-photo {
		width: 150px;
		height: 150px;
		margin: 0 auto;
	}

	.rx-dean-number {
		top: 10px;
		left: 10px;
		padding: 3px 10px;
		font-size: 11px;
	}

	.rx-dean-info {
		align-items: center;
		text-align: center;
		padding: 16px 0 0;
	}

	.rx-dean-item .rx-dean-info p,
	.rx-dean-name {
		text-align: center;
	}

	.rx-dean-name {
		font-size: 15px;
	}

	.rx-dean-name::after {
		margin: 9px auto 0;
	}

	.rx-dean-position {
		font-size: 12px;
	}

	.rx-dean-period {
		font-size: 11px !important;
		line-height: 1.5 !important;
		word-break: keep-all;
	}

	.rx-history-section-title h3 {
		font-size: 16px;
	}
}