/* ── 站点前台 ─────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--c-surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--c-border-soft);
}

.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--c-text-strong); }
.brand:hover { color: var(--c-text-strong); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary-500), var(--c-violet));
  color: #fff;
  font-size: var(--f-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.02em;
  box-shadow: var(--sh-primary);
}
.brand-text { font-size: var(--f-md); font-weight: var(--fw-bold); letter-spacing: -0.01em; }

.site-links { display: flex; gap: var(--s-5); font-size: var(--f-sm); }
.site-links a { color: var(--c-text-soft); font-weight: var(--fw-medium); }
.site-links a:hover { color: var(--c-primary-600); }

.site-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(64px, 12vw, 140px) var(--s-6) var(--s-11);
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  margin-top: var(--s-5);
  font-size: clamp(30px, 5.5vw, var(--f-5xl));
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.028em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--c-gray-900) 20%, var(--c-primary-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .hero-title {
  background: linear-gradient(135deg, #e8eeff 20%, var(--c-primary-400) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  margin-top: var(--s-4);
  max-width: 52ch;
  font-size: var(--f-md);
  line-height: var(--lh-relaxed);
  color: var(--c-text-soft);
}

/* ── 错误页 ───────────────────────────────────────────────────────────── */
.error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--s-6);
}

.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-3);
  max-width: 440px;
  padding: var(--s-9) var(--s-7);
}

