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

.gallery_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%;
}

.gallery_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;
}

.gallery {
    display: flex;
    justify-content: center;
    padding: 50px 20px 200px 20px;
}

.gallery_container {
    display: flex;
    flex-wrap: wrap;
    width: 1170px;
}

.gallery_news_container {
    position: relative;
    overflow: hidden; /* ซ่อนส่วนที่ขยายเกินออกมานอกขอบ */
    width: 382px; /* กำหนดขนาดของ container */
    height: 283px; /* กำหนดขนาดของ container */
    margin-bottom: 50px;
    margin-left: 5px;
}

.gallery_news_container .news_img img {
    width: 100%;
    height: 227px;
    object-fit: cover;
    padding-right: 20px;
}

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

.gallery_news_container .news_data h1 {
    font-size: 14px;
    text-align: left;
    padding-top: 5px;
    color: white;
}

.gallery_news_container .date {
    display: flex;
    align-items: center;
    position: relative; /* ทำให้มั่นใจว่า .date ไม่ถูกซ้อนทับ */
    padding-top: 7px;
    padding-bottom: 7px;
    opacity: 0; /* เริ่มต้นให้มองไม่เห็น */
    transition: opacity 0.8s ease;
}

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

.gallery_news_container .news_data h2 {
    font-size: 13px;
    color: white;
}

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

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

.gallery_news_container:hover .date {
    opacity: 1;
}

@media (max-width: 1500px) {
    .gallery {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 1210px) {
    .gallery_container {
        width: 780px;
    }
}

@media (max-width: 825px) {
    .gallery_container {
        width: 385px;
    }
}

@media (min-width: 425px) and (max-width: 767px) {
    .gallery {
        display: flex;
        padding-left: 10%;
        padding-right: 10%;
        justify-content: center;
        align-items: center;
    }
}

@media (max-width: 320px) {
    .gallery {
        padding: 0;
        justify-content: center;
        margin-top: 20px;
    }
    .gallery_news_container {
        width: 280px; /* กำหนดขนาดของ container */
        height: 210px;
    }

    .gallery_news_container .news_img img {
        height: 180px;
    }

    .gallery_news_container .news_data {
        width: 270px;
    }
}
