@charset "utf-8";
/* คอนเทนเนอร์รูปภาพในหน้าเว็บ */
.gallery-card {
    margin: 10px;
    float: left;
    width: 200px;
    cursor: pointer;
}
.gallery-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: 0.3s;
}
.gallery-card:hover img {
    opacity: 0.8;
}

/* ส่วนครอบ Popup (Overlay) */
.viewer-overlay {
    display: none; /* เริ่มต้นซ่อนไว้ */
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    
    /* จัดกึ่งกลางกึ่งกลาง */
    justify-content: center;
    align-items: center;
    user-select: none;
}

/* รูปภาพใน Popup */
.viewer-img {
    max-width: 85%;
    max-height: 85vh;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.2s ease-out;
    animation: zoomIn 0.3s ease-out;
}
.viewer-img:active {
    cursor: grabbing;
}

/* ปุ่มปิด */
.viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    line-height: 1;
}

/* ปุ่มเลื่อน (ซ้าย-ขวา) */
.nav-prev, .nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    padding: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: 0.3s;
}
.nav-prev { left: 20px; }
.nav-next { right: 20px; }
.nav-prev:hover, .nav-next:hover { color: #f7941d; }

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ปรับแต่งสำหรับมือถือ */
@media (max-width: 768px) {
    .viewer-img { max-width: 95%; }
    .nav-prev, .nav-next { display: none; } /* มือถือเน้นปัด (Swipe) แทนปุ่ม */
}
.viewer-img {
    max-width: 85%;
    max-height: 85vh;
    object-fit: contain;
    cursor: grab;
    /* เพิ่ม transition เพื่อให้ตอนสไลด์เปลี่ยนรูปดูนุ่มขึ้น */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    user-select: none;
    -webkit-user-drag: none; /* ป้องกัน browser ดึงรูปไปเปิดแท็บใหม่ */
}

.viewer-img:active {
    cursor: grabbing;
}