/* ============================
 Battle Pages — Base Layout
 ใช้ร่วมกันทุกหน้า รอง ผบ.พัน/ผบ.ร้อย 1,2
 ============================ */

.battle-page {
	padding: 40px;
}
.battle-title {
	text-align: center;
	margin-bottom: 10px;
	font-size: clamp(1.1rem, 3.2vw, 1.9rem);
	/*font-size: clamp(1.25rem, 3.8vw, 1.9rem);*/
	line-height: 1.25;
	font-weight: 700;
	white-space: nowrap;
}

.battle-subtitle {
	text-align: center;
	font-size: 1.1rem;
	font-weight: 500;
	margin-top: -5px;
}

/* แถวของนายทหาร 3 คน */
.battle-officer-row {
	display: flex;
	justify-content: center;
	gap: 40px;
	flex-wrap: wrap;
	margin-top: 30px;
}

/* การ์ดแต่ละคน */

.battle-card {
	text-align: center;
	width: 170px;
	background-color: #e3e1e2;
	border-radius: 8px;
	padding: 12px;
	display: flex;
	flex-direction: column;
	align-items: center;
}
/* ชื่อ–ตำแหน่ง */
.battle-card h6 {
	width: 100%;
	margin-top: 6px;
	line-height: 1.35;
	font-size: 0.9rem;
	text-align: center;
	white-space: nowrap;
}

.battle-card--center {
	transform: translateY(-15px);
}
.commander-image-frame-battle {
	width: 170px;
	height: auto;
	aspect-ratio: 170/261;
	object-fit: cover;
	border: 2px solid #7da0c8;
	padding: 4px;
	background: #f8fbff;
	border-radius: 6px;
	box-sizing: border-box;
	display: block;
	margin-inline: auto;
}
/*-------End รอง ผบ.พัน/ผบ.ร้อย 1,2--------*/

.battle-image img {
	margin-inline: auto;
}

/* โครงสร้าง 2 คอลัมน์  สัญญลักษณ์กองพัน */
.battle-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 40px;
	align-items: start;
}

.battle-top {
	display: grid;
	grid-template-columns: 1fr 113px;
	gap: 20px;
	align-items: start;
}

.battle-img-small {
	width: 113px;
	height: 180px;
	object-fit: cover;
	border-radius: 6px;
}

.battle-img-large {
	width: 378px;
	height: 243px;
	object-fit: cover;
	display: block;
	margin-inline: auto;
	border-radius: 6px;
}

.battle-img-tall {
	width: 265px;
	height: 388px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
	margin-inline: auto;
}

.battle-right {
	text-align: center;
}

.battle-col {
	min-height: 520px;
}

.battle-img-right {
	width: 100%;
	max-width: 246px;
	height: auto;
	display: block;
	margin-inline: auto;
}

/* =================================
 SCHOOL / ACTIVITIES TEMPLATE
 ================================= */
/*--ภาพการ์ตูน หน้าแรกกิจกรรม--*/
/* =================================
 First gray frame (ภาพต่อ)
 ================================= */
.first-gray-frame {
	/* layout */
	display: flex;
	justify-content: center;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 0;
	/* size */
	width: 100%;
	max-width: 900px;
	box-sizing: border-box;
	/* visual */
	padding: 6px;
	border: 2px solid #cfcfcf;
	border-radius: 6px;
	background: #fff;
}

.activities-header {
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* .first-gray-frame{
 flex-wrap: nowrap; /* กันภาพต่อแตกแถวในอนาคต *
 }*/
.act-img {
	display: block;
	width: auto;
	height: auto;
	margin: 0;
	border-radius: 0;
	transition: width 0.25s ease;
}

/* สัดส่วนภาพต่อ (รวม = 100%) */
.first-gray-frame .img-01 {
	width: 34.7%;
}
.first-gray-frame .img-02 {
	width: 36%;
}
.first-gray-frame .img-03 {
	width: 29.3%;
}

.act-img {
	transition: width 0.25s ease;
}
/*--End ภาพกิจกรรมการ์ตูน-*/

/* ===== Section Wrapper ===== */
.school-section {
	margin-bottom: 60px;
}

.school-box {
	max-width: 900px;
	margin-inline: auto;
}

.school-title {
	margin: 0 0 20px;
	text-align: left;
	font-size: 1.6rem;
	font-weight: 700;
}

.school-title--in-grid {
	width: 100%;
	max-width: 750px; /* เดิมคุณชอบ 750 */
	margin-inline: auto;
}

.school-item {
	display: flex;
	justify-content: center; /* บังคับให้รูปอยู่กลาง */
}
/* =================================
 SCHOOL IMAGE FRAME (NEW)
 ใช้เฉพาะ school / activities
 ================================= */
/* ค่าเดิม (desktop / tablet ใหญ่) */
.school-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 25px;
	justify-items: center;
}
/* ===== Grid : 2×2 ===== */
.school-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 25px;
	justify-items: center; /* รูปอยู่กลางคอลัมน์ */
}

