:root {
  --sky-blue: #e3f2fd;
  --white: #ffffff;
  --text-main: #37474f;
  --accent-pink: #f1394b;
  --accent-blue: #1c3c7d;
  --accent-red: #ff5252;
  --accent-black: #333;
  --glass-bg: rgba(255, 255, 255, 1);
  /* สลับสีกลุ่มภูมิ */
  --color-ariya: rgba(250, 240, 180, 0.5);
  --color-brahma: rgba(243, 229, 245, 0.3); /* เปลี่ยน พรหม เป็นโทนม่วง */
  --color-deva: rgba(224, 247, 250, 0.3); /* เปลี่ยน เทวดา เป็นโทนฟ้า */
  --color-human: rgba(232, 245, 233, 0.4);
  --color-hell: rgba(243, 127, 127, 0.1);
}

/* เพิ่ม Smooth Scroll เพื่อให้เวลาคลิกเมนูแล้วเลื่อนนุ่มนวล */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'SF Thonburi', 'Sarabun', Arial, sans-serif;
  margin: 0;
  color: var(--text-main);
  overflow-x: hidden;
  background-color: #3b0355;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: url('https://www.lcbp.co.th/wp-content/uploads/2026/03/galaxy.webp');
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  animation: galaxyPulse 40s ease-in-out infinite;
}

@keyframes galaxyPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

header {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0.1)
    ),
    url('');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* เส้นแบ่งจางๆ ด้านบน */
}
.details a:hover {
  color: var(--accent-red);
}

h1 {
  color: white;
  margin: 0;
  font-size: 2.5em;
  font-weight: 700;
}

h2 {
  color: rgb(252, 252, 249);
  margin: 40px auto 10px;
  font-size: 2.2em;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0);

  width: fit-content;
  border-radius: 50px;
  padding: 10px 30px;
  position: relative;
  z-index: 10;
}
h3 {
  color: rgb(36, 40, 58);
  margin: -5px auto 10px;
  font-size: 0.9em;
  font-weight: 400;
  text-align: justify;
  background: rgba(253, 254, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0);
  backdrop-filter: blur(5px);
  width: fit-content;
  border-radius: 10px;
  padding: 20px 20px;
  position: relative;
  z-index: 10;
  line-height: 22px;
}
h4 {
  color: white;
  margin: 10;
  font-size: 1em;
  font-weight: 600;
}
h5 {
  color: black;
  margin-top: 11px;
  font-size: 1.1em;
  font-weight: 600;
  text-align: center;
  line-height: 24px;
}
h5 a {
  color: rgb(48, 21, 121);
}
้.realm-group a {
  color: black;
  text-decoration: underline;
}
.realm-group a:hover {
  color: var(--accent-red);
  text-decoration: underline;
}

h6 {
  color: white;
  margin: 0;
  font-size: 0.8em;
  font-weight: 400;
  text-align: center;
  line-height: 20px;
}

h7 {
  font-family: 'Sarabun';
  display: block; /* บังคับเป็น block เพื่อให้ margin auto ทำงาน */
  width: fit-content; /* ให้ขนาดกล่องกว้างพอดีกับข้อความ */
  margin: 20px auto 2px; /* จัดกึ่งกลางหน้าจอแนวนอน */
  color: white;
  font-size: 0.9em;
  font-weight: 500;
  text-align: center;
  background: linear-gradient(
    rgb(255, 182, 12),
    rgba(255, 119, 8, 1)
  ); /* ปรับความเข้มส้มให้ชัดขึ้นตามภาพ */
  border-radius: 50px;
  padding: 8px 25px; /* ปรับ padding ให้ดูเป็นทรงแคปซูลสวยงาม */
  position: relative;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  transition: transform 0.2s; /* เพิ่มลูกเล่นตอนกด */
  cursor: pointer;
  text-decoration: none !important;
}

