/* ==========================================================
   星橙知道 · 动效层
   ReactBits 风格效果的零依赖原生实现（CSS + 少量 JS）
   全部尊重 prefers-reduced-motion
   ========================================================== */

/* ---------- 1. Aurora 极光背景（更克制、更高级） ---------- */
.rb-aurora {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}
.rb-aurora i {
  position: absolute; display: block; border-radius: 50%; filter: blur(90px); opacity: .34;
}
/* 已用 Ghost Fibers 的区块，极光再淡一档，让纤维成为主角 */
[data-fibers] .rb-aurora { opacity: .72; }
.rb-aurora i:nth-child(1) {
  width: 620px; height: 620px; left: -12%; top: -22%;
  background: radial-gradient(circle, rgba(255,120,30,.50), transparent 70%);
  animation: rbFloat1 26s ease-in-out infinite alternate;
}
.rb-aurora i:nth-child(2) {
  width: 540px; height: 540px; right: -10%; top: -6%;
  background: radial-gradient(circle, rgba(60,120,255,.34), transparent 70%);
  animation: rbFloat2 32s ease-in-out infinite alternate;
}
.rb-aurora i:nth-child(3) {
  width: 460px; height: 460px; left: 34%; bottom: -26%;
  background: radial-gradient(circle, rgba(255,180,110,.36), transparent 70%);
  animation: rbFloat3 38s ease-in-out infinite alternate;
}
/* 细腻网格叠加，提升质感 */
.rb-aurora::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(13,18,37,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,18,37,.028) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 78%);
}
@keyframes rbFloat1 { 0% { transform: translate(0,0) scale(1) } 100% { transform: translate(90px,70px) scale(1.18) } }
@keyframes rbFloat2 { 0% { transform: translate(0,0) scale(1.05) } 100% { transform: translate(-100px,80px) scale(.9) } }
@keyframes rbFloat3 { 0% { transform: translate(0,0) scale(.95) } 100% { transform: translate(-70px,-90px) scale(1.2) } }

/* ---------- 2. Spotlight / Glare Hover 聚光卡片（更克制） ---------- */
.rb-spot { position: relative; overflow: hidden; }
.rb-spot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .45s ease;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
              rgba(33,80,255,.085), rgba(33,80,255,.028) 42%, transparent 72%);
}
.rb-spot:hover::after { opacity: 1; }
/* 边框流光 */
.rb-spot::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1px; opacity: 0; transition: opacity .45s ease; z-index: 1;
  background: radial-gradient(260px circle at var(--mx,50%) var(--my,50%),
              rgba(33,80,255,.42), transparent 68%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.rb-spot:hover::before { opacity: 1; }
/* 深色卡片里的聚光换成暖白，避免发橘 */
.card-dark.rb-spot::after,
.stat-dark.rb-spot::after {
  background: radial-gradient(360px circle at var(--mx,50%) var(--my,50%),
              rgba(255,255,255,.09), transparent 70%);
}
.card-dark.rb-spot::before,
.stat-dark.rb-spot::before {
  background: radial-gradient(260px circle at var(--mx,50%) var(--my,50%),
              rgba(128,56,248,.5), transparent 68%);
}

/* ---------- 3. Tilt 3D 倾斜（幅度更小更稳） ---------- */
.rb-tilt { transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2,.8,.3,1), box-shadow .45s; will-change: transform; }
.rb-tilt.rb-tilting { transition: none; box-shadow: 0 24px 56px rgba(13,18,37,.13); }

/* ---------- 4. Magnetic 磁性按钮 ---------- */
.rb-magnet { transition: transform .3s cubic-bezier(.2,.8,.3,1), box-shadow .3s; will-change: transform; }
.rb-magnet.rb-pulling { transition: transform .08s linear; }

/* ---------- 5. CountUp 数字滚动 ---------- */
.rb-count { font-variant-numeric: tabular-nums; }

