/* 众链数科官网 - 自定义样式 */

/* ============================================
   防止闪烁 (FOUC Prevention)
   ============================================ */

/* 确保页面内容默认可见，避免JS加载前的闪烁 */
html {
  scroll-behavior: smooth;
}

/* 默认状态下所有动画元素都可见 */
.animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* JS启用后才启用动画初始状态 */
.js-enabled .animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
}

.js-enabled .animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 页面过渡 - 轻量级淡入 */
.page-transition {
  animation: none; /* 移除可能导致的闪烁动画 */
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 动画定义 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* (已移至文件顶部) */

.animate-fade-in {
  animation: fadeIn 0.8s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease-out;
}

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

/* 延迟类 */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

/* 移动端菜单过渡 */
#mobile-menu {
  transition: transform 0.3s ease-out;
}

#mobile-menu.active {
  transform: translateX(0) !important;
}

#mobile-menu-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 遮罩层 */
.overlay-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* 富文本内容样式 */
.prose {
  color: #334155;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1.25em;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: #0f172a;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

.prose h1 { font-size: 2em; }
.prose h2 { font-size: 1.5em; }
.prose h3 { font-size: 1.25em; }

.prose ul, .prose ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }

.prose li {
  margin-bottom: 0.5em;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.prose a {
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.3);
  transition: text-decoration-color 0.2s;
}

.prose a:hover {
  text-decoration-color: rgba(37, 99, 235, 1);
}

/* 新闻内容图片居中 */
.prose img,
.news-content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Header 品牌文字打字机动画 */
.header-brand-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  border-right: 2px solid transparent;
  transition: none;
}
body.scrolled #header .header-brand-text {
  animation: typewriter 0.8s steps(4) 0.1s forwards, blink-caret 0.5s step-end 0.1s 3;
}
@keyframes typewriter {
  from { width: 0; border-right-color: #2563eb; }
  to { width: 4em; border-right-color: transparent; }
}
@keyframes blink-caret {
  50% { border-color: transparent; }
  0%, 100% { border-right-color: #2563eb; }
}

/* 弹窗遮罩 */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dialog-overlay.active {
  opacity: 1;
  visibility: visible;
}

.dialog-content {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  max-width: 28rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.dialog-overlay.active .dialog-content {
  transform: scale(1);
  opacity: 1;
}

/* 3D轮播样式 */
.carousel-3d {
  perspective: 1000px;
}

.carousel-3d-inner {
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

/* 资质证书卡片 */
.qual-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qual-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* 时间线样式 */
.timeline-dot {
  position: relative;
}

.timeline-dot::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #2563eb;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 3px #2563eb;
}

/* 滚动触发动画 - 默认可见，JS启用后才隐藏 */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s ease-out;
}

.js-enabled .reveal {
  opacity: 0;
  transform: translateY(30px);
}

.js-enabled .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 返回顶部按钮 */
.back-to-top {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

/* 页面过渡 - 禁用默认淡入动画以避免闪烁 */
.page-transition {
  /* animation 已禁用，避免页面切换时的闪烁 */
}

/* ============================================
   3D卡片悬停效果 - 科技感
   ============================================ */

.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.card-3d:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-3d-inner {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.card-3d-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
}

.card-3d:hover .card-3d-shine {
  opacity: 1;
}

/* ============================================
   按钮光效和磁吸效果
   ============================================ */

.btn-magnetic {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  will-change: transform;
}

.btn-magnetic::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-magnetic:hover::before {
  left: 100%;
}

.btn-magnetic:hover {
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.5),
              0 0 40px rgba(37, 99, 235, 0.3);
}

/* ============================================
   数字滚动计数动画
   ============================================ */

.counter-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.counter-animated {
  animation: counterPulse 0.3s ease;
}

@keyframes counterPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ============================================
   链接下划线动画 - 从中心展开
   ============================================ */

.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease, left 0.3s ease;
}

.link-underline:hover::after {
  width: 100%;
  left: 0;
}

/* ============================================
   图标呼吸动画
   ============================================ */

.icon-breathe {
  animation: iconBreathe 3s ease-in-out infinite;
}

@keyframes iconBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   渐变边框流光效果
   ============================================ */

.border-glow {
  position: relative;
  background: white;
  border-radius: 0.75rem;
  z-index: 1;
}

.border-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #2563eb,
    #3b82f6,
    #60a5fa,
    #3b82f6,
    #2563eb
  );
  background-size: 300% 100%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: borderGlow 3s linear infinite;
}

.border-glow:hover::before {
  opacity: 1;
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ============================================
   弹性滚动渐显动画
   ============================================ */

.animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.js-enabled .animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
}

.js-enabled .animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 延迟类使用相同的缓动函数 */
.delay-100 {
  transition-delay: 100ms;
}

.delay-200 {
  transition-delay: 200ms;
}

.delay-300 {
  transition-delay: 300ms;
}

.delay-400 {
  transition-delay: 400ms;
}

.delay-500 {
  transition-delay: 500ms;
}

/* ============================================
   打字机光标效果
   ============================================ */

