/* @berkas  public/assets/css/fx.css
 * @fungsi  Lapisan animasi ringan untuk situs utama, portal, dan portal orang tua. HANYA transform + opacity (GPU, tanpa memicu layout), tanpa pustaka,
 *          tanpa polling. Dimuat setelah app.css lewat app/layout/*-kepala.php. Pasangan: public/assets/js/fx.js.
 * @catatan Aturan prefers-reduced-motion SENGAJA tidak dipakai (permintaan pemilik situs). Tanpa atribut style= (CSP): nilai dinamis lewat kelas atau properti CSS dari JS.
 *          Isi: transisi halaman lintas-dokumen, masuk konten berurutan, tombol (tekan/riak/kilau), pesan kilat, penanda isian berubah, scroll-reveal, popup, konfeti.
 */

/* ---------- 1. Transisi halaman lintas-dokumen (Chrome/Edge/Safari baru; peramban lain mengabaikan) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fx-keluar .1s linear both; }
::view-transition-new(root) { animation: fx-masuk .16s ease-out both; }
@keyframes fx-keluar { to { opacity: 0; } }
@keyframes fx-masuk { from { opacity: 0; } }

/* ---------- 2. Konten masuk berurutan (stagger lewat animation-delay; fill "backwards" supaya tidak ada sisa lapisan setelah selesai) ---------- */
.hub-isi > *, .portal-isi > *, .ortu-isi > *, .dsb > *, #isi > *, .kartu-tengah > * { animation: fx-naik .26s ease-out backwards; }
.hub-isi > :nth-child(1), .portal-isi > :nth-child(1), .ortu-isi > :nth-child(1), .dsb > :nth-child(1), #isi > :nth-child(1), .kartu-tengah > :nth-child(1) { animation-delay: .00s; }
.hub-isi > :nth-child(2), .portal-isi > :nth-child(2), .ortu-isi > :nth-child(2), .dsb > :nth-child(2), #isi > :nth-child(2), .kartu-tengah > :nth-child(2) { animation-delay: .04s; }
.hub-isi > :nth-child(3), .portal-isi > :nth-child(3), .ortu-isi > :nth-child(3), .dsb > :nth-child(3), #isi > :nth-child(3), .kartu-tengah > :nth-child(3) { animation-delay: .08s; }
.hub-isi > :nth-child(4), .portal-isi > :nth-child(4), .ortu-isi > :nth-child(4), .dsb > :nth-child(4), #isi > :nth-child(4), .kartu-tengah > :nth-child(4) { animation-delay: .12s; }
.hub-isi > :nth-child(5), .portal-isi > :nth-child(5), .ortu-isi > :nth-child(5), .dsb > :nth-child(5), #isi > :nth-child(5), .kartu-tengah > :nth-child(5) { animation-delay: .16s; }
.hub-isi > :nth-child(6), .portal-isi > :nth-child(6), .ortu-isi > :nth-child(6), .dsb > :nth-child(6), #isi > :nth-child(6), .kartu-tengah > :nth-child(6) { animation-delay: .20s; }
.hub-isi > :nth-child(n+7), .portal-isi > :nth-child(n+7), .ortu-isi > :nth-child(n+7), .dsb > :nth-child(n+7), #isi > :nth-child(n+7), .kartu-tengah > :nth-child(n+7) { animation-delay: .24s; }
@keyframes fx-naik { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 3. Tombol & kartu: tekan, riak, kilau ---------- */
.tombol, .hub-tombol, .hub-i, .hub-t, .pbar-tombol, .bj-pil, .bj-kelas-btn, .bj-mapel, .bj-materi, .bj-paket, .bj-vc, .bj-chip {
  transition: transform .14s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.tombol:active:not(:disabled), .hub-tombol:active, .hub-i:active, .hub-t:active, .pbar-tombol:active, .bj-pil:active:not(:disabled), .bj-kelas-btn:active { transform: translateY(0) scale(.96); }
.bj-mapel:active, .bj-materi:active, .bj-vc:active { transform: scale(.985); }
.fx-r { position: relative; overflow: hidden; isolation: isolate; }
/* will-change hanya selama riak ada (dilepas bersama elemennya) */
.fx-riak { position: absolute; z-index: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: rgba(255, 255, 255, .5); pointer-events: none; transform: scale(0); opacity: .6; will-change: transform, opacity; animation: fx-riak .4s ease-out forwards; }
@keyframes fx-riak { to { transform: scale(9); opacity: 0; } }
/* kilau saat tombol nonaktif / sedang diproses */
.tombol:disabled, .hub-tombol:disabled, .pbar-tombol:disabled, .tombol[aria-busy="true"] { position: relative; overflow: hidden; }
.tombol:disabled::after, .hub-tombol:disabled::after, .pbar-tombol:disabled::after, .tombol[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .38) 50%, transparent 70%);
  transform: translateX(-100%); animation: fx-kilau 1.25s ease-in-out infinite;
}
@keyframes fx-kilau { to { transform: translateX(100%); } }

