/* ==========================================================================
   交互精修层（motion.css）
   目的：统一缓动曲线、入场节奏、悬停反馈、焦点可见性与微动效
   原则：克制、商务、可降级（无 JS / 降低动效偏好下内容完整可见）
   ========================================================================== */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-fast: 0.22s;
  --dur: 0.36s;
  --dur-slow: 0.7s;
}

html {
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------ 滚动条 ------------------------------ */
@media (min-width: 901px) {
  * {
    scrollbar-width: thin;
    scrollbar-color: #c2d2e0 transparent;
  }
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: #cddae6;
    border: 3px solid #fff;
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #a9bccd;
  }
}

/* ------------------------------ 焦点可见性 ------------------------------ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ------------------------------ 顶部滚动进度 ------------------------------ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--green), #35c9a0 40%, var(--blue));
  z-index: 120;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.scroll-progress.is-on {
  opacity: 1;
}

/* ------------------------------ 页头：滚动收缩 + 毛玻璃 ------------------------------ */
.site-header {
  transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out), backdrop-filter var(--dur) var(--ease-out);
}

.site-header .wrap {
  transition: height var(--dur) var(--ease-out);
}

.site-header.is-scrolled {
  background: rgba(8, 36, 61, 0.82);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 34px rgba(5, 20, 36, 0.28);
}

.site-header.is-scrolled .wrap {
  height: 62px;
}

.brand-mark {
  transition: width var(--dur) var(--ease-out), height var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-spring);
}

.site-header.is-scrolled .brand-mark {
  width: 36px;
  height: 36px;
}

.brand:hover .brand-mark {
  transform: rotate(-4deg) scale(1.04);
}

/* 导航：悬停从「块状底色」改为下划线扫过 */
.nav a {
  background: none;
  transition: color var(--dur-fast) ease;
}

.nav a::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 9px;
  height: 1px;
  background: rgba(255, 255, 255, 0.8);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform 0.42s var(--ease-out);
}

.nav a:hover {
  background: none;
  color: #fff;
}

.nav a:hover::before {
  transform: scaleX(1);
}

.nav a.is-active::before {
  display: none;
}

.nav a.is-active::after {
  transform-origin: 50% 50%;
  animation: navBarIn 0.5s var(--ease-out) both;
}

@keyframes navBarIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* 用户下拉：淡入上浮 */
.dropdown.is-open .dropdown-menu {
  animation: menuIn 0.26s var(--ease-out) both;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-7px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 移动端菜单展开 */
@media (max-width: 900px) {
  .nav.is-open {
    animation: menuIn 0.3s var(--ease-out) both;
  }

  /* 修复：移动端菜单为白底，链接不能沿用深色页头的白色文字 */
  .nav a {
    color: var(--text-soft);
  }

  .nav a:hover {
    color: var(--blue);
    background: var(--bg-soft);
  }

  .nav a.is-active {
    color: var(--blue);
  }
}

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out),
    background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 0.09s;
}

.btn-primary {
  background-image: linear-gradient(135deg, #1877b9 0%, #1466a5 55%, #105d99 100%);
  box-shadow: 0 6px 18px rgba(20, 102, 165, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 12px 30px rgba(20, 102, 165, 0.32);
}

.btn-green {
  background-image: linear-gradient(135deg, #1cb37d 0%, #17a673 55%, #12996a 100%);
  box-shadow: 0 6px 18px rgba(23, 166, 115, 0.22);
}

.btn-green:hover {
  box-shadow: 0 12px 30px rgba(23, 166, 115, 0.3);
}

/* 按钮内箭头位移 */
.btn svg {
  transition: transform var(--dur) var(--ease-out);
}

/* 加载中 */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading svg {
  opacity: 0;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  animation: btnSpin 0.7s linear infinite;
}

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

/* ------------------------------ 卡片与图片 ------------------------------ */
.card,
.biz-card,
.product-card,
.feature {
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out),
    border-color 0.4s var(--ease-out);
}

.biz-card:hover,
.product-card:hover {
  transform: translateY(-6px);
}

.biz-thumb img,
.product-thumb img {
  transition: transform 0.95s var(--ease-out), filter 0.6s var(--ease-out);
}

.biz-card:hover .biz-thumb img,
.product-card:hover .product-thumb img {
  transform: scale(1.045);
}

.product-foot .more svg,
.biz-link svg {
  transition: transform var(--dur) var(--ease-out);
}

.product-card:hover .product-foot .more svg,
.biz-card:hover .biz-link svg {
  transform: translateX(5px);
}

/* 产品标题悬停变色 */
.product-body h3,
.biz-body h3 {
  transition: color var(--dur-fast) ease;
}

.product-card:hover .product-body h3,
.biz-card:hover .biz-body h3 {
  color: var(--blue);
}

/* 首屏能力卡轻微浮起 */
.hero-panel {
  transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out),
    border-color 0.6s var(--ease-out);
}

.hero-panel:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow: 0 24px 60px rgba(3, 16, 30, 0.28);
}

/* 能力卡列表左侧强调线 */
.hero-panel-list li {
  position: relative;
  transition: padding-left var(--dur) var(--ease-out);
}

