/* ============================================
   梗流 - H5交互动画增强系统
   全站动画效果：打字机、视差、粒子脉冲、
   滚动驱动动效、页面过渡、悬浮特效
   ============================================ */

/* ─── 打字机效果 ─── */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--highlight-cyan);
  animation: typing 3s steps(40) 1s forwards,
             blink-caret 0.75s step-end infinite;
  width: 0;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--highlight-cyan); }
}

.typewriter-done {
  border-right: none;
  animation: none;
  width: auto;
}

/* ─── 视差滚动 ─── */
.parallax-bg {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.parallax-layer {
  will-change: transform;
}

/* ─── 浮动动画 ─── */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

.float-anim {
  animation: float 4s ease-in-out infinite;
}

.float-anim-slow {
  animation: float 6s ease-in-out infinite;
}

.float-anim-fast {
  animation: float 2.5s ease-in-out infinite;
}

/* ─── 脉冲光晕（升级为多彩弥散光）─── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 229, 255, 0.3); }
  50% { box-shadow: 0 0 32px rgba(0, 229, 255, 0.6), 0 0 64px rgba(56, 189, 248, 0.15); }
}

.pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow-orange {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 140, 82, 0.3); }
  50% { box-shadow: 0 0 32px rgba(255, 140, 82, 0.6), 0 0 64px rgba(255, 217, 61, 0.15); }
}

.pulse-glow-orange {
  animation: pulse-glow-orange 3s ease-in-out infinite;
}

/* ─── 旋转光环 ─── */
@keyframes rotate-halo {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.halo-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0, 224, 255, 0.2);
  animation: rotate-halo 20s linear infinite;
}

/* ─── 涟漪扩散 ─── */
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

.ripple-effect {
  position: relative;
  overflow: visible;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid var(--highlight-pink);
  animation: ripple 2s ease-out infinite;
}

/* ─── 数字跳动 ─── */
@keyframes digit-roll {
  0% { transform: translateY(-20px); opacity: 0; }
  60% { transform: translateY(3px); }
  100% { transform: translateY(0); opacity: 1; }
}

.digit-roll {
  display: inline-block;
  animation: digit-roll 0.4s ease-out both;
}

/* ─── 倾斜悬浮卡片 ─── */
.tilt-card {
  transition: transform 0.3s ease;
  will-change: transform;
}

/* ─── 渐入文字行 ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-fade > * {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-fade > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-fade > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-fade > *:nth-child(8) { animation-delay: 0.8s; }

/* ─── 线条绘制动画 ─── */
@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

.draw-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-line 2s ease-out forwards;
}

/* ─── 背景渐变流动 ─── */
@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-flow {
  background-size: 200% 200%;
  animation: gradient-flow 6s ease infinite;
}

/* ─── 粒子爆发 ─── */
@keyframes particle-burst {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  100% { transform: scale(1.5) rotate(180deg); opacity: 0; }
}

.particle-burst {
  position: relative;
}

.particle-burst::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,0.3) 0%, transparent 70%);
  animation: particle-burst 1.5s ease-out infinite;
}

/* ─── 弹性缩放 ─── */
@keyframes elastic-scale {
  0% { transform: scale(1); }
  25% { transform: scale(1.12); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.elastic-bounce {
  animation: elastic-scale 0.8s ease-out;
}

/* ─── 闪烁高亮 ─── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-text {
  background: linear-gradient(90deg, 
    var(--highlight-cyan) 0%, 
    var(--highlight-pink) 25%,
    #fff 50%, 
    var(--highlight-pink) 75%,
    var(--highlight-cyan) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ─── 卡片3D翻转 ─── */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
  position: absolute;
  inset: 0;
}

/* ─── 滚动进度条 ─── */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--highlight-cyan), var(--accent-orange));
  z-index: 1001;
  transition: width 0.1s linear;
}

/* ─── 数据条动画 ─── */
@keyframes bar-fill {
  from { width: 0%; }
}

.bar-animated {
  animation: bar-fill 1.2s ease-out forwards;
}

/* ─── 段落高亮标记 ─── */
.highlight-mark {
  background: linear-gradient(180deg, transparent 60%, rgba(0,229,255,0.2) 60%);
  padding: 0 4px;
}

/* ─── 焦点放大 ─── */
.focus-zoom {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.focus-zoom.in-view {
  transform: scale(1.03);
}

/* ─── 统计数字飞入 ─── */
.stat-fly-in {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stat-fly-in.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ─── 环形进度 ─── */
.circle-progress {
  position: relative;
}

.circle-progress svg {
  transform: rotate(-90deg);
}

.circle-progress circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease-out;
}

/* ─── 毛玻璃悬停放大 ─── */
.glass-zoom {
  transition: all 0.4s ease;
}

.glass-zoom:hover {
  backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.08);
  transform: scale(1.04);
}

/* ─── 文字渐显 ─── */
@keyframes text-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.text-reveal {
  animation: text-reveal 1.2s ease-out forwards;
}

/* ─── SVG图标描边动画 ─── */
.svg-stroke-anim path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: stroke-draw 1.5s ease-out forwards;
}

@keyframes stroke-draw {
  to { stroke-dashoffset: 0; }
}

/* ─── 网格背景动画 ─── */
@keyframes grid-move {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

.grid-animated {
  background-image:
    linear-gradient(rgba(56,189,248,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 3s linear infinite;
}

/* ─── 回声波纹 ─── */
@keyframes echo-ripple {
  0% { box-shadow: 0 0 0 0 rgba(0,229,255,0.4); }
  100% { box-shadow: 0 0 0 20px rgba(0,229,255,0); }
}

.echo-ripple {
  animation: echo-ripple 2s ease-out infinite;
}

/* ─── 摇摆动画（可爱晃动）─── */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.wiggle-anim {
  animation: wiggle 0.6s ease-in-out;
}

.wiggle-hover:hover {
  animation: wiggle 0.5s ease-in-out;
}

/* ─── 弹跳入场 ─── */
@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.bounce-in {
  animation: bounce-in 0.7s var(--ease-bounce) both;
}

/* ─── 弹跳浮动（比普通float更活泼）─── */
@keyframes bounce-float {
  0%, 100% { transform: translateY(0px); }
  30% { transform: translateY(-15px); }
  50% { transform: translateY(-3px); }
  70% { transform: translateY(-10px); }
}

.bounce-float {
  animation: bounce-float 3s var(--ease-bounce) infinite;
}

/* ─── 彩虹扫光 ─── */
@keyframes rainbow-sweep {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.rainbow-sweep {
  background: linear-gradient(90deg, 
    var(--highlight-cyan), 
    var(--emo-positive), 
    var(--highlight-pink), 
    var(--emo-playful), 
    var(--highlight-yellow), 
    var(--highlight-cyan));
  background-size: 400% 100%;
  animation: rainbow-sweep 8s ease infinite;
}

/* ─── 缩放脉冲（呼吸效果）─── */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.breathe {
  animation: breathe 3s ease-in-out infinite;
}

/* ─── 旋转光环升级版（多彩）─── */
@keyframes rotate-halo-rainbow {
  from { transform: rotate(0deg); filter: hue-rotate(0deg); }
  to { transform: rotate(360deg); filter: hue-rotate(360deg); }
}

.halo-rainbow {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--highlight-cyan);
  border-right-color: var(--highlight-pink);
  border-bottom-color: var(--highlight-yellow);
  border-left-color: var(--emo-playful);
  animation: rotate-halo-rainbow 8s linear infinite;
}
