/* 规划模块 · 站点外壳 + 阅读器布局（对齐 dca 等工具样式） */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #eeede7;
  --ink: #24231f;
  --ink-2: #56544c;
  --muted: #6b685d;
  --line: #e7e5dc;
  --line-strong: #d9d6ca;
  --accent: #5f7c61;
  --accent-deep: #42584a;
  --accent-soft: #e6ece1;
  --ok: #4f9d6b;
  --warning: #a47735;
  --danger: #b0594b;
  --radius-panel: 18px;
  --radius-control: 10px;
  --radius-small: 7px;
  --shadow-sm: 0 1px 2px rgba(36, 35, 31, 0.05), 0 4px 12px rgba(36, 35, 31, 0.05);
  --shadow-md: 0 2px 6px rgba(36, 35, 31, 0.05), 0 16px 40px rgba(36, 35, 31, 0.10);
  --font-display: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- 顶栏与品牌（对齐 dca 等工具样式）---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.brand__mark svg {
  width: 36px;
  height: 36px;
  display: block;
}
.brand__word { display: flex; flex-direction: column; line-height: 1.15; }
.brand__word strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.brand__word small { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em; color: var(--muted); }

.topbar__meta { display: flex; align-items: center; gap: 22px; }
.back { font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent-deep); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(79, 157, 107, 0.14); }

/* ---- 容器与标题区 ---- */
.main {
  flex: 1;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 60px;
}

.hero {
  max-width: 760px;
  margin-bottom: 22px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}
.eyebrow__rule { width: 34px; height: 2px; border-radius: 2px; background: var(--accent); }

.hero__title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(25px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
}
.hero__lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 640px;
}

/* ---- 页脚 ---- */
.footer {
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ---- 阅读器：侧栏目录 + 内容 ---- */
.planner {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.planner__side {
  position: sticky;
  top: 88px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  padding: 12px;
}

.planner__nav { display: flex; flex-direction: column; gap: 2px; }

.doc-group + .doc-group { margin-top: 4px; }
.doc-group__head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-control);
  font: 600 13px/1.4 var(--font-body);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.doc-group__head:hover { background: var(--surface-2); }
.doc-group__chevron { flex: 0 0 auto; display: inline-flex; color: var(--muted); transition: transform 0.2s ease; }
.doc-group.is-open .doc-group__chevron { transform: rotate(90deg); }
.doc-group__label { flex: 1 1 auto; min-width: 0; }
.doc-group__count { flex: 0 0 auto; font: 500 10px/1 var(--font-mono); color: var(--muted); background: var(--surface-2); padding: 3px 6px; border-radius: var(--radius-small); }
.doc-group.is-active > .doc-group__head { color: var(--accent-deep); }
.doc-group.is-active .doc-group__count { background: var(--surface); }

.doc-group__body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px; }

.doc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px 8px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-control);
  font: 500 13.5px/1.4 var(--font-body);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.doc-link:hover { background: var(--surface-2); color: var(--ink); }
.doc-link.is-active { background: var(--accent-soft); color: var(--accent-deep); }
.doc-link.is-active .doc-link__title { color: var(--accent-deep); }
.doc-link__title { flex: 1 1 auto; min-width: 0; }

.planner__content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  min-width: 0;
}

.md-meta {
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.md-loading, .md-error { color: var(--muted); font-size: 14px; }

/* ---- Markdown 排版 ---- */
.md-view { font: 400 16px/1.75 var(--font-body); color: var(--ink); }
.md-view > *:first-child { margin-top: 0; }

.md-view h1, .md-view h2, .md-view h3, .md-view h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.3;
  margin: 1.6em 0 0.7em;
}
.md-view h1 { font-size: 26px; padding-bottom: 0.35em; border-bottom: 1px solid var(--line); }
.md-view h2 { font-size: 21px; padding-left: 10px; border-left: 4px solid var(--accent); margin-top: 1.9em; }
.md-view h3 { font-size: 17px; }
.md-view h4 { font-size: 15px; }

.md-view p { margin: 0.9em 0; }
.md-view strong { font-weight: 600; color: var(--ink); }
.md-view em { font-style: italic; }

.md-view a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.md-view a:hover { color: var(--accent); }

.md-view ul, .md-view ol { padding-left: 1.5em; margin: 0.9em 0; }
.md-view li { margin: 0.35em 0; }
.md-view li input[type="checkbox"] { margin-right: 0.5em; accent-color: var(--accent); }

.md-view blockquote {
  margin: 1.1em 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  color: var(--ink-2);
}
.md-view blockquote p { margin: 0.2em 0; }

.md-view hr { border: none; border-top: 1px solid var(--line); margin: 1.8em 0; }

.md-view code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  color: var(--accent-deep);
  padding: 2px 6px;
  border-radius: 5px;
}

.md-view pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1.1em 0;
}
.md-view pre code { background: transparent; color: var(--ink-2); padding: 0; border-radius: 0; font-size: 13px; line-height: 1.6; }

.md-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1em 0;
  font-size: 14px;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}
.md-view thead th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.md-view tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.md-view tbody tr:last-child td { border-bottom: none; }
.md-view tbody tr:hover { background: var(--accent-soft); }

/* ---- 响应式 ---- */
@media (max-width: 900px) {
  .planner { grid-template-columns: 1fr; }
  .planner__side { position: static; }
}

@media (max-width: 720px) {
  .planner__content { padding: 20px 18px; }
  .md-view { font-size: 15px; }
  .md-view h1 { font-size: 22px; }
  .md-view h2 { font-size: 18px; }
}
