@charset "utf-8";

        /* ==========================================
           Gallery Grid Section
           ========================================== */
        .gallery-container {
            max-width: 1200px;
            margin: 40px auto;
            padding: 0 20px;
            box-sizing: border-box;
        }

        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
        }

        .gallery-item {
            position: relative;
            aspect-ratio: 1 / 1;
            overflow: hidden;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            cursor: pointer;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .gallery-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }

        .gallery-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            transition: transform 0.5s ease;
        }

        .gallery-item:hover img {
            transform: scale(1.05);
        }

        /* ==========================================
           Popup / Lightbox Section
           ========================================== */
        .lightbox-popup {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.95);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .lightbox-popup.active {
            opacity: 1;
            pointer-events: auto;
        }

        /* ส่วนแสดงตัวเลขบอกจำนวนรูป (1 / 10) */
        .lightbox-counter {
            position: absolute;
            top: 25px;
            left: 50%;
            transform: translateX(-50%);
            color: #fff;
            font-size: 18px;
            font-family: Arial, sans-serif;
            font-weight: bold;
            background-color: rgba(0, 0, 0, 0.5);
            padding: 8px 16px;
            border-radius: 20px;
            z-index: 1010;
            letter-spacing: 1px;
            user-select: none;
        }

        /* ปุ่มปิดมุมขวาบนขนาดใหญ่ */
        .lightbox-close {
            position: absolute;
            top: 20px;
            right: 20px;
            font-size: 45px;
            color: #fff;
            background: none;
            border: none;
            cursor: pointer;
            z-index: 1010;
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.1);
            transition: background-color 0.2s, transform 0.2s;
        }

        .lightbox-close:hover {
            background-color: rgba(255, 255, 255, 0.25);
            transform: scale(1.05);
        }

        /* ปุ่มลูกศร ซ้าย-ขวา */
        .lightbox-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            font-size: 35px;
            color: #fff;
            background: rgba(255, 255, 255, 0.1);
            border: none;
            padding: 15px 20px;
            cursor: pointer;
            z-index: 1005;
            border-radius: 8px;
            user-select: none;
            transition: background-color 0.2s;
        }

        .lightbox-nav:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }

        .lightbox-nav.prev { left: 20px; }
        .lightbox-nav.next { right: 20px; }

        /* พื้นที่แสดงรูปภาพใน Popup */
        .lightbox-slider-container {
            width: 85%;
            height: 80%;
            overflow: hidden;
            position: relative;
            display: flex;
            align-items: center;
            cursor: grab;
        }

        .lightbox-slider-container:active {
            cursor: grabbing;
        }

        .lightbox-wrapper {
            display: flex;
            width: 100%;
            height: 100%;
            transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
            will-change: transform;
        }

        .lightbox-slide {
            min-width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
            padding: 0 10px;
            user-select: none;
        }

        .lightbox-slide img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            pointer-events: none;
            border-radius: 4px;
        }

        /* ปรับตำแหน่ง UI สำหรับอุปกรณ์พกพา */
        @media (max-width: 768px) {
            .lightbox-nav {
                display: none; /* ใช้ Swipe ปัดนิ้วแทน */
            }
            .lightbox-slider-container {
                width: 100%;
                height: 75%;
            }
            .lightbox-close {
                top: 15px;
                right: 15px;
                width: 50px;
                height: 50px;
                font-size: 35px;
            }
            .lightbox-counter {
                top: 20px;
                font-size: 16px;
                padding: 6px 12px;
            }
        }