/* ==========================================================================
   motion.css · 全站唯一的动效层（与 js/fx.js、js/theme.js 配套，可整层停用）
   --------------------------------------------------------------------------
   加载位置：所有页面在 enhancements.css 之后、页面专属样式之前。
   V1.1 起原 motion-premium.css 已并入本文件（见 §11），全站每个元素的动画只有
   一个归属；热爱专题展廊的动效仍独立在 hobbies.css。
   时长与曲线一律取 tokens.css 的令牌，不在这里写裸数值。
   原则：
     · 只动画 transform / opacity / clip-path / 注册过的自定义属性，不触发布局
     · 动画一律放在 (prefers-reduced-motion: no-preference) 且非 [data-motion="reduce"]
       之内；降级时元素直接处于终态，功能与可读性不受影响
     · 跟随指针的特效只在 (hover: hover) and (pointer: fine) 下出现，
       并由 fx.js 按 Legend1sMotion.allowsFx() 挂类，CSS 不单独判断
   PR 04 做了减法：保留有功能的动效（转场、主题扩散、指示器、命令面板、进度条），
   删掉纯装饰的（背景漂移、标题扫光、卡片倾斜与流光描边、磁吸）。编号保持不变，便于对照历史。
   目录：
     1. 关键帧
     2. 跨页转场（@view-transition，类型 page）
     3. 主题切换圆形扩散（fx.js / theme.js 加 .vt-theme）
     4. 背景（已静止）
     5. 首页 Hero 入场编排
     6. 滑动指示器（标签页 / 导航 / 命令面板）
     7. 命令面板进出场
     8. 卡片倾斜与流光描边（已移除）
     9. 磁吸（已移除）
    10. 滚动驱动的进度条
   11. 悬停反馈（原 premium 层）
   12. 降级
   13. 动效 2.0（升级项 13；方案见 docs/MOTION-PLAN.md）；13j 按压回弹与滑动高亮、13k 页脚字标（V2.2）
   ========================================================================== */

/* ---------- 1. 关键帧 ----------
   PR 04 删掉了 fx-shine（标题扫光）、fx-aurora（背景漂移）、fx-spin 与 --fx-angle（卡片流光描边）。
   fx-rise 去掉了 blur：首屏 5 段同时做模糊滤镜很贵，8px 位移 + 淡入已经足够。 */
@keyframes fx-page-out { to { opacity: 0; transform: scale(0.985); } }
@keyframes fx-page-in  { from { opacity: 0; transform: translateY(14px); } }
@keyframes fx-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fx-item-in {
  from { opacity: 0; transform: translateY(6px); }
}
@keyframes fx-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- 2. 跨页转场 ----------
   类型 page 由 @view-transition 声明，只作用于跨文档导航；
   同文档转场（热爱页灯箱 hb-hero、主题切换 .vt-theme）不带这个类型，互不干扰。
   热爱专题之间的 hb-brand 品牌色幕优先，这里显式排除。 */
@view-transition { navigation: auto; types: page; }

html:active-view-transition-type(page) .site-header { view-transition-name: site-header; }

html:active-view-transition-type(page):not(:active-view-transition-type(hb-brand))::view-transition-old(root) {
  animation: fx-page-out var(--dur-exit) var(--ease-in) both;
}
html:active-view-transition-type(page):not(:active-view-transition-type(hb-brand))::view-transition-new(root) {
  animation: fx-page-in var(--dur-slow) var(--ease-emph) 60ms both;
}
html:active-view-transition-type(page)::view-transition-group(site-header) {
  animation-duration: var(--dur-slow);
  animation-timing-function: var(--ease-emph);
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
:root[data-motion="reduce"]::view-transition-group(*),
:root[data-motion="reduce"]::view-transition-old(*),
:root[data-motion="reduce"]::view-transition-new(*) { animation: none !important; }

/* ---------- 3. 主题切换圆形扩散 ----------
   新快照从点击点用 clip-path 圆形展开（动画由 theme.js 用 WAAPI 驱动）；
   这里只关掉默认交叉淡入，并让页头不单独成组。 */
html.vt-theme::view-transition-old(root),
html.vt-theme::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html.vt-theme .site-header { view-transition-name: none; }

/* ---------- 4. 背景 ----------
   PR 04 起这里不再有背景动画；V2.0（25）的柔光漂移写在 §13 末尾。
   空闲时唯一允许循环的就是这层柔光（只动 transform），perf.spec 会检查。 */

/* ---------- 5. 首页 Hero 入场编排 ----------
   标题两段 → 说明 → 搜索 → 备注依次上浮淡入，单段 --dur-enter（400ms）、错峰 40ms，
   整段约 0.6 秒；只播一次，不循环。渐变关键词不再扫光。 */
.hero__title-lead,
.hero__title .text-gradient,
.hero__title-end { display: inline-block; }

/* 错峰序号给 §13 的 13b 用（入场动画本身在 13b）；13i 删掉了这里原来的 fx-rise 分段入场 */
.hero__title-lead { --fx-i: 0; }
.hero__title .text-gradient, .hero__title-end { --fx-i: 1; }
.hero__desc   { --fx-i: 2; }
.hero__search { --fx-i: 3; }
.hero__note   { --fx-i: 4; }

/* ---------- 6. 滑动指示器 ----------
   fx.js 往容器里插入 .fx-indicator，并写 --fx-x / --fx-y / --fx-w / --fx-h。
   容器加 .has-indicator 后，原来每个选项自己的选中底色交给指示器。
   初次定位不带过渡（.is-ready 之后才有），避免页面加载时从左上角滑进来。 */
.fx-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: var(--fx-w, 0);
  height: var(--fx-h, 0);
  transform: translate3d(var(--fx-x, 0), var(--fx-y, 0), 0);
  border-radius: var(--radius-sm);   /* 与 .tab 一致；导航用 --radius-md，见下 */
  pointer-events: none;
}
.fx-indicator.is-ready {
  transition:
    transform var(--dur-slow) var(--ease-out),
    width var(--dur-slow) var(--ease-out),
    height var(--dur-slow) var(--ease-out),
    opacity var(--dur) var(--ease-out);
  transition-timing-function: var(--ease-spring);
}
.fx-indicator.is-snap { transition: none; }