.typewriter-line {
  display: inline;
  white-space: nowrap;
}

.typewriter-cursor {
  display: inline;
  animation: cursorBlink 1s step-end infinite;
  color: #2563eb;
  margin-left: 2px;
}

.typewriter-cursor::after {
  content: '|';
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ============================================
   鼠标跟随光效
   ============================================ */

.mouse-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* ============================================
   数字跳动动画
   ============================================ */

.number-pop {
  display: inline-block;
  animation: numberPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes numberPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ============================================
   3D 卡片倾斜效果
   ============================================ */

.card-3d-tilt {
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.card-3d-tilt:hover {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.card-3d-tilt-inner {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

/* ============================================
   图标呼吸动画 - 缩放版
   ============================================ */

.icon-breathe-scale {
  animation: iconBreatheScale 2s ease-in-out infinite;
}

@keyframes iconBreatheScale {
  0%, 100% { transform: scale(0.95); }
  50% { transform: scale(1.05); }
}

/* ============================================
   边框流光效果增强版
   ============================================ */

.border-glow-enhanced {
  position: relative;
  background: white;
  border-radius: 0.75rem;
  z-index: 1;
  overflow: hidden;
}

.border-glow-enhanced::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent,
    #2563eb,
    #60a5fa,
    #2563eb,
    transparent
  );
  background-size: 400% 100%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: borderGlowEnhanced 2s linear infinite;
}

.border-glow-enhanced:hover::before {
  opacity: 1;
}

@keyframes borderGlowEnhanced {
  0% { background-position: 0% 50%; }
  100% { background-position: 400% 50%; }
}

/* ============================================
   数字滚动计数器
   ============================================ */

.counter-scroll {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ============================================
   图标渐变填充动画
   ============================================ */

.icon-gradient-fill {
  transition: all 0.5s ease;
  filter: grayscale(100%);
  opacity: 0.6;
}

.icon-gradient-fill.animated {
  filter: grayscale(0%);
  opacity: 1;
}

/* ============================================
   展开/折叠动画
   ============================================ */

.expandable-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}

.expandable-content.expanded {
  max-height: 500px;
  opacity: 1;
}

/* ============================================
   悬停光晕效果
   ============================================ */

.hover-glow {
  position: relative;
  overflow: hidden;
}

.hover-glow::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.hover-glow:hover::before {
  opacity: 1;
}

/* ============================================
   标签微动画
   ============================================ */

.tag-wiggle {
  animation: tagWiggle 0.5s ease-in-out;
}

@keyframes tagWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.tag-pulse {
  animation: tagPulse 2s ease-in-out infinite;
}

@keyframes tagPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
}

/* ============================================
   无限滚动优化 - 悬停暂停
   ============================================ */

.partners-track {
  transition: animation-play-state 0.3s ease;
}

.partners-scroll-container:hover .partners-row-track {
  animation-play-state: paused;
}

/* ============================================
   Logo 高亮过渡
   ============================================ */

.logo-highlight {
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-highlight:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* ============================================
   视差滚动效果
   ============================================ */

.parallax-bg {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ============================================
   导航栏收缩效果
   ============================================ */

.header-shrink {
  transition: box-shadow 0.3s ease;
}

.header-shrink.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Footer 社交图标动画
   ============================================ */

.social-icon-hover {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-icon-hover:hover {
  transform: translateY(-4px) rotate(8deg);
  color: #2563eb;
}

.social-icon-bounce:hover {
  animation: socialBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes socialBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.2) translateY(-4px); }
}

/* ============================================
   链接下划线动画 - 从中心展开
   ============================================ */

.link-underline-center {
  position: relative;
  text-decoration: none;
}

.link-underline-center::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease, left 0.3s ease;
}

.link-underline-center:hover::after {
  width: 100%;
  left: 0;
}

/* ============================================
   按钮磁吸效果增强
   ============================================ */

.btn-magnetic-enhanced {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  will-change: transform;
}

.btn-magnetic-enhanced:hover {
  box-shadow: 0 10px 40px -10px rgba(37, 99, 235, 0.5);
}

/* 按钮初始状态（打字动画期间） */
#hero-cta {
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

/* ============================================
   骨架屏动画
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 25%,
    #e2e8f0 50%,
    #f1f5f9 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   成功状态动画 - 对勾画线
   ============================================ */

.success-checkmark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.success-checkmark svg {
  width: 30px;
  height: 30px;
  stroke: white;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.5s ease forwards;
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

.success-circle {
  animation: successScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes successScale {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-check-path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}

.success-circle .success-check-path {
  animation: drawCheck 0.5s ease forwards 0.3s;
}

/* ============================================
   弹性滚动渐显 - spring 效果
   ============================================ */

.animate-spring {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-spring.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 不同的延迟类 */
.animate-spring.delay-100 { transition-delay: 100ms; }
.animate-spring.delay-200 { transition-delay: 200ms; }
.animate-spring.delay-300 { transition-delay: 300ms; }
.animate-spring.delay-400 { transition-delay: 400ms; }
.animate-spring.delay-500 { transition-delay: 500ms; }
