/* ============================================================
   千智AI · 智能体平台 — 公共基础样式
   base.css
   包含：tokens / reset / 背景 / 导航 / 通用 section / 按钮 / footer
   页面专属样式见 home.css / product.css / changelog.css
   ============================================================ */

/* ===== Reset ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Tokens ===== */

:root {
  --radius: 16px;
  --maxw: 1180px;
  --font-body:
    "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* 品牌色（双主题共用） */
  --brand: #3f74e0;
  --brand-2: #12b5a6;
  --gold: #d99b24;
  --purple: #7a5cff;
  --danger: #ff6b6b;
}

/* ===== Light（默认） ===== */

:root,
[data-theme="light"] {
  --bg: #f5f7fc;
  --bg-soft: #eef2fa;
  --panel: #ffffff;
  --panel-2: #f0f4fc;
  --line: rgba(63, 116, 224, 0.14);
  --line-strong: rgba(63, 116, 224, 0.3);
  --text: #16223a;
  --text-dim: #4d5f82;
  --text-faint: #8491ad;
  --nav-bg: rgba(255, 255, 255, 0.86);
  --grid-line: rgba(63, 116, 224, 0.08);
  --glow-a: rgba(63, 116, 224, 0.12);
  --glow-b: rgba(18, 181, 166, 0.1);
  --glow-c: rgba(217, 155, 36, 0.06);
  --hero-lead: #4d5f82;
  --btn-ghost-bg: rgba(63, 116, 224, 0.05);
  --card-bg: linear-gradient(180deg, #ffffff, #f3f6fd);
  --arch-bg: linear-gradient(180deg, #ffffff, #eef3fc);
  --layer-bg: rgba(255, 255, 255, 0.85);
  --scene-bg: linear-gradient(150deg, #ffffff, #eef4fd);
  --dep-bg: rgba(255, 255, 255, 0.9);
  --node-bg: rgba(255, 255, 255, 0.94);
  --shadow: 0 14px 36px rgba(40, 70, 140, 0.1);
  --shadow-strong: 0 24px 60px rgba(40, 70, 140, 0.14);
  --hero-grid: rgba(63, 116, 224, 0.06);
}

/* ===== Dark ===== */

[data-theme="dark"] {
  --bg: #070d1a;
  --bg-soft: #0b1426;
  --panel: #0f1c33;
  --panel-2: #122340;
  --line: rgba(120, 160, 255, 0.14);
  --line-strong: rgba(120, 160, 255, 0.28);
  --text: #e8eefb;
  --text-dim: #9db0d0;
  --text-faint: #6b7ea0;
  --nav-bg: rgba(7, 13, 26, 0.82);
  --grid-line: rgba(120, 160, 255, 0.07);
  --glow-a: rgba(63, 116, 224, 0.2);
  --glow-b: rgba(18, 181, 166, 0.14);
  --glow-c: rgba(217, 155, 36, 0.08);
  --hero-lead: #9db0d0;
  --btn-ghost-bg: rgba(120, 160, 255, 0.05);
  --card-bg: linear-gradient(180deg, #0f1c33, rgba(15, 28, 51, 0.55));
  --arch-bg: linear-gradient(180deg, #122340, rgba(18, 35, 64, 0.4));
  --layer-bg: rgba(15, 28, 51, 0.55);
  --scene-bg: linear-gradient(
    150deg,
    rgba(18, 35, 64, 0.9),
    rgba(11, 20, 38, 0.6)
  );
  --dep-bg: rgba(15, 28, 51, 0.5);
  --node-bg: rgba(15, 28, 51, 0.94);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.42);
  --hero-grid: rgba(120, 160, 255, 0.045);
}

/* ===== Base ===== */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition:
    background 0.35s ease,
    color 0.35s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  position: relative;
}

/* 锚点跳转不被 sticky 导航遮挡 */

section[id],
header[id] {
  scroll-margin-top: 84px;
}

/* ===== 背景网格 ===== */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse 90% 70% at 50% 0%,
    #000 40%,
    transparent 100%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 90% 70% at 50% 0%,
    #000 40%,
    transparent 100%
  );
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  transition: background 0.35s ease;
  background:
    radial-gradient(620px 420px at 18% 8%, var(--glow-a), transparent 62%),
    radial-gradient(520px 380px at 85% 16%, var(--glow-b), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, var(--glow-c), transparent 65%);
}

/* ============================================================
   Top Nav（新结构：产品 / 解决方案 / 关于 / 帮助）
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  box-shadow: 0 0 18px rgba(63, 116, 224, 0.45);
}

.logo-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.logo-name {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--text);
}

.logo-name small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 6px;
  letter-spacing: 1px;
}

/* --- 主导航菜单 --- */

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition:
    color 0.2s,
    background 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover,
.nav-item:hover .nav-link {
  color: var(--text);
  background: var(--btn-ghost-bg);
}

.nav-link.active {
  color: var(--text);
  font-weight: 600;
}

.nav-link .caret {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
  opacity: 0.7;
}

.nav-item:hover .caret {
  transform: rotate(180deg);
}

.nav-link .ext-icon {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* --- 下拉菜单 --- */

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
  min-width: 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow-strong);
  margin-top: 6px;
}

