/* ==========================================================================
   Reasonix 介绍站点 — 共享样式
   方向: Terminal-native —— 像在真实终端里认识 Reasonix
   色系: GitHub dark 终端色 (绿=成功/主操作, 蓝=信息, 红=错误, 黄=警告)
   ========================================================================== */

:root {
  /* 表面 */
  --bg: #0d1117;
  --bg-grid: rgba(110, 118, 129, 0.05);
  --surface: #161b22;
  --surface-2: #1c2128;
  --surface-3: #21262d;
  --border: #30363d;
  --border-soft: #21262d;

  /* 文本 */
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;

  /* 语义色（终端语义） */
  --green: #3fb950;   /* 成功 / 主操作 */
  --green-dim: rgba(63, 185, 80, 0.12);
  --blue: #58a6ff;    /* 信息 / 链接 */
  --blue-dim: rgba(88, 166, 255, 0.12);
  --red: #f85149;     /* 错误 / 危险 */
  --yellow: #d29922;  /* 警告 */
  --yellow-dim: rgba(210, 153, 34, 0.12);

  /* 字体 */
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", "Fira Code",
          "Consolas", "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          "Noto Sans SC", system-ui, -apple-system, sans-serif;

  /* 度量 */
  --radius: 8px;
  --radius-sm: 4px;
  --nav-h: 56px;
  --shell-w: 1120px;
  --focus: 2px solid var(--blue);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

::selection { background: var(--blue-dim); color: var(--text); }

:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  width: min(var(--shell-w), 100% - 48px);
  margin-inline: auto;
}

.mono { font-family: var(--mono); }

/* ---------- 顶部导航 ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.topnav .shell {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .prompt { color: var(--green); font-weight: 700; }
.brand .ver {
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
}
.nav-links a[aria-current="page"] {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.35);
}

.nav-cta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--bg) !important;
  background: var(--green);
  border: none !important;
  font-weight: 600;
  padding: 6px 14px !important;
}
.nav-cta:hover { background: #46c75a; color: var(--bg) !important; }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  width: 40px;
  height: 36px;
  cursor: pointer;
}

/* ---------- 页头（每页终端式标题） ---------- */
.page-head {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 48px;
}

.kicker {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.kicker::before { content: "$ "; color: var(--green); }

.page-head h1 {
  font-family: var(--mono);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.5px;
}
.page-head h1 .hl { color: var(--green); }
.page-head .lede {
  margin-top: 14px;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.02rem;
}

/* ---------- 区块标题 ---------- */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--border-soft); }

.sec-head { margin-bottom: 32px; }
.sec-head .idx {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  display: block;
  margin-bottom: 6px;
}
.sec-head h2 {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.sec-head h2 .mark { color: var(--green); }
.sec-head p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 640px;
  font-size: 0.98rem;
}

/* ---------- 首页 hero ---------- */
.hero {
  padding: 72px 0 88px;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 56px;
  align-items: center;
}

