:root {
    --primary-blue: #000000;
    --accent-yellow: #FFCA61;
    --text-dark: #333;
    --bg-light: #ffdc97;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Kanit', sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
    scroll-behavior: smooth;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* ไม่ต้องกำหนดความสูงตายตัว */
    background: transparent !important; /* ทำให้พื้นหลังโปร่งใส */
    box-shadow: none !important;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 1000;
}

/* สร้างลักษณะวงกลม/ครึ่งวงกลมที่มุม */
.nav-circle {
    position: fixed;
    top: 0;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* ดันให้อยู่ชั้นบนสุดของทุกอย่าง */
    cursor: pointer; /* เปลี่ยนเมาส์เป็นรูปมือเมื่อชี้ */
    pointer-events: auto; /* มั่นใจว่าคลิกติดแน่นอน */
}

/* ตกแต่งมุมซ้าย (โลโก้) */
.nav-circle.left {
    border-radius: 0 0 50px 0; /* ทำเป็นโค้ง 1 ใน 4 หรือครึ่งวงกลมตามมุม */
    position: fixed;
    top: 0;
    left: 0;
}

.nav-circle.left img {
    height: 45px;
    margin-right: 10px;
    margin-bottom: 10px;
}

/* ตกแต่งมุมซ้าย (โลโก้) */
/* ค้นหาส่วนนี้ใน style.css */
.nav-circle.left {
    position: fixed;
    top: 0;
    left: 0; /* หรือตามที่คุณตั้งค่าไว้ */
    width: 120px;  /* ปรับเพิ่มจากเดิม (เช่น จาก 100px เป็น 120px หรือ 150px) */
    height: 120px; /* ต้องเท่ากับ width เพื่อให้เป็นวงกลม */
    background: var(--accent-yellow);
    border-bottom-right-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    cursor: pointer; /* เพิ่มเพื่อให้รู้ว่ากดได้ */
}

/* ตกแต่งมุมขวา (ปุ่มเมนู) */
.nav-circle.right {
    border-radius: 0 0 0 50px;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1002; /* เพิ่ม z-index ให้สูงกว่าเพื่อน */
    font-size: 24px;
    color: var(--primary-blue);
    pointer-events: auto;
}
/* ค้นหาหรือเพิ่มส่วนนี้ */
.nav-circle img {
    width: 70%; /* ปรับเปอร์เซ็นต์เพื่อให้รูปเล็กลงหรือใหญ่ขึ้นเมื่อเทียบกับวงกลม */
    height: auto;
    object-fit: contain;
}

nav .logo img { height: 50px; }
nav ul { display: flex; list-style: none; margin: 0; }
nav ul li a { 
    text-decoration: none; 
    margin-left: 20px; 
    color: var(--text-dark); 
    font-weight: 600; 
}

/* Hero Section */
.hero {
    position: relative;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ส่วนครอบสไลด์ */
.hero-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* ให้อยู่หลังข้อความ */
}

/* แถบยาวที่บรรจุรูปทั้งหมด */
.slide-track {
    display: flex;
    width: 400%; /* (จำนวนรูปทั้งหมดรวมตัวซ้ำ) x 100% */
    height: 100%;
    animation: scrollSlides 20s linear infinite; /* ปรับเวลาตามความเร็วที่ชอบ */
}

.slide {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(0.6); /* ปรับความมืดให้ข้อความอ่านง่ายขึ้น */
}

/* สั่งให้เลื่อนจากรูปที่ 1 ไปจนจบ */
@keyframes scrollSlides {
    0% { transform: translateX(0); }
    100% { transform: translateX(-75%); } /* เลื่อนไปทางซ้าย (100 - (100/จำนวนรูป)) */
}

.hero-content {
    z-index: 1; /* ดันข้อความมาข้างหน้า */
    color: var(--white);
    text-align: center;
}

/* News Section */
.news-section { padding: 80px 20px; background: var(--bg-light); text-align: center; }
.news-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px; 
    max-width: 1200px; 
    margin: 40px auto 0; 
}

.news-card { 
    background: var(--white); 
    padding: 25px; 
    border-left: 5px solid var(--primary-blue); 
    box-shadow: var(--shadow);
    cursor: pointer; 
    transition: 0.3s ease; 
}

.news-card:hover { transform: translateY(-5px); }