/* จำกัดต่อหน้า 4 ภาพ */
.school-grid--4 > .school-item:nth-child(n + 5) {
	display: none;
}

/* ===== Figure / Image ===== */
.school-figure {
	width: 100%;
	max-width: 299px;
	margin: 0;
}

.school-figure img {
	width: 299px;
	height: 200px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

/* ===== Caption ===== */
.school-caption {
	margin-top: 10px;
}

/* ---------- แผนก ---------- */
.school-name {
	margin: 6px 0 2px;
	text-align: center;
	font-size: 1rem;
	font-weight: 700;
}

.school-role {
	margin: 0;
	text-align: center;
	font-size: 0.9rem;
	font-weight: 500;
	line-height: 1.4;
}
.school-frame {
	display: block;
	width: 100%;
	box-sizing: border-box;
	border: 2px solid #cfcfcf;
	border-radius: 6px;
	background: #ffffff;
	padding: 6px;
}

/*--กองการศึกษา/รายชื่อแผนก--*/
/* ===============================
 EDUCATION SECTION
 =============================== */
.edu-section {
	padding: 40px 20px;
}

.edu-box {
	max-width: 900px;
	margin: 0 auto;
	/*text-align: center;*/
}

/* ---------- Header ---------- */
.edu-header {
	margin-bottom: 30px;
	text-align: center;
}

.edu-title {
	margin: 0 0 10px;
	font-size: 2rem;
	font-weight: 700;
}

.edu-subtitle {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 500;
}

/* ---------- Columns ---------- */
.edu-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	max-width: 700px;
	margin: 30px auto;
	text-align: left;
	justify-items: center; /* คอลัมน์อยู่กลาง cell */
}

.edu-col {
	max-width: 300px;
	width: fit-content; /* ✅ ให้กว้างเท่าเนื้อหา (ไม่ดันไปซ้าย) */
	justify-self: center; /* ✅ บังคับให้อยู่กลางในแต่ละ cell */
	text-align: left; /* ✅ ตัวอักษรเสมอแบบชิดซ้าย */
}

.edu-col p {
	margin: 0 0 10px;
	font-size: 1.2rem;
	line-height: 1.8;
}

/* ---------- Footer ---------- */
.edu-footer {
	margin-top: 40px;
	text-align: center;
}

.edu-footer h4 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 500;
	line-height: 1.8;
	font-style: italic;
	text-align: center;
}

h4.edu-poem-caption {
	text-align: center;
	margin: 2rem auto 0;
	padding:  .8rem 0;
	font-weight: 800;
	font-style: italic;
	font-size: 1.2rem;
}

/* Responsive for mobile */
@media (max-width: 768px) {
	h4.edu-poem-caption {
		font-size: 1rem; /* ปรับให้เล็กลงบนมือถือ */
		font-weight: 700; /* ลดความหนาเพื่อให้ดูพอดีบนจอเล็ก */
	}
}

/* ===============================
 Responsive
 =============================== */
@media (max-width: 768px) {

	.edu-columns {
		grid-template-columns: 1fr;
		gap: 20px;
		text-align: center;
	}

	.edu-col p {
		font-size: 1.05rem;
	}

	.edu-title {
		font-size: 1.7rem;
	}

	.edu-subtitle {
		font-size: 1.2rem;
	}

	.edu-footer h4 {
		font-size: 1rem;
		text-align: center;
	}
}

/* ---------- กิจกรรม ---------- */
.school-desc {
	margin: 0;
	text-align: left;
	font-size: 0.95rem;
	line-height: 1.6;
	word-break: break-word;
}

/* ===============================
 END SECTION (ข้อความปิดท้าย)
 =============================== */
.end-up {
	max-width: 900px; /* ความกว้างพอดีกับ school-box */
	margin: 60px auto 0; /* กึ่งกลางหน้า + เว้นจาก grid ด้านบน */
	text-align: center;
	padding: 0; /* กันชิดขอบจอบนมือถือ  0 20px*/
	box-sizing: border-box;
}

/* ---- ระยะห่างแต่ละบรรทัด ---- */
.end-up h2 {
	margin: 0 0 12px;
	font-size: 1.4rem;
	font-weight: 700;
	letter-spacing: 0.5px;
}

.end-up h3 {
	margin: 0 0 10px;
	font-size: 1.2rem;
	font-weight: 600;
	letter-spacing: 0.5px;
}