/* 标签页 */
.tabs.has-indicator { position: relative; }
.tabs.has-indicator .tab { position: relative; z-index: 1; }
.tabs.has-indicator .tab[aria-selected="true"] { background: transparent; box-shadow: none; }
.tabs .fx-indicator { background: var(--bg-elev); box-shadow: var(--shadow-sm); }

/* 顶栏导航：悬停胶囊跟着指针在链接之间滑动 */
/* 只在桌面布局里改定位：≤820px 时 .nav__links 是 position: fixed 的下拉抽屉，不能覆盖 */
@media (min-width: 821px) {
  .nav__links.has-indicator { position: relative; }
}
.nav__links.has-indicator .nav__link { z-index: 1; }
.nav__links.has-indicator .nav__link:hover { background: transparent; }
@media (hover: hover) and (pointer: fine) {
  .nav__links.has-indicator .nav__link:hover { transform: none; }
}
.nav__links .fx-indicator { background: var(--surface-strong); border-radius: var(--radius-md); opacity: 0; }
.nav__links .fx-indicator.is-on { opacity: 1; }
@media (max-width: 820px) {
  .nav__links .fx-indicator { display: none; }
  .nav__links.has-indicator .nav__link:hover { background: var(--surface); }
}

/* 命令面板：当前高亮块在选项之间滑动 */
.palette__list.has-indicator { position: relative; }
.palette__list.has-indicator .palette__item { position: relative; z-index: 1; }
.palette__list.has-indicator .palette__item.is-active { background: transparent; }
.palette__list.has-indicator .palette__item:hover:not(.is-active) { background: var(--surface); }
.palette__list .fx-indicator {
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: inset 2px 0 0 var(--accent);
}
.palette__list .fx-indicator.is-ready {
  transition:
    transform var(--dur-move) var(--ease-out),
    width var(--dur-move) var(--ease-out),
    height var(--dur-move) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
  transition-timing-function: var(--ease-spring);
}

/* ---------- 7. 命令面板进出场 ----------
   进场：盒子带一点弹性落位，前几项结果依次浮现（只在刚打开时，打字时不再重播）。
   退场：ease-in、更短，快速让开；main.js 在遮罩 opacity 过渡结束后才隐藏面板。 */
.palette.is-open .palette__box {
  transition: transform var(--dur-slow) var(--ease-out);
  transition-timing-function: var(--ease-spring);
}
.palette:not(.is-open) { transition: opacity var(--dur-exit) var(--ease-in); }
.palette:not(.is-open) .palette__box {
  transform: translateY(-6px) scale(0.985);
  transition: transform var(--dur-exit) var(--ease-in);
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .palette.is-entering .palette__item,
  :root:not([data-motion="reduce"]) .palette.is-entering .palette__group {
    animation: fx-item-in var(--dur-move) var(--ease-out) both;
    animation-delay: calc(40ms + min(var(--fx-i, 8), 8) * 22ms);
  }
}

