/* =============================================================
   components.css —— 按钮 / 导航 / 抽屉 / 页脚 / 卡片 / 表单 /
   Toast / 回到顶部 / 页面区块组件
   视觉样式仅引用 tokens.css 语义层与组件层
   ============================================================= */

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  height: 48px;
  padding-inline: var(--sp-4);
  border-radius: var(--radius-full);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
  will-change: transform;
}

.btn--sm { height: 40px; padding-inline: var(--sp-3); font-size: var(--fs-sm); }

.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--color-text-on-brand);
}

.btn--primary:hover {
  background: var(--btn-primary-bg-hover);
  box-shadow: var(--glow-md);
  transform: translateY(-2px);
}

.btn--ghost {
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--color-brand);
  color: var(--color-text-strong);
  box-shadow: var(--glow-sm);
  transform: translateY(-2px);
}

.btn[disabled], .btn.is-loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.btn__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------------- 顶部导航（吸顶） ---------------- */
.nav {
  position: fixed;
  inset: 0 0 0 0;
  z-index: var(--z-header);
  height: var(--nav-h);
  transition: background var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              backdrop-filter var(--dur) var(--ease-out);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-right: auto;
  font-weight: 700;
  color: var(--color-text-strong);
}

.nav__logo img { height: 32px; width: 32px; }
.nav__logo-name { font-size: var(--fs-md); letter-spacing: 0.01em; }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.nav__link {
  position: relative;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  padding-block: var(--sp-1);
  transition: color var(--dur-fast) var(--ease-out);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}

.nav__link:hover { color: var(--color-text-strong); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link.is-active { color: var(--color-text-strong); }
.nav__link.is-active::after { transform: scaleX(1); }

.nav__cta { margin-left: var(--sp-3); }

/* 透明态 ↔ 吸顶态（滚动 > 40px 切换毛玻璃实底） */
.nav.is-solid {
  background: rgba(6, 9, 15, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--color-border), 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* 汉堡按钮 */
.nav__burger {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-sm);
}

.nav__burger span {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 2px;
  background: var(--color-text-strong);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease-out), opacity var(--dur);
}

.nav__burger span:nth-child(1) { top: 16px; }
.nav__burger span:nth-child(2) { top: 22px; }
.nav__burger span:nth-child(3) { top: 28px; }

.nav__burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 移动端抽屉（右侧滑入 ≤300ms） */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  visibility: hidden;
  pointer-events: none;
}

.drawer.is-open { visibility: visible; pointer-events: auto; }

.drawer__mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.drawer.is-open .drawer__mask { opacity: 1; }

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(78vw, 320px);
  height: 100%;
  background: var(--color-surface);


  border-left: 1px solid var(--color-border-strong);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.drawer.is-open .drawer__panel { transform: translateX(0); }

.drawer__link {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-md);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.drawer__link:hover { background: var(--color-bg-elevated); color: var(--color-text-strong); }
.drawer__link.is-active { color: var(--color-brand-strong); background: var(--color-brand-soft); }
.drawer__cta { margin-top: auto; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  position: relative;
  background: var(--grad-footer);
  border-top: 1px solid var(--color-border);
  padding-block: var(--sp-8) var(--sp-4);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--sp-5);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--color-border);
}

.footer__brand .nav__logo { margin-bottom: var(--sp-2); }

.footer__tagline {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  max-width: 300px;
  margin-bottom: var(--sp-3);
}

.footer__contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.footer__contact a { color: var(--color-text-muted); }
.footer__contact a:hover { color: var(--color-brand-strong); }

.footer__wechat { color: var(--color-text-muted); }
.footer__wechat code { font-family: var(--font-mono); color: var(--color-text-strong); }

.footer__col-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-text-strong);
  margin-bottom: var(--sp-2);
}

.footer__links { display: flex; flex-direction: column; gap: var(--sp-1); }

.footer__links a {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  transition: color var(--dur-fast), transform var(--dur-fast);
}

.footer__links a:hover { color: var(--color-brand-strong); transform: translateX(3px); }

