/* ==========================================================================
   MOTION & TATA LETAK: footer di bawah, layar pembuka, animasi muka,
   galeri yang bisa diperbesar, dan lightbox ukuran penuh.
   ========================================================================== */

/* 1. Footer selalu berada di bawah halaman, tidak naik saat konten belum tampil */
.site-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.site-shell > main { flex: 1 0 auto; }
.site-shell > .site-footer { margin-top: auto; }

/* 2. Layar pembuka */
#preloader {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.15rem;
  background: var(--bg); transition: opacity .7s ease, visibility .7s ease;
}
#preloader.is-hidden { opacity: 0; visibility: hidden; }
#preloader .pre-logo {
  width: 76px; height: 76px; border-radius: 50%; overflow: hidden;
  box-shadow: 0 18px 40px -12px var(--accent);
  animation: preIn .9s var(--ease) both;
}
#preloader .pre-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
#preloader .pre-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -.02em; color: var(--fg);
  animation: preIn .9s var(--ease) .15s both;
}
#preloader .pre-line {
  position: relative; width: 150px; height: 2px; border-radius: 2px; overflow: hidden; background: var(--border);
  animation: preIn .9s var(--ease) .25s both;
}
#preloader .pre-line::after {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, var(--accent-pastel), var(--accent));
  animation: preSweep 1.2s var(--ease) infinite;
}

/* 3. Animasi saat halaman dibuka */
.site-nav { animation: navIn 1s var(--ease) .15s both; }
.site-shell > main { animation: pageIn 1.1s ease .2s both; }
.site-shell > .site-footer { animation: pageIn 1.2s ease .45s both; }
.chat-fab { animation: fabIn .8s var(--ease) 1.1s backwards; }

@keyframes navIn { from { opacity: 0; transform: translateY(-22px); } to { opacity: 1; transform: none; } }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fabIn { from { opacity: 0; transform: translateY(18px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes preIn { from { opacity: 0; transform: translateY(14px) scale(.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes preSweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

@media (prefers-reduced-motion: reduce) {
  .site-nav, .site-shell > main, .site-shell > .site-footer, .chat-fab { animation: none !important; }
  #preloader { display: none; }
}

/* 4. Galeri proyek: gambar bisa dibuka ukuran penuh */
.gallery-zoom { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery-zoom img { display: block; }
.gallery-zoom-icon {
  position: absolute; right: 14px; bottom: 14px; width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass); color: var(--fg); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .35s var(--ease);
}
.gallery-zoom:hover .gallery-zoom-icon,
.gallery-zoom:focus-visible .gallery-zoom-icon { opacity: 1; transform: none; }
.gallery-zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: none) { .gallery-zoom-icon { opacity: 1; transform: none; } }

/* 5. Lightbox: pratinjau gambar di dalam halaman */
.lightbox {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column;
  background: rgba(4, 6, 14, .97);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: lbIn .3s ease both;
}
.lightbox-bar {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; color: #fff;
}
.lightbox-count { font-size: .9rem; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.lightbox-tools { display: flex; align-items: center; gap: 8px; }
.lightbox-btn {
  display: inline-flex; align-items: center; gap: .45rem; height: 40px; padding: 0 14px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08);
  color: #fff; font-size: .85rem; cursor: pointer; transition: background .2s ease;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .18); }
.lightbox-btn-icon { width: 40px; padding: 0; justify-content: center; }
.lightbox-btn:focus-visible, .lightbox-nav:focus-visible { outline: 2px solid var(--accent-pastel); outline-offset: 2px; }
.lightbox-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 72px 16px; }
.lightbox-stage img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border-radius: 12px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  cursor: zoom-in; user-select: none; animation: lbZoom .45s var(--ease) both;
}
.lightbox-stage.is-actual { display: block; overflow: auto; padding: 0 16px 16px; }
.lightbox-stage img.is-actual { display: block; max-width: none; max-height: none; margin: 0 auto; cursor: zoom-out; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer;
  transition: background .2s ease;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, .18); }
.lightbox-nav.prev { left: 14px; }
.lightbox-nav.next { right: 14px; }
.lightbox-caption {
  text-align: center; color: rgba(255, 255, 255, .8); font-size: .9rem;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 767.98px) {
  .lightbox-btn span { display: none; }
  .lightbox-btn { padding: 0 11px; }
  .lightbox-stage { padding: 0 12px 12px; }
  .lightbox-nav { width: 40px; height: 40px; top: auto; bottom: 64px; transform: none; }
  .lightbox-nav.prev { left: 12px; }
  .lightbox-nav.next { right: 12px; }
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