/* 7b · 确认框（V2.0 21）：打开时盒子从略小处弹性落位、遮罩淡入；关闭直接移除，不留退场。 */
@keyframes fx-confirm-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes fx-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .confirm[open] {
    animation: fx-confirm-in var(--dur-slow) var(--ease-spring) both;
  }
  :root:not([data-motion="reduce"]) .confirm[open]::backdrop {
    animation: fx-fade-in var(--dur) var(--ease-out) both;
  }
}

/* ---------- 8. 卡片倾斜与流光描边（PR 04 已移除） ----------
   站点卡片与资源卡片不再倾斜、不再有旋转的流光描边；悬停反馈只剩
   components.css 的上移 2px + 边框加强（13i 起跟随高光由 §13 的边框聚光代替）。 */

/* ---------- 9. 磁吸（PR 04 已移除） ---------- */

/* ---------- 10. 滚动驱动的进度条 ----------
   支持 scroll-driven animations 时由 CSS 直接绑定根滚动；不支持时沿用 main.js 写入的 --scroll。 */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .scroll-progress {
      animation: fx-progress linear both;
      animation-timeline: scroll(root block);
    }
  }
}

/* ---------- 11. 悬停反馈（原 premium 层） ----------
   原来这里还有一层首屏强调色环境光（.hero::before），与 layout.css 的 .aurora 重复，PR 04 删除。
   颜色一律取令牌：描边 --accent-line，阴影 --shadow-*，焦点环 --focus-ring。 */

/* 首页搜索框的悬停与聚焦样式 13c 起只在 layout.css 一处（原来这里与 layout.css 各写一份）。 */

@media (hover: hover) and (pointer: fine) {
  .card--interactive:hover {
    border-color: var(--accent-line);
    box-shadow: var(--shadow-md);
  }
  .theme-preset:hover {
    border-color: var(--accent-line);
  }
}

/* 主题切换的降级过渡：浏览器不支持 View Transitions（没有圆形扩散）时，
   theme.js 给 <html> 加 .theme-fading，主要表面的颜色在 --dur-theme-fade 内渐变；
   支持扩散的浏览器不会加这个类，两种效果不会叠加。 */
html.theme-fading body,
html.theme-fading .site-header,
html.theme-fading .card,
html.theme-fading .tabs,
html.theme-fading .hero__search,
html.theme-fading .palette__box {
  transition:
    background-color var(--dur-theme-fade) var(--ease-out),
    border-color var(--dur-theme-fade) var(--ease-out),
    color var(--dur-theme-fade) var(--ease-out);
}