.footer__beian {
  padding-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--color-text-faint);
}

.footer__beian a { color: inherit; }
.footer__beian a:hover { color: var(--color-text-muted); }

.footer__icp { display: flex; gap: var(--sp-3); }

/* ---------------- 卡片（通用） ---------------- */
.card {
  position: relative;
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  transition: transform var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(49, 144, 245, 0.5);
  box-shadow: var(--glow-sm);
}

/* 3D Tilt 卡片（hover 时由 JS 注入 --rx/--ry） */
.card--tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
}

.card--tilt:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0);
}

.card__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--color-brand-soft);
  color: var(--color-brand-strong);
  margin-bottom: var(--sp-3);
  font-size: 22px;
  transition: transform var(--dur) var(--ease-out);
}

.card:hover .card__icon { transform: translateY(-4px) scale(1.06); }

.card__title { font-size: var(--fs-xl); margin-bottom: var(--sp-1); }
.card__desc { font-size: var(--fs-sm); }

.card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-brand-strong);
}

.card__link::after { content: "→"; transition: transform var(--dur-fast); }
.card__link:hover::after { transform: translateX(4px); }

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }

.tag {
  font-size: var(--fs-xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-brand-soft);
  color: var(--color-brand-strong);
  border: 1px solid rgba(49, 144, 245, 0.25);
  font-family: var(--font-mono);
}

/* ---------------- 页内 Hero（非首页） ---------------- */
.page-hero {
  position: relative;
  min-height: 40vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-h);
  overflow: hidden;
  background:
    var(--grad-hero),
    radial-gradient(80% 100% at 50% -10%, rgba(24, 119, 232, 0.16), transparent 60%);
  border-bottom: 1px solid var(--color-border);
}

.page-hero--detail { min-height: 56vh; }

.page-hero__inner { position: relative; z-index: var(--z-content); padding-block: var(--sp-8); }

.breadcrumb {
  display: flex;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--color-text-faint);
  margin-bottom: var(--sp-2);
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-brand-strong); }

.page-hero h1 { max-width: 800px; }
.page-hero .lead { max-width: 720px; margin-top: var(--sp-2); }


.page-hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

/* 业务专属光效（三业务 Hero 区分） */
.glow-vibe      { --svc: var(--color-service-vibe); }
.glow-transform { --svc: var(--color-service-transform); }
.glow-agent     { --svc: var(--color-service-agent); }

.page-hero--svc {
  background:
    radial-gradient(60% 70% at 30% 40%, color-mix(in srgb, var(--svc) 26%, transparent), transparent 70%),
    radial-gradient(50% 60% at 80% 20%, color-mix(in srgb, var(--svc) 16%, transparent), transparent 70%),
    var(--color-bg);
}

/* ---------------- 通用区块组件 ---------------- */
/* 时间线 Timeline（进程点亮） */
.timeline { position: relative; display: flex; flex-direction: column; gap: var(--sp-4); }

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--color-brand), transparent);
  opacity: 0.35;
}

.timeline__item { position: relative; padding-left: var(--sp-5); }

.timeline__dot {
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border-strong);
  transition: background var(--dur-slow) var(--ease-out),
              border-color var(--dur-slow) var(--ease-out),
              box-shadow var(--dur-slow) var(--ease-out);
}

.timeline__item.is-visible .timeline__dot {
  background: var(--color-brand);
  border-color: var(--color-brand-strong);
  box-shadow: 0 0 0 6px var(--color-brand-soft);
}

.timeline__year {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-brand-strong);
}

.timeline__title { font-size: var(--fs-lg); color: var(--color-text-strong); }
.timeline__desc { font-size: var(--fs-sm); }

/* 数据战绩 */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  text-align: center;
}

.metric__value {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  color: var(--color-text-strong);
  line-height: 1.1;
}

.metric__value sup {
  font-size: 0.4em;
  color: var(--color-brand-strong);
  top: -0.6em;
}

.metric__label { font-size: var(--fs-sm); color: var(--color-text-muted); }

