/* =========================================================================
   PUSTINA — galeri hidup (sorotan + rel thumbnail + lightbox)
   Dipakai oleh inc/galeri.php.

   Berkas terpisah dari site.css dengan sengaja: site.css beberapa kali
   ditulis ulang oleh pekerjaan lain, dan gaya galeri ikut hilang bila
   ditumpangkan di sana. Semua warna memakai token tema di site.css,
   jadi tetap ikut berubah pada tema samudra / gelap / terang.
   ========================================================================= */

.gh { display: grid; gap: .8rem; }

/* --- Sorotan besar ------------------------------------------------------ */
.gh-sorot {
  position: relative; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
  box-shadow: var(--shadow);
}
.gh-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 260px; }
/* Hanya slide aktif (dan yang sedang memudar) yang dirender. Dengan 12 foto,
   menahan semuanya tetap terlukis membuat peramban kehabisan memori gambar. */
.gh-slide {
  display: none; position: absolute; inset: 0;
  opacity: 0; transition: opacity .8s ease;
}
.gh-slide.is-on,
.gh-slide.is-out { display: block; }
.gh-slide.is-on { opacity: 1; }
.gh-slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.06); transition: transform 1.3s ease;
}
.gh-slide.is-on img { transform: scale(1); }
.gh-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--overlay) 4%, rgba(0, 0, 0, .35) 42%, transparent 76%);
}
.gh-slide-teks {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-start; gap: .7rem;
  padding: clamp(3rem, 8vw, 5rem) clamp(1rem, 4vw, 2.2rem) clamp(2.4rem, 5vw, 2.8rem);
  /* Peredup: judul putih harus tetap terbaca di atas foto yang terang. */
  background: linear-gradient(to top,
              rgba(4, 18, 22, .88) 0%,
              rgba(4, 18, 22, .62) 42%,
              rgba(4, 18, 22, 0) 100%);
}
.gh-slide-teks h3 {
  margin: 0; color: #fff; font-family: var(--display);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55);
  font-size: clamp(1.15rem, 3vw, 1.85rem); line-height: 1.15; text-wrap: balance;
}
.gh-cta {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent); color: var(--on-accent);
  padding: .55rem 1rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; text-decoration: none;
  transition: background .25s ease, transform .25s ease;
}
.gh-cta:hover { background: var(--accent-hover); transform: translateX(3px); }
.gh-cta .gh-arrow { transition: transform .25s ease; }
.gh-cta:hover .gh-arrow { transform: translateX(3px); }

.gh-nav {
  position: absolute; top: calc(50% - 1.4rem); transform: translateY(-50%); z-index: 4;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--chip-bg); color: var(--on-chip, #fff);
  font-size: 1rem; line-height: 1;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.gh-nav:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.gh-prev { left: .9rem; }
.gh-next { right: .9rem; }

/* --- Pita berjalan + bingkai seleksi ------------------------------------ */
/* Pita bergerak terus dari kanan ke kiri. Bingkai diam di tengah; foto yang
   sedang melewatinya menjadi foto besar di atas.                            */
.gh-rel { position: relative; overflow: hidden; padding: .45rem 0; }
.gh-track {
  display: flex; gap: .5rem; width: max-content;
  will-change: transform;
}

/* Tepi kiri-kanan memudar agar pita terasa tak berujung. */
.gh-rel::before,
.gh-rel::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 12%;
  z-index: 2; pointer-events: none;
}
.gh-rel::before { left: 0;  background: linear-gradient(90deg, var(--bg), transparent); }
.gh-rel::after  { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }

.gh-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 120px; height: 76px; z-index: 3; pointer-events: none;
  border: 2px solid var(--accent); border-radius: calc(var(--r-sm) + 2px);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 26px rgba(0, 0, 0, .45);
}