/* ---------- 12. 降级 ---------- */
@media (prefers-reduced-transparency: reduce) {
  .aurora { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html.theme-fading body,
  html.theme-fading .site-header,
  html.theme-fading .card,
  html.theme-fading .tabs,
  html.theme-fading .hero__search,
  html.theme-fading .palette__box { transition: none !important; }
}

/* ---------- 13. 动效 2.0 ----------
   13a 只登记门控写法，不改任何外观；13b 起的规则都写在这一节。
   标题遮罩上升的起点用 opacity 0.001 而不是 0，避免把首屏最大内容绘制（LCP）推迟到动画结束。
   门控：两个条件同时满足才动——系统允许（prefers-reduced-motion: no-preference）、站内档位不是 reduce：
     @media (prefers-reduced-motion: no-preference) {
       :root:not([data-motion="reduce"]) .xxx { … }
     }
   13i 起这一节不再挂在实验开关后面，是唯一路径。
   JS 侧用 Legend1sFx.on()（js/fx.js）。只动 transform / opacity / clip-path / 注册过的自定义属性，
   时长与曲线只用令牌（--dur-hero、--stagger-hero、--ease-glide …），同一元素只有一处规则负责动画。
   不做：无限循环动画、背景漂移、流光描边、卡片 3D 倾斜、磁吸、光标大光斑、大面积模糊入场、滚动劫持、视差超过 --parallax。 */

/* 13b · 首屏编排：日期 → 标题遮罩上升 → 说明 / 搜索 / 备注 → 今日概览，全部在 0.9 秒内结束、只播一次。
   遮罩不加外层元素：clip-path 跟着标题一起下移，下沿始终落在标题原来的底边（inset 底边 = 下移量），
   看起来像从一条线后面升上来；fill 只用 backwards，播完 clip-path 与 transform 都回到无。
   今日概览只有第一次渲染的列表带 .fx-enter（dashboard.js），收藏变化、跨午夜、跨标签页的重画都不重播。 */
@keyframes fx-mask-in {
  from { transform: translateY(var(--enter-y-lg)); clip-path: inset(-1em -1em var(--enter-y-lg) -1em); opacity: 0.001; }
  to   { transform: none; clip-path: inset(-1em -1em 0 -1em); opacity: 1; }
}
@keyframes fx-fade { from { opacity: 0; } }
@property --fx-grow { syntax: '<number>'; inherits: false; initial-value: 1; }
@keyframes fx-grow { from { --fx-grow: 0; } }

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .hero__date {
    animation: fx-fade var(--dur-enter) var(--ease-out) backwards;
  }
  :root:not([data-motion="reduce"]) .hero__title-lead,
  :root:not([data-motion="reduce"]) .hero__title .text-gradient,
  :root:not([data-motion="reduce"]) .hero__title-end {
    animation: fx-mask-in var(--dur-hero) var(--ease-out) backwards;
    animation-timing-function: var(--ease-glide);
    animation-delay: calc(40ms + var(--fx-i, 0) * var(--stagger-hero));
  }
  :root:not([data-motion="reduce"]) .hero__desc,
  :root:not([data-motion="reduce"]) .hero__search,
  :root:not([data-motion="reduce"]) .hero__note {
    animation: fx-rise var(--dur-enter) var(--ease-emph) backwards;
    animation-delay: calc(220ms + (var(--fx-i, 2) - 2) * 30ms);
  }
  :root:not([data-motion="reduce"]) .hero__today {
    animation: fx-rise var(--dur-enter) var(--ease-emph) 280ms backwards;
  }
  :root:not([data-motion="reduce"]) .today-stats.fx-enter > li {
    animation: fx-rise var(--dur-enter) var(--ease-out) backwards;
    animation-delay: calc(320ms + var(--fx-n, 0) * 40ms);
  }
  .today-stats.fx-enter > li:nth-child(2) { --fx-n: 1; }
  .today-stats.fx-enter > li:nth-child(3) { --fx-n: 2; }
  .today-stats.fx-enter > li:nth-child(4) { --fx-n: 3; }
  :root:not([data-motion="reduce"]) .today-stats.fx-enter .today-stat__bar {
    background: linear-gradient(90deg,
      var(--accent) calc(var(--progress, 0%) * var(--fx-grow)),
      var(--surface-strong) calc(var(--progress, 0%) * var(--fx-grow)));
    animation: fx-grow var(--dur-enter) var(--ease-glide) 400ms backwards;
  }
  /* 顶部柔光淡入一次：是过渡不是动画（animationName 仍为 none） */
  :root:not([data-motion="reduce"]) .aurora {
    transition: opacity var(--dur-hero) var(--ease-out);
  }
  @starting-style {
    :root:not([data-motion="reduce"]) .aurora { opacity: 0; }
  }
}

/* 13c · 首页内容区。
   区块标题：沿用 [data-reveal] 的触发（main.js 的 IntersectionObserver，只播一次），标题块本身不再整体淡入，
   改为里面的眉标、标题先、说明晚 80ms，位移收到 12px。
   工作台：只有第一次渲染的网格带 .fx-enter（dashboard.js），卡片错峰进场；隐藏时的缩小淡出与其余卡片补位由 JS（Legend1sFx.flip）负责。
   工具标签切换、快捷导航筛选的补间都在 fx.js / toolkit.js，这里没有对应规则。 */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .section-head[data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  :root:not([data-motion="reduce"]) .section-head[data-reveal] > * {
    opacity: 0;
    transform: translateY(12px);
    transition:
      opacity var(--reveal-dur) var(--ease-out),
      transform var(--reveal-dur) var(--ease-out);
    transition-timing-function: var(--ease-glide);
  }
  :root:not([data-motion="reduce"]) .section-head[data-reveal].is-visible > * {
    opacity: 1;
    transform: none;
  }
  :root:not([data-motion="reduce"]) .section-head[data-reveal].is-visible > .section-desc {
    transition-delay: 80ms;
  }

  :root:not([data-motion="reduce"]) .dashboard__grid.fx-enter > .dash-card {
    animation: fx-rise var(--dur-enter) var(--ease-out) backwards;
    animation-delay: calc(300ms + var(--fx-n, 0) * 40ms);
  }
  .dashboard__grid.fx-enter > .dash-card:nth-child(2) { --fx-n: 1; }
  .dashboard__grid.fx-enter > .dash-card:nth-child(3) { --fx-n: 2; }
  .dashboard__grid.fx-enter > .dash-card:nth-child(4) { --fx-n: 3; }
  .dashboard__grid.fx-enter > .dash-card:nth-child(n+5) { --fx-n: 4; }
}
.dash-card.is-leaving { pointer-events: none; }

