
/* ===== 动效层 v16 —— 滚动入场 + 骨架屏 + 页面切换进度条 =====
   设计原则:只播一次、尊重 reduced-motion、不改变布局尺寸、不阻塞首屏
   依赖 JS 类: .rv-ready(已接管) .rv-in(进入视口) */

/* --- 1. 滚动入场 --- */
/* 默认态：仅在 JS 成功接管后才隐藏，避免无 JS 时内容不可见 */
.rv-ready [data-rv] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity .62s cubic-bezier(.22, 1, .36, 1),
    transform .62s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--rv-delay, 0ms);
  will-change: opacity, transform;
}
.rv-ready [data-rv].rv-in {
  opacity: 1;
  transform: none;
}
/* 动画结束后释放合成层 */
.rv-ready [data-rv].rv-done { will-change: auto; }

/* 首屏元素不参与滚动动画（避免首屏闪一下才出现） */
[data-rv="hero"] { transition-duration: .7s; }

/* 错开延迟：由 JS 按同级序号写入 --rv-delay，这里只给上限保护 */
.rv-ready [data-rv] { transition-delay: var(--rv-delay, 0ms); }

/* --- 2. 骨架屏 --- */
.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    rgba(16, 20, 30, .085) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: sk-shimmer 1.35s ease-in-out infinite;
}
@keyframes sk-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 骨架卡片组：列表页 */
.sk-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 26px 12px;
  border-bottom: 1px solid var(--line);
}
.sk-row .sk-num  { width: 24px; height: 12px; }
.sk-row .sk-body { display: grid; gap: 10px; }
.sk-row .sk-t    { width: 46%; height: 15px; }
.sk-row .sk-d    { width: 92%; height: 11px; }
.sk-row .sk-m    { width: 28%; height: 10px; }
.sk-row .sk-a    { width: 30px; height: 30px; border-radius: 50%; }

/* 骨架文章页 */
.sk-article { display: grid; gap: 18px; }
.sk-article .sk-h1 { width: 62%; height: 30px; border-radius: 8px; }
.sk-article .sk-h2 { width: 38%; height: 20px; }
.sk-article .sk-p  { width: 100%; height: 12px; }
.sk-article .sk-p.short { width: 74%; }
.sk-article .sk-gap { height: 8px; }

/* 骨架后台列表 */
.sk-admin {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-bottom: 1px solid var(--line);
}
.sk-admin .sk-t { flex: 1; height: 14px; max-width: 320px; }
.sk-admin .sk-b { width: 62px; height: 28px; border-radius: 8px; }

/* 骨架淡出：真实内容接管时避免生硬切换 */
.sk-fade-out { animation: sk-fade .28s ease-out forwards; }
@keyframes sk-fade {
  to { opacity: 0; }
}

/* --- 3. 页面切换进度条（顶部细线） --- */
.page-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  z-index: 200;
  opacity: 0;
  transition: width .32s ease-out, opacity .28s ease;
  pointer-events: none;
}
.page-bar.on { opacity: 1; }
.page-bar.done { opacity: 0; transition: width .18s ease-out, opacity .34s ease .06s; }

/* 列表行入场（真实数据渲染后） */
.list-row.enter {
  animation: row-in .5s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: var(--row-delay, 0ms);
}
@keyframes row-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* 内容区淡入（骨架 -> 内容） */
.content-in { animation: content-in .42s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes content-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* --- 4. 无障碍与降级 --- */
@media (prefers-reduced-motion: reduce) {
  .rv-ready [data-rv],
  .list-row.enter,
  .content-in { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .skeleton { animation: none; background: var(--surface-2); }
  .page-bar { display: none; }
}
