/* aicf-core 文档站 —— 纯静态、无外部依赖、离线可渲染。
   风格：深色、等宽优先、代码感、克制。 */

:root {
  --bg:          #0b0e14;
  --bg-soft:     #0f131b;
  --panel:       #141922;
  --panel-2:     #182029;
  --border:      #232b38;
  --border-soft: #1b222c;
  --text:        #d6dbe4;
  --text-dim:    #9aa4b4;
  --text-faint:  #6f7a8c;
  --accent:      #5eead4;
  --accent-dim:  #2c8a80;
  --warn:        #f0b429;
  --danger:      #f2777a;

  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
          "Liberation Mono", "DejaVu Sans Mono", "Noto Sans Mono CJK SC",
          "Sarasa Mono SC", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --wrap: 1000px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(94, 234, 212, 0.24); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, pre, kbd, samp {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #eef2f7;
  margin: 0 0 12px;
}

p { margin: 0 0 14px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  color: var(--accent);
  padding: 10px 16px;
  z-index: 100;
  font-family: var(--mono);
}
.skip:focus { left: 12px; top: 12px; }

/* ───────────────────────── 顶部导航 ───────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 20, 0.92);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 58px;
}

.brand {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-sub { color: var(--text-faint); }

.nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--accent); text-decoration: none; border-bottom-color: var(--accent-dim); }

.topbar-actions { display: flex; gap: 10px; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  padding: 8px 14px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  background: rgba(94, 234, 212, 0.08);
  color: var(--accent);
  white-space: nowrap;
}
.btn:hover { background: rgba(94, 234, 212, 0.16); text-decoration: none; }
.btn-ghost { border-color: var(--border); background: transparent; color: var(--text-dim); }
.btn-ghost:hover { border-color: var(--accent-dim); color: var(--accent); background: transparent; }

/* ───────────────────────── HERO ───────────────────────── */

.hero {
  position: relative;
  padding: 84px 0 64px;
  border-bottom: 1px solid var(--border-soft);
  background-color: var(--bg);
}

/* 网格画在伪元素上并向下渐隐 —— 直接画在 .hero 的 background 上时，
   网格会在 hero 底部硬切断，与下方纯黑背景之间留下一条明显的水平线。 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--border-soft) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px) 0 0 / 44px 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.hero > * { position: relative; z-index: 1; }

.kicker {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-dim);
  letter-spacing: 0.06em;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(30px, 5.4vw, 52px);
  margin-bottom: 22px;
  letter-spacing: -0.02em;
}

.lede {
  font-size: 17.5px;
  color: var(--text-dim);
  max-width: 68ch;
}
.lede strong { color: var(--text); font-weight: 600; }

/* 次级一句：场景证明。字更小、更暗，主句仍然是那条定位。 */
.lede-sub {
  font-size: 15px;
  color: var(--text-faint);
  margin-top: -2px;
}

.install {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 26px 0 18px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.install-prompt { color: var(--accent); font-family: var(--mono); }
.install-cmd { font-size: 15px; color: #e6edf6; overflow-x: auto; white-space: nowrap; }

.copy {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
}
.copy:hover { color: var(--accent); border-color: var(--accent-dim); }

.hero-note {
  font-size: 14.5px;
  color: var(--text-faint);
  max-width: 74ch;
}
.hero-note code { color: var(--text-dim); font-size: 13.5px; }

.promise-strip {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.promise-strip li {
  background: var(--bg-soft);
  padding: 16px 18px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.promise-strip .tag { display: block; width: fit-content; margin: 0 0 8px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
  white-space: nowrap;
}
.tag-strong { border-color: var(--accent); background: rgba(94, 234, 212, 0.13); }

/* ───────────────────────── 区块 ───────────────────────── */

.section { padding: 68px 0; border-bottom: 1px solid var(--border-soft); }
.section-alt { background: var(--bg-soft); }
.section-alt + .section { background: var(--bg); }

.section h2 {
  font-size: clamp(22px, 3.2vw, 30px);
  margin-bottom: 12px;
}
.section h2::before {
  content: "#";
  color: var(--accent-dim);
  margin-right: 10px;
  font-weight: 400;
}

.section-lede {
  color: var(--text-dim);
  max-width: 74ch;
  margin-bottom: 30px;
}

.section-lede code, .expected code, .plain-list code, td code, .rule code {
  font-size: 13px;
  color: #b9e6dd;
  background: rgba(94, 234, 212, 0.07);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* ───────────────────────── 代码块 ───────────────────────── */

pre {
  position: relative;
  margin: 0 0 16px;
  padding: 18px 18px 18px;
  background: #0a0d13;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  color: #cdd6e4;
  tab-size: 4;
}
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 9px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--panel);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: var(--radius);
  pointer-events: none;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; white-space: pre; }

pre.mini { font-size: 12.5px; padding: 14px 14px; margin-bottom: 10px; }

/* 语言标签占一行，代码从标签下方开始，避免首行被压住 */
pre[data-lang] { padding-top: 30px; }
pre.mini[data-lang] { padding-top: 26px; }

.expected {
  font-size: 13.5px;
  color: var(--text-faint);
  line-height: 1.7;
  margin: 0 0 20px;
}
.expected strong { color: var(--text-dim); font-weight: 600; }

/* ───────────────────────── 表格 ───────────────────────── */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}

thead th {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  color: var(--text-dim);
  line-height: 1.65;
}
tbody tr:last-child td { border-bottom: 0; }
tbody td strong { color: var(--text); font-weight: 600; }

.promise-table .col-promise { width: 130px; }
.promise-table .col-check { width: 42%; }
.promise-table td code { white-space: normal; }

.doc-table .col-when { width: 26%; }
.doc-table td:first-child { white-space: nowrap; }
.doc-table td:first-child a code { background: rgba(94, 234, 212, 0.07); }

.migration-table { min-width: 0; }
.migration-table .col-arrow { width: 56px; text-align: center; color: var(--accent-dim); }
.migration-table tbody td:first-child code,
.migration-table tbody td:last-child code {
  white-space: nowrap;
  background: rgba(94, 234, 212, 0.07);
}
.migration-table tbody td:last-child code { color: #b9e6dd; }

/* ───────────────────────── 步骤列表 ───────────────────────── */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.steps > li {
  border-left: 1px solid var(--border);
  padding: 0 0 34px 26px;
  margin-left: 12px;
  position: relative;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--accent-dim);
}
.steps > li:last-child::before { background: var(--accent); border-color: var(--accent); }

.step-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.step-no {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.step-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: #e6edf6; }

/* ───────────────────────── 卡片 / 网格 ───────────────────────── */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

/* 四个维度用 2×2，比 auto-fit 的三栏均衡（auto-fit 会把第四张挤到第二行）。 */
.grid-dim {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}
.card h3 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.card .expected { margin-bottom: 0; }

.plain-list { margin: 0 0 12px; padding-left: 20px; color: var(--text-dim); font-size: 14px; }
.plain-list li { margin-bottom: 6px; }

/* ───────────────────────── 架构图 ───────────────────────── */

.arch {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 24px;
  margin-bottom: 26px;
}

.arch-layer {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 18px 20px;
}
.arch-layer-infra { border-left-color: var(--warn); }
/* 上面两层：长在本仓库之上（技能包 / 你的应用），比核心层淡一档。 */
.arch-layer-top { border-left-color: var(--accent-dim); }
.arch-layer-outside {
  border-style: dashed;
  border-left-style: solid;
  border-left-color: var(--accent-dim);
}

.arch-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.arch-path {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: #e6edf6;
}
.arch-layer-infra .arch-path { color: #f4d08a; }
.arch-role {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 7px;
}

.arch-desc { font-size: 14px; color: var(--text-dim); margin-bottom: 14px; max-width: 82ch; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chips li {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 3px 9px;
}

.arch-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  text-align: center;
}
.arch-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--accent-dim);
}
.arch-arrow-up {
  border-top: 0;
  border-bottom: 10px solid var(--accent-dim);
}

.arch-link-text {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 0.06em;
}
.arch-link-note {
  font-size: 12.5px;
  color: var(--text-faint);
  max-width: 78ch;
  line-height: 1.7;
}
.arch-link-note strong { color: var(--text-dim); font-weight: 600; }
.arch-link-note code { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* 模块地图：每层一行，路径不被折行切开。 */
.modmap { margin: 0 0 22px; }
.modmap-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.modmap-row:last-child { margin-bottom: 0; }
.modmap-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  min-width: 54px;
}
/* 与架构图同一套色：harness 是青，infra 是琥珀。 */
.modmap-label-harness { color: var(--accent); }
.modmap-label-infra { color: var(--warn); }

/* 四条规则排 2×2（280px 的 auto-fit 会排成 3+1）。 */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.rule {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--panel);
}
.rule h3 { font-size: 13.5px; color: var(--text); margin-bottom: 8px; }
.rule p { font-size: 13.5px; color: var(--text-faint); margin: 0; line-height: 1.7; }

/* ───────────────────────── CTA ───────────────────────── */

.cta { text-align: left; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 0; }

/* ───────────────────────── 页脚 ───────────────────────── */

.footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 44px 0 26px;
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
}
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.footer-col p { font-size: 13px; color: var(--text-faint); margin: 0; line-height: 1.7; }
.footer-head {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.footer-col a { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.footer-col a:hover { color: var(--accent); }

.footer-base {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}
.footer-base p { font-family: var(--mono); font-size: 12px; color: var(--text-faint); margin: 0; }

/* ───────────────────────── 响应式 ───────────────────────── */

@media (max-width: 860px) {
  .topbar-inner { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 12px; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 16px; }
  .topbar-actions { margin-left: auto; }
  .hero { padding: 56px 0 44px; }
  .section { padding: 48px 0; }
  .arch { padding: 16px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .btn { padding: 7px 11px; font-size: 12px; }
  .promise-strip { grid-template-columns: 1fr; }
  .steps > li { padding-left: 18px; margin-left: 6px; }
  pre { font-size: 12.5px; padding: 14px; }
  table { font-size: 13px; }
  .install { width: 100%; }

  /* 宽表在窄屏上改成堆叠卡片，避免横向裁切 */
  .promise-table, .doc-table,
  .promise-table tbody, .doc-table tbody,
  .promise-table tr, .doc-table tr,
  .promise-table td, .doc-table td {
    display: block;
    width: auto;
    min-width: 0;
  }
  .promise-table thead, .doc-table thead { display: none; }
  .promise-table tr, .doc-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .promise-table tr:last-child, .doc-table tr:last-child { border-bottom: 0; }
  .promise-table td, .doc-table td { border: 0; padding: 4px 0; }
  .promise-table .col-promise { width: auto; margin-bottom: 4px; }
  .promise-table .col-check { width: auto; }
  .doc-table td:first-child { white-space: normal; margin-bottom: 4px; }
  .doc-table .col-when { width: auto; }
  .doc-table .col-when::before {
    content: "什么时候读：";
    color: var(--text-faint);
  }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .copy { display: none; }
}
