/* ============================================================
   动效与粒子特效（手机优先，桌面增强）
   与 style.css 解耦，可单独删除，不影响站点功能
   ============================================================ */

:root {
  --ease-out: cubic-bezier(.22, .61, .36, 1);
}

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  html.anim *,
  html.anim *::before,
  html.anim *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-fx { display: none !important; }
}

/* ---------- 页面整体淡入 ---------- */
html.anim body { animation: pageIn .5s ease both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

html.anim { scroll-behavior: smooth; }

/* ---------- 顶部滚动进度条 ---------- */
.scroll-progress {
  position: fixed; left: 0; top: 0; height: 2px; width: 0; z-index: 80;
  background: linear-gradient(90deg, #8fb4ff, #2f6bff 55%, #5ad1ff);
  box-shadow: 0 0 10px rgba(47, 107, 255, .45);
  transition: width .08s linear;
  pointer-events: none;
}

/* ---------- 通用入场 / 滚动显现 ---------- */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.9); }
  60% { opacity: 1; transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ---------- Hero 动效 + 粒子层 ---------- */
.hero {
  background-size: 180% 180%;
  animation: heroShift 16s ease-in-out infinite;
}
@keyframes heroShift {
  0%, 100% { background-position: 0% 30%; }
  50% { background-position: 100% 70%; }
}
.hero > * { position: relative; z-index: 1; }
.hero-fx {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: .85;
}
.hero .blob {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(2px);
}
.hero .blob.b1 {
  width: 130px; height: 130px; right: -26px; bottom: -34px;
  background: radial-gradient(circle at 35% 35%, rgba(47,107,255,.32), rgba(47,107,255,0) 70%);
  animation: float1 9s ease-in-out infinite;
}
.hero .blob.b2 {
  width: 86px; height: 86px; right: 68px; top: 18px;
  background: radial-gradient(circle at 40% 40%, rgba(111,155,255,.30), rgba(111,155,255,0) 72%);
  animation: float2 7.5s ease-in-out infinite;
}
.hero .blob.b3 {
  width: 56px; height: 56px; left: 46%; bottom: 10px;
  background: radial-gradient(circle at 40% 40%, rgba(90,209,255,.28), rgba(90,209,255,0) 72%);
  animation: float1 11s ease-in-out infinite reverse;
}
@keyframes float1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-10px, -14px, 0) scale(1.08); }
}
@keyframes float2 {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(8px, 12px, 0); }
}

/* 标题蓝字流光 */
.hero h1 span {
  background: linear-gradient(90deg, #2f6bff, #7aa6ff 40%, #2f6bff 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textFlow 6s linear infinite;
}
@keyframes textFlow {
  to { background-position: -200% 0; }
}

html.anim .hero h1 { animation: riseIn .7s var(--ease-out) both; }
html.anim .hero p { animation: riseIn .7s .1s var(--ease-out) both; }
html.anim .hero-actions { animation: riseIn .7s .18s var(--ease-out) both; }
html.anim .hero-stats { animation: riseIn .7s .26s var(--ease-out) both; }

/* ---------- Logo / 公告 ---------- */
.logo-mark { animation: markGlow 4s ease-in-out infinite; }
@keyframes markGlow {
  0%, 100% { box-shadow: 0 6px 16px rgba(47,107,255,.28); }
  50% { box-shadow: 0 8px 24px rgba(47,107,255,.5); }
}
.notice-bar .tag { animation: tagPulse 2.8s ease-in-out infinite; }
@keyframes tagPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47,107,255,.28); }
  60% { box-shadow: 0 0 0 7px rgba(47,107,255,0); }
}

/* ---------- 桌面导航下划线动画 ---------- */
.nav-main a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--blue-600, #2f6bff);
  transform: scaleX(0); transform-origin: left;
  transition: transform .28s var(--ease-out);
}
.nav-main a:hover::after, .nav-main a.on::after { transform: scaleX(1); }

/* ---------- 按钮：光泽扫过 + 点击波纹 ---------- */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-18deg); pointer-events: none;
}
.btn:hover::after { animation: sheen .9s var(--ease-out); }
@keyframes sheen {
  from { left: -60%; }
  to { left: 120%; }
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }

.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .55); transform: scale(0); opacity: .7;
  animation: rippleOut .55s ease-out forwards;
}
.ripple.dark { background: rgba(47, 107, 255, .22); }
@keyframes rippleOut {
  to { transform: scale(2.6); opacity: 0; }
}

/* ---------- 素材卡片动效 ---------- */
.card-m { will-change: transform; }
html.anim .card-m .cover img { transition: transform .5s var(--ease-out), opacity .45s ease; }
.card-m .cover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,.35), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
@media (hover: hover) {
  .card-m:hover .cover::after { opacity: 1; }
}
.card-m .fav.on, .card-m .fav { transition: transform .2s, background .2s, color .2s; }
.card-m .fav:active { transform: scale(.86); }
.card-m .fav.pop { animation: pop .42s var(--ease-out); }
@keyframes pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.32); }
  70% { transform: scale(.92); }
  100% { transform: scale(1); }
}

/* 标签 hover */
.cats a, .tabs a { transition: background .2s, color .2s, border-color .2s, transform .2s; }
.cats a:active, .tabs a:active { transform: scale(.96); }

/* ---------- 图片淡入 ---------- */
html.anim .card-m .cover img,
html.anim .banner a img,
html.anim .detail-cover img,
html.anim .thumbs a img { opacity: 0; }
html.anim .card-m .cover img.in,
html.anim .banner a img.in,
html.anim .detail-cover img.in,
html.anim .thumbs a img.in { opacity: 1; }

/* ---------- 提示条 / Toast ---------- */
html.anim .alert { animation: riseIn .45s var(--ease-out) both; }
.alert-error { animation: shake .45s ease both; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.toast-wrap {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: max-content; max-width: 86vw;
}
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: #fff; background: rgba(19, 34, 58, .88);
  box-shadow: 0 12px 30px rgba(19, 34, 58, .24);
  backdrop-filter: blur(10px);
  animation: toastIn .32s var(--ease-out) both;
}
.toast.ok { background: linear-gradient(135deg, rgba(47,107,255,.96), rgba(111,155,255,.96)); }
.toast.err { background: linear-gradient(135deg, #e5484d, #ff7d7d); }
.toast.out { animation: toastOut .25s ease both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(.96); }
}
@media (min-width: 768px) {
  .toast-wrap { bottom: 32px; }
}

/* ---------- 底部导航 ---------- */
html.anim .tabbar a.on i { animation: tabBounce .55s var(--ease-out); }
@keyframes tabBounce {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-5px) scale(1.15); }
  100% { transform: translateY(0) scale(1); }
}
.tabbar a { transition: color .2s, transform .18s; }
.tabbar a:active { transform: scale(.94); }

/* ---------- 空状态 / 头像 ---------- */
.empty i { animation: float1 4.5s ease-in-out infinite; display: inline-block; }
.profile-hero img, .center-head img { transition: transform .3s var(--ease-out); }
.profile-hero img:hover { transform: translateY(-2px) rotate(-2deg); }

/* ---------- 登录卡片 ---------- */
html.anim .auth-card { animation: popIn .5s var(--ease-out) both; }
.auth-card::before { background-size: 200% 100%; animation: textFlow 5s linear infinite; }

/* ---------- 桌面增强 ---------- */
@media (min-width: 768px) {
  .hero .blob.b1 { width: 190px; height: 190px; }
  .hero .blob.b2 { width: 120px; height: 120px; }
  .card-m:hover { box-shadow: 0 18px 40px rgba(47,107,255,.16); }
}
