/* ============================================
   ==          GENERAL & FONTS             ==
   ============================================ */
body {
    font-family: 'Kanit', sans-serif !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* ============================================
   ==            BREADCRUMB AREA           ==
   ============================================ */
.breadcrumb-area {
    padding: 0;
    height: 300px;
    background-size: cover;
    background-position: center;
    color: #fff;
    text-align: center;
    text-shadow: 3px 3px 5px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.breadcrumb-content h4 {
    font-size: 50px;
    font-weight: 600;
    margin-top: -50px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.breadcrumb-content h5 {
    font-size: 24px;
    font-weight: 400;
    margin-top: 10px;
    color: #f0f0f0;
}
.breadcrumb-content p {
    font-size: 16px;
    margin-top: 5px;
    color: #ffffff;
}
.breadcrumb-content p a {
    color: #ffffff;
    text-decoration: none;
}
.breadcrumb-content p a:hover { text-decoration: underline; }
.breadcrumb-content p i { margin: 0 5px; font-size: 12px; }


/* ============================================
   ==          ORG CHART CONTAINER         ==
   ============================================ */
.org-chart-container {
    position: relative;
    padding: 40px 20px;
    background: #FCF6EF;
    min-height: 100vh;
    align-items: center;
    display: flex;
    flex-direction: column;
}
.org-chart {
    position: relative;
    padding: 80px 20px;
    max-width: 600px; /* ขยายเพื่อให้มีพื้นที่สำหรับ Grid */
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* แบ่งเป็น 6 คอลัมน์ */
    grid-auto-rows: minmax(350px, auto); /* กำหนดความสูงของแถว */
    gap: 150px 40px;
    align-items: center;
    justify-items: center;
}

.org-row {
    display: flex; /* << คำสั่งสำคัญ: ทำให้ item ข้างในเรียงแนวนอน */
    justify-content: center; /* จัดให้อยู่กึ่งกลาง */
    flex-wrap: wrap; /* ทำให้ขึ้นบรรทัดใหม่เมื่อจอเล็ก */
    width: 100%;
    gap: 30px; /* ระยะห่างระหว่างการ์ด */
}

.org-row.president-person-row {
    justify-content: center; /* จัดให้อยู่กึ่งกลาง */
}

/* ============================================
   ==      SPECIAL STYLE FOR PRESIDENT       ==
   ============================================ */

.person-card-pre1 {
    /* --- 1. กำหนด Layout หลัก --- */
    display: flex;         /* << เปิดใช้งาน Flexbox */
    flex-direction: row;   /* << สั่งให้เรียงเนื้อหาแนวนอน (ซ้ายไปขวา) */
    align-items: center;   /* << จัดให้ "รูป" กับ "กลุ่มเนื้อหา" อยู่กึ่งกลางแนวตั้ง */
    gap: 40px;             /* << ระยะห่างระหว่างรูปกับเนื้อหา */

    /* --- 2. กำหนดหน้าตาและความกว้าง --- */
    background: linear-gradient(rgba(255, 255, 255, 0.850)),
    radial-gradient(ellipse at top right, #FCF6EF, #7E4D9F, #81358D);
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 1200px; /* กำหนดความกว้างสูงสุด */
    min-height: 520px;
    margin-bottom: 40px;

    border: 3px solid transparent; /* สร้างเส้นขอบโปร่งใสรอไว้ (ปรับความหนาได้) */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.person-card-pre1:hover {
    transform: translateY(-5px) scale(1);
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    border-color: #E5CAA7;
}
.person-card-pre1.active {
    border-color: #E5CAA7;
    transform: translateY(-5px) scale(1);
}

.person-card-pre1 .person-image {
    width: 400px; /* ปรับขนาดรูปให้ใหญ่ขึ้น */
    height: 400px;
}

.person-card-pre1 .person-detail {
    text-align: left;
}

/* ทำให้เส้นขีดชิดซ้ายด้วย */
.person-card-pre1 .contact-info-name-1 {
    align-items: center; 
    display: flex;
    flex-direction: column; 
    align-items: center;
    text-align: center;

    position: relative; /* จำเป็นสำหรับการวางเส้นใต้ */
}

/* ทำให้ข้อมูลติดต่อชิดซ้าย */
.person-card-pre1 .contact-info,
.person-card-pre1 .contact-item {
    justify-content: center;
    flex-direction: row;
    gap: 24px;
    padding: 0;
}

.person-card-pre1 .contact-logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.person-card-pre1 .cesm-logo {
    width: 100%;
    max-width: 500px;
    height: auto;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 20px;
}

.person-card-pre1 .mission-link {
    justify-content: center;
}

.person-card-pre1 .person-name,
.person-card-pre1 .person-position {
    text-align: left; /* จัดตัวหนังสือชิดซ้าย */
    font-size: 2rem;
}



/* ============================================
   ==             PERSON CARD              ==
   ============================================ */
.person-card {
    position: relative; /* เปลี่ยนจาก absolute เป็น relative */
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    width: 500px; /* กำหนดขนาดสูงสุด */
    min-height: 420px;
    margin-bottom: 40px;

    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp 0.6s ease forwards; /* Animation ตอนโหลด */
    gap: 32px;
}
.person-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    border-color: #E5CAA7;
}
.person-card.active {
    border-color: #E5CAA7;
    transform: translateY(-5px) scale(1.02);
}

/* --- Card Content --- */
.person-image {
    width: 300px;
    height: 300px;
    border-radius: 5%;
    object-fit: cover;
    flex-shrink: 0;
}

.person-detail {
    display: flex;
    flex-direction: column; /* จัดเนื้อหาด้านขวาให้เรียงจากบนลงล่าง */
    align-items: center;
    width: 100%;
    gap: 12px;
}

.person-name {
    font-size: 1.7rem;
    font-weight: 500;
    color: #454545;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.3;
}
.person-position {
    font-size: 1.4rem;
    color: #6F6F6F;
    text-align: center;
    font-weight: 400;
    line-height: 1.4;
    flex-grow: 1; /* ทำให้ contact-info อยู่ล่างสุดเสมอ */
    gap: 12px;
}

/* --- Card Clickable Area (Contact Info) --- */
.contact-info {
    display: flex; 
    flex-direction: column; 
    align-items: center;
    gap: 12px;
    width: 100%;
}

.contact-info-name {
    display: flex;
    flex-direction: column; 
    align-items: center;
    text-align: center;

    position: relative; /* จำเป็นสำหรับการวางเส้นใต้ */
    padding-bottom: 16px; /* สร้างระยะห่างใต้เส้น */
}

.contact-info-name::after {
    content: ''; /* << จำเป็นต้องมีเสมอ */
    position: absolute;
    bottom: 0; /* ให้เส้นอยู่ด้านล่างสุดของกรอบ .contact-info-name */
    left: 50%; /* จัดให้อยู่กึ่งกลางแนวนอน */
    transform: translateX(-50%); /* จัดให้อยู่กึ่งกลางแนวนอน */

    width: 90%; /* ให้เส้นมีความกว้าง 100% ของ .contact-info-name */
    height: 2px; /* ความหนาของเส้น */
    background-color: #E5CAA7; /* สีของเส้น */
}

.contact-info-line {
    display: inline-block;
    width: 75%; /* <<< ทำให้เส้นยาว 120% */
    height: 2px; /* ความหนาของเส้น */
    background-color: #E5CAA7; /* สีของเส้น */
    border-radius: 10px;
    margin: 0 auto;
}

.contact-item {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.contact-item-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.3s ease;
    cursor: pointer;
    gap: 12px;
}

.contact-item i {
    color: #E5CAA7;
    margin-right: 6px;
    width: 20px;
    text-align: center;
}

.contact-item-link i {
    color: #E5CAA7;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.contact-item .contact-text {
    font-size: 1rem;
    color: #6F6F6F;
    word-break: break-all;
    text-decoration: none;
}

/* --- Mission Link Button --- */
.contact-item-link.mission-link,
.contact-item-link.mission-link-2,
.contact-item-link.mission-link-3 {
    display: inline-block;
    background: linear-gradient(45deg, #E5CAA7, #ecc591);
    color: #6F6F6F;
    text-decoration: none;
}
.contact-item-link.mission-link:hover,
.contact-item-link.mission-link-2:hover,
.contact-item-link.mission-link-3:hover {
    background: linear-gradient(45deg, #e4b271, #e4ba84);
    text-decoration: none;
}
.contact-item-link.mission-link i,
.contact-item-link.mission-link .contact-text,
.contact-item-link.mission-link-2 i,
.contact-item-link.mission-link-2 .contact-text,
.contact-item-link.mission-link-3 i,
.contact-item-link.mission-link-3 .contact-text {
    color: #454545;
    text-decoration: none;
}


/* ============================================
   ==       ORG CHART GRID PLACEMENT       ==
   ============================================ */
.president { grid-column: 3 / span 2; grid-row: 1; }
.vice-president { grid-column: 2 / span 2; grid-row: 2; }
.assistant { grid-column: 4 / span 2; grid-row: 2; }
.director { grid-column: 3 / span 2; grid-row: 3; }
.admin-head { grid-column: 2 / span 2; grid-row: 4; }
.promotion-head { grid-column: 4 / span 2; grid-row: 4; }

/* Animation Delays */
.president { animation-delay: 0.1s; }
.vice-president { animation-delay: 0.2s; }
.assistant { animation-delay: 0.3s; }
.director { animation-delay: 0.4s; }
.admin-head { animation-delay: 0.5s; }
.promotion-head { animation-delay: 0.6s; }


/* ============================================
   ==         SVG CONNECTION LINES         ==
   ============================================ */
.connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}
.connection-line {
    stroke: #e74c3c;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1s ease forwards;
}

/* ============================================
   สไตล์สำหรับ Modal
   ============================================ */

/* ทำให้การ์ดของอธิการบดีดูเหมือนกดได้ */
#presidentCard {
    cursor: pointer;
}

/* 1. Overlay พื้นหลังสีเทา */
.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.6); /* สีดำโปร่งแสง */
}

/* 2. กล่องเนื้อหาของ Modal */
.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* จัดให้อยู่กลางแนวตั้งและแนวนอน */
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 100%;
    border-radius: 8px;
    position: relative;
    animation: fadeIn 0.5s;
}

/* ============================================
   สไตล์เพิ่มเติมสำหรับเนื้อหา Modal อธิการบดี
   ============================================ */

.modal-content h2.modal-title {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 30px;
    border-bottom: 5px solid #e4b271; /* เส้นใต้หัวข้อหลัก */
    padding-bottom: 10px;
    text-align: center;
}

.modal-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e0e0e0; /* เส้นประแบ่งแต่ละ Section */
}
.modal-section:last-of-type {
    border-bottom: none; /* ไม่ต้องมีเส้นประที่ส่วนท้ายสุด */
}