.hero-panel-list li::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  border-radius: 2px;
  background: var(--green);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease-out);
}

.hero-panel-list li:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

/* ------------------------------ 筛选与表单 ------------------------------ */
.chip {
  transition: transform var(--dur) var(--ease-out), border-color var(--dur-fast) ease,
    color var(--dur-fast) ease, background-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out);
}

.chip:hover {
  transform: translateY(-1px);
}

.chip.is-active {
  box-shadow: 0 8px 18px rgba(20, 102, 165, 0.22);
}

.field label {
  transition: color var(--dur-fast) ease;
}

.field:focus-within label {
  color: var(--blue);
}

.field input,
.field select,
.field textarea {
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out),
    background-color var(--dur-fast) ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #b6c7d6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(20, 102, 165, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a4b5c4;
  transition: color var(--dur-fast) ease;
}

.field input:focus::placeholder,
.field textarea:focus::placeholder {
  color: #c3d0dc;
}

/* 提示条入场 */
.alert.is-show {
  animation: alertIn 0.4s var(--ease-out) both;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------ 页脚链接 ------------------------------ */
.footer-grid ul a {
  display: inline-block;
  transition: color var(--dur-fast) ease, transform var(--dur) var(--ease-out);
}

.footer-grid ul a:hover {
  transform: translateX(3px);
}

/* ------------------------------ 回到顶部 ------------------------------ */
.to-top {
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  transition: opacity var(--dur) ease, transform 0.5s var(--ease-spring),
    background-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out);
}

.to-top.is-show {
  opacity: 1;
  transform: none;
}

.to-top:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 16px 34px rgba(20, 102, 165, 0.34);
}

/* ------------------------------ 轻提示（新版） ------------------------------ */
.a-toast {
  position: fixed;
  left: 50%;
  top: 26px;
  transform: translate(-50%, -14px);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, 86vw);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #fff;
  background: rgba(12, 42, 68, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 44px rgba(8, 30, 52, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease, transform 0.42s var(--ease-out);
}

.a-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.a-toast::before {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #45d6a4;
  box-shadow: 0 0 0 3px rgba(69, 214, 164, 0.22);
}

.a-toast--error {
  background: rgba(150, 40, 32, 0.95);
}

.a-toast--error::before {
  background: #ffb4ac;
  box-shadow: 0 0 0 3px rgba(255, 180, 172, 0.22);
}

.a-toast-icon {
  display: none;
}

.a-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(69, 214, 164, 0.9), rgba(69, 214, 164, 0.35));
  animation: toastBar 2.8s linear forwards;
}

@keyframes toastBar {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ------------------------------ 滚动入场 ------------------------------ */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.85s var(--ease-out), transform 0.95s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

html.js [data-reveal="left"] {
  transform: translateX(-26px);
}

html.js [data-reveal="right"] {
  transform: translateX(26px);
}

html.js [data-reveal="zoom"] {
  transform: scale(0.97);
}

html.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* 标题眉线生长 */
html.js [data-reveal] .eyebrow::before,
html.js [data-reveal].is-in .eyebrow::after {
  transform-origin: left center;
}

html.js [data-reveal] .eyebrow::before,
html.js [data-reveal] .eyebrow::after {
  transform: scaleX(0);
  transition: transform 0.8s var(--ease-out) 0.12s;
}

html.js [data-reveal].is-in .eyebrow::before,
html.js [data-reveal].is-in .eyebrow::after {
  transform: scaleX(1);
}

/* ------------------------------ 首屏 / 内页头入场 ------------------------------ */
html.js .hero-badge,
html.js .hero h1,
html.js .hero-lead,
html.js .hero-actions,
html.js .hero-metrics,
html.js .hero-panel {
  opacity: 0;
  animation: riseIn 0.95s var(--ease-out) both;
}

html.js .hero-badge {
  animation-delay: 0.05s;
}
html.js .hero h1 {
  animation-delay: 0.13s;
}
html.js .hero-lead {
  animation-delay: 0.22s;
}
html.js .hero-actions {
  animation-delay: 0.3s;
}
html.js .hero-metrics {
  animation-delay: 0.38s;
}
html.js .hero-panel {
  animation-delay: 0.28s;
}

html.js .page-hero .crumb,
html.js .page-hero h1,
html.js .page-hero p {
  opacity: 0;
  animation: riseIn 0.9s var(--ease-out) both;
}

html.js .page-hero h1 {
  animation-delay: 0.08s;
}

html.js .page-hero p {
  animation-delay: 0.16s;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 数字滚动时的等宽，避免抖动 */
.hero-metric b,
.stat-cell b {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ 降低动效偏好 ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

  html.js [data-reveal],
  html.js .hero-badge,
  html.js .hero h1,
  html.js .hero-lead,
  html.js .hero-actions,
  html.js .hero-metrics,
  html.js .hero-panel,
  html.js .page-hero .crumb,
  html.js .page-hero h1,
  html.js .page-hero p {
    opacity: 1 !important;
    transform: none !important;
  }
}