/* ---------- 4. Tombol simpan: berdenyut saat ada perubahan, "membal" saat sukses, bergetar saat gagal ---------- */
form.fx-kotor [type="submit"].tombol:not(:disabled) { animation: fx-denyut .6s ease-out 2; }
@keyframes fx-denyut { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.fx-ok { animation: fx-membal .5s cubic-bezier(.3, 1.6, .5, 1); }
.fx-gagal { animation: fx-getar .45s ease-in-out; }
@keyframes fx-membal { 0% { transform: scale(.9); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes fx-getar { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
/* isian yang berubah dari nilai awal */
.fx-diubah { box-shadow: 0 0 0 2px rgba(245, 158, 11, .55); border-color: #f59e0b !important; transition: box-shadow .2s; }

/* ---------- 5. Pesan kilat (sukses membal, galat bergetar) ---------- */
.pesan { animation: fx-turun .38s cubic-bezier(.2, .7, .2, 1) backwards; }
.pesan-ok { animation-name: fx-turun, fx-membal; animation-duration: .38s, .5s; animation-delay: 0s, .1s; }
.pesan-galat { animation-name: fx-turun, fx-getar; animation-duration: .38s, .45s; animation-delay: 0s, .15s; }
@keyframes fx-turun { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- 6. Scroll-reveal (kelas dipasang JS hanya pada elemen di bawah layar) ---------- */
.fx-sembunyi { opacity: 0; transform: translateY(16px); }
.fx-lihat { opacity: 1; transform: none; transition: opacity .38s ease, transform .38s cubic-bezier(.2, .7, .2, 1); }

/* ---------- 7. Popup / dialog (SweetAlert2 bila dipakai, <dialog>, dan dialog situs) masuk-keluar halus ---------- */
.swal2-popup.swal2-show, dialog[open], .dialog-situs[open] { animation: fx-popup .28s cubic-bezier(.3, 1.4, .5, 1); }
.swal2-popup.swal2-hide { animation: fx-popup-keluar .18s ease-in forwards; }
.swal2-icon.swal2-success, .swal2-icon.swal2-error { animation: fx-membal .5s .15s cubic-bezier(.3, 1.6, .5, 1) backwards; }
@keyframes fx-popup { from { opacity: 0; transform: scale(.88) translateY(8px); } }
@keyframes fx-popup-keluar { to { opacity: 0; transform: scale(.92); } }
.fx-percik { position: fixed; z-index: 2147483000; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 2px; pointer-events: none; animation: fx-percik .9s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes fx-percik { to { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0deg)) scale(.4); opacity: 0; } }
.fx-bintang-terbang { position: fixed; z-index: 2147483000; font-size: 1.6rem; margin: -14px 0 0 -14px; pointer-events: none; animation: fx-terbang .85s cubic-bezier(.5, -.2, .6, 1) forwards; }
@keyframes fx-terbang { to { transform: translate(var(--dx, 0), var(--dy, 0)) scale(.5); opacity: .2; } }

/* ---------- 8. Halaman masuk: kartu masuk bergantian ---------- */