/* Member Carousel (3D) */
/* ค้นหาส่วนนี้ใน style.css */
.member-section { 
    padding: 80px 0; 
    text-align: center; 
    overflow: hidden; 
    background: var(--bg-light); /* เพิ่มบรรทัดนี้ หรือเปลี่ยนจากสีเดิมเป็นตัวแปรนี้ */
}
.carousel-wrapper { 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 500px; 
}

.carousel-container { 
    position: relative; 
    width: 800px; 
    height: 450px; 
    perspective: 1200px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.card-3d {
    position: absolute;
    width: 280px;
    height: 400px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    transform: scale(0.5) rotateY(0deg);
    pointer-events: none;
    overflow: hidden;
}

/* ปรับปรุงการตอบสนองของการ์ดสมาชิก */
/* สถานะปกติของการ์ดที่อยู่ตรงกลาง (Active) */
.card-3d.active {
    opacity: 1;           /* ทำให้การ์ดปรากฏขึ้น (จากเดิมที่โดนซ่อนเป็น 0) */
    z-index: 10;          /* ให้การ์ดอยู่หน้าสุด */
    transform: scale(1.1) translateX(0) rotateY(0deg); /* ขยายขนาดให้เด่นกว่าใบอื่น */
    pointer-events: auto; /* ให้กดคลิกได้ */
    cursor: pointer;      /* เปลี่ยนเมาส์เป็นรูปมือ */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ (Hover) */
.card-3d.active:hover {
    transform: scale(1.05) translateY(-15px); /* ขยายขนาดขึ้นเล็กน้อยและลอยขึ้น */
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3); /* เพิ่มเงาให้ดูเหมือนการ์ดลอยสูงขึ้นจากพื้นหลัง */
    filter: brightness(1.1); /* เพิ่มความสว่างเล็กน้อยเพื่อให้ดู Highlight */
}

/* เอฟเฟกต์แสงเงาวิ่งผ่านการ์ด (Glossy Shine Effect) */
/* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ (Hover) เฉพาะใบกลาง */
.card-3d.active:hover {
    transform: scale(1.15) translateY(-20px); /* ลอยขึ้นสูงขึ้นและขยายขึ้นอีกนิด */
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4); /* เงาเข้มขึ้นเพื่อให้ดูเหมือนลอยสูงจากพื้น */
    filter: brightness(1.05); /* สว่างขึ้นเล็กน้อย */
}

/* เพิ่มแสงวิ่งผ่านการ์ด (Glossy Effect) */
.card-3d.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    transition: 0.6s;
}

.card-3d.active:hover::after {
    left: 150%; /* แสงวิ่งจากซ้ายไปขวาเมื่อชี้ */
}

/* เพิ่มแอนิเมชันให้รูปภาพข้างในขยับเล็กน้อย */
.card-3d.active:hover .card-content img {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}
.card-3d.prev-card { opacity: 0.6; z-index: 5; transform: scale(0.8) translateX(-350px) rotateY(30deg); pointer-events: auto; }
.card-3d.next-card { opacity: 0.6; z-index: 5; transform: scale(0.8) translateX(350px) rotateY(-30deg); pointer-events: auto; }

.card-content { padding: 20px; }
.card-content img { width: 100%; height: 220px; object-fit: cover; border-radius: 15px; margin-bottom: 15px; }

.nav-btn {
    width: 50px;
    height: 50px;
    background: var(--accent-yellow);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    transition: 0.3s;
}

.nav-btn:hover { background: var(--primary-blue); color: var(--white); }

/* Staff Section */
/* ค้นหาส่วนนี้ใน style.css และแก้ไขตามนี้ */
.staff-section { 
    padding: 80px 20px; 
    text-align: center; 
    background: var(--bg-light); /* เปลี่ยนจาก #f0f4f8 เป็นสีเหลืองนวล */
}
.staff-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 30px; margin-top: 40px; }
.staff-card { 
    background: var(--white); 
    padding: 25px; 
    border-radius: 20px; 
    box-shadow: var(--shadow); 
    max-width: 300px; 
    cursor: pointer; /* ทำให้เมาส์เป็นรูปมือ */
    transition: 0.3s; 
}
.staff-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); /* เพิ่มเงาตอน Hover ให้ดูเด่นขึ้น */
}
#staffDetailContainer {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
}
.staff-img { width: 200px; height: 250px; object-fit: cover; border-radius: 15px; margin-bottom: 15px; }