/* ===============================
 เส้นคั่นก่อน end-up
 =============================== */
.end-up h4 {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.6;
	color: #24466c;
	letter-spacing: 0.5px;
	display: block; /* ← แก้ตรงนี้ */
	text-align: center; /* ← ให้เหมือนเดิม */
	position: relative;
	padding-bottom: 14px;
}

/* ดอกจันใต้ข้อความ */
.end-up h4::after {
	content: "✻ ✻ ✻ ✻ ✻";
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	top: 15px;
	padding: 20px 20px 0;
	font-size: 12px; /* ปรับขนาดดอกจัน */
	letter-spacing: 6px; /* ระยะห่างดอกจัน */
	color: #f9b517;
	white-space: nowrap;
}
/*----*/
/* ===============================
 Responsive (Tablet / Mobile)
 =============================== */

@media (max-width: 768px) {

	.end-up {
		margin-top: 40px;
	}

	.end-up h2 {
		font-size: 1.15rem;
	}

	.end-up h3 {
		font-size: 1.05rem;
	}

	.end-up h4 {
		font-size: 1rem;
		text-align: center;
	}
}
@media (max-width: 768px) {
	.end-up h4::after {
		font-size: 11px;
	}
}
/* Mobile เล็กมาก */
@media (max-width: 480px) {

	.end-up h2 {
		font-size: 1.05rem;
	}

	.end-up h3 {
		font-size: 0.95 ;
	}

	.end-up h4 {
		font-size: 0.9rem;
		text-align: center;
	}
}

/* ========== คำขวัญกองร้อยที่ 2 ========== */

.symbol-quote .quote-box {
	max-width: 800px;
	margin-inline: auto; /* กล่องอยู่กลางหน้า */
}
.symbol-quote .quote-text {
	text-align: left; /* ข้อความชิดซ้าย */
	line-height: 1.8;
	text-indent: 30px;
	font-size: 1.1 rem;
}

/* ========== symbol/กองพัน/กองร้อย1/2 ========== */
/* section หลัก */
.symbol {
	padding: 40px 20px;
}

/* container */
.symbol-inner {
	max-width: 900px;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
}

.symbol-title {
	font-size: 1.5rem;
	font-weight: 600;
	text-align: center;
	color: #24466c;
	margin-bottom: 24px;
	letter-spacing: 0.5px;
	position: relative;
}

.symbol-title::after {
	content: "";
	display: block;
	width: 90px;
	height: 3px;
	background: #bdbdbd;
	margin: 12px auto 0;
	border-radius: 2px;
}
/* image */
.symbol-image {
	width: 100%;
	max-width: 500px;
}

/* image responsive */
.symbol-image img {
	width: 100%;
	height: auto;
	display: block;
}
@media (max-width: 768px) {
	.symbol-title {
		font-size: 1.25rem;
	}
}

@media (max-width: 480px) {
	.symbol-title {
		font-size: 1.1rem;
	}
}
/* gray frame */
.symbol-gray-frame {
	border: 2px solid #cfcfcf;
	padding: 6px;
	background: #fff;
	border-radius: 6px;
	box-sizing: border-box;
}

/* ✅ Responsive */
@media (max-width: 768px) {
	.symbol {
		padding: 30px 15px;
	}

	.symbol-title {
		font-size: 1.2rem;
	}
}

@media (max-width: 480px) {
	.symbol-title {
		font-size: 1.1rem;
	}

	.symbol-image {
		max-width: 100%;
	}
}
/*--End--*/
/*--comFirst-*/
.motto-left .motto-text {
	text-align: left;
}
.motto-indent .motto-text {
	text-align: left;
	text-indent: 2rem;
}

.symbolic-camp-title {
	line-height: 1.6;
}

.max-w-700 {
	max-width: 700px;
	margin-inline: auto;
}

.school-last {
	margin-top: 40px;
	text-align: center;
}

.school-last h2, .school-last h3 {
	margin: 10px 0;
}

.school-last-end {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	margin-top: 20px;
	padding: 20px 30px;
	width: fit-content;
	margin-inline: auto;
}
.school-last-end h2 {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 10px 0;
	line-height: 1.8;
}
/*--<!--หน้าด้านบน สิ่งศักดิ์สิทธิ์-->--*/
/* ===== Sacred Item (scoped) ===== */
.sacred-item.section {
	width: 100%;
	padding-inline: 16px;
	margin: 20px 0 40px;
}

.sacred-item.box-base {
	background-color: #e3e1e2;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.sacred-item .sacred-item__container {
	max-width: 900px;
	margin-inline: auto;
}

/* ===== Desktop Grid ===== */
.sacred-item .sacred-item__grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 60px; /* ✅ ใช้ค่าเดียว */
	align-items: start;
}

