/* Sunnyside — galeri proyek. Token warna ikut styles.css, jadi mode gelap
   tidak perlu aturan sendiri. */

/* Pil jumlah di sudut media. Selalu terlihat, bukan muncul saat hover:
   perangkat sentuh tidak punya hover, dan galeri yang tidak kelihatan ada
   sama saja dengan tidak ada. */
.gl-count {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px;
  background: rgba(20, 20, 19, .72); color: #fff;
  font-family: var(--font-body); font-size: .78rem; line-height: 1;
  backdrop-filter: blur(4px);
  transition: background .25s var(--ease);
}
.gl-count b { font-weight: 700; }
button.proj-media { padding: 0; border: 0; cursor: zoom-in; width: 100%; font: inherit; color: inherit; }
button.proj-media:hover .gl-count { background: var(--yellow); color: #141413; }
button.proj-media:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* Overlay */
.gl-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: none; place-items: center; padding: 20px;
  background: rgba(20, 20, 19, .82);
  backdrop-filter: blur(6px);
}
.gl-overlay.open { display: grid; }

.gl-modal {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  width: min(880px, 100%); max-height: calc(100dvh - 40px);
  padding: 22px;
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}

.gl-close {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.gl-close:hover { background: var(--bg-tint, #f2f0ea); }

.gl-head { padding-right: 40px; }
.gl-title { margin: 0 0 4px; font-size: 1.25rem; }
.gl-desc { margin: 0; font-size: .9rem; color: var(--ink-soft); }

.gl-stage { position: relative; display: flex; align-items: center; gap: 10px; min-height: 0; }
.gl-frame { flex: 1; min-height: 0; display: grid; place-items: center; }
.gl-frame picture { display: contents; }
.gl-frame img {
  max-width: 100%; max-height: min(62dvh, 560px);
  width: auto; height: auto;
  border-radius: var(--radius-md); display: block;
}
/* Satu berkas gagal tidak mengosongkan panggung tanpa penjelasan. */
.gl-frame .gl-failed::after {
  content: ''; display: block;
  width: min(60vw, 320px); aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--bg-tint, #f2f0ea);
}

.gl-nav {
  flex: 0 0 auto; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--ink);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: background .2s var(--ease);
}
.gl-nav:hover { background: var(--yellow); }
.gl-nav[hidden] { display: none; }

.gl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gl-thumbs { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.gl-thumbs[hidden] { display: none; }
.gl-thumb {
  width: 48px; height: 48px; padding: 0;
  border: 2px solid transparent; border-radius: 8px;
  background-color: var(--bg-tint, #f2f0ea);
  background-size: cover; background-position: center;
  cursor: pointer; opacity: .55;
  transition: opacity .2s var(--ease), border-color .2s var(--ease);
}
.gl-thumb:hover { opacity: .85; }
.gl-thumb.is-on { opacity: 1; border-color: var(--yellow); }
.gl-counter { flex: 0 0 auto; font-size: .82rem; color: var(--ink-soft); }

@media (max-width: 640px) {
  .gl-overlay { padding: 0; }
  .gl-modal { width: 100%; max-height: 100dvh; border-radius: 0; padding: 18px 14px; }
  .gl-nav { width: 34px; height: 34px; }
  .gl-thumb { width: 40px; height: 40px; }
  .gl-frame img { max-height: 52dvh; }
}

/* Ikut aturan gerak yang sudah ada di styles.css, tidak membuat aturan baru. */
@media (prefers-reduced-motion: reduce) {
  .gl-count, .gl-nav, .gl-thumb { transition: none; }
}
