/* ========================================
   U校官网 - 动画样式
   ======================================== */

/* ---------- 关键帧动画 ---------- */

/* 淡入上移 */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 淡入 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 脉冲发光 */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

/* 闪烁光泽 */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 浮动动画 */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* 旋转加载 */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 呼吸效果 */
@keyframes breathe {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* 渐变流动 */
@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ---------- 动画类 ---------- */

/* 基础动画类 */
.animate-fade-up {
  animation: fadeUp 0.6s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 3s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-shimmer {
  animation: shimmer 1.5s infinite;
}

/* 动画延迟 */
.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }

/* ---------- 过渡效果 ---------- */

/* 快速过渡 */
.transition-fast {
  transition: all 0.15s ease;
}

/* 标准过渡 */
.transition-base {
  transition: all 0.3s ease;
}

/* 平滑过渡 */
.transition-smooth {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 颜色过渡 */
.transition-color {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* 变换过渡 */
.transition-transform {
  transition: transform 0.3s ease;
}

/* ---------- 悬停效果 ---------- */

/* 上浮 */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
}

/* 缩放 */
.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* 辉光 */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* ---------- 3D 效果 ---------- */

/* 3D 倾斜卡片 */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.tilt-card:hover {
  transform: rotateX(5deg) rotateY(-5deg);
}

/* ---------- 加载状态 ---------- */

/* 骨架屏变体 */
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-button {
  width: 120px;
  height: 44px;
  border-radius: 22px;
}

/* ---------- 滚动触发动画 ---------- */

/* 基础渐入 */
.fade-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 缩放渐入 */
.scale-on-scroll {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-on-scroll.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* 左滑入 */
.slide-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* 右滑入 */
.slide-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- 交错动画容器 ---------- */

.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.is-visible > *:nth-child(1) { animation: fadeUp 0.5s ease 0.1s forwards; }
.stagger-children.is-visible > *:nth-child(2) { animation: fadeUp 0.5s ease 0.15s forwards; }
.stagger-children.is-visible > *:nth-child(3) { animation: fadeUp 0.5s ease 0.2s forwards; }
.stagger-children.is-visible > *:nth-child(4) { animation: fadeUp 0.5s ease 0.25s forwards; }
.stagger-children.is-visible > *:nth-child(5) { animation: fadeUp 0.5s ease 0.3s forwards; }
.stagger-children.is-visible > *:nth-child(6) { animation: fadeUp 0.5s ease 0.35s forwards; }
.stagger-children.is-visible > *:nth-child(7) { animation: fadeUp 0.5s ease 0.4s forwards; }
.stagger-children.is-visible > *:nth-child(8) { animation: fadeUp 0.5s ease 0.45s forwards; }

/* ---------- 按钮特殊效果 ---------- */

/* 波纹效果 */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s, opacity 0.3s;
}

.btn-ripple:active::after {
  transform: scale(2);
  opacity: 1;
  transition: transform 0s, opacity 0s;
}

/* ---------- 背景动画 ---------- */

/* 动态渐变背景 */
.animated-gradient {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
}

/* 网格背景 */
.grid-bg {
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* 点阵背景 */
.dots-bg {
  background-image: radial-gradient(rgba(99, 102, 241, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ---------- 实用工具 ---------- */

/* 隐藏滚动条 */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* 文本溢出省略 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 多行文本溢出 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 减少动画 (无障碍) ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-on-scroll,
  .scale-on-scroll,
  .slide-left,
  .slide-right,
  .stagger-children > * {
    opacity: 1;
    transform: none;
  }
}