/* 边框聚光：fx.js 在鼠标移动时给卡片加 .fx-rim 并写 --rim-x / --rim-y；只有 1px 边框在指针附近亮起，不倾斜、不放大。
   伪元素盖在边框上（inset: -1px），mask 只留边框那一圈。旧的两条光晕路径 13i 已删除，指针反馈只剩这一种。 */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .fx-rim::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 1;
    padding: 1px;
    border-radius: inherit;
    background: radial-gradient(14rem circle at var(--rim-x, -100%) var(--rim-y, -100%), var(--accent-line), transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--dur) var(--ease-out);
    pointer-events: none;
  }
  :root:not([data-motion="reduce"]) .fx-rim:hover::before { opacity: 1; }
}

/* 热爱横幅：图片随滚动轻视差（view() 时间线，±4%，scale 1.08 留出余量）。视差写在 img 上、用独立的 translate / scale，
   悬停放大仍写在父元素 .passion-card__media 上，两者不抢同一个 transform。不支持滚动时间线的浏览器图片静止。 */
@keyframes fx-parallax {
  from { translate: 0 calc(var(--parallax) * -0.66); }
  to   { translate: 0 calc(var(--parallax) * 0.66); }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .passion-card__media img {
      scale: 1.08;
      animation: fx-parallax linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }
  }
}
:root .passion-card__arrow { transition-timing-function: var(--ease-glide); }

/* 13e · 通用微交互（全站）。都是一次性的状态反馈，空闲时不动。
   按钮：按下 --dur-micro 缩到 0.97，松开用弹簧曲线回弹（先写 --ease-out 兜底，不认 linear() 时整条失效、退回兜底）；
   主按钮悬停加一道静态内高光，不加流光。焦点环：键盘聚焦时轮廓从贴边扩到原位。开关：滑块走弹簧。
   轻提示：进场用弹簧；新提示出现时，已有的提示补位上移（main.js 经 Legend1sFx.flip 插入与移除）。
   手机抽屉（≤ 820px）：打开时菜单项错峰 30ms，关闭更快、不错峰。主题图标的旋转淡入在 fx.js（只在没有圆形扩散时）。 */
@keyframes fx-ring { from { outline-offset: 0; } }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .btn {
    transition:
      transform var(--dur) var(--ease-out),
      background-color var(--dur) var(--ease-out),
      border-color var(--dur) var(--ease-out),
      box-shadow var(--dur) var(--ease-out),
      opacity var(--dur) var(--ease-out);
    transition-timing-function: var(--ease-spring), var(--ease-out), var(--ease-out), var(--ease-out), var(--ease-out);
  }
  :root:not([data-motion="reduce"]) .btn:active {
    transform: translateY(0) scale(0.97);
    transition-duration: var(--dur-micro), var(--dur), var(--dur), var(--dur), var(--dur);
    transition-timing-function: var(--ease-out);
  }
  :root:not([data-motion="reduce"]) .btn--primary:hover {
    box-shadow: var(--shadow-md), inset 0 1px 0 color-mix(in srgb, #fff 24%, transparent);
  }

  :root:not([data-motion="reduce"]) :focus-visible {
    animation: fx-ring var(--dur-micro) var(--ease-out);
  }

  :root:not([data-motion="reduce"]) .switch__track::after {
    transition-timing-function: var(--ease-spring), var(--ease-out);
  }

  :root:not([data-motion="reduce"]) .toast {
    animation-timing-function: var(--ease-spring);
  }
  :root:not([data-motion="reduce"]) .toast.is-leaving {
    animation: toast-out var(--dur-exit) var(--ease-in) forwards;
  }
}
@media (max-width: 820px) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .nav__links.is-open .nav__link {
    animation: fx-rise var(--dur) var(--ease-out) backwards;
    animation-delay: calc(var(--fx-n, 0) * 30ms);
  }
  .nav__links .nav__link:nth-child(2) { --fx-n: 1; }
  .nav__links .nav__link:nth-child(3) { --fx-n: 2; }
  .nav__links .nav__link:nth-child(4) { --fx-n: 3; }
  .nav__links .nav__link:nth-child(5) { --fx-n: 4; }
  .nav__links .nav__link:nth-child(n+6) { --fx-n: 5; }
  :root:not([data-motion="reduce"]) .nav__links:not(.is-open) {
    transition:
      opacity var(--dur-exit) var(--ease-in),
      transform var(--dur-exit) var(--ease-in),
      visibility 0s linear var(--dur-exit);
  }
}

/* 13f-1 · 悬浮胶囊顶栏（桌面 ≥ 821px，热爱专题页除外）。
   滚动超过 8px（main.js 加 .is-stuck）时，顶栏不再铺满通栏毛玻璃，而是在内容区两侧各宽 12px 的位置出现一枚悬浮胶囊。
   胶囊画在 ::before 上、几何固定（上下各留 7px、圆角 --radius-xl），出现 / 消失只用 clip-path 从上往下展开 / 收起，
   导航、按钮的位置一像素不变（滑动指示器与当前页下划线不受影响）；描边画在胶囊自己身上，不会被裁掉。
   手机宽度保持通栏（抽屉菜单依赖它）。减少动效时形状直接切换，不过渡。 */