.dropdown.dropdown-sm {
  min-width: 220px;
}

.dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown a {
  display: flex;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  transition: background 0.15s;
  align-items: flex-start;
}

.dropdown a:hover {
  background: var(--btn-ghost-bg);
}

.dropdown a .dd-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(63, 116, 224, 0.1);
  border: 1px solid rgba(63, 116, 224, 0.2);
}

.dropdown a .dd-icon svg {
  width: 17px;
  height: 17px;
}

.dropdown a .dd-text b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.dropdown a .dd-text span {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* --- 右侧操作区 --- */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--btn-ghost-bg);
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  transition: all 0.2s;
}

.theme-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
}

.theme-btn .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-btn .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-btn .icon-moon {
  display: none;
}

.btn-auth {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  box-shadow: 0 4px 16px rgba(63, 116, 224, 0.32);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  white-space: nowrap;
}

.btn-auth:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(63, 116, 224, 0.42);
}

.btn-auth.ghost {
  color: var(--brand);
  background: transparent;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn-auth.ghost:hover {
  border-color: var(--brand);
  box-shadow: none;
}

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

.mobile-auth {
  display: none;
}

/* --- 移动端导航 --- */

@media (max-width: 1080px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 12px 16px 20px;
    border-bottom: 1px solid var(--line);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-item {
    width: 100%;
  }
  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
    font-size: 15px;
  }
  .dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 8px;
    margin: 0;
    min-width: 0;
    display: none;
  }
  .nav-item.open .dropdown {
    display: block;
  }
  .nav-item.open .caret {
    transform: rotate(180deg);
  }
  .nav-actions {
    margin-left: auto;
    border-left: none;
    padding-left: 0;
  }
  .menu-btn {
    display: grid;
    place-items: center;
  }
  .nav-actions .btn-auth {
    display: none;
  }
  .mobile-auth {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .mobile-auth .btn-auth {
    display: block;
    text-align: center;
  }
}

/* ============================================================
   通用 Section
   ============================================================ */

.sec {
  padding: 84px 0;
}

.sec-head {
  max-width: 720px;
  margin: 0 auto 52px;
  text-align: center;
}

.sec-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--brand-2);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.sec-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
  line-height: 1.3;
  color: var(--text);
}

.sec-sub {
  font-size: 15px;
  color: var(--text-dim);
}

/* ============================================================
   通用按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  box-shadow: 0 6px 22px rgba(63, 116, 224, 0.34);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(63, 116, 224, 0.42);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: var(--btn-ghost-bg);
}

.btn-ghost:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

/* ============================================================
   通用卡片（.card，首页价值卡 + 产品页矩阵共用）
   ============================================================ */

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  transition:
    transform 0.28s,
    border-color 0.28s,
    box-shadow 0.28s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0;
  transition: opacity 0.28s;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card:hover::before {
  opacity: 1;
}

.card .cico {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  background: rgba(63, 116, 224, 0.12);
  border: 1px solid rgba(63, 116, 224, 0.25);
}

.card .cico svg {
  width: 26px;
  height: 26px;
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.card p {
  font-size: 14px;
  color: var(--text-dim);
}

/* ============================================================
   通用 CTA
   ============================================================ */

.cta {
  position: relative;
  padding: 92px 0;
  text-align: center;
  overflow: hidden;
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    560px 300px at 50% 40%,
    var(--glow-a),
    transparent 70%
  );
  z-index: -1;
}

.cta h2 {
  font-size: 38px;
  font-weight: 900;
  margin-bottom: 14px;
  color: var(--text);
}

.cta p {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 34px;
}

.cta .btn {
  margin: 0 8px;
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  border-top: 1px solid var(--line);
  padding: 52px 0 40px;
  background: var(--bg-soft);
}

.foot-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 2fr;
  gap: 36px;
}

.foot-brand p {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 12px;
  max-width: 300px;
}

.foot-col h5 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.foot-col a,
.foot-col div {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  transition: color 0.2s;
}

.foot-col a:hover {
  color: var(--text);
}

.foot-bottom {
  max-width: var(--maxw);
  margin: 36px auto 0;
  padding: 22px 24px 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ============================================================
   响应式基础（footer / 通用）
   ============================================================ */

@media (max-width: 960px) {
  .foot-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .sec {
    padding: 60px 0;
  }
  .sec-title {
    font-size: 28px;
  }
  .foot-inner {
    grid-template-columns: 1fr;
  }
  .cta h2 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