/* เพิ่ม Effect ตอนเอาเมาส์ไปวาง (Hover) */
h7:hover {
  transform: scale(1.05); /* ขยายใหญ่ขึ้นนิดหน่อย */
  filter: brightness(1.1); /* สว่างขึ้นเล็กน้อย */
  text-decoration: none;
}
h8 {
  display: block; /* บังคับเป็น block เพื่อให้ margin auto ทำงาน */
  width: fit-content; /* ให้ขนาดกล่องกว้างพอดีกับข้อความ */
  margin: 0px auto 25px; /* จัดกึ่งกลางหน้าจอแนวนอน */
  color: white;
  font-size: 0.9em;
  font-weight: 400;
  text-align: center;
  background: linear-gradient(
    rgb(255, 182, 12),
    rgba(255, 119, 8, 1)
  ); /* ปรับความเข้มส้มให้ชัดขึ้นตามภาพ */
  border-radius: 50px;
  padding: 8px 25px; /* ปรับ padding ให้ดูเป็นทรงแคปซูลสวยงาม */
  position: relative;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
}

.timeline-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  padding: 20px 20px;
}
a {
  text-decoration: none !important; /* ปิดเส้นใต้ถาวร */
  color: inherit;
}
c {
  color: rgb(255, 254, 254);
  margin: 10;
  font-size: 1em;
  font-weight: 700;
}
f {
  color: rgb(17, 17, 16);
  margin: 10;
  font-size: 1em;
  font-weight: 700;
}
d {
  color: white;
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  text-align: center;
  line-height: 20px;
}
.timeline-line {
  position: absolute;
  left: 1%;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(
    to bottom,
    #ffffff,
    #2979ff,
    #ff80ab,
    #ff5252,
    #2979ff,
    #ffffff
  );
  background-size: 100% 300%;
  animation: timelineFlow 15s linear infinite;
  transform: translateX(-50%);
  z-index: 0;
  box-shadow: 0 0 15px rgba(200, 151, 190, 0.4);
}

@keyframes timelineFlow {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 0% 100%;
  }
}

.realm-group {
  margin: 30px auto;
  padding: 20px;
  border-radius: 20px;
  border: 0.1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px);
  position: relative;
  scroll-margin-top: 50px; /* ระยะเผื่อเวลาเลื่อนมาถึงไอดี */
}
.group-ariya {
  position: relative;
  background-color: rgba(250, 193, 193, 0.3); /* สีพื้นหลังเหลืองทองจางๆ */
  border-bottom: 0.1px solid rgba(248, 238, 212, 0.3);
  overflow: visible !important; /* สำคัญ: เพื่อให้ดอทลอยได้อิสระ */
  z-index: 1;
}

/* สร้างเลเยอร์ภาพดอกบัวแยกออกมา */
.group-ariya::before {
  border-radius: 19px;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* ใส่ URL ภาพดอกบัวของคุณตรงนี้ */
  background-image: url('https://www.lcbp.co.th/wp-content/uploads/2026/03/ASR_lotus.webp');
  background-size: cover; /* หรือใช้ cover ถ้าอยากให้เต็มพื้นที่ */
  background-repeat: no-repeat;
  background-position: center; /* วางไว้กึ่งกลางด้านล่าง */
  opacity: 0.5; /* ปรับความจางของภาพดอกบัว (0.1 - 1.0) */
  z-index: -1; /* ส่งไปอยู่หลังสุดของกรุ๊ป แต่ยังอยู่หน้าพื้นหลัง Galaxy */
  pointer-events: none; /* ป้องกันไม่ให้ภาพขวางการคลิกเนื้อหา */
}

.group-brahma {
  background: var(--color-brahma);
  border-bottom: #dfd4e0;
} /* พรหม - ม่วง */
.group-deva {
  background: var(--color-deva);
  border-bottom: #c3d1d8;
} /* เทวดา - ฟ้า */
.group-human {
  background: var(--color-human);
  border-bottom: #c4d4c4;
}
.group-hell {
  background: var(--color-hell);
  border-bottom: #cfb9b0;
}

.section-header {
  text-align: center;
  padding: 15px 0 5px;
  position: relative;
  z-index: 10;
  font-size: 1.2em;
  scroll-margin-top: 50px;
}