.section-heading {
    font-size: 1.6rem;
    color: #34495e;
    margin-top: 0;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 5px solid #e4b271; /* แถบสีส้มข้างหัวข้อ */
}

.profile-summary {
    display: flex;
    flex-direction: column;
    align-items: center;    /* << แก้กลับมาเป็น center */
    
    gap: 20px;
    /* text-align: left; */ /* << ลบบรรทัดนี้ออกไปก่อน */
    margin-bottom: 20px;
}

.profile-image {
    width: 250px; /* ขนาดรูปภาพใน Modal */
    height: 250px;
    border-radius: 50%; /* ทำให้เป็นวงกลม */
    object-fit: contain;
    flex-shrink: 0; /* ไม่ให้รูปภาพหด */
}

/* สั่งให้ข้อความใน .profile-text จัดชิดซ้าย */
.profile-text {
    width: 100%; /* ทำให้กล่องข้อความกว้างเต็มพื้นที่ */
    text-align: left; /* สั่งให้ตัวหนังสือข้างในชิดซ้าย */
}

.profile-text p {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 1.5rem;
    color: #333;
}
.profile-text ul {
    list-style: disc; /* ใช้ bullet point */
    padding-left: 25px;
    margin-top: 10px;
    font-size: 1.1rem;
    color: #333;
}
.profile-text ul li {
    margin-bottom: 5px;
}