/* Gallery */
/* ค้นหาหรือเพิ่มส่วนนี้ใน style.css */
.gallery-section {
    padding: 80px 20px;
    text-align: center;
    background: var(--bg-light); /* เพิ่มบรรทัดนี้เพื่อให้เป็นสีเหลืองนวล */
}

/* หากในไฟล์เดิมมี .gallery-grid อยู่แล้ว ไม่ต้องลบครับ ให้คงไว้เหมือนเดิม */
.gallery-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
    padding: 40px 20px; 
    max-width: 1200px; 
    margin: 0 auto;
}
.gallery-item img { width: 100%; border-radius: 12px; cursor: pointer; transition: 0.3s ease; }
.gallery-item img:hover { transform: scale(1.03); }

/* Modals & Lightbox */
/* Lightbox พื้นหลัง */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    cursor: zoom-out;
}

/* รูปภาพขนาดเต็ม */
.full-res-img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    cursor: default;
    animation: zoomIn 0.3s ease;
}

/* ปุ่มปิด (X) */
.close-btn {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: #ffeb3b;
    transform: scale(1.2);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* แก้ไข .news-modal ให้ใช้คุณสมบัติเดียวกับ lightbox เพื่อให้เด้งทับหน้าจอ */
.news-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* พื้นหลังมืด */
    z-index: 10000; /* ให้อยู่บนสุด */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

/* ปรับปรุงดีไซน์การ์ดเนื้อหาข่าวสาร */
.news-modal-content {
    background: var(--white);
    padding: 40px;
    border-radius: 25px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 50px rgba(235, 232, 232, 0.3);
    border-top: 8px solid var(--primary-blue); /* เพิ่มแถบสีให้ดูเหมือนการ์ด */
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ปรับแต่งหัวข้อในข่าวสาร */
#newsDetail h2 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 1.8rem;
}

#newsDetail p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333232;
}

@keyframes pop { from {transform: scale(0.9); opacity: 0;} to {transform: scale(1); opacity: 1;} }