.section-header span {
  background: linear-gradient(40deg, #42a5f5, #642bb2, #ec407a);
  padding: 10px 25px;
  color: var(--white);
  border-radius: 50px;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
}

.realm-item {
  display: flex;
  margin-bottom: 13px;
  position: relative;
  z-index: 1;
  align-items: flex-start;
}
.realm-item.left {
  flex-direction: ;
}

.realm-content {
  width: 90%;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  padding: 15px;
  margin-left: 20px;
  padding-left: 20px;
  border-radius: 30px;
  border-top: 1px solid rgba(245, 178, 72, 0.8);
  box-shadow: 0 6px 10px rgba(47, 48, 68, 0.3);
  cursor: pointer;
  transition: 0.3s ease;
}

.realm-content:hover {
  transform: translateY(-5px);
  background: rgb(255, 255, 255);
  box-shadow: 0 0px 10px rgba(255, 254, 245, 0.8);
}

.realm-header-flex {
  display: flex;
  justify-content: center; /* เปลี่ยนจาก space-between เป็น center */
  align-items: center;
  position: relative; /* เพื่อให้ลูกศรวางทับแบบอิสระได้ */
  width: 100%;
}
.realm-title {
  font-weight: 600;
  font-size: 1.1em;
  color: var(--accent-blue);
  margin: 0;
  text-align: center;
}
.arrow-icon {
  position: absolute;
  right: 4px;
  font-size: 0.8em;
  transition: 0.3s;
  opacity: 0.5;
}
.realm-content.active .arrow-icon {
  transform: rotate(180deg);
  opacity: 1;
}
.realm-summary {
  font-weight: 600; /* สั่งตัวหนา */
  font-size: 1.03em; /* สั่งตัวใหญ่ขึ้นเล็กน้อย */
  color: var(--accent-blue); /* ใช้สีน้ำเงินเดียวกับ Title หรือปรับตามชอบ */
  margin: 0 0 0px 0; /* เว้นระยะห่างด้านล่างก่อนถึงรายละเอียดเนื้อหา */
  display: block;
}

.details {
  display: none;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.9em;
  line-height: 1.6;
  text-align: justify;
}
.details img {
  pointer-events: none;
  cursor: default; /* เปลี่ยนรูปเมาส์ให้เป็นลูกศรปกติ ไม่เป็นรูปมือ */
}
b {
  color: var(--accent-pink);
}
.details a {
  font-weight: 600;
  color: rgb(33, 33, 37);
}
h3 a {
  font-weight: 700;
  color: #333;
}
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  position: absolute;
  left: -10px;
  top: 17px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  animation: pulse-glow 2s ease-in-out infinite;
}

.dot.white {
  background: #ffffff;
  box-shadow: 0 0 15px 5px rgba(255, 200, 0, 0.5);
}
.dot.purple {
  background: #9c27b0;
  box-shadow: 0 0 15px 5px rgba(156, 39, 176, 0.5);
} /* ใช้กับพรหม */
.dot.blue {
  background: #2979ff;
  box-shadow: 0 0 15px 5px rgba(41, 121, 255, 0.5);
} /* ใช้กับเทวดา */
.dot.green {
  background: #4caf50;
  box-shadow: 0 0 15px 5px rgba(76, 175, 80, 0.5);
}
.dot.red {
  background: #ff5252;
  box-shadow: 0 0 15px 5px rgba(255, 82, 82, 0.5);
}

@keyframes pulse-glow {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1.2);
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
    filter: brightness(1);
  }
}

.realm-image {
  display: block;
  height: 100px;
  margin-top: 10px;
  flex-shrink: 0;
}

/* สำหรับ PC */
.zone-header-img {
  display: block;
  width: 90%; /* ปรับขนาดตามความสวยงาม */
  max-width: 550px;
  height: auto;
  margin: 20px auto -33px; /* จัดกลางจอ (ทับเส้นไทม์ไลน์) และขยับลงมาทับส่วนหัวกรุ๊ปเล็กน้อย */
  position: relative;
  z-index: 20; /* ให้ลอยอยู่เหนือเส้นไทม์ไลน์ */
}