@media (min-width: 821px) {
  :root body:not(.hobby) .site-header.is-stuck {
    background: none;
    border-bottom-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  :root body:not(.hobby) .site-header::before {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: max(8px, calc((100% - var(--container)) / 2 - 12px));
    right: max(8px, calc((100% - var(--container)) / 2 - 12px));
    z-index: -1;
    isolation: isolate;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    clip-path: inset(0 -24px 100% -24px round var(--radius-xl));
    pointer-events: none;
  }
  :root body:not(.hobby) .site-header.is-stuck::before {
    clip-path: inset(-24px -24px -24px -24px round var(--radius-xl));
  }
}
@media (min-width: 821px) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) body:not(.hobby) .site-header::before {
    transition: clip-path var(--dur-slow) var(--ease-out);
    transition-timing-function: var(--ease-glide);
  }
}
@media (min-width: 821px) and (prefers-reduced-transparency: reduce) {
  :root body:not(.hobby) .site-header::before {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-elev);
  }
}

/* 13f-2 · 页面后退：命令面板打开时 main 与页脚缩到 0.985、稍微变淡，面板浮在页面之上；关闭时更快的 ease-in 复原。
   fx.js 只在桌面、允许动效、main 里没有正在显示的 fixed 元素时给 <html> 加 .fx-recede，并写好缩放原点 --fx-origin-y（视口中心）；
   .fx-receding 只在过渡期间存在，期间才有 will-change。 */
@media (min-width: 821px) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) #main,
  :root:not([data-motion="reduce"]) .site-footer {
    transform-origin: 50% var(--fx-origin-y, 50%);
    transition: transform var(--dur-exit) var(--ease-in), opacity var(--dur-exit) var(--ease-in);
  }
  :root:not([data-motion="reduce"]).fx-recede #main,
  :root:not([data-motion="reduce"]).fx-recede .site-footer {
    transform: scale(0.985);
    opacity: 0.9;
    transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
    transition-timing-function: var(--ease-glide);
  }
  :root.fx-receding #main,
  :root.fx-receding .site-footer { will-change: transform, opacity; }
}

/* 13f-3 · 文字翻滚：fx.js 把顶栏导航、主按钮、热爱横幅「进入专题」的文字包成 .fx-roll（只在精确指针、允许动效时）。
   悬停时原文向上滑出，::after 画的同一段文字从下方滑入；::after 的替代文本为空，读屏不会读两遍。
   浏览器不支持 content 的替代文本写法时整段跳过（fx.js 也不会包）。 */
@supports (content: "a" / "") {
  @media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .fx-roll {
      display: inline-grid;
      overflow: clip;
      vertical-align: top;
    }
    :root:not([data-motion="reduce"]) .fx-roll > span,
    :root:not([data-motion="reduce"]) .fx-roll::after {
      grid-area: 1 / 1;
      transition: translate var(--dur) var(--ease-out);
      transition-timing-function: var(--ease-glide);
    }
    :root:not([data-motion="reduce"]) .fx-roll::after {
      content: attr(data-text) / "";
      translate: 0 100%;
    }
    :root:not([data-motion="reduce"]) :is(a, button):hover > .fx-roll > span,
    :root:not([data-motion="reduce"]) .passion-card:hover .passion-card__go > .fx-roll > span {
      translate: 0 -100%;
    }
    :root:not([data-motion="reduce"]) :is(a, button):hover > .fx-roll::after,
    :root:not([data-motion="reduce"]) .passion-card:hover .passion-card__go > .fx-roll::after {
      translate: 0 0;
    }
  }
}

/* 13f-4 · 区块标题逐字点亮（Apple 产品页的读法）：fx.js 把少于 20 个字的 .section-title 拆成 .fx-char（原文在 .sr-only 里），
   每个字用自己的 view() 时间线，从 25% 不透明度点亮到 100%；animation-range 按序号（--p = 序号 / 字数）错开，
   最后一个字在标题到达视口上 40%（cover 60%）前点亮。零 JS 逐帧计算；不支持滚动时间线时 fx.js 不拆字，标题照常显示。 */
@keyframes fx-light { from { opacity: 0.25; } to { opacity: 1; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .fx-char {
      animation: fx-light linear both;
      animation-timeline: view();
      animation-range: cover calc(18% + var(--p, 0) * 30%) cover calc(28% + var(--p, 0) * 30%);
    }
  }
}

