/* Maskot interaktif di carousel beranda (js/hero-maskot.js).
   Tiap slide ber-data-maskot dapat satu tokoh Cibel: mata ikut kursor/jari, ketuk = lompat + partikel + gelembung,
   ketuk 5x cepat = pusing, Cibi ketuk 2x = buka chat. Ilustrasi & tokoh sedikit bergeser mengikuti kursor (desktop). */

.hm { position: absolute; z-index: 11; bottom: 16px; pointer-events: none; --hm-w: 118px;
      right: 220px; width: var(--hm-w); translate: calc(var(--hx, 0) * 7px) calc(var(--hy, 0) * 4px);
      transition: translate .35s ease-out; }
.hm[data-k="gembi"] { --hm-w: 106px; }
.hm[data-k="koin"]  { --hm-w: 76px; bottom: 24px; }
.hm[data-k="pado"]  { --hm-w: 104px; bottom: 18px; }

/* masuk saat slide aktif */
.hm-tokoh { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
            pointer-events: auto; -webkit-tap-highlight-color: transparent; border-radius: 24px;
            opacity: 0; transform: translateY(46px) scale(.9); transform-origin: 50% 100%;
            transition: opacity .4s ease, transform .65s cubic-bezier(.3, 1.5, .5, 1); }
.hero-slide.is-active .hm-tokoh { opacity: 1; transform: none; transition-delay: .42s; }
.hero-slide.tanpa-anim .hm-tokoh { transition: none; }
.hm-tokoh:focus-visible { outline: 3px solid #feb300; outline-offset: 4px; }
.hm-lompat, .hm-napas { transform-origin: 50% 100%; }
.hm-napas { animation: hmNapas 3.4s ease-in-out infinite; }
.hm[data-k="koin"] .hm-napas { animation: hmMelayang 2.6s ease-in-out infinite; }
.hm-tokoh svg { display: block; width: 100%; height: auto; overflow: visible; }
.hm-bayang { position: absolute; left: 18%; right: 18%; bottom: -4px; height: 9px; border-radius: 50%; background: rgba(5, 10, 30, .35); filter: blur(2px); }
.hm[data-k="koin"] .hm-bayang { bottom: -8px; animation: hmBayang 2.6s ease-in-out infinite; }

/* bagian wajah: default */
.hm .mk-senang, .hm .mk-merem, .hm .mk-mangap, .hm .mk-gelem, .hm .mk-cinta, .hm .pd-getar, .hm .mk-pusing, .hm .mk-bola-hati { display: none; }
.hm .mk-pupil { transform: translate(var(--mx, 0px), var(--my, 0px)); transition: transform .14s ease-out; }
.hm .mk-mata { transform-box: fill-box; transform-origin: center; transition: transform .1s ease; }
.hm.kedip .mk-mata { transform: scaleY(.12); }
.hm .mk-halo { transform-box: fill-box; transform-origin: center; animation: hmHalo 2.2s ease-in-out infinite; }
.hm .mk-lampu { animation: hmKelip 1.8s ease-in-out infinite; } .hm .mk-lampu.b { animation-delay: .9s; }
.hm .mk-tombol { animation: hmKelip 2.4s ease-in-out infinite; } .hm .mk-tombol.t2 { animation-delay: .6s; } .hm .mk-tombol.t3 { animation-delay: 1.2s; } .hm .mk-tombol.t4 { animation-delay: 1.8s; }
.hm .kn-kilap { animation: hmKilap 3.4s ease-in-out infinite; }
.hm .gb-gagang { transform-box: fill-box; transform-origin: 80% 100%; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }

/* sapaan saat slide aktif */
.hm.sapa .hm-lompat { animation: hmSapa 1.1s ease-in-out; }

/* hover (perangkat ber-mouse): senyum */
@media (hover: hover) and (pointer: fine) {
  .hm-tokoh:hover .mk-mata { display: none; }
  .hm-tokoh:hover .mk-senang { display: inline; }
  .hm-tokoh:hover .hm-lompat { transform: translateY(-4px) rotate(-3deg); transition: transform .25s ease; }
}

/* ketuk: senang */
.hm.senang .mk-mata, .hm.senang .mk-mulut { display: none !important; }
.hm.senang .mk-senang, .hm.senang .mk-mangap { display: inline !important; }
.hm.senang .hm-lompat { animation: hmLompat .55s cubic-bezier(.3, 1.6, .5, 1); }
.hm.senang .mk-bola-hati { display: inline; }
.hm.senang .mk-bola { display: none; }
.hm[data-k="gembi"].senang .gb-gagang { transform: translateY(-10px) rotate(-14deg); }
.hm[data-k="koin"].senang .hm-lompat { animation: hmPutar .6s cubic-bezier(.3, 1.4, .5, 1); }
.hm[data-k="pado"].senang .pd-getar { display: inline; animation: hmKelip .25s linear infinite; }

/* ketuk 5x cepat: pusing */
.hm.pusing .mk-mata, .hm.pusing .mk-senang, .hm.pusing .mk-mulut, .hm.pusing .mk-cinta { display: none !important; }
.hm.pusing .mk-pusing { display: inline !important; transform-box: fill-box; transform-origin: center; animation: hmSpiral .7s linear infinite; }
.hm.pusing .mk-mangap { display: inline !important; }
.hm.pusing .hm-lompat { animation: hmGeleng .45s ease-in-out 3; }

/* gelembung omongan */
.hm-gelembung { position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 2; width: max-content; max-width: 200px;
                background: #fff; color: #191c1e; font: 700 12px/1.35 Sora, system-ui, sans-serif; text-align: center;
                padding: 8px 12px; border-radius: 14px; box-shadow: 0 8px 22px -8px rgba(10, 20, 50, .45);
                opacity: 0; transform: translate(-50%, 8px) scale(.9); transform-origin: 50% 100%; pointer-events: none;
                transition: opacity .2s ease, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.hm-gelembung::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: #fff; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.hm.bicara .hm-gelembung { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* partikel yang beterbangan saat diketuk */
.hm-partikel { position: absolute; left: 50%; top: 30%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; z-index: 3;
               animation: hmTerbang .9s cubic-bezier(.2, .7, .3, 1) forwards; }
.hm-partikel svg { width: 100%; height: 100%; display: block; }

/* ilustrasi ikut kursor (desktop) */
.hero-slide.ada-hm .hero-illu { translate: calc(var(--hx, 0) * -10px) calc(var(--hy, 0) * -7px); }

@keyframes hmNapas { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975); } }
@keyframes hmMelayang { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes hmBayang { 0%, 100% { transform: scaleX(1); opacity: .35; } 50% { transform: scaleX(.75); opacity: .2; } }
@keyframes hmHalo { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.9); opacity: 0; } }
@keyframes hmKelip { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes hmKilap { 0%, 55% { transform: translateX(0); } 100% { transform: translateX(70px); } }
@keyframes hmSapa { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 45% { transform: rotate(8deg); } 70% { transform: rotate(-5deg); } }
@keyframes hmLompat { 0% { transform: translateY(0) scale(1.06, .92); } 40% { transform: translateY(-26px) scale(.96, 1.05); } 75% { transform: translateY(0) scale(1.05, .95); } 100% { transform: none; } }
@keyframes hmPutar { 0% { transform: translateY(0) rotateY(0); } 50% { transform: translateY(-22px) rotateY(180deg); } 100% { transform: translateY(0) rotateY(360deg); } }
@keyframes hmGeleng { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes hmSpiral { to { transform: rotate(360deg); } }
@keyframes hmTerbang { 0% { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0); } 15% { opacity: 1; }
                       100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1) rotate(var(--r)); } }

