/* =========================
   GALLERY PAGE (full CSS)
   - Mosaic grid + Lightbox (Swiper)
   - No PHP inside CSS
   - Uses CSS var --arrow-icon (set in HTML inline on .gallery-page)
   ========================= */

/* Section spacing */
.gallery-page{
  --m-cols: 4;
  --m-gap: 18px;

  padding: 70px 0;
  background: #fff;
}

/* Make it span wide like your print */
.gallery-page .container-lg{
  max-width: none;
  width: 100%;
  padding-left: 40px;
  padding-right: 40px;
}

/* -------------------------
   Mosaic / Masonry
-------------------------- */

.mosaic-masonry{
  position: relative;
}

/* IMPORTANT:
   If you are using Masonry/Isotope, keep these sizers in the HTML:
   <div class="grid-sizer"></div>
   <div class="gutter-sizer"></div>
*/
.grid-sizer,
.mosaic-item{
  width: calc((100% - (var(--m-gap) * (var(--m-cols) - 1))) / var(--m-cols));
}

.gutter-sizer{
  width: var(--m-gap);
}

.mosaic-item{
  display: block;
  margin-bottom: var(--m-gap);
  overflow: hidden;
  background: #eee;
  text-decoration: none;
}

.mosaic-item img{
  width: 100%;
  height: auto;
  display: block;
  transform: translateZ(0);
  transition: transform .45s cubic-bezier(.2,.7,.2,1);
}

@media (hover:hover){
  .mosaic-item:hover img{ transform: scale(1.03); }
}

/* -------------------------
   Lightbox / Overlay
-------------------------- */

html.is-locked,
body.is-locked{
  overflow: hidden;
}

.gallery-lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 9999;
  display: none;          /* hidden by default */
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.gallery-lightbox.is-open{
  display: flex;
}

.glb-close{
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

/* panel */
.glb-inner{
  width: min(1200px, 100%);
}

/* Swiper main */
.glb-main{
  position: relative;
  background: transparent;
}

/* Make image fully visible */
.glb-main .swiper-slide{
  display: flex;
  align-items: center;
  justify-content: center;
}

.glb-main .swiper-slide img{
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

/* Navigation buttons (CSS arrows with mask) */
.glb-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: 0;
  background: rgba(0,0,0,.45);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.glb-prev{ left: 14px; }
.glb-next{ right: 14px; }

.glb-nav::before{
  content: "";
  width: 24px;
  height: 24px;
  background: #fff;

  /* arrow icon provided by HTML variable:
     style="--arrow-icon:url('/path/long-arrow-right.svg');"
  */
  -webkit-mask: var(--arrow-icon) no-repeat center / contain;
  mask: var(--arrow-icon) no-repeat center / contain;
}

.glb-prev::before{
  transform: rotate(180deg);
}

/* Swiper disabled state (hide when no more slides) */
.glb-nav.swiper-button-disabled{
  opacity: 0;
  pointer-events: none;
}

/* Thumbs */
.glb-thumbs{
  margin-top: 16px;
}

.glb-thumbs .swiper-slide{
  opacity: .6;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.22);
  overflow: hidden;
}

.glb-thumbs .swiper-slide-thumb-active{
  opacity: 1;
  border-color: rgba(255,255,255,.65);
}

.glb-thumbs img{
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}

/* -------------------------
   Responsive
-------------------------- */

@media (max-width: 1120px){
  .gallery-page{
    --m-cols: 2;
    --m-gap: 14px;
  }

  .gallery-page .container-lg{
    padding-left: 24px;
    padding-right: 24px;
  }

  .glb-main .swiper-slide img{
    max-height: 64vh;
  }
}

@media (max-width: 640px){
  .gallery-page{
    --m-cols: 1;
    --m-gap: 12px;
  }

  .gallery-page .container-lg{
    padding-left: 18px;
    padding-right: 18px;
  }

  .gallery-lightbox{
    padding: 18px 12px;
  }

  .glb-close{
    top: 10px;
    right: 10px;
  }

  /* Bigger tap targets on mobile */
  .glb-nav{
    width: 52px;
    height: 52px;
  }

  .glb-prev{ left: 8px; }
  .glb-next{ right: 8px; }

  .glb-main .swiper-slide img{
    max-height: 58vh;
  }

  .glb-thumbs img{
    height: 56px;
  }
}
