/**
 * DGA Team Member Styling - Final Version
 * ไฟล์นี้ควรอยู่ที่: child-theme/css/dga-team.css
 * ออกแบบตามภาพตัวอย่างที่ส่งมา
 */

/* =============== ส่วนของการ์ดหลัก =============== */
.dga-team-member {
    width: 280px;
    margin: 40px 25px 25px;
    border-radius: 0; /* ปรับให้ไม่มีขอบมน ตามภาพตัวอย่าง */
    overflow: visible; /* ให้เนื้อหาล้นออกมาจากกรอบได้ */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    background-color: #f9f9f9; /* สีพื้นหลังอ่อนๆ ตามภาพตัวอย่าง */
    position: relative;
    opacity: 0; /* เริ่มต้นไม่แสดงเพื่อทำ animation */
}

.dga-team-member:hover {
    transform: translateY(0); /* ไม่ต้องเลื่อนขึ้นเมื่อโฮเวอร์ ตามภาพตัวอย่าง */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); /* คงไว้เท่าเดิมเมื่อโฮเวอร์ */
    z-index: 50; /* เพิ่ม z-index เมื่อโฮเวอร์เพื่อให้อยู่ด้านบนสุด */
}

/* =============== ส่วนของคอนเทนเนอร์ภาพ =============== */
.dga-team-image-container {
    height: 480px; /* ปรับความสูงให้เหมาะกับภาพครึ่งตัว ตามภาพตัวอย่าง */
    position: relative;
    overflow: hidden;
    background-color: #f9f9f9;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.dga-team-member:hover .dga-team-image-container {
    overflow: visible; /* เมื่อโฮเวอร์ให้เนื้อหาล้นออกจากกรอบได้ */
    height: 480px; /* เพิ่มความสูงเมื่อโฮเวอร์ ตามภาพตัวอย่าง */
}

/* =============== ส่วนของภาพทีมงาน =============== */
.dga-team-image-half,
.dga-team-image-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
    /* เพิ่มความคมชัดของภาพ */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform, opacity;
}

.dga-team-image-half {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
    filter: contrast(1.05) saturate(1.05);
    background-position: center top; /* แสดงเฉพาะส่วนบน */
}

.dga-team-image-full {
    opacity: 0;
    transform: scale(1);
    z-index: 2;
    filter: contrast(1.1) saturate(1.1) brightness(1.03);
    background-position: center top;
    box-shadow: none;
}

/* =============== เอฟเฟกต์เมื่อโฮเวอร์ภาพ =============== */
.dga-team-member:hover .dga-team-image-half {
    opacity: 0;
}

.dga-team-member:hover .dga-team-image-full {
    opacity: 1;
    transform: scale(1.2); /* ขยายภาพให้ล้นออกจากกรอบด้านบน */
    transform-origin: 0px 0px;
    box-shadow: none;
}

/* =============== ส่วนข้อมูลตามภาพตัวอย่าง =============== */
.dga-team-info-tag {
    background: linear-gradient(to right, #ff5f6d, #ff8a00);
    color: white;
    padding: 15px 15px 15px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 6;
    display: flex;
    flex-direction: column;
}

.dga-team-info-tag:after {
    content: '';
    position: absolute;
    right: -20px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-left: 20px solid #ff8a00;
    border-bottom: 93px solid transparent; /* ปรับความสูงให้เหมาะสม */
}

/* เส้นใต้ชื่อในป้ายข้อมูล */
.dga-team-title {
    color: white;
    font-size: 20px;
    font-weight: bold;
    margin: 0;
    display: block;
    position: relative;
    padding-bottom: 10px;
}

.dga-team-title:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: white;
}

.dga-team-subtitle {
    color: white;
    opacity: 0.9;
    display: block;
    margin-top: 5px;
    font-size: 16px;
}

.dga-team-phone-overlay {
    color: white;
    margin-top: 5px;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.dga-team-phone-overlay:before {
    content: '📞';
    margin-right: 5px;
    font-size: 14px;
}

/* =============== Animation และ Responsive =============== */
/* Animation สำหรับการแสดงผลครั้งแรก */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.dga-team-member.visible {
    animation: fadeInUp 0.8s forwards;
}

/* การปรับแต่งตามขนาดหน้าจอ */
@media (max-width: 768px) {
    .dga-team-member {
        width: 100%;
        max-width: 320px;
        margin: 40px auto 30px;
    }
    
    .dga-team-image-container {
        height: 280px;
    }
    
    .dga-team-member:hover .dga-team-image-container {
        height: 350px;
    }
}

/* สำหรับหน้าจอขนาดเล็กมาก */
@media (max-width: 480px) {
    .dga-team-member {
        margin: 35px auto 25px;
    }
    
    .dga-team-image-container {
        height: 260px;
    }
    
    .dga-team-member:hover .dga-team-image-container {
        height: 320px;
    }
    
    .dga-team-info-tag {
        padding: 12px 12px 12px;
    }
    
    .dga-team-title {
        font-size: 18px;
    }
    
    .dga-team-subtitle, .dga-team-phone-overlay {
        font-size: 13px;
    }
}

/* =============== การจัดรูปแบบกริด =============== */
.dga-team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px 0;
}

.dga-team-grid .dga-team-member {
    margin: 40px 0 0;
}

/* =============== ข้อความแจ้งเตือนข้อผิดพลาด =============== */
.dga-team-error {
    color: #FF5F6D;
    font-weight: bold;
    padding: 10px;
    border: 1px solid #FF5F6D;
    border-radius: 5px;
    background-color: rgba(255, 95, 109, 0.1);
}