/* สไตล์สำหรับรายการใน Section อื่นๆ */
.modal-section ul {
    padding-left: 25px;
    margin-top: 10px;
    font-size: 1.1rem;
    color: #333;
}
.modal-section ul li {
    margin-bottom: 5px;
    line-height: 1.6;
}
.modal-section ul li strong {
    color: #2c3e50;
}

.modal-footer {
    text-align: right;
    margin-top: 30px;
    font-size: 0.9rem;
    color: #777;
}

/* ============================================
   สไตล์สำหรับรายการแบบตัวเลข (Ordered List)
   ============================================ */

/* กำหนดสไตล์โดยรวมสำหรับ <ol> ที่อยู่ใน Modal */
.modal-section ol {
    /* --- ส่วนสำคัญที่สุดในการจัดตำแหน่ง --- */
    list-style-type: decimal; /* ทำให้เป็นตัวเลข 1, 2, 3 */
    list-style-position: outside; /* ทำให้ตัวเลขอยู่ "นอก" ขอบเขตข้อความ (เพื่อให้ย่อหน้าสวย) */
    padding-left: 30px; /* สร้างพื้นที่ด้านซ้ายสำหรับวางตัวเลข (ปรับค่าได้) */

    /* --- สไตล์อื่นๆ --- */
    margin: 0;
}

/* กำหนดสไตล์ให้แต่ละรายการ <li> */
.modal-section ol li {
    padding-left: 10px; /* ระยะห่างระหว่าง "ตัวเลข" กับ "ข้อความ" */
    margin-bottom: 15px; /* ระยะห่างระหว่างแต่ละข้อ */
    line-height: 1.6;
}

