/* Al-Fath — motion: scroll reveal + stagger + hover (gaya web DNK, tanpa library).
 * Atribut ditulis langsung di index.html:
 *   data-m="up|fade|img|kb|pop"  jenis animasi masuk (pop = badge miring, pakai animation)
 *   data-md="1..8"           urutan stagger (x 90ms)
 *   data-m-lift              kartu terangkat halus saat hover
 *   data-m-zoom              bingkai foto: foto zoom halus saat kartu (article) di-hover
 *   data-count               angka dihitung naik saat terlihat (motion.js)
 * State dari motion.js: data-m-in (sudah masuk layar), data-m-done (animasi masuk selesai).
 * Semua keadaan tersembunyi hanya berlaku kalau <html> punya class .m-on (dipasang script inline
 * di <head>), jadi kalau JS mati / gagal / reduced motion, konten tetap tampil normal.
 * Transition hanya dipasang pada [data-m-in] supaya elemen tidak beranimasi "tampil -> sembunyi". */

/* Keadaan awal (sebelum masuk layar) */
.m-on [data-m="up"]:not([data-m-in])   { opacity: 0; transform: translate3d(0, 32px, 0); }
.m-on [data-m="fade"]:not([data-m-in]) { opacity: 0; }
.m-on [data-m="img"]:not([data-m-in])  { clip-path: inset(100% 0 0 0); }
.m-on [data-m="kb"]:not([data-m-in])   { transform: scale(1.12); }
/* pop: untuk elemen yang punya transform inline (badge miring) -> pakai animation, bukan transition */
.m-on [data-m="pop"]:not([data-m-in])  { opacity: 0; }

/* Animasi masuk */
.m-on [data-m-in] {
  transition-property: opacity, transform, clip-path, box-shadow;
  transition-duration: 0.9s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
.m-on [data-m="img"][data-m-in] { clip-path: inset(0 0 0 0); transition-duration: 1.2s; }
.m-on [data-m="kb"][data-m-in]  { transition-duration: 2.8s; transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
.m-on [data-m="pop"][data-m-in] { animation: m-pop 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.m-on [data-m="pop"][data-m-in][data-md="6"] { animation-delay: 540ms; }
@keyframes m-pop {
  from { opacity: 0; transform: rotate(-40deg) scale(0.4); }
  to   { opacity: 1; transform: rotate(-10deg) scale(1); }
}

/* Stagger */
.m-on [data-m-in][data-md="1"] { transition-delay: 90ms; }
.m-on [data-m-in][data-md="2"] { transition-delay: 180ms; }
.m-on [data-m-in][data-md="3"] { transition-delay: 270ms; }
.m-on [data-m-in][data-md="4"] { transition-delay: 360ms; }
.m-on [data-m-in][data-md="5"] { transition-delay: 450ms; }
.m-on [data-m-in][data-md="6"] { transition-delay: 540ms; }
.m-on [data-m-in][data-md="7"] { transition-delay: 630ms; }
.m-on [data-m-in][data-md="8"] { transition-delay: 720ms; }
.m-on [data-m-done] { transition-delay: 0s !important; }

/* Hover: foto berita zoom halus di dalam bingkainya */
[data-m-zoom] { overflow: hidden; }
[data-m-zoom] img { transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  article:hover [data-m-zoom] img { transform: scale(1.06); }
}

/* Hover: kartu terangkat + bayangan lebih dalam (hanya setelah animasi masuk selesai) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .m-on [data-m-lift][data-m-done] { transition-duration: 0.35s; }
  .m-on [data-m-lift][data-m-done]:hover {
    transform: translate3d(0, -6px, 0);
    box-shadow: 0 18px 40px rgba(11, 42, 94, 0.14) !important;
  }
}

/* Warna link/tombol berganti halus */
a { transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease; }

/* Tombol WhatsApp melayang: denyut halus untuk menarik perhatian */
@media (prefers-reduced-motion: no-preference) {
  .wa-float { animation: wa-pulse 2.6s ease-out 1.5s infinite; }
  @keyframes wa-pulse {
    /* bayangan bawaan (inline) ikut ditulis, karena animasi menimpa box-shadow inline */
    0%   { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(30, 158, 85, 0.45); }
    70%  { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 16px rgba(30, 158, 85, 0); }
    100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(30, 158, 85, 0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
}

/* ===== Tombol Daftar ===== */

/* Tombol Daftar di header: berganti emas setelah tombol hero lewat (class .cta-hot dari script header).
 * !important karena warna asli ditulis inline. Hover ditulis eksplisit supaya teks tidak hilang. */
.nav-daftar { transition: background-color 0.35s ease, color 0.35s ease, transform 0.25s ease, box-shadow 0.25s ease !important; }
.nav-daftar:hover { background: #123B7D !important; color: #FFFFFF !important; }
.cta-hot .nav-daftar { background: #D8AE5A !important; color: #0B2A5E !important; }
.cta-hot .nav-daftar:hover { background: #E3BD70 !important; color: #0B2A5E !important; }

/* CTA emas: hover terangkat + panah muncul bergeser */
.cta { transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease !important; }
.cta-arrow {
  display: inline-block; max-width: 0; margin-left: 0; opacity: 0; overflow: hidden;
  transform: translateX(-6px);
  transition: max-width 0.3s ease, margin-left 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}
@media (hover: hover) {
  .cta:hover, .nav-daftar:hover { transform: translate3d(0, -2px, 0); }
  .cta:hover { box-shadow: 0 12px 26px rgba(216, 174, 90, 0.4); }
  .cta:hover .cta-arrow { max-width: 1.2em; margin-left: 10px; opacity: 1; transform: none; }
}
.cta-navy:hover { box-shadow: 0 12px 26px rgba(11, 42, 94, 0.3) !important; }
/* Panah yang sudah ada di teks tombol: bergeser saat hover */
.cta-nudge { display: inline-block; margin-left: 0.4em; transition: transform 0.3s ease; }
#daftar .cta-nudge, #wa-kirim .cta-nudge { margin-left: 0; } /* dua tombol ini sudah punya gap 8px */
@media (hover: hover) { .cta:hover .cta-nudge { transform: translateX(4px); } }

.cta:focus-visible .cta-arrow { max-width: 1.2em; margin-left: 10px; opacity: 1; transform: none; }

/* Kilau: cahaya miring melintas tiap ~4,5 detik */
.cta-shine { position: relative; overflow: hidden; isolation: isolate; }
@media (prefers-reduced-motion: no-preference) {
  .cta-shine::after {
    content: ""; position: absolute; top: -10%; bottom: -10%; left: -50%; width: 35%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    animation: cta-shine 4.5s ease-in-out 2.2s infinite;
    pointer-events: none;
  }
  @keyframes cta-shine {
    0%        { left: -50%; }
    22%, 100% { left: 125%; }
  }
}
/* Titik hijau "Pendaftaran Dibuka": berdenyut */
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live-dot 2s ease-out infinite; }
  @keyframes live-dot {
    0%   { box-shadow: 0 0 0 0 rgba(30, 158, 85, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(30, 158, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 158, 85, 0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta, .nav-daftar, .cta-arrow { transition: none !important; }
  .cta:hover, .nav-daftar:hover { transform: none !important; }
}
