body {
    font-family: "Kanit", sans-serif;
}

.news_header {
    background-image: linear-gradient(
            rgba(255, 255, 255, 0.1),
            rgba(255, 255, 255, 0.1)
        ),
        url("/images/Background_header_companyProfile.jpg");
    display: flex;
    /* จัดกึ่งกลางในแนวนอน */
    background-size: cover;

    min-height: 100%;
}

.news_header h1 {
    color: #ffffff;
    font-size: 34px;
    padding-top: 30px;
    padding-bottom: 30px;
    padding-left: 10%;
    font-family: "Mitr", sans-serif;
    font-weight: 300;
    font-style: normal;
}

.background_news {
    display: flex;
    justify-content: center;
    align-items: center;
}

.news {
    display: flex;
    flex-wrap: wrap;
    margin-top: 50px;
    width: 1240px;
}

.news_container {
    position: relative;
    overflow: hidden; /* ซ่อนส่วนที่ขยายเกินออกมานอกขอบ */
    width: 288px; /* กำหนดขนาดของ container */
    height: 320px; /* กำหนดขนาดของ container */
    box-shadow: 5px 5px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: 50px;
    margin-right: 10px;
    margin-left: 10px;
}

.news_container .news_img img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.5s ease; /* เพิ่ม transition เพื่อให้การขยายดูนุ่มนวล */
}

.news_container .news_data h1,
.news_container .news_data h2,
.news_container .news_data p {
    margin: 0; /* ลบ margin ของทุกองค์ประกอบภายใน */
    padding: 0; /* ลบ padding ภายในถ้ามี */
}

.news_container .news_data h1 {
    font-size: 14px;
    text-align: left;
    padding-top: 5px;
    padding-right: 10px;
}

.news_container .date {
    display: flex;
    align-items: center;
    position: relative; /* ทำให้มั่นใจว่า .date ไม่ถูกซ้อนทับ */
    padding-top: 7px;
    padding-bottom: 7px;
}

.news_container .calendar_icon {
    height: 20px;
    width: auto;
    color: #666262; /* สีเริ่มต้น */
    margin-right: 10px;
    transition: fill 0.3s ease;
}

.news_container .news_data h2 {
    font-size: 13px;
    color: #666262;
}

.news_container .news_data p {
    font-size: 11px;
    color: #666262;
}

.news_container .news_data {
    position: absolute;
    bottom: 0; /* ให้ .news_data อยู่ติดด้านล่างของคอนเทนเนอร์ */
    left: 0;
    right: 0;
    max-height: 120px;
    height: auto; /* ความสูงของข้อมูล */
    background-color: #ffffff;
    border-radius: 0px 57px 0px 0px;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden; /* ซ่อนเนื้อหาที่เกินออกไป */
    z-index: 10; /* ให้อยู่ด้านบนสุด */
    transition: background-color 0.5s ease, max-height 0.5s ease,
        color 0.5s ease, filter 0.5s ease;
    opacity: 1; /* แสดงเนื้อหาด้วย opacity */
}

.news_container:hover .news_data {
    max-height: 300px; /* เพิ่มความสูงเมื่อ hover */
    background-color: rgba(117, 47, 139, 0.85);
}

.news_container:hover .news_img img {
    transform: scale(1.5);
}

.news_container:hover .news_data h1 {
    color: #ffffff;
}

.news_container:hover .news_data h2 {
    color: #ffffff;
}

.news_container:hover .news_data p {
    color: #ffffff;
}

.news_container:hover .calendar_icon {
    color: #ffffff;
}

@media (min-width: 1024px) and (max-width: 1400px) {
    .news {
        margin-top: 50px;
        width: 750px;
    }

    .news_container {
        margin-right: 35px;
        margin-left: 45px;
    }
}

@media (min-width: 767px) and (max-width: 1023px) {
    .news {
        margin-top: 50px;
        width: 750px;
    }

    .news_container {
        margin-right: 35px;
        margin-left: 35px;
    }
    .news {
        display: flex;
        justify-content: center;
        margin: 50px 0 0 0;
    }
}

@media (min-width: 425px) and (max-width: 767px) {
    .news {
        margin-top: 50px;
        width: 420px;
    }

    .news {
        display: flex;
        justify-content: center;
        margin: 50px 0 0 0;
    }
}

@media (max-width: 425px) {
    .news {
        margin-top: 50px;
        width: 320px;
    }
    .news {
        display: flex;
        justify-content: center;
        margin: 50px 0 0 0;
    }
}