/* Responsive สำหรับ Modal บนจอมือถือ */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 20px;
    }
    .modal-content h2.modal-title {
        font-size: 1.8rem;
    }
    .section-heading {
        font-size: 1.4rem;
    }
    .profile-summary {
        flex-direction: column; /* จัดให้รูปอยู่บน ข้อความอยู่ล่าง */
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    .profile-image {
        width: 120px;
        height: 120px;
    }
    .profile-text p, .profile-text ul, .modal-section ul {
        font-size: 1rem;
    }
}

/* 3. ปุ่มปิด (X) */
.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Animation ตอน Modal ปรากฏขึ้นมา */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   สไตล์สำหรับตารางประวัติการศึกษาใน Modal
   ============================================ */

.education-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    display: table; /* ทำให้ div ทำงานเหมือน table */
}

.table-header, .table-row {
    display: table-row; /* ทำให้ div ทำงานเหมือน tr */
}

.table-header {
    background-color: #f2f2f2;
    font-weight: 800;
    color: #333;
}

.table-header .table-cell {
    font-size: 1.2rem;   /* << ปรับขนาดฟอนต์ของ Header ได้ที่นี่ */
    font-weight: 600;    /* ปรับความหนาได้ที่นี่ */
    color: #2c3e50;
}

.table-cell {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    display: table-cell; /* ทำให้ div ทำงานเหมือน td */
    text-align: left;
    vertical-align: middle;
    font-size: 1rem;
}

/* ============================================
   สไตล์สำหรับรูปภาพที่อยู่ในตาราง
   ============================================ */

/* กำหนดสไตล์ให้รูปภาพทุกรูปที่อยู่ใน .table-cell */
.table-cell img {
    max-width: 200px; /* กำหนดความกว้างสูงสุดของรูป (ปรับค่าได้) */
    height: auto;    /* ทำให้ความสูงปรับตามอัตโนมัติเพื่อไม่ให้รูปบิดเบี้ยว */
    
    /* ทำให้รูปอยู่กึ่งกลางของช่อง cell */
    display: block;
    margin: 0 auto;
}

.table-row:nth-child(even) {
    background-color: #f9f9f9; /* สีสลับแถว */
}

.table-row:hover {
    background-color: #f1f1f1; /* สีตอนเอาเมาส์ชี้ */
}

.table-full-width-row {
    text-align: left;
    padding: 12px 15px;
}

/* --- Responsive สำหรับตารางบนจอมือถือ --- */
@media (max-width: 768px) {
    .education-table, .table-header, .table-row, .table-cell {
        display: block; /* เปลี่ยนให้ทุกอย่างเป็น block เพื่อเรียงต่อกันแนวตั้ง */
    }

    .table-header {
        display: none; /* ซ่อนหัวตารางในมือถือ (เราจะใช้ data-label แทน) */
    }
    
    .table-row {
        border: 1px solid #ddd;
        margin-bottom: 15px;
        padding: 10px;
        border-radius: 5px;
    }

    .table-cell {
        padding: 8px 0;
        border-bottom: none;
        position: relative;
        padding-left: 50%; /* เว้นที่ให้หัวข้อด้านซ้าย */
        text-align: right;
    }

    .table-cell[colspan="4"] {
        padding-left: 0;
        text-align: left;
        margin-top: 10px;
        font-style: italic;
    }
    .table-cell[colspan="4"]::before {
        display: none; /* ไม่ต้องแสดงหัวข้อสำหรับแถวที่รวม cell */
    }

    .table-cell::before {
        content: attr(data-label); /* ดึงข้อความจาก data-label มาแสดง */
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
    }
}

/* ============================================
   กฎพิเศษสำหรับ Cell เต็มความกว้าง (ใช้ ID ช่วย)
   ============================================ */

/* 1. ใช้ ID #presidentModal นำหน้าเพื่อเพิ่มพลังสูงสุด */
#presidentModal .education-table .table-row-full {
    display: block; 
    width: 100%;
}

/* 2. ใช้ ID #presidentModal นำหน้าเช่นกัน */
#presidentModal .education-table .table-row-full .table-cell-full {
    display: block;
    width: 100%;
    text-align: left;
    background-color: #f9f9f9;
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

/* ============================================
   ==              MODAL STYLES            ==
   ============================================ */