.close-btn { position: absolute; top: 15px; right: 25px; font-size: 35px; cursor: pointer; color: #999; }
.close-btn:hover { color: var(--text-dark); }

/* Footer */
footer {
    padding: 40px;
    background: var(--primary-blue);
    color: var(--white);
    text-align: center;
}
/* ปรับปรุงดีไซน์ Modal รายละเอียดสมาชิก */
.detail-modal {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    max-width: 450px; /* จำกัดความกว้างรวม */
    width: 90%;
    max-height: 90vh; /* จำกัดความสูงไม่ให้เกินหน้าจอ */
    overflow-y: auto; /* เพิ่ม Scrollbar หากเนื้อหายาวเกินไป */
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: pop 0.3s ease-out;
}

/* ควบคุมขนาดรูปภาพใน Modal ให้ไม่ใหญ่เกินไป */
.detail-modal img {
    width: 100%;
    max-height: 300px; /* กำหนดความสูงสูงสุดของรูป */
    object-fit: cover; /* ให้รูปดูสมส่วนไม่เบี้ยว */
    border-radius: 15px;
    margin-bottom: 20px;
    display: block;
}

.detail-modal h2 { margin: 10px 0; color: var(--primary-blue); }
.detail-modal p { margin: 8px 0; line-height: 1.5; color: #333333; }
/* ปรับให้การ์ดที่ไม่ได้เป็น Active ดูเหมือนปุ่มที่คลิกได้ */
.carousel-item {
    cursor: pointer; /* เปลี่ยนเมาส์เป็นรูปมือ */
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* ลบสไตล์ปุ่มเดิมออก (ถ้ามี) เพื่อความสะอาดของโค้ด */
.carousel-controls {
    display: none;
}
.carousel-item {
    cursor: pointer; /* เปลี่ยนเมาส์เป็นรูปมือ */
    transition: all 0.5s ease-in-out;
}

/* เพิ่ม Effect นิดหน่อยเวลาเอาเมาส์ไปชี้ใบที่อยู่ข้างๆ */
.carousel-item:not(.active):hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}
/* ดีไซน์ปุ่มแฮมเบอร์เกอร์ */
.menu-toggle {
    display: block; /* แสดงผล */
    font-size: 28px;
    cursor: pointer;
    color: var(--primary-blue);
    z-index: 1001;
    transition: transform 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

/* ซ่อนเมนูและเตรียมการเคลื่อนไหว */
/* ปรับปรุงเมนูที่สไลด์ออกมา */
.nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: rgba(255, 202, 97, 0.98); 
    display: flex; /* มั่นใจว่าเป็น flex เพื่อจัดเรียงแนวตั้ง */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9998; /* ให้อยู่ต่ำกว่าปุ่มกดนิดนึงแต่สูงกว่าหน้าเว็บ */
    transition: 0.5s ease;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu.active {
    right: 0;
}

.nav-menu li {
    margin: 20px 0;
}

.nav-menu li a {
    font-size: 1.2rem;
    transition: 0.3s;
}

.nav-menu li a:hover {
    color: var(--white);
    letter-spacing: 2px; /* เอฟเฟกต์ตัวอักษรขยายตอน Hover */
}

/* เปลี่ยนไอคอนแฮมเบอร์เกอร์ตอนคลิก (Optional: หมุนไอคอน) */
.menu-toggle.active i::before {
    content: "\f00d"; /* เปลี่ยนเป็นรูปตัว X (FontAwesome times) */
}
/* --- ปรับปรุงระบบ Hero Slider ใหม่ --- */

.slide-track {
    display: block;      /* เปลี่ยนจาก flex เป็น block เพื่อให้ภาพซ้อนกัน */
    width: 100%;
    height: 100%;
    position: relative;
    animation: none;     /* ลบการเลื่อนซ้ายเดิมออก */
}

.slide {
    position: absolute;  /* สั่งให้ทุกภาพวางซ้อนทับกันที่จุดเดียว */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;          /* เริ่มต้นด้วยการซ่อนภาพไว้ */
    filter: brightness(0.6); /* ค่าความสว่างเริ่มต้น (ปรับตามที่คุณชอบ) */
    
    /* เรียกใช้ Animation ใหม่ที่เราสร้าง: 6 วินาที x 3 ภาพ = 18 วินาที */
    animation: heroPopAndFade 18s infinite; 
}

/* กำหนด Delay ให้แต่ละภาพเริ่มไม่พร้อมกัน (สำหรับ 3 ภาพ) */
.slide:nth-child(1) { animation-delay: 0s; }
.slide:nth-child(2) { animation-delay: 6s; }
.slide:nth-child(3) { animation-delay: 12s; }

/* สร้าง Animation: เด้งขึ้น -> แสดงภาพ -> ดรอปสีและหายไป */
@keyframes heroPopAndFade {
    0% {
        opacity: 0;
        transform: scale(1.1) translateY(20px); /* เด้งขึ้นมาจากด้านล่างนิดๆ และขนาดใหญ่กว่าปกติ */
        filter: brightness(0) grayscale(1);      /* เริ่มจากมืดสนิทและขาวดำ (ดรอปสี) */
    }
    /* 5% ของ 18 วินาที คือช่วงที่ภาพกำลังโผล่ขึ้นมา (ประมาณ 0.9 วินาที) */
    5% {
        opacity: 1;
        transform: scale(1) translateY(0);       /* กลับสู่ขนาดปกติ */
        filter: brightness(0.6) grayscale(0);    /* สีกลับมาสดใสและความสว่างปกติ */
    }
    /* 28% คือช่วงเวลาที่ภาพจะหยุดนิ่งให้คนดู (ประมาณ 4-5 วินาที) */
    28% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: brightness(0.6) grayscale(0);
    }
    /* 33.33% คือช่วงที่ภาพกำลังเริ่มดรอปสีและหายไปเพื่อสลับภาพใหม่ */
    33.33% {
        opacity: 0;
        transform: scale(0.95);                 /* ย่อตัวลงเล็กน้อย */
        filter: brightness(0) grayscale(1);      /* ดรอปสีลงเป็นขาวดำและมืดลง */
    }
    /* เวลาที่เหลือ 100% ให้ภาพนั้นซ่อนตัวอยู่ เพื่อให้ภาพอื่นแสดงผล */
    100% {
        opacity: 0;
    }
}