/* ===== Left column ===== */
.sacred-item .sacred-item__left {
	display: flex;
	flex-direction: column;
	align-items: center; /* ก้อนซ้ายอยู่กึ่งกลาง */
}

.sacred-item .sacred-item__leftTop, .sacred-item .sacred-item__leftBottom {
	width: 100%;
	max-width: 420px;
}

/* left-top */
.sacred-item .sacred-item__leftTop {
	margin-bottom: 40px;
}

.sacred-item .sacred-item__topGrid {
	display: grid;
	grid-template-columns: 1fr 113px;
	gap: 20px;
	align-items: start;
}

.sacred-item .sacred-item__text {
	line-height: 1.9;
	text-align: justify;
	margin: 0;
	max-width: 100%;
}

/* left-bottom */
.sacred-item .sacred-item__leftBottom {
	margin-top: 20px;
	text-align: right;
}

.sacred-item .sacred-item__rightPack {
	display: inline-block;
	text-align: center;
}

.sacred-item .sacred-item__h3 {
	margin-top: 10px;
}

/* ===== Images ===== */
.sacred-item .sacred-item__imgSmall {
	width: 113px;
	height: 156px;
	object-fit: cover;
	display: block;
	justify-self: end;
	margin: 0;
	border-radius: 6px;
}

.sacred-item .sacred-item__imgWide {
	width: 370px;
	height: 238px;
	object-fit: cover;
	display: block;
	margin-left: auto;
	margin-right: 0;
	border-radius: 6px;
}

.sacred-item .sacred-item__imgTall {
	width: 260px;
	height: 380px;
	object-fit: cover;
	display: block;
	margin-inline: auto;
	border-radius: 6px;
}

/* ===== Right column ===== */
.sacred-item .sacred-item__right {
	text-align: center;
}

.sacred-item .sacred-item__caption {
	margin-top: 15px;
}
.sacred-item .sacred-item__h4, .sacred-item .sacred-item__h5 {
	margin: 0 0 10px;
}

/* ===== Utilities (scoped) ===== */
.sacred-item .shadow {
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sacred-item .symbol-gray-frame {
	border: 2px solid #cfcfcf;
	padding: 6px;
	background: #fff;
	border-radius: 6px;
	box-sizing: border-box;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
	.sacred-item .sacred-item__grid {
		display: flex;
		flex-direction: column;
		gap: 24px;
	}

	.sacred-item .sacred-item__right {
		order: 1;
	}
	.sacred-item .sacred-item__left {
		order: 2;
	}

	.sacred-item .sacred-item__topGrid {
		grid-template-columns: 1fr;
	}

	.sacred-item .sacred-item__imgWide, .sacred-item .sacred-item__imgTall {
		width: min(100%, 370px);
		height: auto;
	}

	.sacred-item .sacred-item__imgSmall {
		width: 113px;
		height: 156px;
	}
}
@media (max-width: 768px) {
	/* คงของเดิม: ให้ topGrid เป็นคอลัมน์เดียว (ข้อความก่อน รูปทีหลัง) */
	.sacred-item .sacred-item__topGrid {
		grid-template-columns: 1fr;
	}

	/* ✅ เพิ่มบรรทัดนี้: ทำให้รูปเล็กอยู่กึ่งกลางเมื่อจอเล็ก */
	.sacred-item .sacred-item__imgSmall {
		justify-self: center; /* override จาก end → center */
		margin-inline: auto; /* กันกรณีมีค่าอื่นมาทับ */
	}
}
@media (max-width: 768px) {
	.sacred-item .sacred-item__imgSmall {
		margin-top: 10px;
	}
}

/*--แก้ไขให้พระอยู่ด้านบน--*/
@media (max-width: 768px) {
	.sacred-item .sacred-item__topGrid {
		display: flex;
		flex-direction: column;
	}

	.sacred-item .sacred-item__imgSmall {
		order: -1; /* ⭐ ย้ายรูปขึ้นไปบนสุด */
		margin-bottom: 12px; /* ระยะห่างจากข้อความ */
	}

	.sacred-item .sacred-item__text {
		order: 2;
	}
}

/*--ชื่อพระเจ้าตากสินมหาราช--*/

@media (max-width: 768px) {
	.sacred-item .sacred-item__caption {
		white-space: nowrap;
		display: block;
		width: 100%;
		text-align: center;
		margin: 12px auto 20px; /* ⭐ margin-top 12px, margin-bottom 20px */
	}
}

@media (max-width: 768px) {
	.sacred-item .sacred-item__grid {
		display: flex;
		flex-direction: column;
		align-items: center; /* ⭐ บังคับให้คอลัมน์ซ้าย–ขวาอยู่กลาง */
	}
}