.modal-1 {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-1 i {
    margin-right: 8px;
    color: #e4b271;
}

.modal-content-1 {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    animation: fadeIn 0.4s ease;
}
.close {
    color: #aaa;
    position: absolute;
    right: 25px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.close:hover { color: #e4b271; }
.modal-1 h2 {
    color: #e4b271;
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 500;
    text-align: center;
}
.mission-list, .mission-list-2 {
    list-style: none;
    padding: 0;
}
.mission-item {
    background: #f8f9fa;
    margin-bottom: 15px;
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #e4ba84;
    transition: all 0.3s ease;
}
.mission-item:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.mission-item h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 400;
}


/* ============================================
   ==           ANIMATIONS                 ==
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* ============================================
   ==      RESPONSIVE DESIGN SECTION       ==
   ============================================ */

/* ============== สำหรับจอ Tablet (<= 1200px) ============== */
@media (max-width: 1200px) {
    .org-chart {
        grid-template-columns: repeat(4, 1fr); /* ลดเหลือ 4 คอลัมน์ */
        gap: 100px 30px;
    }
    .president { grid-column: 2 / span 2; grid-row: 1; }
    .vice-president { grid-column: 1 / span 2; grid-row: 2; }
    .assistant { grid-column: 3 / span 2; grid-row: 2; }
    .director { grid-column: 2 / span 2; grid-row: 3; }
    .admin-head { grid-column: 1 / span 2; grid-row: 4; }
    .promotion-head { grid-column: 3 / span 2; grid-row: 4; }
}

/* ============== สำหรับจอ Mobile (<= 768px) ============== */
@media (max-width: 768px) {
    .breadcrumb-content h4 { font-size: 32px; }
    .breadcrumb-content h5 { font-size: 18px; }

    .org-chart {
        display: flex; /* เปลี่ยนเป็น Flexbox เพื่อเรียงแนวตั้ง */
        flex-direction: column;
        align-items: center;
        gap: 40px;
        padding: 40px 15px;
    }
    
    .person-card {
        width: 100%;
        max-width: 380px;
        min-height: auto; /* ให้ความสูงเป็นไปตามเนื้อหา */
        animation: none; /* ปิด animation ตอนโหลดในมือถือ */
    }

    .person-name { font-size: 1.2rem; }
    .person-position { font-size: 0.95rem; flex-grow: 0; }
    
    .connections-svg {
        display: none; /* ซ่อนเส้น SVG ในมือถือ */
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
        max-height: 90vh;
    }
}

/* ============================================
   ==      RESPONSIVE FOR PRESIDENT CARD     ==
   ============================================ */

@media (max-width: 992px) { /* << เริ่มทำงานเมื่อหน้าจอเล็กกว่า 992px (แท็บเล็ต) */

    /* --- ปรับการ์ด President ให้เป็นแนวตั้ง --- */
    .person-card-pre1 {
        flex-direction: column; /* 1. เปลี่ยนกลับเป็นแนวตั้ง */
        max-width: 500px;       /* 2. ลดความกว้างสูงสุดลง */
        min-height: auto;       /* 3. ให้ความสูงปรับตามเนื้อหา */
        gap: 20px;
        padding: 25px;
    }

    .person-card-pre1 .person-image {
        width: 300px; /* ย่อขนาดรูปภาพ */
        height: 300px;
    }

    /* 4. จัดเนื้อหาทั้งหมดให้กลับมาอยู่กึ่งกลาง */
    .person-card-pre1 .person-detail,
    .person-card-pre1 .contact-info-name-1,
    .person-card-pre1 .contact-info {
        align-items: center;
    }
    
    .person-card-pre1 .person-name,
    .person-card-pre1 .person-position {
        text-align: center;
        font-size: 1.2rem;
    }
    
    /* 5. จัดเบอร์โทรกับอีเมลให้เรียงแนวตั้ง */
    .person-card-pre1 .contact-item {
        flex-direction: column;
        gap: 10px;
    }

    /* 6. ซ่อนโลโก้เพื่อให้ไม่รกเกินไปบนจอเล็ก */
    .person-card-pre1 .contact-logo {
        display: none;
    }

    .person-card-pre1 .contact-item-link.mission-link {
        display: flex;  /* 1. เปลี่ยนกลับเป็น flex */
        width: 100%;    /* 2. ทำให้ปุ่มกว้างเต็ม 100% */
    }
}


@media (max-width: 768px) { /* << ปรับเพิ่มเติมสำหรับมือถือ */
    
    /* ทำให้การ์ด President มีขนาดเท่ากับการ์ดอื่นบนมือถือ */
    .person-card-pre1 {
        max-width: 380px; /* ขนาดเดียวกับ .person-card ในโหมดมือถือ */
    }

    .person-card-pre1 .person-image {
        width: 300px;
        height: 300px;
    }
}