/* 13f-5 · 回到顶部进度环：按钮外圈一道细环，按页面滚动进度从 0 画到一整圈。
   支持滚动时间线时由 scroll(root) 驱动注册过的 --fx-p（零 JS）；不支持或减少动效时读 main.js 写在按钮上的 --scroll。
   悬停时环变亮、按钮上移 2px。顶部那条进度条保留不变。 */
@property --fx-p { syntax: '<number>'; inherits: false; initial-value: 0; }
@keyframes fx-ring-fill { from { --fx-p: 0; } to { --fx-p: 1; } }
:root .back-to-top::before {
  --fx-p: var(--scroll, 0);
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--fx-p) * 1turn), color-mix(in srgb, var(--accent) 18%, transparent) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  opacity: 0.7;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}
:root .back-to-top:hover::before { opacity: 1; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .back-to-top.is-visible:hover { transform: translateY(var(--lift-hover)); }
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .back-to-top::before {
      animation: fx-ring-fill linear both;
      animation-timeline: scroll(root block);
    }
  }
}

/* 13g · 跨页方向：theme-custom.js 在 pagereveal 里加类型 fwd / back。
   往后的页面：旧页向左移出、新页从右边进来；返回反过来。页头组（site-header）不变；hb-brand 品牌色幕照旧排除。
   类型选择器比第 2 节的通用规则多一个，自然覆盖它；减少动效时第 2 节的 none !important 仍然生效。 */
@keyframes fx-nav-out-l { to { opacity: 0; transform: translateX(-16px); } }
@keyframes fx-nav-out-r { to { opacity: 0; transform: translateX(16px); } }
@keyframes fx-nav-in-r { from { opacity: 0; transform: translateX(16px); } }
@keyframes fx-nav-in-l { from { opacity: 0; transform: translateX(-16px); } }
@media (prefers-reduced-motion: no-preference) {
  html:active-view-transition-type(page):active-view-transition-type(fwd):not(:active-view-transition-type(hb-brand))::view-transition-old(root) {
    animation: fx-nav-out-l var(--dur-exit) var(--ease-in) both;
  }
  html:active-view-transition-type(page):active-view-transition-type(fwd):not(:active-view-transition-type(hb-brand))::view-transition-new(root) {
    animation: fx-nav-in-r var(--dur-slow) var(--ease-emph) 60ms both;
  }
  html:active-view-transition-type(page):active-view-transition-type(back):not(:active-view-transition-type(hb-brand))::view-transition-old(root) {
    animation: fx-nav-out-r var(--dur-exit) var(--ease-in) both;
  }
  html:active-view-transition-type(page):active-view-transition-type(back):not(:active-view-transition-type(hb-brand))::view-transition-new(root) {
    animation: fx-nav-in-l var(--dur-slow) var(--ease-emph) 60ms both;
  }
}

/* 13h-2 · 待办勾选：删除线从左画到右。todos.js 只给刚勾选的那条加 .fx-strike，播完移除、回到原来的 line-through。
   线画在行内的 .todo-item__label 上（行内背景跨行连续，多行文字按行依次画完）；用注册属性 --fx-strike 驱动宽度。 */
@property --fx-strike { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes fx-strike { from { --fx-strike: 0%; } to { --fx-strike: 100%; } }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .todo-item.is-done.fx-strike .todo-item__text { text-decoration: none; }
  :root:not([data-motion="reduce"]) .todo-item.is-done.fx-strike .todo-item__label {
    background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / var(--fx-strike) 1px;
    animation: fx-strike var(--dur-slow) var(--ease-out) both;
  }
}

/* 13h-4 · 主题页预设：选中态与滑动选中环；换预设时整页颜色交叉淡入。
   选中态由 theme-studio.js 写在 aria-pressed 上。没有 fx.js 时是预设自己的强调色边框；
   有 fx.js 时它插入的 .fx-indicator 画一圈强调色环，在预设之间滑动，预设自己的边框还原。 */
.theme-presets.has-indicator { position: relative; }
.theme-presets .fx-indicator { display: none; }
:root .theme-presets.has-indicator .theme-preset { position: relative; z-index: 1; }
:root .theme-presets.has-indicator .theme-preset[aria-pressed="true"] { border-color: var(--border); }
:root .theme-presets .fx-indicator {
  display: block;
  z-index: 2;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 2px var(--accent);
  opacity: 0;
}
:root .theme-presets .fx-indicator.is-on { opacity: 1; }
/* 换预设的交叉淡入（同文档 View Transition，theme-studio.js 加 .vt-preset）：只调时长，动画仍是浏览器默认的透明度淡入淡出 */
html.vt-preset::view-transition-old(root),
html.vt-preset::view-transition-new(root) {
  animation-duration: var(--dur-slow);
  animation-timing-function: var(--ease-out);
}