@media (max-width: 768px) {
  .timeline-line {
    left: 10px;
    transform: none;
  }
  .realm-item,
  .realm-item.left {
    flex-direction: column !important;
    padding-left: 8px;
    padding-right: 30px;
    align-items: flex-start !important;
    margin-bottom: 13px;
  }
  .dot {
    position: absolute;
    left: -35px;
    top: 20px;
    margin: 0 !important;
  }
  .realm-content {
    width: 100% !important;
    margin-left: -10px !important;
    margin-right: 0 !important;
    margin-bottom: 15px;
  }
  .realm-image {
    width: auto !important;
    max-height: 100px;
    margin: 0 auto 10px 0 !important;
  }
  .section-header {
    text-align: center;
    padding-left: 0px;
  }
  .realm-group {
    margin: 0px 0px !important;
    margin-top: 20px !important;
  }
  .quick-nav {
    display: ;
  } /* ซ่อนเมนูในมือถือ */
  h5 {
    text-align: center;
    padding-left: 0px;
  }
  /* ในคอม: เรียงต่อกันและขึ้นบรรทัดใหม่ (Grid Style) */
  .gallery-container {
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
  }
  .zone-header-img {
    width: 90%;
    max-width: 450px;
  }
}

/* --- Quick Nav Styles --- */
.quick-nav {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 30px;
  z-index: 100;
}
.nav-item {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  text-decoration: none;
  position: relative;
  transition: 0.3s;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.nav-item span {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  backdrop-filter: blur(5px);
}

/* ปรับสีพื้นหลังของข้อความที่เด้งออกมาจากปุ่ม (Label) */
.nav-item.white span {
  background: #fdfaed;
  color: rgb(122, 58, 4);
} /* อริยะใช้เหลืองทอง */
.nav-item.purple span {
  background: #9c27b0;
  color: #fff;
}
.nav-item.blue span {
  background: #2979ff;
  color: #fff;
}
.nav-item.green span {
  background: #4caf50;
  color: #fff;
}
.nav-item.red span {
  background: #ff5252;
  color: #fff;
}

.nav-item:hover span {
  opacity: 1;
  right: 30px;
}
.nav-item:hover {
  transform: scale(1.5);
}
.nav-item.white {
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}
.nav-item.purple {
  background: #9c27b0;
  box-shadow: 0 0 10px #9c27b0;
} /* พรหม */
.nav-item.blue {
  background: #2979ff;
  box-shadow: 0 0 10px #2979ff;
} /* เทวดา */
.nav-item.green {
  background: #4caf50;
  box-shadow: 0 0 10px #4caf50;
}
.nav-item.red {
  background: #ff5252;
  box-shadow: 0 0 10px #ff5252;
}

#backToTop {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
  background: var(--accent-pink);
  color: white;
  border: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: 0.3s;
}
#backToTop:hover {
  background: #ff9000;
  color: white;
}

footer {
  text-align: center;
  padding: 10px 10px;
  background: rgb(233, 233, 233);
  font-size: 0.8em;
  color: #666;
}
footer a {
  color: var(--accent-pink);
  text-decoration: none;
  font-weight: bold;
}

/* สไตล์สำหรับรูปที่คลิกได้ */
header img {
  cursor: pointer;
  transition: 0.3s;
}

header img:hover {
  transform: scale(1.05); /* ให้รูปขยายขึ้นนิดหน่อยเมื่อเอาเมาส์วาง */
}

/* สไตล์ของกล่อง Modal (พื้นหลังดำจางๆ) */
.modal {
  display: none; /* ซ่อนไว้เริ่มต้น */
  position: fixed;
  z-index: 200; /* ให้อยู่หน้าสุดเหนือ Nav */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  cursor: zoom-out;
}

/* สไตล์รูปภาพที่ขยาย */
.modal-content {
  margin: auto;
  display: block;
  width: auto;
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: zoomIn 0.3s ease;
  border-radius: 20px;
}

