/* 主题切换的圆形擦除。管理面板和用户面板共用这一份，改一处两边同时生效。
   圆心是主题按钮，方向跟着目标主题走：
     浅色 -> 深色  新主题从按钮往外铺开
     深色 -> 浅色  旧主题往按钮里收拢，露出下面的新主题
   浏览器不支持 View Transitions 时整段不生效，退回直接换色。 */

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* 往外释放：新的压在上面铺开 */
:root.theme-fx-out::view-transition-old(root) { z-index: 1; }
:root.theme-fx-out::view-transition-new(root) { z-index: 2; }

/* 往内收拢：旧的压在上面，收小了才露得出新的 */
:root.theme-fx-in::view-transition-old(root) { z-index: 2; }
:root.theme-fx-in::view-transition-new(root) { z-index: 1; }

/* 擦除期间冻结各处过渡，免得和快照叠出拖影 */
:root.theme-fx-run * { transition: none !important; }

/* 按钮上的日月图标跟着转进来，转向和擦除方向一致 */
.theme-fx-swap i,
.theme-fx-swap-rev i { display: inline-block; }
.theme-fx-swap i     { animation: shawuThemeIcon .42s cubic-bezier(.33, 1, .68, 1); }
.theme-fx-swap-rev i { animation: shawuThemeIconRev .42s cubic-bezier(.33, 1, .68, 1); }

@keyframes shawuThemeIcon {
    from { transform: rotate(-120deg) scale(.55); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
@keyframes shawuThemeIconRev {
    from { transform: rotate(120deg) scale(.55); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .theme-fx-swap i,
    .theme-fx-swap-rev i { animation: none; }
}