/* tablet: tokoh lebih kecil dan lebih menempel ke ilustrasi supaya tidak menutupi teks */
@media (min-width: 768px) and (max-width: 1023px) {
  .hm { right: 150px; --hm-w: 92px; }
  .hm[data-k="gembi"] { --hm-w: 84px; } .hm[data-k="koin"] { --hm-w: 60px; } .hm[data-k="pado"] { --hm-w: 82px; }
}
/* tablet kecil */
@media (min-width: 640px) and (max-width: 767px) {
  .hm { right: 146px; --hm-w: 94px; }
  .hm[data-k="gembi"] { --hm-w: 86px; } .hm[data-k="koin"] { --hm-w: 62px; } .hm[data-k="pado"] { --hm-w: 84px; }
}
/* HP: ilustrasi naik ke pojok kanan atas, tokoh berdiri di bawahnya, di atas tombol geser */
@media (max-width: 639px) {
  .hm { right: 12px; bottom: 50px; --hm-w: 70px; }
  .hm[data-k="gembi"] { --hm-w: 64px; } .hm[data-k="koin"] { --hm-w: 46px; bottom: 56px; right: 22px; } .hm[data-k="pado"] { --hm-w: 66px; bottom: 52px; }
  .hero-slide.ada-hm .hero-illu { width: 56px !important; height: 56px !important; top: 12px !important; right: 12px !important; --tw-translate-y: 0 !important; }
  .hm-gelembung { left: auto; right: -4px; max-width: 150px; font-size: 11px; padding: 7px 10px; transform: translate(0, 8px) scale(.9); transform-origin: 85% 100%; }
  .hm-gelembung::after { left: auto; right: 26px; }
  .hm.bicara .hm-gelembung { transform: translate(0, 0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .hm, .hero-slide.ada-hm .hero-illu { translate: none !important; }
  .hm-napas, .hm-bayang, .hm .mk-halo, .hm .mk-lampu, .hm .mk-tombol, .hm .kn-kilap { animation: none !important; }
  .hm-lompat { animation: none !important; }
  .hm-tokoh { transition: opacity .2s ease !important; transform: none !important; }
  .hm-partikel { display: none; }
}