@keyframes zoomIn {
  from {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* ปุ่มปิด (X) */
.close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}
/* บังคับให้รูปที่มี Lightbox ดูโดดเด่น */
img[onclick] {
  transition: transform 0.3s ease;
}

img[onclick]:hover {
  transform: scale(1.07);
}

/* ปรับ Modal ให้ทับทุกอย่าง 100% */
.modal {
  z-index: 9999; /* มั่นใจว่าทับ Nav และ Timeline แน่นอน */
}

/* สร้างอนิเมชั่นการหมุนจาก 0 ถึง 360 องศา */
@keyframes rotateWheel {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* นำมาสร้างเป็น Class สำหรับเรียกใช้ */
.rotating-wheel {
  animation: rotateWheel 150s linear infinite; /* steps(14) linear หมุนครบรอบใน 20 วินาที, ความเร็วคงที่, วนไม่สิ้นสุด */
  display: block;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.3s ease; /* สำหรับตอน Hover */
}

/* ทริค: เมื่อเอาเมาส์วาง ให้กงล้อหยุดหมุนชั่วคราวเพื่อให้คนดูภาพชัดๆ */
.rotating-wheel:hover {
  animation-play-state: paused;
}

/* ปรับปรุง Gallery ให้เลื่อนแนวนอนได้ */
.gallery-container {
  display: flex;
  flex-wrap: nowrap; /* บังคับไม่ให้ขึ้นบรรทัดใหม่ */
  overflow-x: auto; /* เปิดการเลื่อนแนวนอน */
  gap: 10px;
  padding: 10px 5px;
  margin-top: 5px;

  /* ซ่อนแถบ Scrollbar สำหรับ Chrome/Safari เพื่อความสวยงาม */
  scrollbar-width: none; /* สำหรับ Firefox */
  -ms-overflow-style: none; /* สำหรับ IE/Edge */

  /* เพิ่มแรงเฉื่อยเวลาปัดในมือถือ (Smooth Scrolling) */
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory; /* ให้ภาพหยุดตรงกลางช่องพอดี */
}

/* ซ่อน Scrollbar ของ Chrome/Safari */
.gallery-container {
  display: flex;
  flex-wrap: wrap; /* เปลี่ยนจาก nowrap เป็น wrap เพื่อให้ขึ้นบรรทัดใหม่ */
  justify-content: center; /* จัดรูปให้อยู่กึ่งกลางหน้าจอ */
  gap: 15px; /* ระยะห่างระหว่างรูป */
  padding: 15px;
}
.gallery-title {
  color: white;
  margin-top: 2px;
  font-size: 0.8em;
  font-weight: 400;
  text-align: center;
  line-height: 24px;
}

/* ปรับให้การเลื่อนดูนุ่มนวล */
.gallery-container {
  scroll-behavior: smooth;
}

/* --- Gallery Layout (Clean Version) --- */
.gallery-wrapper {
  position: relative;
  width: 100%;
  margin: 10px 0;
}

.gallery-container {
  display: flex;
  gap: 12px;
  padding: 15px 5px;
  scroll-behavior: smooth;
  /* ซ่อน Scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery-container::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 120px; /* ขนาดรูปย่อคงที่ */
  text-align: center;
}

.gallery-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.3s ease;
  /* เพิ่มบรรทัดนี้ในตัวหลักเพื่อให้การขยายดูนุ่มนวล */
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* กำหนดจุดหมุน/ขยาย ไว้ที่กึ่งกลางด้านล่าง */
  transform-origin: bottom center;
}

.gallery-img:hover {
  /* ขยาย 2 เท่า (ปรับตัวเลขได้ตามชอบ) และรูปจะพุ่งขึ้นบน โดยฐานล่างไม่ขยับ */
  transform: scale(2);
  z-index: 100; /* มั่นใจว่ารูปที่ขยายจะทับรูปข้างๆ */
  position: relative;
}

@media (max-width: 767px) {
  /* ในมือถือ: แถวเดียวและปัดซ้าย-ขวา (Carousel Style) */
  .gallery-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-left: 15px; /* เผื่อระยะขอบให้ปัดง่าย */
  }

  .gallery-item {
    scroll-snap-align: start;
  }
}

/*เปิดทั้งหมด*/
.toggle-all-btn {
  display: block;
  margin: 10px auto;
  padding: 5px 15px;
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.8em;
  cursor: pointer;
  transition: 0.3s;
  font-family: 'SF Thonburi', sans-serif;
}

.toggle-all-btn:hover {
  background: var(--accent-pink);
  transform: scale(1.05);
}

/* --- Pre-footer Credits Styles --- */
.pre-footer-credits {
  background-color: transparent; /* ให้เห็นพื้นหลัง Galaxy เดิม */
  color: white;
  padding: 40px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1); /* เส้นแบ่งจางๆ ด้านบน */
  backdrop-filter: blur(5px); /* เพิ่มเอฟเฟกต์เบลอให้เนื้อหาอ่านง่าย */
  position: relative;
  z-index: 5;
}