/* ---------- 6. GradientText / ShinyText 渐变流光文字 ---------- */
.rb-shine {
  background: linear-gradient(100deg, var(--ink) 20%, #558eff 42%, var(--ink) 62%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text;
  color: transparent; animation: rbShine 5.5s linear infinite;
}
@keyframes rbShine { 0% { background-position: 180% 0 } 100% { background-position: -60% 0 } }

.rb-grad {
  background: linear-gradient(100deg, #2150ff, #7ba6ff 40%, #2150ff 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 7. StarBorder / Electric Border 流光边框按钮 ---------- */
.rb-star { position: relative; overflow: hidden; isolation: isolate; }
.rb-star::before {
  content: ""; position: absolute; inset: -60%; z-index: -1;
  background: conic-gradient(from 0deg, transparent 0 62%, #558eff 78%, #d5e4ff 86%, transparent 92% 100%);
  animation: rbSpin 3.6s linear infinite; opacity: .95;
}
.rb-star::after {
  content: ""; position: absolute; inset: 2px; border-radius: inherit; z-index: -1;
  background: linear-gradient(135deg, var(--brand), #558eff);
}
@keyframes rbSpin { to { transform: rotate(1turn) } }

/* ---------- 13. GlareHover 悬停扫光（按钮） ---------- */
.rb-glare { position: relative; overflow: hidden; }
.rb-glare::after {
  content: ""; position: absolute; top: -25%; bottom: -25%; left: 0; width: 46%;
  transform: translateX(-190%) skewX(-18deg); opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--glare, rgba(255,255,255,.5)), transparent);
}
.rb-glare:hover::after { animation: rbGlare .9s cubic-bezier(.2,.7,.3,1); }
@keyframes rbGlare {
  0%   { transform: translateX(-190%) skewX(-18deg); opacity: .9; }
  100% { transform: translateX(330%) skewX(-18deg); opacity: 0; }
}

/* ---------- 8. Marquee 无限滚动 ---------- */
.rb-marquee { position: relative; overflow: hidden; width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.rb-marquee-track { display: flex; gap: 10px; width: max-content; animation: rbScroll 42s linear infinite; }
.rb-marquee:hover .rb-marquee-track { animation-play-state: paused; }
.rb-marquee-track > * { flex: 0 0 auto; }
@keyframes rbScroll { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ---------- 9. Fade / Blur 入场（升级版） ---------- */
.rb-in { opacity: 0; transform: translateY(26px); filter: blur(8px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.3,1), filter .7s ease; }
.rb-in.rb-shown { opacity: 1; transform: none; filter: blur(0); }
.rb-in[data-d="1"] { transition-delay: .08s } .rb-in[data-d="2"] { transition-delay: .16s }
.rb-in[data-d="3"] { transition-delay: .24s } .rb-in[data-d="4"] { transition-delay: .32s }
.rb-in[data-d="5"] { transition-delay: .4s }  .rb-in[data-d="6"] { transition-delay: .48s }

/* ---------- 10. Glow Cursor 光标光晕 ---------- */
.rb-cursor {
  position: fixed; top: 0; left: 0; width: 340px; height: 340px; margin: -170px 0 0 -170px;
  border-radius: 50%; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .4s;
  background: radial-gradient(circle, rgba(33,80,255,.16), rgba(33,80,255,.05) 45%, transparent 70%);
  will-change: transform;
}
.rb-cursor.on { opacity: 1; }

/* ---------- 12. 顶部滚动进度条 ---------- */
.rb-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000;
  background: linear-gradient(90deg, var(--brand), #7ba6ff, var(--blue));
  transition: width .12s linear;
}

/* ---------- 13. 悬浮微动 ---------- */
.rb-float { animation: rbBob 6s ease-in-out infinite; }
@keyframes rbBob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

/* ---------- 14. 渐显遮罩（Gradual Blur 风格） ---------- */
.rb-fade-mask {
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}

/* ---------- 降低动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .rb-aurora i, .rb-shine, .rb-star::before, .rb-marquee-track, .rb-float, .rb-glare::after { animation: none !important; }
  .rb-in { opacity: 1 !important; transform: none !important; filter: none !important; }
  .rb-cursor { display: none !important; }
  .rb-tilt, .rb-magnet { transform: none !important; }
  .page-ai .ai-sc-body { transition: none !important; }
}
