/* ============================================
   串源科技企业官网 — 自定义样式
   ============================================ */

/* 基础平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 字体配置 */
body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-display {
  font-family: 'Outfit', 'Noto Sans SC', sans-serif;
}

/* ============================================
   动画关键帧
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================
   滚动动画类（由 IntersectionObserver 触发）
   ============================================ */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* 子元素依次延迟 */
.stagger-children > .animate-on-scroll:nth-child(1) { transition-delay: 0ms; }
.stagger-children > .animate-on-scroll:nth-child(2) { transition-delay: 80ms; }
.stagger-children > .animate-on-scroll:nth-child(3) { transition-delay: 160ms; }
.stagger-children > .animate-on-scroll:nth-child(4) { transition-delay: 240ms; }
.stagger-children > .animate-on-scroll:nth-child(5) { transition-delay: 320ms; }
.stagger-children > .animate-on-scroll:nth-child(6) { transition-delay: 400ms; }

/* ============================================
   导航栏
   ============================================ */

/* 品牌顶栏 */
.brand-header {
  transition: background-color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

.brand-header .brand-title,
.brand-header .brand-sub {
  transition: color 0.3s ease;
}

.brand-header.is-scrolled {
  background-color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.brand-header.is-scrolled .brand-title {
  color: #0F172A;
}

.brand-header.is-scrolled .brand-sub {
  color: rgba(148, 163, 184, 1);
}

/* 移动端菜单 */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-menu.is-open {
  transform: translateX(0);
}

.mobile-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* 导航链接下划线动画 */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: #2563EB;
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.is-active::after {
  width: 100%;
}

/* ============================================
   Hero 区域背景
   ============================================ */

.hero-bg {
  background: linear-gradient(135deg, #0B1120 0%, #0F172A 40%, #1E293B 100%);
  position: relative;
  overflow: hidden;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 150%;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-bg::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 60%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* 网格纹理叠加 */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

/* ============================================
   手机 Mockup
   ============================================ */

.phone-mockup {
  position: relative;
  width: 280px;
  height: 560px;
  background: #1E293B;
  border-radius: 36px;
  padding: 12px;
  box-shadow:
    0 0 0 2px #334155,
    0 25px 50px -12px rgba(0, 0, 0, 0.5);
  margin: 0 auto;
}

.phone-mockup::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 20px;
  background: #0F172A;
  border-radius: 10px;
  z-index: 10;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #1E293B;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
}

.phone-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================
   卡片交互
   ============================================ */

.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
}

.service-card:active {
  transform: scale(0.98);
}

/* ============================================
   按钮交互
   ============================================ */

.btn-primary {
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  background-color: #1D4ED8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-outline {
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-outline:hover {
  background-color: rgba(37, 99, 235, 0.06);
}

.btn-outline:active {
  transform: scale(0.98);
}

/* ============================================
   回到顶部按钮
   ============================================ */

.back-to-top {
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:hover {
  background-color: #1D4ED8;
}

/* ============================================
   表单样式
   ============================================ */

.form-input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-input.is-error {
  border-color: #EF4444;
}

.form-input.is-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
  color: #EF4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: none;
}

.error-message.is-visible {
  display: block;
  animation: slideDown 0.2s ease;
}

/* Loading 状态 */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 成功提示 */
.success-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #0F172A;
  color: #fff;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 0.9375rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
}

.success-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ============================================
   图片懒加载淡入
   ============================================ */

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.5s ease;
}

img[loading="lazy"].is-loaded {
  opacity: 1;
}

/* ============================================
   产品特性列表勾选
   ============================================ */

.feature-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 50%;
  color: #2563EB;
  flex-shrink: 0;
}

/* ============================================
   页脚链接
   ============================================ */

.footer-link {
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-block;
}

.footer-link:hover {
  color: #60A5FA;
  transform: translateX(2px);
}

/* ============================================
   响应式微调
   ============================================ */

@media (max-width: 767px) {
  .phone-mockup {
    width: 240px;
    height: 480px;
    border-radius: 30px;
    padding: 10px;
  }

  .phone-screen {
    border-radius: 24px;
  }

  .hero-title {
    font-size: 2rem !important;
    line-height: 1.2 !important;
  }

  .hero-subtitle {
    font-size: 1rem !important;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .phone-mockup {
    width: 260px;
    height: 520px;
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
