/* === 0. การตั้งค่าการเลื่อน (Scroll Settings) === */
html {
    scroll-behavior: smooth; /* ทำให้การเลื่อน (scroll) นุ่มนวล */
}

/* === 1. การตั้งค่าโดยรวม (Global Settings) === */
body {
    font-family: 'Sarabun', sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === 2. ส่วนหัวและเมนู (Header & Navigation) === */
header {
    background-color: #ffffff;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 50px;
    width: auto;
    display: block;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

header nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
}

header nav li {
    margin-left: 20px;
}

header nav a {
    text-decoration: none;
    color: #555;
    font-weight: bold;
    transition: color 0.3s ease;
}

header nav a:hover {
    color: #007bff;
}

/* === 3. ส่วนเนื้อหาหลัก (Sections) === */
section {
    padding: 60px 0;
    border-bottom: 1px solid #eee;
}

section:nth-child(even) {
    background-color: #ffffff;
}

h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #2c3e50;
}

/* === 4. การ์ด (Card Layout) === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.card h3 {
    margin-top: 0;
    color: #007bff;
}

/* === 5. ส่วน Hero (หน้าแรก) - พร้อมรูปพื้นหลัง === */
.hero {
    /* ★★★ แก้ไขชื่อไฟล์รูปพื้นหลังตรงนี้ครับ ★★★ */
    background-image: url('images/hero-background.jpg'); 
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    color: #ffffff;
    text-align: left;
    padding: 100px 0;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero h2, .hero p {
    color: #ffffff;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    text-align: left;
}

/* === 6. ส่วนท้ายเว็บ (Footer) === */
footer {
    background-color: #333;
    color: #aaa;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* === 7. ส่วนติดต่อ (Contact Section) === */
#contact {
    background-color: #ffffff;
}

.contact-bio {
    flex: 1;
    text-align: left; 
    font-size: 1.1rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
}

.contact-list {
    text-align: center;
    margin-top: 30px;
}

.contact-link {
    display: inline-block;
    margin: 10px 20px;
    text-decoration: none;
    color: #333;
    font-size: 1.1rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: #007bff;
}

.contact-link i {
    margin-right: 8px;
    font-size: 2rem;
    color: #555;
    vertical-align: middle;
}

.contact-link:hover i.fa-facebook { color: #3b5998; }
.contact-link:hover i.fa-github { color: #181717; }
.contact-link:hover i.fa-envelope { color: #db4437; }
.contact-link:hover i.fa-line { color: #00B900; }
.contact-link:hover i.fa-phone { color: #007bff; }


/* === 8. สไตล์สำหรับ Section Subtitle === */
.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    font-style: italic;
    color: #777;
    max-width: 700px;
    margin: -30px auto 40px auto;
}

/* === 9. สไตล์สำหรับ Timeline (Education) === */
.timeline-heading {
    text-align: center;
    color: #333;
    font-size: 1.8rem;
    margin-top: 50px;
    margin-bottom: 30px;
}

.education-timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 0;
}

.education-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background-color: #007bff;
    border-radius: 2px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}

.timeline-item:nth-child(odd) {
    left: 0;
    padding-right: 20px;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
    padding-left: 20px;
    text-align: left;
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: 20px;
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    border: 4px solid #007bff;
    border-radius: 50%;
    z-index: 1;
}

.timeline-item:nth-child(odd)::after {
    right: -12px;
}

.timeline-item:nth-child(even)::after {
    left: -12px; 
}

.timeline-content {
    padding: 20px 30px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.timeline-content h3 {
    margin-top: 0;
    color: #007bff;
    font-size: 1.3rem;
}
.timeline-content h4 {
    margin: 5px 0;
    font-size: 1rem;
    font-weight: normal;
    font-style: italic;
    color: #555;
}
.timeline-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #333;
}

@media screen and (max-width: 600px) {
    .education-timeline::before {
        left: 31px;
    }
    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        left: 0;
        text-align: left;
    }
    .timeline-item:nth-child(odd)::after,
    .timeline-item:nth-child(even)::after {
        left: 23px;
    }
}

/* === 10. สไตล์สำหรับรูปภาพในการ์ด (Card Image) */
.card-image {
    width: calc(100% + 40px);
    height: auto;
    
    margin-top: -20px; 
    margin-left: -20px; 
    margin-bottom: 20px; 
    
    border-radius: 8px 8px 0 0; 
}

.card ul {
    padding-left: 20px;
    margin-bottom: 0;
    margin-top: 15px;
    text-align: left;
}

.card li {
    margin-bottom: 5px;
}

/* === 11. สไตล์สำหรับ Card ที่ต้องการจัดกลาง (Helper Class) */
.card-centered {
    text-align: center;
}
.card-centered ul {
    text-align: left;
    display: inline-block;
}

/* === 12. สไตล์สำหรับ "ปรัชญาการสอน" (Philosophy Quote) */
.philosophy-quote {
    text-align: center;
    margin: 20px auto 40px auto;
    max-width: 700px;
    font-style: italic;
}

.philosophy-quote p {
    font-size: 1.2rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 10px;
}

.philosophy-quote .author {
    font-size: 1rem;
    font-style: normal;
    font-weight: bold;
    color: #333;
}

/* === 13. สไตล์สำหรับ "About Me" (Profile Pic + Bio) */
.about-me-container {
    display: flex;
    align-items: center;
    gap: 30px;
    max-width: 900px;
    margin: 40px auto 50px auto;
}

.profile-image {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

@media screen and (max-width: 700px) {
    .about-me-container {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .contact-bio {
        text-align: center;
    }
}

/* === 14. สไตล์สำหรับ Modal (Pop-up Gallery) === */
.modal {
    display: none; /* ซ่อนไว้ก่อน */
    position: fixed;
    z-index: 1000; /* ให้ทับทุกองค์ประกอบ */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8); /* พื้นหลังดำโปร่งแสง */
    padding-top: 50px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* จัดกึ่งกลางแนวตั้ง */
    padding: 30px;
    border: 1px solid #888;
    width: 80%; /* ความกว้างหลัก */
    max-width: 900px; /* ความกว้างสูงสุด */
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

#modal-title {
    color: #007bff;
    margin-top: 0;
}

/* Gallery Grid สำหรับรูปภาพหลักฐาน */
.modal-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.modal-gallery-grid img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* ทำให้การ์ดที่คลิกได้ดูเหมือนปุ่ม */
.card.clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}
