/* ==========================================================================
   UNMUSIC — animations.css
   Semua animasi memakai transform / opacity / filter agar tidak memicu layout.
   ========================================================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
.skel,
.skel-row__art,
.skel-line,
.skel-card__art {
  animation: shimmer 1.5s linear infinite;
}

/* --- entrance --- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.anim-in {
  animation: rise 0.42s var(--ease-out) both;
}
.view.is-active > .view__inner > * {
  animation: rise 0.45s var(--ease-out) both;
}
.view.is-active > .view__inner > *:nth-child(1) {
  animation-delay: 0.02s;
}
.view.is-active > .view__inner > *:nth-child(2) {
  animation-delay: 0.06s;
}
.view.is-active > .view__inner > *:nth-child(3) {
  animation-delay: 0.1s;
}
.view.is-active > .view__inner > *:nth-child(4) {
  animation-delay: 0.14s;
}
.view.is-active > .view__inner > *:nth-child(n + 5) {
  animation-delay: 0.18s;
}

/* staggered rows/cards */
@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.row.anim-stagger,
.card.anim-stagger {
  animation: rowIn 0.34s var(--ease-out) both;
}

/* --- equalizer (hanya saat playing) --- */
@keyframes eqBar {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 15px;
  }
}
body[data-playing="true"] .eq i {
  animation: eqBar 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) {
  animation-delay: 0.18s;
}
.eq i:nth-child(3) {
  animation-delay: 0.36s;
}
.eq i:nth-child(4) {
  animation-delay: 0.54s;
}

/* --- indikator "now playing" pada row --- */
.row__bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.row.is-playing .row__bars {
  display: flex;
}
.row.is-playing .row__index-num {
  display: none;
}
.row__bars i {
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
body[data-playing="true"] .row.is-playing .row__bars i {
  animation: eqBar 0.9s ease-in-out infinite;
}
.row__bars i:nth-child(2) {
  animation-delay: 0.2s;
}
.row__bars i:nth-child(3) {
  animation-delay: 0.4s;
}

/* --- artwork disc: rotasi sangat halus saat playing --- */
@keyframes slowSpin {
  to {
    transform: rotate(360deg);
  }
}
body[data-playing="true"] .fullplayer__disc {
  animation: slowSpin 12s linear infinite;
}

/* --- pulse halus pada artwork bottom player --- */
@keyframes artGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 22%, transparent);
  }
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
  }
}
body[data-playing="true"] .player__art {
  animation: artGlow 3.4s ease-in-out infinite;
}

/* --- waveform dekoratif di featured --- */
.wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  opacity: 0.5;
}
.wave i {
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
}
body[data-playing="true"] .wave i {
  animation: eqBar 1.4s ease-in-out infinite;
}
.wave i:nth-child(2) {
  animation-delay: 0.1s;
}
.wave i:nth-child(3) {
  animation-delay: 0.2s;
}
.wave i:nth-child(4) {
  animation-delay: 0.3s;
}
.wave i:nth-child(5) {
  animation-delay: 0.4s;
}
.wave i:nth-child(6) {
  animation-delay: 0.5s;
}
.wave i:nth-child(7) {
  animation-delay: 0.6s;
}
.wave i:nth-child(8) {
  animation-delay: 0.7s;
}

/* --- toast --- */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}
.toast {
  animation: toastIn 0.28s var(--ease-out) both;
}
.toast.is-out {
  animation: toastOut 0.24s var(--ease) both;
}

/* --- context menu --- */
@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ctxmenu {
  animation: menuIn 0.16s var(--ease-out) both;
  transform-origin: top left;
}

/* --- modal --- */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal__panel {
  animation: modalIn 0.26s var(--ease-out) both;
}

/* --- artwork crossfade saat lagu berganti --- */
@keyframes artSwap {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.art-swap {
  animation: artSwap 0.5s var(--ease-out) both;
}

/* --- lirik masuk ---
   Animasi masuk dipasang pada lapisan teks (anak), bukan pada .lyric-line.
   Alasannya penting: .lyric-line memegang opacity dan transform berbasis
   kedalaman dari ui.js. Kalau animasi ber-fill-mode dipasang di sana, nilai
   akhirnya akan mengunci opacity dan transform, dan transisi antar baris jadi
   patah. Opacity anak bersifat relatif terhadap induk, jadi keduanya menumpuk
   dengan rapi. */
@keyframes lyricIn {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
.lyricsview.is-open .lyric-line .lyric-line__text {
  animation: lyricIn 0.46s var(--ease-out) both;
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .main,
  .lyricsview__scroll {
    scroll-behavior: auto;
  }
  .lyric-line.active {
    transform: none;
  }
  .card:hover {
    transform: none;
  }
}

/* Denyut halus untuk indikator sinkronisasi. */
@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .account__dot,
  .account-status__dot {
    animation: none !important;
  }
}

/* Lirik: kalau pengguna meminta gerak minimal, hilangkan blur, skala, dan
   sapuan karaoke. Perpindahan baris hanya lewat perubahan opacity. */
@media (prefers-reduced-motion: reduce) {
  .lyric-line,
  .lyric-line.active,
  .lyric-line.is-near {
    transform: none !important;
    filter: none !important;
    transition: opacity 160ms linear, color 160ms linear !important;
  }
  .lyric-line__fill,
  .lyric-word {
    display: none;
  }
}
