/* ==========================================================================
   动效
   - 首屏内容分块淡入上移，网格卡片错峰
   - 顶栏滚动阴影、按钮/标签按下反馈、角落细节
   - 对话框进出场（含 ::backdrop）
   时长 180–460ms，位移不超过 14px；base.css 里已有 prefers-reduced-motion 全局降级
   ========================================================================== */

/* ---------------- 关键帧 ---------------- */

@keyframes lys-rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes lys-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes lys-dialog-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.975); }
  to   { opacity: 1; transform: none; }
}

@keyframes lys-dialog-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(0, 8px, 0) scale(.985); }
}

/* ---------------- 首屏内容入场 ---------------- */

.page > *:not(.song-page) {
  animation: lys-rise .42s var(--md-sys-motion-standard) backwards;
}
.page > *:nth-child(2):not(.song-page) { animation-delay: .05s; }
.page > *:nth-child(3):not(.song-page) { animation-delay: .1s; }
.page > *:nth-child(4):not(.song-page) { animation-delay: .15s; }
.page > *:nth-child(n+5):not(.song-page) { animation-delay: .18s; }

.song-page > * {
  animation: lys-rise .42s var(--md-sys-motion-standard) backwards;
}
.song-page > *:nth-child(2) { animation-delay: .05s; }
.song-page > *:nth-child(3) { animation-delay: .1s; }
.song-page > *:nth-child(4) { animation-delay: .14s; }
.song-page > *:nth-child(n+5) { animation-delay: .18s; }

.admin-content > * {
  animation: lys-rise .4s var(--md-sys-motion-standard) backwards;
}
.admin-content > *:nth-child(2) { animation-delay: .05s; }
.admin-content > *:nth-child(3) { animation-delay: .1s; }
.admin-content > *:nth-child(n+4) { animation-delay: .14s; }

/* 首页歌曲卡片：逐张进场 */
.song-grid > * {
  animation: lys-rise .44s var(--md-sys-motion-standard) backwards;
}
.song-grid > *:nth-child(1) { animation-delay: .04s; }
.song-grid > *:nth-child(2) { animation-delay: .08s; }
.song-grid > *:nth-child(3) { animation-delay: .12s; }
.song-grid > *:nth-child(4) { animation-delay: .16s; }
.song-grid > *:nth-child(5) { animation-delay: .2s; }
.song-grid > *:nth-child(6) { animation-delay: .24s; }
.song-grid > *:nth-child(n+7) { animation-delay: .27s; }

/* 歌曲页的版本 chip：依次亮起，提示这里有多个版本 */
.version-bar .chip-row > * {
  animation: lys-fade .3s var(--md-sys-motion-standard) backwards;
}
.version-bar .chip-row > *:nth-child(1) { animation-delay: .18s; }
.version-bar .chip-row > *:nth-child(2) { animation-delay: .22s; }
.version-bar .chip-row > *:nth-child(3) { animation-delay: .26s; }
.version-bar .chip-row > *:nth-child(n+4) { animation-delay: .3s; }

/* ---------------- 顶栏 ---------------- */

.app-bar {
  transition: box-shadow var(--md-sys-motion-dur-3) var(--md-sys-motion-standard),
              border-color var(--md-sys-motion-dur-3);
}
.app-bar.is-scrolled,
.admin-topbar.is-scrolled {
  box-shadow: var(--md-sys-elevation-1);
  border-bottom-color: transparent;
}
.admin-topbar {
  transition: box-shadow var(--md-sys-motion-dur-3) var(--md-sys-motion-standard),
              border-color var(--md-sys-motion-dur-3);
}

/* ---------------- 按压 / 悬停 ---------------- */

.md-icon-btn:active { transform: scale(.92); }

.md-chip,
.md-btn,
.song-card,
.md-icon-btn {
  -webkit-tap-highlight-color: transparent;
}

.md-chip {
  transition: background var(--md-sys-motion-dur-3),
              color var(--md-sys-motion-dur-3),
              border-color var(--md-sys-motion-dur-3),
              transform var(--md-sys-motion-dur-2) var(--md-sys-motion-standard);
}
@media (hover: hover) {
  .md-chip:hover { transform: translateY(-1px); }
}
.md-chip:active { transform: translateY(0) scale(.985); }

/* 搜索联想：从输入框下沿轻轻展开 */
.suggest-panel:not([hidden]) {
  animation: lys-rise .18s var(--md-sys-motion-standard) backwards;
}

/* 后台表格行：悬停时轻微提亮（部分浏览器不支持 tr transform，只做底色） */
.admin-table tbody tr { transition: background var(--md-sys-motion-dur-2); }

/* ---------------- 对话框 ---------------- */

dialog.md-dialog[open] {
  animation: lys-dialog-in .22s cubic-bezier(.2, .9, .3, 1) backwards;
}
dialog.md-dialog[open]::backdrop {
  animation: lys-fade .2s var(--md-sys-motion-standard) backwards;
}
dialog.md-dialog.is-closing {
  animation: lys-dialog-out .17s ease-in both;
}
dialog.md-dialog.is-closing::backdrop {
  animation: lys-fade .17s ease-in reverse both;
}

/* ---------------- 下载歌词对话框 ---------------- */

.dl-dialog[open] { animation: lys-dialog-in .24s cubic-bezier(.2, .9, .3, 1) backwards; }

.dl-dialog.is-open .dl-item {
  animation: lys-rise .32s var(--md-sys-motion-standard) backwards;
}
.dl-dialog.is-open .dl-item:nth-child(1) { animation-delay: .03s; }
.dl-dialog.is-open .dl-item:nth-child(2) { animation-delay: .06s; }
.dl-dialog.is-open .dl-item:nth-child(3) { animation-delay: .09s; }
.dl-dialog.is-open .dl-item:nth-child(4) { animation-delay: .12s; }
.dl-dialog.is-open .dl-item:nth-child(5) { animation-delay: .15s; }
.dl-dialog.is-open .dl-item:nth-child(6) { animation-delay: .18s; }
.dl-dialog.is-open .dl-item:nth-child(7) { animation-delay: .21s; }
.dl-dialog.is-open .dl-item:nth-child(n+8) { animation-delay: .24s; }
