/* 膳知网页版样式 · 切页面、弹出层、按下反馈（经典风格）（css/ 下的文件按 index.html 里的顺序叠加，后面的覆盖前面的） */
/* ======================================================================
 * 动效：切页面、弹出层、按下反馈（都尊重「减少动态效果」设置）
 * ====================================================================== */
html { touch-action: manipulation; }
/* 不跟着页面一起动的部分：各自单独成层，切页面时原地不动 */
.tabbar { view-transition-name: tabbar; }
.side { view-transition-name: side; }
.topbar { view-transition-name: topbar; }
.composer { view-transition-name: composer; }
.ai-entry .ai-avatar, .chat-hello .ai-avatar, .chat-top .ai-avatar { view-transition-name: xiaoshan; }
::view-transition-group(xiaoshan) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2, .9, .25, 1); }
::view-transition-old(xiaoshan), ::view-transition-new(xiaoshan) { animation-duration: .3s; }

/* 切标签：旧页面快速淡出，新页面带一点上浮淡入 */
html[data-nav="tab"]::view-transition-old(root) { animation: vt-fade-out .09s ease-out both; }
html[data-nav="tab"]::view-transition-new(root) { animation: vt-rise-in .24s cubic-bezier(.2, .8, .2, 1) .05s both; }
/* 进子页面：新页面从右边滑进，旧页面往左让开 */
html[data-nav="push"]::view-transition-old(root) { animation: vt-out-left .18s cubic-bezier(.4, 0, 1, 1) both; }
html[data-nav="push"]::view-transition-new(root) { animation: vt-in-right .3s cubic-bezier(.2, .8, .2, 1) both; }
/* 返回：反过来 */
html[data-nav="pop"]::view-transition-old(root) { animation: vt-out-right .18s cubic-bezier(.4, 0, 1, 1) both; }
html[data-nav="pop"]::view-transition-new(root) { animation: vt-in-left .26s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-rise-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-8%); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(14%); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(14%); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-8%); } }

/* 不用 View Transitions 时（手机、旧浏览器）的切页动画在 clean-fx.css：给页面里每一块单独做，不给整页加 transform */

/* 弹出层关闭：遮罩淡出、面板往下滑走（电脑上是居中的卡片：缩小淡出） */
.mask.leaving { pointer-events: none; animation: mask-out .22s ease forwards; }
.mask.leaving .sheet { animation: sheet-out .22s cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes mask-out { to { opacity: 0; } }
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }
@media (min-width: 1024px) { @keyframes sheet-out { to { transform: translateY(8px) scale(.98); opacity: 0; } } }
@keyframes sheet-in { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }

/* 按下去的反馈：像原生 App 一样轻轻一缩 */
.btn, .me-row, .tabbar a, .side-nav a, .fp-opt, .starter, .label-hero, .dish-card, .ledger-item, .hub-tabs a, .opt, .seg button {
  transition: transform .14s ease, background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease; }
.btn:active:not(:disabled), .fp-opt:active, .starter:active, .dish-card:active, .ledger-item:active, .opt:active, .seg button:active { transform: scale(.97); }
.me-row:active { background: rgba(var(--ink-rgb), .05); }
.tabbar a:active .ico, .side-nav a:active .ico { transform: scale(.86); }
.tabbar a .ico { transition: transform .16s cubic-bezier(.2, .8, .2, 1); }
.tabbar a.on .ico { animation: tab-pop .32s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes tab-pop { 0% { transform: scale(.82); } 100% { transform: none; } }
/* 页面内跳转平滑滚动 */
html { scroll-behavior: smooth; }

/* 数据还没回来时的骨架屏（只在第一次打开、还没有缓存时出现） */
.skel { padding: 8px 0; display: flex; flex-direction: column; gap: 12px; }
.skel i { display: block; height: 18px; border-radius: 9px;
  background-size: 200% 100%; }
.skel i.card { height: 120px; border-radius: 18px; }
.skel i.short { width: 55%; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .no-vt .view > *, .sheet, .mask, .tabbar a.on .ico, .skel i { animation: none !important; }
  .btn:active, .fp-opt:active, .starter:active { transform: none; }
}
/* 一周计划切换日期：三餐依次浮上来 */
.day-meal { animation: vt-rise-in .28s cubic-bezier(.2, .8, .2, 1) both; }
.day-meal:nth-of-type(2) { animation-delay: .04s; } .day-meal:nth-of-type(3) { animation-delay: .08s; } .day-meal:nth-of-type(4) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { .day-meal { animation: none; } }

/* 弹出层右上角的关闭按钮（所有弹出层统一；手机上也可以按住顶部往下拖、电脑上按 Esc） */
.sheet { position: relative; }
.sheet-x { position: sticky; top: 0; float: right; z-index: 3; width: 34px; height: 34px; margin: -2px -8px 0 8px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2); background: rgba(var(--ink-rgb), .06); }
.sheet-x:hover { background: rgba(var(--ink-rgb), .11); color: var(--ink); }
.sheet-x:active { transform: scale(.9); }
.sheet-x:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