.pre-footer-credits .container {
  max-width: 1000px;

  margin: 0 auto;
}

.credit-columns {
  display: flex;
  justify-content: space-between;
  gap: 30px;
}

.credit-col {
  flex: 1;
  text-align: left;
  min-width: 270px;
}

/* ปรับสไตล์หัวข้อและเนื้อหาเครดิต */
.pre-footer-credits h5 {
  font-weight: 500;
  font-size: 1em;
  color: white; /* ใช้สีฟ้าอ่อนที่คุณตั้งไว้ใน :root */
  margin-bottom: 15px;
}

.pre-footer-credits h6 {
  font-weight: 400;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.9);
  margin: 5px 0;
  line-height: 1;
}
.pre-footer-credits {
  display: flex;
  justify-content: center; /* จัดให้อยู่กลางหน้าจอในคอม */
  gap: 12px; /* ระยะห่างระหว่างปุ่ม */
  padding: 20px 15px;
  width: 100%;
}

/* คอนเทนเนอร์คุมปุ่มให้อยู่ตรงกลาง */
.nav-button-container {
  display: flex;
  justify-content: center; /* จัดกึ่งกลางแนวนอน */
  gap: 15px; /* ระยะห่างระหว่างปุ่ม */
  margin: 10px auto; /* เว้นระยะบน-ล่างให้สมดุล */
  margin-left: -20;
  width: 80%;
  max-width: 400px;
  z-index: 10;
  position: relative;
}

/* สไตล์ปุ่มแบบเรียวมน ชมพูแดง */
.btn-nav {
  flex: 1;
  background: linear-gradient(40deg, #ff934b, #d4145a);
  color: #ffffff !important;
  text-decoration: none;
  text-align: center;
  padding: 10px 10px;
  margin-left: -10;
  border-radius: 50px; /* ทรงแคปซูลเรียวมน */
  font-size: 1em;
  font-weight: 400; /* น้ำหนัก 600 ตามที่คุณแนะนำ */
  transition: all 0.3s ease;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 214, 214, 1);
}

.btn-nav:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(112, 84, 94, 0.6);
  border-top: 1px solid rgba(255, 214, 214, 1);
  filter: brightness(1.1);
}

