/* ===== สไลด์ภาพ + แกลเลอรี + lightbox (เขียนเอง แทน LayerSlider / Unite Gallery) ===== */

/* ---------- Image slider (เฟดเปลี่ยนภาพ ไม่ pan / zoom) ---------- */
.ms-slider{ position:relative; width:100%; max-width:1300px; margin:0 auto; aspect-ratio:1300/732;
            overflow:hidden; background:#f2f2f2; user-select:none; touch-action:pan-y; }
.ms-slide{ position:absolute; inset:0; opacity:0; visibility:hidden; transition:opacity .8s ease, visibility .8s; }
.ms-slide.is-active{ opacity:1; visibility:visible; z-index:1; }
.ms-slide img{ width:100%; height:100%; object-fit:cover; object-position:50% 50%; display:block; }
.ms-caption{ position:absolute; left:1.5%; right:1.5%; bottom:4%; z-index:2; padding:24px 20px; border-radius:10px;
             background:#00000099; color:#fff; text-align:center; font-size:clamp(16px,2.6vw,34px); line-height:1.5; }

.ms-arrow{ position:absolute; top:50%; z-index:3; width:46px; height:46px; margin-top:-23px; border:0; border-radius:50%;
           background:rgba(0,0,0,.35); color:#fff; font-size:18px; cursor:pointer; opacity:0;
           display:flex; align-items:center; justify-content:center; transition:opacity .25s ease, background .2s ease; }
.ms-arrow:hover{ background:rgba(0,0,0,.6); }
.ms-arrow:focus-visible{ opacity:1; outline:2px solid #fff; outline-offset:2px; }
.ms-prev{ left:14px; } .ms-next{ right:14px; }
.ms-slider:hover .ms-arrow{ opacity:1; }

.ms-dots{ display:flex; justify-content:center; flex-wrap:wrap; gap:8px; padding:12px 0 4px; }
.ms-dot{ width:14px; height:14px; padding:0; border-radius:10px; cursor:pointer; background:#fff;
         border:2px solid var(--ms-c1,#999); transition:background .2s ease, width .2s ease; }
.ms-dot.is-active{ background:var(--ms-c2,#666); width:28px; }

@media (max-width:767px){
    .ms-arrow{ display:none; }   /* มือถือใช้ปัดซ้าย/ขวาแทน */
    .ms-dot{ width:11px; height:11px; } .ms-dot.is-active{ width:22px; }
}

/* ---------- Center carousel (แทน slick) ---------- */
.mc-carousel{ position:relative; overflow:hidden; user-select:none; touch-action:pan-y; }
.mc-track{ display:flex; align-items:center; width:max-content; transition:transform .45s ease; will-change:transform; }
.mc-track > img{ flex:0 0 auto; width:300px; height:auto; margin:10px; border-radius:10px; display:block;
                 -webkit-user-drag:none; }
.mc-carousel:not(.is-ready) .mc-track{ visibility:hidden; }   /* ซ่อนจนกว่าจะจัดตำแหน่งเสร็จ กันภาพกระโดด */
.mc-carousel.mc-single .mc-track{ visibility:visible; margin:0 auto; }
.mc-carousel.is-dragging{ cursor:grabbing; }
.mc-carousel.is-dragging .mc-track{ transition:none; }

.mc-arrow{ position:absolute; top:50%; z-index:2; width:42px; height:42px; margin-top:-21px; border:0; border-radius:50%;
           background:rgba(0,0,0,.35); color:#fff; font-size:16px; cursor:pointer; opacity:0;
           display:flex; align-items:center; justify-content:center; transition:opacity .25s ease, background .2s ease; }
.mc-arrow:hover{ background:rgba(0,0,0,.6); }
.mc-arrow:focus-visible{ opacity:1; outline:2px solid #fff; outline-offset:2px; }
.mc-prev{ left:10px; } .mc-next{ right:10px; }
.mc-carousel:hover .mc-arrow{ opacity:1; }

.mc-dots{ display:flex; justify-content:center; flex-wrap:wrap; gap:4px; padding:6px 0 0; }
.mc-dot{ width:20px; height:20px; padding:0; border:0; background:transparent; cursor:pointer; position:relative; }
.mc-dot::before{ content:""; position:absolute; left:50%; top:50%; width:6px; height:6px; margin:-3px 0 0 -3px;
                 border-radius:50%; background:#000; opacity:.25; transition:opacity .2s ease, transform .2s ease; }
.mc-dot:hover::before{ opacity:.5; }
.mc-dot.is-active::before{ opacity:.75; transform:scale(1.25); }

@media (max-width:767px){
    .mc-arrow{ display:none; }   /* มือถือใช้ปัดแทน */
    .mc-track > img{ width:260px; margin:8px; }
}

/* ---------- Gallery ---------- */
/* มีอัตราส่วน (data-ratio) → กริดช่องเท่ากันครอบตัดพอดี / ไม่มี → แถวแบบ justified ตามสัดส่วนรูปจริง */
.mg-gallery{ display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%,220px), 1fr)); gap:12px; }
.mg-gallery.mg-justified{ display:flex; flex-wrap:wrap; }
.mg-gallery.mg-justified::after{ content:""; flex-grow:999; }   /* แถวสุดท้ายไม่ยืดจนรูปใหญ่เกิน */
.mg-item{ position:relative; display:block; overflow:hidden; border-radius:10px; background:#eee; cursor:zoom-in;
          border:0; padding:0; }
.mg-item img{ width:100%; height:100%; object-fit:cover; display:block; transition:opacity .3s ease; }
.mg-item::after{ content:"\f00e"; font-family:"Font Awesome 6 Free"; font-weight:900; position:absolute; inset:0;
                 display:flex; align-items:center; justify-content:center; font-size:26px; color:#fff;
                 background:rgba(0,0,0,.6); opacity:0; transition:opacity .3s ease; }
.mg-item:hover::after, .mg-item:focus-visible::after{ opacity:1; }
.mg-gallery.mg-justified .mg-item{ height:140px; flex-grow:1; }
.mg-gallery.mg-justified .mg-item img{ min-width:100%; }

@media (max-width:575px){
    .mg-gallery{ grid-template-columns:repeat(2, 1fr); gap:8px; }
    .mg-gallery.mg-justified .mg-item{ height:110px; }
}

/* ---------- Lightbox ---------- */
.mlb{ position:fixed; inset:0; z-index:99990;   /* เหนือปุ่มโทร/ไลน์ลอย (9990) แต่ใต้แบนเนอร์คุกกี้ */ background:rgba(0,0,0,.92); display:flex; align-items:center; justify-content:center;
      opacity:0; visibility:hidden; transition:opacity .25s ease, visibility .25s; touch-action:pan-y; }
.mlb.is-open{ opacity:1; visibility:visible; }
.mlb-img{ max-width:92vw; max-height:84vh; object-fit:contain; border-radius:6px; box-shadow:0 10px 40px rgba(0,0,0,.5);
          transition:opacity .2s ease; }
.mlb-img.is-loading{ opacity:0; }
.mlb-btn{ position:absolute; border:0; background:rgba(255,255,255,.12); color:#fff; width:48px; height:48px; border-radius:50%;
          font-size:20px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .2s ease; }
.mlb-btn:hover{ background:rgba(255,255,255,.25); }
.mlb-close{ top:16px; right:16px; }
.mlb-prev{ left:16px; top:50%; margin-top:-24px; }
.mlb-next{ right:16px; top:50%; margin-top:-24px; }
.mlb-bar{ position:absolute; left:0; right:0; bottom:0; padding:12px 70px; color:#ddd; font-size:14px; text-align:center;
          line-height:1.4; }
.mlb-count{ position:absolute; top:26px; left:24px; color:#bbb; font-size:14px; }
@media (max-width:767px){
    .mlb-prev, .mlb-next{ top:auto; bottom:12px; margin-top:0; }
    .mlb-bar{ bottom:64px; padding:10px 16px; }
}
body.mlb-lock{ overflow:hidden; }