.gh-thumb {
  position: relative; flex: 0 0 112px; height: 68px; padding: 0; cursor: pointer;
  border: 0; border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface-2); opacity: .4;
  transition: opacity .4s ease, transform .4s ease;
}
.gh-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gh-thumb:hover { opacity: .8; }
.gh-thumb.is-pilih { opacity: 1; transform: scale(1.02); }
.gh-thumb-judul {
  position: absolute; inset: auto 0 0 0; padding: .9rem .4rem .25rem;
  font-size: .62rem; line-height: 1.2; color: #fff; text-align: left;
  background: linear-gradient(0deg, var(--overlay), transparent);
  opacity: 0; transition: opacity .3s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gh-thumb.is-pilih .gh-thumb-judul,
.gh-thumb:hover .gh-thumb-judul { opacity: 1; }

/* --- Kartu grid: tambahan di atas .galeri yang sudah ada ---------------- */
.gh-grid { margin-top: .2rem; }
.gh-fig { transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease; }
.gh-fig:hover {
  transform: translateY(-5px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}
.gh-open {
  position: absolute; inset: 0; z-index: 3; cursor: zoom-in;
  border: 0; background: transparent; padding: 0;
}
.gh-zoom {
  position: absolute; top: .6rem; right: .6rem;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; background: var(--chip-bg); color: var(--on-chip, #fff); font-size: .8rem;
  opacity: 0; transform: scale(.8);
  transition: opacity .3s ease, transform .3s ease, background .25s ease, color .25s ease;
}
.gh-fig:hover .gh-zoom,
.gh-open:focus-visible .gh-zoom { opacity: 1; transform: none; }

/* Tombol perbesar di sorotan hanya menempati pojok kanan atas, supaya
   tombol tautan di bawah foto tetap bisa diklik. */
.gh-open-pojok {
  inset: 0 0 auto auto; width: 62px; height: 62px;
  border-radius: 0 var(--r) 0 var(--r);
}
.gh-open-pojok .gh-zoom {
  top: .9rem; right: .9rem; opacity: .8; transform: none;
  width: 34px; height: 34px; font-size: .9rem;
}
.gh-open-pojok:hover .gh-zoom,
.gh-open-pojok:focus-visible .gh-zoom { opacity: 1; background: var(--accent); color: var(--on-accent); }

/* --- Lightbox ----------------------------------------------------------- */
.gh-lb {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--bg-deep);
  animation: gh-masuk .25s ease both;
}
@keyframes gh-masuk { from { opacity: 0; } to { opacity: 1; } }
.gh-lb[hidden] { display: none !important; }
.gh-lb-isi { width: 100%; max-width: 1040px; display: grid; gap: .9rem; }
.gh-lb img { width: 100%; max-height: 66vh; object-fit: contain; border-radius: var(--r-sm); display: block; }
.gh-lb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.gh-lb-meta h3 { margin: 0; color: var(--fg); font-family: var(--display); font-size: 1.1rem; }
.gh-lb-nav { display: flex; gap: .5rem; margin-left: auto; }
.gh-lb-nav button {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg);
  transition: background .22s ease, color .22s ease;
}
.gh-lb-nav button:hover { background: var(--accent); color: var(--on-accent); }
.gh-lb-x {
  position: absolute; top: clamp(1rem, 4vw, 2rem); right: clamp(1rem, 4vw, 2rem);
  width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--surface); color: var(--fg); font-size: 1rem;
  transition: background .22s ease, color .22s ease;
}
.gh-lb-x:hover { background: var(--accent); color: var(--on-accent); }

@media (max-width: 640px) {
  .gh-stage { aspect-ratio: 4 / 3; }
  .gh-nav { width: 38px; height: 38px; }
}

/* Mode sederhana & hemat gerak: galeri tetap utuh, hanya diam. */
html.a11y-simple .gh-slide img { transform: none; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .gh-lb { animation: none !important; }
  .gh-slide img { transform: none; transition: none; }
  .gh-fig:hover { transform: none; }
}