/* ปรับแต่งสำหรับมือถือให้วางคู่กันได้สวยงาม */
@media (max-width: 480px) {
  .nav-button-container {
    gap: 10px;
    padding: 0 10px;
    margin-left: -10;
  }
  .btn-nav {
    font-size: 0.85em;
    padding: 10px 5px;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .credit-columns {
    flex-direction: column; /* มือถือเรียงเป็นคอลัมน์เดียว */
    text-align: center;
    gap: 20px;
  }
  .credit-col {
    text-align: center;
  }
}

/* คอนเทนเนอร์หลักสำหรับภาพคู่ */
.image-grid-section {
  display: grid;
  grid-template-columns: 1fr 1fr; /* แบ่ง 2 คอลัมน์เท่ากันในคอม */
  gap: 15px; /* ระยะห่างระหว่างภาพ */
  margin: 20px 0;
}

/* จัดการภาพให้เป็นสัดส่วน 1:1 (Square) */
.grid-item {
  width: 100%;
  aspect-ratio: 1 / 1; /* บังคับสัดส่วน 1:1 */
  overflow: hidden;
  border-radius: 15px;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* ให้ภาพเต็มกรอบโดยไม่เสียสัดส่วน */
  transition: 0.3s ease;
  pointer-events: none; /* สั่งให้ข้ามเหตุการณ์คลิกไปเลย */
  user-select: none; /* กันการกดค้างเพื่อก๊อปปี้รูป */
}

.grid-item img:hover {
  transform: scale(1.05); /* เอฟเฟกต์ขยายเมื่อชี้เม้าส์ */
}

/* --- การปรับแต่งสำหรับมือถือ --- */
@media (max-width: 768px) {
  .image-grid-section {
    grid-template-columns: 1fr; /* ปรับเป็นแถวเดี่ยวในมือถือ */
    gap: 10px;
  }
}
/* css Page2*/
/* --- สไตล์เฉพาะหน้าหัวข้อธรรมะ --- */

.dhamma-group {
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  margin-left: -40;
  border-top: 1px solid rgba(237, 248, 255, 0.5);
  border-radius: 20px;
  max-width: 900px;
}

/* หัวข้อกลุ่ม H1 (เช่น ชั้นอริยะ) */
.group-title {
  color: #fff;
  text-align: center;
  font-size: 2.7em;
  margin-bottom: 10px;
  margin-top: 30px;
  text-shadow: 0 0 15px rgba(250, 247, 234, 0.5);
}

/* 1. คอนเทนเนอร์หลัก: ใช้ระบบ Columns จะไหลได้สมบูรณ์กว่า Grid ในเคสที่ความสูงไม่เท่ากัน */
.dhamma-grid {
  display: block; /* ห้ามใช้ flex หรือ grid ซ้อนที่นี่ */
  column-count: 2; /* แบ่ง 2 คอลัมน์ */
  column-gap: 15px; /* ระยะห่างซ้าย-ขวา */
  width: 100%;
  padding-top: 20px;
  padding-left: 0;
  padding-right: 20px;
  padding-bottom: 20px;
}

/* 2. ตัวกล่อง: ต้องกันไม่ให้เกิดการทับซ้อนและการขาดครึ่ง */
.dhamma-card {
  display: block; /* ห้ามใช้ inline-block เพราะมักทำให้ทับกันในบาง Browser */
  width: 90%;
  margin-bottom: 40px; /* ระยะห่างบน-ล่างระหว่างกล่อง */
  margin-top: -10px;
  /* คำสั่งเด็ดขาด: ห้ามแยกกล่องไปอยู่คนละคอลัมน์ และห้ามแทรกกัน */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;

  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 20px rgba(95, 93, 93, 0.512);
  height: auto; /* สูงตามเนื้อหาจริง */
  position: relative; /* ป้องกันปัญหาระบบพิกัด */
  transition: 0.3s ease;
}
.dhamma-card:hover {
  transform: translateY(-5px);
  transition: 0.3s ease;
  background: rgba(255, 255, 255, 1);
  box-shadow: 2px 0 10px rgba(255, 255, 255, 0.8);
}

/* หัวข้อคอลัมน์ H2 */
.dhamma-card h2 {
  color: white;
  font-size: 1.1em;
  font-weight: 600; /* น้ำหนักที่พอดี ไม่บวม */

  /* หัวใจสำคัญ: การจัดวางให้ลอย */
  display: inline-block;
  position: relative;
  top: -35px; /* ยกขึ้นไปทับขอบบน */
  margin-bottom: -60px; /* ดึงเนื้อหาด้านล่างให้ขยับขึ้นตามมา */
  left: 50%;
  transform: translateX(-50%); /* จัดให้อยู่กึ่งกลางเป๊ะ */

  background: linear-gradient(#89a6ea, #315f9c);
  padding: 8px 25px; /* เพิ่มพื้นที่รอบตัวหนังสือ */
  border-radius: 50px; /* ความมนแบบแคปซูล */
  box-shadow: 0 2px 3px rgba(61, 61, 61, 0.5); /* เพิ่มมิติให้ดูโผล่ออกมา */

  border-top: 1px solid rgba(237, 248, 255, 0.8);
  margin-top: 0px;
  letter-spacing: 0px;
  white-space: nowrap; /* กันหัวข้อตกบรรทัด */
}

.card-content {
  margin-top: -10px;
  font-size: 1em;
  line-height: 1.7;
  color: #333;
  flex-grow: 1; /* ดันเนื้อหาให้กระจายเต็มกล่อง */
}
.card-content p {
  margin-bottom: 10px; /* เว้นระยะห่างระหว่างย่อหน้า */
  text-align: left; /* จัดหน้าแบบกระจายตัวเพื่อให้ขอบขวาเรียบสวยงาม */
}

/* --- ปรับแต่งสำหรับมือถือ (Single Column) --- */
@media (max-width: 768px) {
  .dhamma-grid {
    column-count: 1; /* มือถือให้เหลือคอลัมน์เดียว */
    padding-left: 10px;
    padding-right: 20px;
    margin-right: 25px;
    margin-left: -3px;
  }
  .group-title {
    font-size: 2.4em;
  }
  .dhamma-card {
    width: 90%;
  }
}
