/* =====================================================
   GALERI HOME - SIPENSI
===================================================== */

.sipensi-gallery{
  background: #f4f6f8;
  min-height: 100vh;
  padding: 34px 0;
  overflow: hidden;
}

.sipensi-gallery .container{
  max-width: 1400px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gallery-head{ text-align: center; margin: 0 0 10px 0; }
.gallery-title{ font-weight: 800; font-size: clamp(28px, 3vw, 44px); margin: 0; line-height: 1.08; color: #212121;}
.gallery-subtitle{ margin: 8px 0 0 0; color: rgba(15,23,42,.70); }

.gallery-filter{
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin: 14px 0 14px;
}

.gallery-filter-btn{
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease;
}
.gallery-filter-btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.08); }
.gallery-filter-btn.active{ background: #22466C; border-color: #22466C; color: #fff; }

.gallery-stage{
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: visible !important;
}

.gallery-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  height: 100%;
  min-height: 0;
  align-content: stretch;
  position: relative;
}

.gallery-item{ height: 100%; display: flex; min-width: 0; }
.gallery-card{ width: 100%; border: 0; background: transparent; padding: 0; margin: 0; cursor: pointer; }

.gallery-thumb{
  width: 100%;
  height: 230px;
  border-radius: 18px;
  overflow: hidden;
  background: #eef2f7;
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
  transition: transform .22s ease, box-shadow .22s ease;
}
@media (min-width: 1200px){ .gallery-thumb{ height: 260px; } }

.gallery-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-card:hover .gallery-thumb{ transform: translateY(-4px); box-shadow: 0 18px 46px rgba(0,0,0,.18); }

.gallery-item.is-hidden{ display: none !important; }

.gallery-arrow{
  position: absolute;
  top: var(--arrowTop, 50%);
  transform: translateY(-50%);
  width: 76px;
  height: 76px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,.96);
  color: #22466C;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: pointer;
  box-shadow: 0 18px 46px rgba(0,0,0,.25);
}
.gallery-arrow svg{ width: 44px; height: 44px; }
.gallery-arrow svg path{ fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.gallery-arrow-prev{ left: -60px; }
.gallery-arrow-next{ right: -60px; }

#sipensiGalleryGrid.is-switching{
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease;
}
#sipensiGalleryGrid:not(.is-switching){
  opacity: 1;
  transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease;
}

@media (max-width: 992px){
  .sipensi-gallery{ min-height: auto; overflow: visible; padding: 70px 0; }
  .sipensi-gallery .container{ height: auto; }
  .gallery-grid{ height: auto; grid-template-columns: repeat(2, 1fr); }
  .gallery-thumb{ height: auto; aspect-ratio: 4/3; }
}
@media (max-width: 576px){
  .gallery-grid{ grid-template-columns: 1fr; }
  .gallery-arrow{ width: 58px; height: 58px; }
  .gallery-arrow svg{ width: 30px; height: 30px; }
  .gallery-arrow-prev{ left: -10px; }
  .gallery-arrow-next{ right: -10px; }
}

/* =====================================================
   LIGHTBOX (FIX: GAK KEPOTONG + X GAK HILANG)
===================================================== */
:root{
  --nav-safe-top: 130px;
}

.sipensi-lightbox{
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sipensi-lightbox.active{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sipensi-lightbox__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.86);
}

/* panel center full layar, tapi ada safe padding */
.sipensi-lightbox__panel{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    calc(var(--nav-safe-top) + 16px)
    22px
    22px;
}

/* ✅ ini bikin gambar gak kepotong */
.sipensi-lightbox__img{
  max-width: min(92vw, 1700px);
  max-height: calc(100vh - (var(--nav-safe-top) + 16px) - 22px);
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  background: rgba(255,255,255,.02);
}

/* ✅ tombol X dipaku di viewport + aman dari navbar */
.sipensi-lightbox__close{
  position: fixed;
  top: calc(var(--nav-safe-top) - 54px); /* muncul tepat di bawah navbar */
  right: 22px;

  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.55);
  color: #fff;

  display: grid;
  place-items: center;
  cursor: pointer;

  z-index: 2147483647; /* paling atas */
}

.sipensi-lightbox__close svg{
  width: 22px;
  height: 22px;
  display: block;
}

.sipensi-lightbox__close svg path{
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* hover tombol close */
.sipensi-lightbox__close{
  transition:
    background-color .18s ease,
    transform .18s ease,
    box-shadow .18s ease;
}

.sipensi-lightbox__close:hover{
  background: #22466C;               /* warna utama SIPENSI */
  transform: scale(1.08);
  box-shadow: 0 10px 26px rgba(0,0,0,.45);
}

/* optional: feedback klik */
.sipensi-lightbox__close:active{
  transform: scale(0.96);
}


@media (max-width: 576px){
  :root{ --nav-safe-top: 76px; }
  .sipensi-lightbox__close{ right: 14px; }
}

/* =========================
   FIX: HOVER PANAH GALERI JANGAN HILANG
========================= */
.gallery-arrow{
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transition:
    transform .18s ease,
    background-color .18s ease,
    color .18s ease,
    box-shadow .18s ease,
    opacity .18s ease;
}

.gallery-arrow:hover{
  opacity: 1 !important;
  background: #22466C !important;  /* biar keliatan jelas */
  color: #fff !important;          /* svg ikut putih */
  box-shadow: 0 18px 46px rgba(0,0,0,.28) !important;
  transform: translateY(-50%) scale(1.06);
}

/* pastiin stroke svg tetap ngikut currentColor */
.gallery-arrow svg path{
  stroke: currentColor !important;
}