.hero-copy h1 {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 3.9vw, 2.6rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.8px;
}
.hero-copy h1 .l1,
.hero-copy h1 .l2 { display: block; }
.hero-copy h1 .accent { color: var(--green); }
.hero-copy h1 .caret::after {
  content: "▋";
  color: var(--green);
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.hero-copy .sub {
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 560px;
  line-height: 1.85;
}

.hero-cta {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--green); color: var(--bg) !important; }
.btn-primary:hover { background: #46c75a; }

.btn-ghost {
  color: var(--text) !important;
  border-color: var(--border);
  background: var(--surface);
}
.btn-ghost:hover { border-color: var(--muted); background: var(--surface-2); }

.hero-meta {
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.hero-meta .ok::before { content: "✓ "; color: var(--green); }

/* ---------- 终端窗口 ---------- */
.term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
}
.term-bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.term-bar .dot:nth-child(1) { background: var(--red); }
.term-bar .dot:nth-child(2) { background: var(--yellow); }
.term-bar .dot:nth-child(3) { background: var(--green); }
.term-bar .title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin-left: 8px;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-body {
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  overflow-x: auto;
}
.term-body .line { white-space: pre; }
.term-body .p { color: var(--green); font-weight: 700; }
.term-body .c { color: var(--faint); }        /* 注释/路径 */
.term-body .ok { color: var(--green); }
.term-body .info { color: var(--blue); }
.term-body .warn { color: var(--yellow); }
.term-body .err { color: var(--red); }
.term-body .dim { color: var(--faint); }
.term-body .hl2 { color: var(--text); font-weight: 600; }

.term-body .cursor::after {
  content: "▋";
  color: var(--green);
  animation: caret 1.1s steps(1) infinite;
}

/* 打字动画：播放中逐行显示，无 JS 或 reduced-motion 时全部显示 */
.term[data-type] .line { display: none; }
.term[data-type].typing .line,
.term[data-type][data-typed="done"] .line,
.term[data-type="off"] .line { display: block; }
.no-js .term[data-type] .line, .no-js .term[data-type] .cursor { display: block; }

/* ---------- 行式特性列表（首页 / features） ---------- */
.feature-list { display: grid; gap: 0; }
.feature-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 3fr) minmax(0, 4fr) 120px;
  gap: 20px;
  align-items: baseline;
  padding: 22px 8px;
  border-top: 1px solid var(--border-soft);
}
.feature-row:last-child { border-bottom: 1px solid var(--border-soft); }
.feature-row .no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}
.feature-row .no::before { content: "["; }
.feature-row .no::after { content: "]"; }
.feature-row h3 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
}
.feature-row h3 a { color: var(--text); }
.feature-row h3 a:hover { color: var(--green); text-decoration: none; }
.feature-row h3 .tag {
  font-size: 11px;
  color: var(--blue);
  border: 1px solid rgba(88, 166, 255, 0.4);
  background: var(--blue-dim);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: 2px;
  font-weight: 400;
}

/* 通用标签（标题旁） */
.tag {
  font-size: 11px;
  color: var(--blue);
  border: 1px solid rgba(88, 166, 255, 0.4);
  background: var(--blue-dim);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: 4px;
  font-weight: 400;
  white-space: nowrap;
}
.feature-row p { color: var(--muted); font-size: 0.94rem; }
.feature-row .cmd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--yellow);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-row .cmd::before { content: "$ "; color: var(--faint); }

/* 三亮点（首页） */
.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.trio-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 22px 20px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.trio-item:hover { border-color: var(--muted); transform: translateY(-2px); }
.trio-item .k {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--green);
  display: block;
  margin-bottom: 8px;
}
.trio-item h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 6px; }
.trio-item p { color: var(--muted); font-size: 0.9rem; line-height: 1.7; }

/* ---------- 命令块 ---------- */
.cmdblock {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  overflow-x: auto;
}
.cmdblock code, .cmdblock pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre;
}
.cmdblock .pc { color: var(--green); font-weight: 700; }
.cmdblock .path { color: var(--faint); }
.cmdblock .flag { color: var(--blue); }
.cmdblock .arg { color: var(--yellow); }
.cmdblock .cm { color: var(--faint); }
.cmdblock .out { color: var(--muted); }

.cmdblock.has-copy { padding-right: 92px; }

/* 复制按钮 */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.copy-btn[data-state="ok"] {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-dim);
}

/* ---------- 表格（命令速查） ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.cmdtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  min-width: 720px;
}
.cmdtable thead th {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cmdtable tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.cmdtable tbody tr:last-child td { border-bottom: none; }
.cmdtable tbody tr:hover { background: rgba(110, 118, 129, 0.06); }
.cmdtable td.cmd {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.cmdtable td.cmd .flag { color: var(--blue); }
.cmdtable td.desc { color: var(--muted); }
.cmdtable td.ex {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--yellow);
  white-space: nowrap;
}

/* ---------- 步骤（快速开始） ---------- */
.steps { counter-reset: step; display: grid; gap: 24px; }
.step {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.step-num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.4);
  background: var(--green-dim);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step h3 { font-family: var(--mono); font-size: 1.02rem; font-weight: 600; margin-bottom: 8px; }