.error-code {
  font-size: clamp(64px, 14vw, 108px);
  font-weight: var(--fw-extrabold);
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--c-primary-400), var(--c-violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-title { font-size: var(--f-xl); font-weight: var(--fw-semibold); }
.error-desc { font-size: var(--f-sm); color: var(--c-text-soft); margin-bottom: var(--s-3); }
/* ── 站点通用区块 ─────────────────────────────────────────── */
.site-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--nav-height, 68px) + 32px) 20px 64px;
}
.site-section { display: flex; flex-direction: column; gap: 16px; }
.site-section-head h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.site-section-head p { font-size: var(--f-sm, 14px); color: var(--c-text-soft, #64748b); }

.card-pad { padding: 20px; }
.card-title { font-size: var(--f-md, 16px); font-weight: 600; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* 键值对网格（卡密信息） */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 24px;
  margin: 0;
}
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv dt { font-size: var(--f-xs, 12px); color: var(--c-text-faint, #94a3b8); }
.kv dd { margin: 0; font-size: var(--f-sm, 14px); color: var(--c-text, #1e293b); word-break: break-all; }

/* 说明列表 */
.hint-list { margin: 0; padding-left: 20px; line-height: 1.9; font-size: var(--f-sm, 14px); color: var(--c-text-soft, #64748b); }
.hint-list strong { color: var(--c-text, #1e293b); font-weight: 600; }

/* 导航当前项 */
.site-links a.is-active { color: var(--c-primary, #4f46e5); font-weight: 600; }

/* ── 页脚 ─────────────────────────────────────────────────── */
.site-foot {
  border-top: 1px solid var(--c-border, #e5e9f2);
  padding: 22px 20px;
  margin-top: 40px;
}
.site-foot-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  font-size: var(--f-xs, 12px); color: var(--c-text-soft, #64748b);
}
.site-foot-inner a { color: inherit; text-decoration: none; }
.site-foot-inner a:hover { color: var(--c-primary, #4f46e5); }

[data-theme="dark"] .site-foot { border-color: #222c42; }
[data-theme="dark"] .kv dd { color: #e2e8f0; }

/* ── 应用卡片列表 ─────────────────────────────────────────── */
.app-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.app-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--c-border, #e5e9f2);
  border-radius: var(--r-md, 12px);
  background: var(--c-surface, #fff);
  transition: box-shadow .15s, transform .15s;
}
.app-card:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}
.app-card-head { display: flex; align-items: center; gap: 12px; }
.app-icon {
  flex: 0 0 46px; height: 46px; border-radius: 12px;
  object-fit: cover;
}
.app-icon-fallback {
  display: grid; place-items: center;
  background: var(--c-primary-soft, #eef2ff);
  color: var(--c-primary, #4f46e5);
  font-size: 20px; font-weight: 700;
}
.app-title-wrap { min-width: 0; flex: 1; }
.app-name { font-size: var(--f-md, 16px); font-weight: 600; margin: 0; }
.app-name a { color: inherit; text-decoration: none; }
.app-name a:hover { color: var(--c-primary, #4f46e5); }
.app-meta { font-size: var(--f-xs, 12px); color: var(--c-text-soft, #64748b); margin-top: 2px; }
.app-note {
  margin: 0; font-size: var(--f-sm, 14px); color: var(--c-text-soft, #64748b);
  line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: auto; padding-top: 4px;
}

/* 成功提示 */
.alert-success {
  background: #dcfce7; color: #15803d;
  border: 1px solid #bbf7d0;
}

[data-theme="dark"] .app-card { background: #131a2a; border-color: #222c42; }
[data-theme="dark"] .app-icon-fallback { background: #1e2a4a; color: #818cf8; }
[data-theme="dark"] .alert-success { background: #14311f; color: #4ade80; border-color: #1d4d33; }

/* ── 开发文档（C1 第三批） ─────────────────────────────── */
.doc-code {
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--text, #0f172a);
}
.doc-h3 {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.doc-ep-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-ep {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.doc-ep:hover {
  border-color: var(--primary, #6366f1);
  background: var(--surface-2, #f8fafc);
}
.doc-ep-path {
  font-size: 12.5px;
  color: var(--primary, #6366f1);
  background: var(--primary-soft, #eef2ff);
  padding: 2px 7px;
  border-radius: 6px;
}
.doc-ep-name {
  font-size: 14px;
  font-weight: 500;
}
.badge-warn { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge-warn { background: #422006; color: #fcd34d; }
[data-theme="dark"] .doc-code {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
[data-theme="dark"] .doc-ep:hover { background: #1e293b; }
[data-theme="dark"] .doc-ep-path { background: #312e81; color: #c7d2fe; }

/* ── 首页：Hero ──────────────────────────────────────── */
.hero-section {
  padding-top: clamp(32px, 8vw, 72px);
  padding-bottom: clamp(32px, 8vw, 72px);
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.hero-inner .hero-title {
  margin: 8px 0 0;
  font-size: clamp(26px, 5.2vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.hero-inner .hero-desc {
  margin: 0;
  max-width: 620px;
  font-size: clamp(14px, 2.4vw, 16px);
  line-height: 1.75;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 560px;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border: 1px solid var(--c-border-soft, #e2e8f0);
  border-radius: 14px;
  background: var(--c-surface, #fff);
}
.hero-stat strong {
  font-size: clamp(20px, 3.4vw, 28px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-primary, #6366f1);
}
.hero-stat span {
  font-size: 12.5px;
  color: var(--c-text-soft, #64748b);
}

/* ── 首页：功能卡片 ──────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 20px;
  border: 1px solid var(--c-border-soft, #e2e8f0);
  border-radius: 14px;
  background: var(--c-surface, #fff);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.feature-card:hover {
  border-color: var(--c-primary, #6366f1);
  box-shadow: 0 6px 20px rgba(99, 102, 241, .08);
  transform: translateY(-2px);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--c-primary-soft, #eef2ff);
  color: var(--c-primary, #6366f1);
  margin-bottom: 14px;
}
.feature-title {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 600;
}
.feature-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--c-text-soft, #64748b);
}

/* ── 首页：三步接入 ──────────────────────────────────── */
.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.step-card {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--c-border-soft, #e2e8f0);
  border-radius: 14px;
  background: var(--c-surface, #fff);
}
.step-no {
  display: inline-block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-primary-soft-text, #c7d2fe);
  margin-bottom: 10px;
}
.step-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.step-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--c-text-soft, #64748b);
}

/* ── 首页：行动号召 ──────────────────────────────────── */
.cta-card {
  padding: clamp(28px, 6vw, 52px) 24px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(168,85,247,.08));
  border: 1px solid var(--c-border-soft, #e2e8f0);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.cta-title {
  margin: 0;
  font-size: clamp(20px, 3.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cta-desc {
  margin: 0;
  max-width: 520px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--c-text-soft, #64748b);
}

/* 首页应用卡：内容区（app-card 已有 flex 布局） */
.app-card-body { min-width: 0; flex: 1; }

/* ── 暗色模式 ──────────────────────────────────────── */
[data-theme="dark"] .feature-card,
[data-theme="dark"] .step-card,
[data-theme="dark"] .hero-stat {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .feature-icon {
  background: #312e81;
  color: #c7d2fe;
}
[data-theme="dark"] .step-no { color: #4338ca; }
[data-theme="dark"] .cta-card {
  background: linear-gradient(135deg, rgba(99,102,241,.14), rgba(168,85,247,.14));
  border-color: #334155;
}
[data-theme="dark"] .hero-stat strong { color: #a5b4fc; }

/* ══════════════════════════════════════════════════════════
   移动端适配
   ──────────────────────────────────────────────────────────
   断点选择：
     768px —— 平板以下走抽屉导航
     560px —— 手机竖屏，卡片单列、字号下调
     380px —— 小屏手机（iPhone SE 等）
   ══════════════════════════════════════════════════════════ */

/* 汉堡按钮：默认隐藏，窄屏才出 */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--r-md);
  background: var(--c-surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--c-text);
  transition: transform .18s, opacity .18s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 导航当前项高亮 */
.site-links a.is-active {
  color: var(--c-primary-600);
  font-weight: var(--fw-semibold);
}

/* ── 768px 以下：抽屉导航 ─────────────────────────────── */
@media (max-width: 767px) {
  .site-nav {
    height: 56px;
    padding: 0 var(--s-4);
    /* iPhone 刘海 / 安全区 */
    padding-left: max(var(--s-4), env(safe-area-inset-left));
    padding-right: max(var(--s-4), env(safe-area-inset-right));
  }
  .nav-toggle { display: flex; }

  .site-links {
    position: fixed;
    inset: 56px 0 auto 0;
    flex-direction: column;
    gap: 0;
    padding: var(--s-3) var(--s-4) var(--s-5);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border-soft);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
    /* 默认收起 */
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform .18s ease, opacity .18s ease, visibility .18s;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .site-links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .site-links a {
    display: block;
    padding: 13px 4px;
    font-size: 15px;
    border-bottom: 1px solid var(--c-border-soft);
  }
  .site-links a:last-child { border-bottom: none; }
  .site-links .nav-login {
    margin-top: var(--s-3);
    text-align: center;
    border-bottom: none;
    padding: 11px 16px;
  }

  /* 抽屉打开时锁定背景滚动 */
  body.nav-open { overflow: hidden; }

  /* 主内容左右留白收紧 */
  .site-main { padding: 0 var(--s-4); }
  .site-section { padding: var(--s-6) 0; }

  /* Hero 更紧凑 */
  .hero-section {
    padding-top: var(--s-7);
    padding-bottom: var(--s-7);
  }
  .hero-inner { gap: 12px; }
  .hero-stats {
    max-width: 100%;
    gap: 8px;
  }
  .hero-stat { padding: 12px 4px; }

  /* 按钮组竖排更易点 */
  .site-section .row.gap-3 { gap: 10px !important; }
  .site-section .btn-lg {
    padding: 12px 20px;
    font-size: 15px;
  }

  /* 页脚堆叠 */
  .site-foot-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding-left: max(var(--s-4), env(safe-area-inset-left));
    padding-right: max(var(--s-4), env(safe-area-inset-right));
  }
}

/* ── 560px 以下：卡片单列、表格横向滚动 ───────────────── */
@media (max-width: 559px) {
  .feature-grid,
  .step-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .feature-card,
  .step-card { padding: 16px; }
  .feature-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
  }
  .cta-card { padding: 24px 18px; }

  /* 数据表在手机上均横向滚动，不撑破页面 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table { min-width: 560px; }

  /* 表单控件放大到可点尺寸 */
  .input, .select, .textarea { font-size: 16px; } /* 防止 iOS 自动缩放 */
  .btn { min-height: 40px; }

  /* kv 网格单列 */
  .kv-grid { grid-template-columns: 1fr !important; }

  /* 文档代码块字体调小 */
  .doc-code { font-size: 12px; }
}

/* ── 380px 以下：极窄屏 ─────────────────────────────── */
@media (max-width: 379px) {
  .brand-text { display: none; }
  .hero-stat strong { font-size: 18px; }
  .hero-stat span { font-size: 11px; }
  .site-links a { font-size: 14px; padding: 12px 4px; }
}

/* ── 触屏设备：去掉 hover 阴影位移，避免点完“卡住” ─────── */
@media (hover: none) {
  .feature-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--c-border-soft);
  }
}

/* ── 横屏手机：压缩 Hero 高度 ────────────────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  .hero-section { padding-top: var(--s-5); padding-bottom: var(--s-5); }
  .hero-stats { display: none; }
}

/* ── 暗色模式补丁 ────────────────────────────────────── */
[data-theme="dark"] .nav-toggle {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .nav-toggle-bar { background: #e2e8f0; }
[data-theme="dark"] .site-links {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
}
