body {
    font-family: Arial, sans-serif;
    background-color: #000000;
    margin: 0;
    
    font-family: 'Anton', sans-serif;
}

h1 {
    text-align: center;
    color: #ffffff;
    font-size: 4rem;
    text-align: right;
    padding-right: 100px;
    border-bottom: none;
    position: relative;
    margin-bottom: 40px; /* เพิ่มระยะห่างด้านล่าง H1 */
    margin-top: 100px;
}
h1::after {
    content: ""; 
    position: absolute;
    bottom: 10px; /* ปรับตำแหน่งเส้นใต้ H1 เล็กน้อย */
    right: 100px; 
    width: 100px; 
    height: 3px; 
    background-color: #ffffff; 
}

.gallery-container {
    column-count: 3; 
    column-gap: 7px; /* เพิ่มระยะห่างเล็กน้อย */
    width: 99%;
    margin: 0 auto;
}

.gallery-item {
    break-inside: avoid; 
    margin-bottom: 10px; /* เพิ่มระยะห่าง */
    position: relative; 
    overflow: hidden; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: block; /* ทำให้ gallery-item เป็น block container */
}

/* --- นี่คือ Overlay --- */
.gallery-item::before {
    content: ""; 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2); /* สี Overlay */
    z-index: 1; /* ให้ Overlay อยู่บน img */

    /* ===== ⬇️ [เพิ่ม] ⬇️ ===== */
    /* ทำให้ Overlay ไม่ขวางการคลิก */
    pointer-events: none; 
    /* ========================= */

    transition: background-color 0.3s ease; /* เพิ่ม animation ตอน hover */
}
.hrbutton {
    width: 80%;
    margin: 20px auto;
    border: none;
    border-top: 2px solid #ccc;
    border-radius: 2px;
    margin-top: 80px;
}
.footer-text {
    color: #ccc;
    font-size: 0.9rem;
    margin: 0 10% 25px;
    
}
/* (ทางเลือก) ทำให้ Overlay จางลงเมื่อ Hover */
.gallery-item:hover::before {
     background-color: rgba(0, 0, 0, 0.1); 
}


.gallery-item a {
    display: block; /* ทำให้ลิงก์ขยายเต็มพื้นที่ */
    text-decoration: none; /* เอาขีดเส้นใต้ลิงก์ออก */
    /* ไม่ต้องใส่ z-index ที่ <a> แล้ว เพราะ ::before ไม่ขวางคลิก */
}

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover; 
    display: block; /* สำคัญ: ป้องกันช่องว่างใต้รูป */
    /* z-index: auto (default) จะอยู่ใต้ ::before */
}

.gallery-item p {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    color: white;
    margin: 0;
    padding: 20px;
    box-sizing: border-box; 
    font-size: 1.7rem;
    text-align: left;
    z-index: 2; /* ให้ข้อความอยู่บน Overlay เสมอ */
    pointer-events: none; /* ข้อความก็ไม่ควรขวางคลิกเช่นกัน */
    
    /* เพิ่ม gradient ให้ข้อความอ่านง่ายขึ้น */
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

/* --- ทำให้ Responsive บนมือถือ --- */
@media (max-width: 768px) {
    /* เมื่อจอกว้างไม่เกิน 768px (แท็บเล็ต) ให้เหลือ 2 คอลัมน์ */
    body {
        padding: 0px;
    }
    .gallery-container {
        column-count: 2;
         grid-template-columns: repeat(2, 1fr);
    }
   .gallery-item p {
        font-size: 0.6rem;
       padding: 10px;
    }
   h1 {
    text-align: center;
    color: #ffffff;
    font-size: 2rem;
    text-align: right;
    padding-right: 30px;
    border-bottom: none;
    position: relative;
    
}
h1::after {
    content: ""; /* ต้องมีเสมอ */
    position: absolute;
    bottom: 0; /* ให้อยู่ล่างสุด (ในพื้นที่ padding) */
    
    /* 5. จัดให้ชิดขวา 100px (ให้ตรงกับตัวอักษร) */
    right: 30px; 
    
    /* --- 6. (จุดสำคัญ) กำหนดความยาวของเส้นที่นี่ --- */
    width: 50px; /* <-- ปรับความยาวได้ตามต้องการเลยครับ */
    
    /* 7. หน้าตาของเส้น */
    height: 3px; /* ความหนา */
    background-color: #ffffff; /* สี */
}
}
@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-item p {
        font-size: 1.2rem;
       
    }
    h1 {
    
    font-size: 4rem;
    
    
}
}
