@font-face {
  font-family: "Hurufnya Sheo";
  src: url("../assets/fonts/hurufnya-sheo.woff") format("woff");
  font-display: block;
}

:root {
  --bg: #ffe9fc;
  --text: #be1212;
  --s: 1; /* skala: lebar layar / 1366 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#viewer {
  position: fixed;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

#sizer { position: relative; overflow: hidden; }

#stage {
  position: absolute;
  left: 0; top: 0;
  width: 1366px;
  transform: scale(var(--s));
  transform-origin: 0 0;
  transition: opacity .25s ease;
}
#stage.out { opacity: 0; }

/* ---------- Elemen ---------- */
.el { position: absolute; }
.el > .anim, .anim > .rot, .rot > .loop, .loop > .flip, .flip > .box {
  position: absolute; inset: 0;
}
.el.link { cursor: pointer; }
.el.link > .anim { pointer-events: auto; }

.box { overflow: hidden; }
.box.noclip { overflow: visible; }
.box > img, .box > video, .box > canvas {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.gstage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* Frame foto (shape) */
.frame {
  position: absolute; inset: 0;
  overflow: hidden;
  border-radius: 45%/ 45%;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Teks ---------- */
.txt {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  font-family: "Hurufnya Sheo", "Comic Sans MS", cursive;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-kerning: normal;
}
.txt p { margin: 0; }
.txt .w, .txt .c { display: inline-block; white-space: pre; }
.txt svg { position: absolute; left: 0; top: 0; overflow: visible; }

/* ---------- Video musik ---------- */
.player { position: absolute; inset: 0; border-radius: 34px; overflow: hidden; background: #000; cursor: pointer; }
.player video, .player img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player .play {
  position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(17, 18, 22, .78);
  display: grid; place-items: center;
  transition: opacity .2s, transform .2s;
}
.player .play::after {
  content: ""; margin-left: 4px;
  border-left: 15px solid #fff;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}
.player.playing .play { opacity: 0; transform: scale(.8); }
.player.playing:hover .play { opacity: 1; transform: none; }
.player.playing .play::after {
  margin: 0; width: 14px; height: 16px;
  border: 0; border-left: 5px solid #fff; border-right: 5px solid #fff;
}

/* ---------- Animasi masuk ---------- */
.anim { animation-fill-mode: both; animation-delay: var(--d, 0s); }
.pre { visibility: hidden; }

/* 31: grup zoom + blur */
.a31 { animation: zoomBlur .55s cubic-bezier(.22,.8,.3,1) var(--d) both; }
@keyframes zoomBlur {
  from { opacity: 0; transform: scale(.75); filter: blur(24px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* 8: fade + blur ringan */
.a8 { animation: fadeBlur var(--dur, 1s) cubic-bezier(.25,.75,.35,1) var(--d) both; }
@keyframes fadeBlur {
  from { opacity: 0; transform: scale(.965); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* 29: foto muncul dari blur */
.a29 { animation: blurIn .5s ease-out var(--d) both; }
@keyframes blurIn {
  from { opacity: 0; filter: blur(32px); }
  to   { opacity: 1; filter: blur(0); }
}

/* 9: terbang dari pojok kiri atas layar */
.a9 { animation: flyIn .75s cubic-bezier(.25,.8,.3,1) var(--d) both; }
@keyframes flyIn {
  from { transform: translate(var(--fx), var(--fy)); }
  to   { transform: none; }
}

/* 5: pop */
.a5 { animation: pop .6s cubic-bezier(.34,1.56,.64,1) var(--d) both; }
@keyframes pop {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: none; }
}

/* 30: reveal tinta (fallback bila canvas tidak tersedia) */
.a30fb { animation: inkFallback 1.2s ease-out var(--d) both; }
@keyframes inkFallback {
  from { opacity: 0; clip-path: circle(0% at 50% 50%); }
  to   { opacity: 1; clip-path: circle(75% at 50% 50%); }
}

/* animasi teks per kata / huruf */
.tw { animation: wordRise .45s cubic-bezier(.25,.8,.3,1) var(--d) both; }
@keyframes wordRise {
  from { opacity: 0; transform: translateY(.45em); }
  to   { opacity: 1; transform: none; }
}
.tc { animation: typeIn .05s linear var(--d) both; }
@keyframes typeIn { from { opacity: 0; } to { opacity: 1; } }
.tb { animation: charBounce .55s cubic-bezier(.34,1.56,.64,1) var(--d) both; }
@keyframes charBounce {
  from { opacity: 0; transform: translateY(-.6em) scale(.4); }
  to   { opacity: 1; transform: none; }
}
.tp { animation: wordPop .5s cubic-bezier(.34,1.56,.64,1) var(--d) both; }
@keyframes wordPop {
  from { opacity: 0; transform: scale(.3); }
  to   { opacity: 1; transform: none; }
}
.tcurve { animation: wordRise .6s cubic-bezier(.25,.8,.3,1) var(--d) both; }

/* ---------- Animasi berulang ---------- */
.l7 { animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50%      { transform: rotate(2deg) scale(1.04); }
}
.lpulse { animation: pulse 1.7s ease-in-out infinite alternate; }
@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.035); }
}
.lrock { animation: rock 2.2s ease-in-out infinite; }
@keyframes rock {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .anim, .tw, .tc, .tb, .tp, .tcurve, .loop { animation: none !important; }
}