/* V2.0 25 · 全站背景柔光漂移：两团品牌色光各自沿不同路径缓慢往返（--dur-drift 48s / --dur-drift-2 62s）。
   这是「空闲时页面完全静止」唯一的例外：只动 transform（合成层完成，主线程没有开销），
   标签页隐藏时暂停（motion.js 给 <html> 加 .is-paused），系统或站内减少动效时静止，减少透明效果时整层不显示（§12）。 */
@keyframes fx-drift-a {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(22vw, 14vh, 0) scale(1.12); }
  100% { transform: translate3d(8vw, 30vh, 0) scale(0.94); }
}
@keyframes fx-drift-b {
  0%   { transform: translate3d(0, 0, 0) scale(1.06); }
  50%  { transform: translate3d(-24vw, -12vh, 0) scale(0.92); }
  100% { transform: translate3d(-10vw, -30vh, 0) scale(1.1); }
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .aurora::before {
    animation: fx-drift-a var(--dur-drift) ease-in-out infinite alternate;
    will-change: transform;
  }
  :root:not([data-motion="reduce"]) .aurora::after {
    animation: fx-drift-b var(--dur-drift-2) ease-in-out infinite alternate;
    will-change: transform;
  }
}
/* 选择器必须比上面的门控规则更强：那里的 animation 简写会把 play-state 重置成 running */
:root.is-paused:not([data-motion="reduce"]) .aurora::before,
:root.is-paused:not([data-motion="reduce"]) .aurora::after { animation-play-state: paused; }

/* ==========================================================================
   13j · Apple 式按压 + Linear 式滑动高亮（V2.1，全站）
   按压：可点的卡片、筛选按钮、资源标签按下时缩到 0.985 / 0.96，松开走 --ease-spring 回弹。
   用独立的 scale 属性，不碰悬停上移用的 transform；过渡写在各自原来的 transition 列表里
   （components.css .card / .passion-card，layout.css .filter，resources.css .rf-chip），这里只给按下的终点。
   滑动高亮：fx.js 的 glide 在 .filters / .footer__list 里插入 .fx-indicator（与顶栏导航胶囊同一套），
   悬停底色在项目之间滑动；只在精确指针、允许特效时。
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .card--interactive:active,
  :root:not([data-motion="reduce"]) .passion-card:active { scale: 0.985; }
  :root:not([data-motion="reduce"]) .filter:active,
  :root:not([data-motion="reduce"]) .rf-chip:active { scale: 0.96; }
}

.fx-glide.has-indicator { position: relative; }
.fx-glide.has-indicator > :not(.fx-indicator) { position: relative; z-index: 1; }
.fx-glide .fx-indicator { background: var(--surface-strong); border-radius: var(--radius-full); opacity: 0; }
.fx-glide .fx-indicator.is-on { opacity: 1; }
.footer__list.fx-glide .fx-indicator { border-radius: var(--radius-sm); }
/* 筛选按钮自己有不透明底色，底色块放在后面会被挡住：这里滑动的是一圈描边光环，叠在按钮上方、不拦指针 */
.filters.fx-glide .fx-indicator {
  z-index: 2;
  background: transparent;
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ==========================================================================
   13k · 页脚巨型字标（V2.1，少量 Awwwards 式视觉）
   页脚底部一行超大的淡灰字标「LEGEND1S」，滚到页面底部时品牌渐变随滚动从左往右盖满（滚动时间线，只动 background-size）。
   文字用 content 的替代文本写成空串，读屏不读；不支持这种写法的浏览器整条失效，页脚照旧。
   不支持滚动时间线、或减少动效时：静态半透明填充。不拦指针，不能选中。
   ========================================================================== */
.site-footer { overflow-x: clip; }
.site-footer::after {
  content: "LEGEND1S" / "";
  display: block;
  margin-top: var(--space-6);
  font-size: clamp(3.5rem, 15.5vw, 15rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.045em;
  text-align: center;
  white-space: nowrap;
  color: transparent;
  /* 两层都裁到字形里：上层品牌渐变（宽度即填充进度），下层淡灰底字。
     不用 -webkit-text-stroke：Geist 可变字体的轮廓有重叠，描边会露出字形内部的线 */
  background:
    var(--gradient-brand) 0 0 / 100% 100% no-repeat,
    linear-gradient(var(--border-strong), var(--border-strong));
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
@keyframes fx-wordmark {
  from { background-size: 0% 100%, 100% 100%; opacity: 0.9; }
  to   { background-size: 100% 100%, 100% 100%; opacity: 0.9; }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) .site-footer::after {
      animation: fx-wordmark linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
  }
}
@media (forced-colors: active) {
  .site-footer::after { display: none; }
}
