/* --- คุมกรอบให้เป็นสี่เหลี่ยมจัตุรัสเท่ากันทุกช่อง --- */
.gallery-square {
    width: 100%;
    aspect-ratio: 1 / 1; /* บังคับให้เป็นสี่เหลี่ยมจัตุรัสเป๊ะๆ */
    background: #fff;
    border-radius: 15px;
    border: 2px solid #e0f2fe;
    overflow: hidden;
    transition: 0.3s;
}

.gallery-square:hover {
    transform: translateY(-5px);
    border-color: #fbbf24;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.img-fit {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ตัดรูปให้เต็มช่องสี่เหลี่ยมโดยไม่เสียสัดส่วน */
}

/* --- ระบบ Lightbox ขยายรูปเต็มใบ --- */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none; /* ซ่อนไว้ */
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox-overlay:target {
    display: flex; /* แสดงเมื่อกด Link */
}

.close-area {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: default;
}

.lightbox-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 85vh;
    animation: zoomIn 0.3s ease;
}

.lightbox-wrapper img {
    max-width: 100%;
    max-height: 85vh;
    border: 5px solid #fff;
    border-radius: 10px;
    object-fit: contain; /* โชว์รูป "เต็มใบ" ไม่มีการตัดขอบ */
}

.close-x {
    position: absolute;
    top: -50px; right: 0;
    color: white;
    font-size: 40px;
    text-decoration: none;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