/* 跑马灯（hover 暂停） */
.marquee {
  overflow: hidden;
  height: 80px;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: flex;
  gap: var(--sp-8);
  width: max-content;
  animation: marquee 32s linear infinite;
}

.marquee:hover .marquee__track { animation-play-state: paused; }

.marquee__item {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  color: var(--color-text-faint);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* 图文行 */
.value-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  align-items: center;
}

.value-row--flip .value-row__media { order: -1; }

.value-row__media {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background:
    linear-gradient(135deg, rgba(24, 119, 232, 0.18), rgba(12, 16, 24, 0.4)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(49, 144, 245, 0.08) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(49, 144, 245, 0.08) 31px 32px);
  overflow: hidden;
}

/* CTA 横幅 */
.cta-banner {
  position: relative;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-6);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(60% 120% at 10% 50%, rgba(24, 119, 232, 0.35), transparent 60%),
    linear-gradient(120deg, var(--color-surface-2), var(--color-surface));
  border: 1px solid rgba(49, 144, 245, 0.35);
  overflow: hidden;
}

.cta-banner::after {
  content: "";
  position: absolute;
  inset: auto -20% -60% auto;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(24, 119, 232, 0.28), transparent 65%);
  pointer-events: none;
}

.cta-banner__body { position: relative; z-index: 1; }
.cta-banner__title { font-size: clamp(26px, 3vw, 36px); }
.cta-banner__desc { margin-top: var(--sp-1); max-width: 560px; }
.cta-banner__actions { position: relative; z-index: 1; display: flex; gap: var(--sp-2); flex-wrap: wrap; }


/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed;
  top: calc(var(--nav-h) + var(--sp-2));
  right: var(--sp-3);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  min-width: 260px;
  max-width: min(90vw, 380px);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  background: rgba(14, 20, 32, 0.96);
  border: 1px solid var(--color-brand);
  box-shadow: var(--glow-sm), 0 12px 32px rgba(0, 0, 0, 0.5);
  color: var(--color-text);
  font-size: var(--fs-sm);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
}

.toast.is-show { transform: translateX(0); opacity: 1; }
.toast--error { border-color: var(--color-danger); }

.toast__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--color-text-strong);
  margin-bottom: 4px;
}

.toast--error .toast__title { color: var(--color-danger); }

/* ---------------- 回到顶部 ---------------- */
.back-top {
  position: fixed;
  right: var(--sp-3);
  bottom: var(--sp-3);
  z-index: var(--z-toast);
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all var(--dur) var(--ease-out);
}

.back-top.is-show { opacity: 1; visibility: visible; transform: translateY(0); }

.back-top:hover {
  color: var(--color-brand-strong);
  border-color: var(--color-brand);
  box-shadow: var(--glow-sm);
}

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

  .marquee__track { animation: none; }
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}


/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .metrics { grid-template-columns: repeat(2, 1fr); row-gap: var(--sp-5); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .nav__links,
  .nav__cta { display: none; }

  .nav__burger { display: block; }

  .value-row { grid-template-columns: 1fr; }
  .value-row--flip .value-row__media { order: 0; }
}

@media (max-width: 768px) {
  :root { --nav-h: 64px; }

  .section { padding-block: var(--sp-7); }
  .section-head { text-align: left; }

  .page-hero { min-height: auto; }
  .page-hero__inner { padding-block: var(--sp-6); }
  .page-hero--detail { min-height: auto; }

  .cta-banner {
    min-height: auto;
    padding: var(--sp-5);
    justify-content: flex-start;
  }

  .footer__grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .footer__beian { flex-direction: column; gap: var(--sp-1); }

  .toast-wrap { left: var(--sp-3); right: var(--sp-3); }
  .toast { max-width: none; min-width: 0; }
}

@media (max-width: 480px) {
  .btn { width: 100%; }
  .page-hero__cta .btn { width: auto; flex: 1 1 auto; }

  .metrics { grid-template-columns: 1fr 1fr; }
  .metric__value { font-size: 36px; }

  .card { padding: var(--sp-3); }

  .marquee { height: 64px; }
  .marquee__item { font-size: var(--fs-md); }
}
