/* Monk 动效层 monk-motion v2 的样式，配合 monk-motion.js。规范见 ui/README.md「动效」。
   只在 html.mm（没开「减少动态效果」）下生效；mm-lite 是弱设备；mm-admin 是后台（不做进场和像素）。
   位移、缩放一律用独立的 translate / scale 属性，不碰页面自己的 transform。 */
:root {
  --mm-ease: cubic-bezier(.28, .11, .32, 1);
  --mm-out: cubic-bezier(0, 0, .5, 1);
  --mm-spring: cubic-bezier(.2, .9, .25, 1.02);
  --mm-glide: cubic-bezier(.65, 0, .25, 1);
  --mm-notch: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 4px 4px);
}

/* ---------- 按下的手感：按钮按下瞬间缩一点（不加过渡，像素式的「咔哒」） ---------- */
.mm :is(.mk-btn, .btn, button, [role="button"]):active:not(:disabled):not([aria-disabled="true"]) { scale: .97; }

/* ---------- 滚动进场（JS 播完会把这几个类删掉） ---------- */
.mm .mm-rv { opacity: 0; translate: 0 22px; }
.mm .mm-rv.mm-rv-in { opacity: 1; translate: none; transition: opacity .7s var(--mm-out) var(--rv-d, 0ms), translate .8s var(--mm-spring) var(--rv-d, 0ms); }
.mm .mm-rv.mm-rv-fast { translate: 0 10px; }
.mm .mm-rv.mm-rv-fast.mm-rv-in { translate: none; transition-duration: .32s, .4s; }

/* ---------- 数字 ---------- */
.mm-num { font-variant-numeric: tabular-nums; }
.mm .mm-bump { display: inline-block; animation: mmBump .42s var(--mm-spring); }
@keyframes mmBump { 0% { translate: 0 35%; opacity: .2; } 60% { opacity: 1; } 100% { translate: none; } }

/* ---------- 像素卡：画布在卡片背景之上、内容之下 ---------- */
.mm-pxhost { isolation: isolate; }
.mm-rel { position: relative; }
.mm-px { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; border-radius: inherit; }
.mm-lite .mm-px, .mm-admin .mm-px { display: none; }

/* ---------- 点击火花（popover 顶层，铺满屏幕、不挡点击） ---------- */
.mm-spark { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; pointer-events: none; z-index: 2147483000; }
.mm-spark::backdrop { display: none; }

/* ---------- 滑块：选中项后面一块（默认）或下面一条线（--line），切换时滑过去 ---------- */
.mm-glide { position: absolute; left: 0; top: 0; width: var(--gw, 0); height: var(--gh, 0); translate: var(--gx, 0) var(--gy, 0); opacity: 0; pointer-events: none; z-index: 0; transition: translate .45s var(--mm-glide), width .45s var(--mm-glide), height .45s var(--mm-glide), opacity .2s; }
.mm-glide.is-on { opacity: 1; }
.mm-glide.no-tr { transition: none; }
.mm-glide--line { height: 2px; translate: var(--gx, 0) calc(var(--gy, 0px) + var(--gh, 0px) - 2px); background: var(--flame, var(--mk-accent, #F97316)); }
html:not(.mm) .mm-glide { display: none; }

/* ---------- 弹窗（所有 <dialog>）：弹性入场、遮罩淡入；Esc / 退场先播动画 ---------- */
.mm dialog[open]:not([data-mm-skip]) { animation: mmDlgIn .44s var(--mm-spring); }
.mm dialog[open]:not([data-mm-skip])::backdrop { animation: mmFade .24s var(--mm-out); }
.mm dialog.is-closing { animation: mmDlgOut .2s var(--mm-ease) forwards; }
.mm dialog.is-closing::backdrop { animation: mmFade .2s var(--mm-ease) reverse forwards; }
@keyframes mmDlgIn { from { opacity: 0; translate: 0 18px; scale: .965; } }
@keyframes mmDlgOut { to { opacity: 0; translate: 0 10px; scale: .98; } }
@keyframes mmFade { from { opacity: 0; } }

/* ---------- 白天 / 黑夜切换：新画面从按钮处一格一格扩散开（像素圆） ---------- */
.mm-theming::view-transition-old(root), .mm-theming::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.mm-theming::view-transition-new(root) { animation: mmTheme .62s steps(12, end) both; }
@keyframes mmTheme { from { clip-path: circle(0 at var(--mm-tx, 50%) var(--mm-ty, 0)); } to { clip-path: circle(var(--mm-tr, 150vmax) at var(--mm-tx, 50%) var(--mm-ty, 0)); } }

@media (prefers-reduced-motion: reduce) {
  .mm-glide { transition: none; }
}