.step h3 .en { color: var(--faint); font-weight: 400; font-size: 0.85em; margin-left: 8px; }
.step p, .step li { color: var(--muted); font-size: 0.94rem; }
.step ul { margin: 8px 0 0 20px; }
.step .note {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--yellow);
  background: var(--yellow-dim);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--mono);
}

/* ---------- 架构：配置优先级栈 ---------- */
.stack { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.stack-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 13.5px;
}
.stack-row:first-child { border-top: none; }
.stack-row .lv {
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  background: var(--green);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.stack-row .lv.l2 { background: var(--blue); }
.stack-row .lv.l3 { background: var(--yellow); color: var(--bg); }
.stack-row .lv.l4 { background: var(--muted); }
.stack-row .path2 { color: var(--text); }
.stack-row .why { color: var(--faint); margin-left: auto; font-size: 12px; flex-shrink: 0; }
.stack .arrow { text-align: center; color: var(--green); font-family: var(--mono); font-size: 13px; padding: 6px 0; background: var(--surface-2); border-top: 1px solid var(--border-soft); }

/* ---------- ASCII 目录树 ---------- */
pre.tree {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
}
pre.tree .d { color: var(--blue); }
pre.tree .f { color: var(--text); }
pre.tree .cm { color: var(--faint); }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq details { border-top: 1px solid var(--border-soft); background: var(--surface); }
.faq details:first-child { border-top: none; }
.faq summary {
  cursor: pointer;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--green); font-weight: 700; }
.faq details[open] summary::before { content: "−"; }
.faq summary:hover { background: var(--surface-2); }
.faq .faq-body { padding: 0 20px 18px 46px; color: var(--muted); font-size: 0.93rem; }
.faq .faq-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--yellow);
  background: var(--surface-3);
  border-radius: 3px;
  padding: 1px 6px;
}

/* ---------- 内联代码 ---------- */
code.inline {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--yellow);
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 1px 6px;
}

/* ---------- 提示条 ---------- */
.note-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 18px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.93rem;
}
.note-box.warn { border-left-color: var(--yellow); }
.note-box.err { border-left-color: var(--red); }
.note-box .lb {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.note-box.warn .lb { color: var(--yellow); }
.note-box.err .lb { color: var(--red); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}
.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  padding: 28px 0;
}
.site-footer .f-brand { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.site-footer .f-brand .prompt { color: var(--green); }
.site-footer .f-links { display: flex; gap: 20px; margin-left: auto; font-size: 0.9rem; }
.site-footer .f-copy {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

/* ---------- 404 ---------- */
.err404 { text-align: center; padding: 96px 24px; }
.err404 .code {
  font-family: var(--mono);
  font-size: clamp(4rem, 10vw, 6.5rem);
  font-weight: 700;
  color: var(--red);
  line-height: 1;
}
.err404 .code .z { color: var(--faint); }
.err404 h1 { font-family: var(--mono); font-size: 1.3rem; margin: 18px 0 10px; }
.err404 p { color: var(--muted); max-width: 420px; margin: 0 auto 26px; }

/* ---------- 动画 ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.45s ease, transform 0.45s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
  .trio { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 48px minmax(0, 1fr); }
  .feature-row .cmd { display: none; }
  .site-footer .f-links { margin-left: 0; }
}

@media (max-width: 720px) {
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px; }
  .nav-toggle { display: block; }
  .step { grid-template-columns: 1fr; }
  .step-num { width: 40px; height: 40px; }
  .page-head { padding: 44px 0 30px; margin-bottom: 36px; }
  .section { padding: 40px 0; }
  .shell { width: calc(100% - 32px); }
}

/* 极窄屏：主标题降字号，避免折行 */
@media (max-width: 359px) {
  .hero-copy h1 { font-size: 1.45rem; }
}

/* ---------- 减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-copy h1 .caret::after, .term-body .cursor::after { animation: none; }
  .term[data-type] .line { display: block; }
}

/* ---------- 打印 ---------- */
@media print {
  .topnav, .site-footer, .copy-btn, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
