/* ============================================================
   Linux 运维与安全专家 · 一站式学习站点 共享样式
   离线可用：无外部字体 / 无 CDN 依赖
   ============================================================ */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #21303a;
  --ink-soft: #43535f;
  --muted: #6b7c88;
  --line: #dbe4e0;
  --line-strong: #c3d0cb;
  --accent: #0e7a6b;        /* 青绿，终端气息 */
  --accent-deep: #0a5f53;
  --accent-soft: #e2f2ee;
  --amber: #b45309;
  --amber-soft: #fdf1e0;
  --red: #b91c1c;
  --red-soft: #fdeaea;
  --blue: #1d5fa8;
  --blue-soft: #e8f0fa;
  --code-bg: #101d2a;
  --code-ink: #dbe7ee;
  --code-key: #7dd3c0;
  --code-str: #fcd9a8;
  --mono: "Consolas", "SF Mono", "Cascadia Code", "Courier New", monospace;
  --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 40, 35, 0.08), 0 6px 18px rgba(20, 40, 35, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: #10231f;
  color: #e8f2ee;
  box-shadow: var(--shadow);
}
.topbar .brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.topbar .brand::before {
  content: "> ";
  color: #4fd1a6;
}
.topbar .crumb {
  color: #9fc4b9;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .topnav {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.topbar .topnav a {
  color: #cfe6df;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid #2b4a42;
  border-radius: 6px;
}
.topbar .topnav a:hover { background: #1d4038; color: #fff; }

/* ---------- 布局 ---------- */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 22px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}
@media (min-width: 1024px) {
  main.with-toc {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}
.content { min-width: 0; }
.content > .page-head { margin-bottom: 18px; }

/* 页内目录（侧栏） */
.toc {
  display: none;
}
@media (min-width: 1024px) {
  .toc {
    display: block;
    position: sticky;
    top: 74px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow: auto;
    font-size: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 12px;
  }
  .toc h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 0 0 8px;
    font-weight: 600;
  }
  .toc a {
    display: block;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 5px;
    border-left: 2px solid transparent;
  }
  .toc a:hover { background: var(--accent-soft); color: var(--accent-deep); }
  .toc a.lv2 { padding-left: 20px; font-size: 12.5px; color: var(--muted); }
}

/* ---------- 标题 ---------- */
h1 {
  font-size: 30px;
  line-height: 1.3;
  margin: 6px 0 6px;
  letter-spacing: 0.2px;
}
h2 {
  font-size: 22px;
  margin: 42px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
  scroll-margin-top: 76px;
}
h2 .sec-no {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85em;
  margin-right: 8px;
}
h3 {
  font-size: 18px;
  margin: 30px 0 10px;
  scroll-margin-top: 76px;
}
h4 { font-size: 16px; margin: 22px 0 8px; }
p { margin: 10px 0; }
ul, ol { margin: 10px 0; padding-left: 26px; }
li { margin: 5px 0; }
strong { color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--line); margin: 30px 0; }
.lead {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 72ch;
}
.page-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 1px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- 代码 ---------- */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #e8efec;
  color: #0b5d4f;
  padding: 1px 6px;
  border-radius: 4px;
  word-break: break-word;
}
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
  margin: 14px 0;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
pre.cmd { border-left: 4px solid var(--accent); }
pre.conf { border-left: 4px solid var(--amber); }
pre .cm { color: #7f9aa8; }          /* 注释 */
pre .k  { color: var(--code-key); }  /* 关键字/命令 */
pre .s  { color: var(--code-str); }  /* 字符串/路径 */
.kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #eef2f0;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 7px;
  white-space: nowrap;
}
/* 终端窗口外观 */
.term {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 14px 0;
}
.term-bar {
  background: #1d2c36;
  color: #9fb8c3;
  font-size: 12px;
  padding: 6px 12px;
  font-family: var(--mono);
  display: flex;
  gap: 6px;
  align-items: center;
}
.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.term-bar .dot.r { background: #f06a5a; }
.term-bar .dot.y { background: #f5b04a; }
.term-bar .dot.g { background: #57c78a; }
.term pre { margin: 0; border-radius: 0; }

/* ---------- 表格 ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14.5px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead th {
  background: #eef3f1;
  color: var(--ink-soft);
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line-strong);
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7faf9; }
td code, th code { white-space: nowrap; }

/* ---------- 提示框 ---------- */
.callout {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 15px;
  border-left: 4px solid;
}
.callout .co-title { font-weight: 700; display: block; margin-bottom: 4px; }
.callout.note { background: var(--blue-soft); border-color: var(--blue); }
.callout.note .co-title { color: var(--blue); }
.callout.tip { background: var(--accent-soft); border-color: var(--accent); }
.callout.tip .co-title { color: var(--accent-deep); }
.callout.warn { background: var(--amber-soft); border-color: var(--amber); }
.callout.warn .co-title { color: var(--amber); }
.callout.danger { background: var(--red-soft); border-color: var(--red); }
.callout.danger .co-title { color: var(--red); }

/* ---------- 卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0;
}
@media (min-width: 768px) { .cards.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .cards.cols-4 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .cards, .cards.cols-3, .cards.cols-4 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h4 { margin: 0 0 8px; font-size: 15.5px; }
.card h4 .idx {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8em;
  margin-right: 6px;
}
.card p { margin: 6px 0 0; font-size: 14px; color: var(--ink-soft); }
.card ul { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-soft); padding-left: 18px; }

/* ---------- 首页 Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0f2b26 0%, #123a31 60%, #14463a 100%);
  color: #e9f5f1;
  border-radius: 16px;
  padding: 40px 34px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-size: 34px;
  margin: 0 0 10px;
  color: #fff;
  letter-spacing: 0.5px;
}
.hero .sub { font-size: 16.5px; color: #b9d8cd; max-width: 62ch; }
.hero .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: #8fc9b4;
}
.hero .meta-line span { background: rgba(255,255,255,0.07); padding: 5px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); }
.hero::after {
  content: ">_";
  position: absolute;
  right: -14px;
  bottom: -28px;
  font-family: var(--mono);
  font-size: 140px;
  color: rgba(255,255,255,0.06);
  font-weight: 700;
  pointer-events: none;
}

/* ---------- 学习路线时间轴 ---------- */
.roadmap { margin: 24px 0; }
.roadmap .rm-stage {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  margin: 0;
  position: relative;
}
.roadmap .rm-stage::before {
  content: "";
  position: absolute;
  left: 42px;
  top: 26px;
  bottom: -26px;
  width: 2px;
  background: var(--line-strong);
}
.roadmap .rm-stage:last-child::before { display: none; }
.roadmap .rm-week {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
  align-self: start;
  z-index: 1;
}
.roadmap .rm-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.roadmap .rm-body h4 { margin: 0 0 6px; font-size: 16px; }
.roadmap .rm-body p { margin: 4px 0; font-size: 14px; color: var(--ink-soft); }
.roadmap .rm-body .rm-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.roadmap .rm-body .rm-tags span {
  font-size: 12px;
  background: #eef3f1;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 2px 10px;
  border-radius: 999px;
}

/* 每日时间块 */
.daybar { margin: 16px 0; }
.daybar .db-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
}
.daybar .db-name { font-size: 14px; color: var(--ink-soft); text-align: right; }
.daybar .db-track { background: #e9efec; border-radius: 8px; height: 30px; position: relative; overflow: hidden; }
.daybar .db-fill {
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  font-family: var(--mono);
  white-space: nowrap;
}
.db-fill.f1 { background: #0e7a6b; }
.db-fill.f2 { background: #1d5fa8; }
.db-fill.f3 { background: #b45309; }

/* ---------- SVG 示意图 ---------- */
.dia-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 18px 0;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.dia-wrap .dia-cap {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
  text-align: center;
}
.dia-wrap svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.dia-wrap .note-line { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
svg text { font-family: var(--sans); }
.dia-node {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.dia-node.alt { stroke: var(--amber); }
.dia-node.deep { fill: var(--accent-soft); stroke: var(--accent); }
.dia-arrow { stroke: var(--line-strong); stroke-width: 1.5; fill: none; marker-end: url(#arr); }
.dia-arrow.hot { stroke: var(--amber); }
.dia-label { fill: var(--ink); font-size: 13px; }
.dia-label.sm { font-size: 11.5px; fill: var(--muted); }
.dia-label.dim { fill: var(--muted); }

/* ---------- 自测题 ---------- */
.quiz {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 22px 0;
}
.quiz h3 { margin: 0 0 10px; font-size: 16px; color: var(--blue); }
.quiz ol { margin: 6px 0 0; }
.quiz li { margin: 8px 0; font-size: 15px; }
.quiz details {
  background: #f3f7f6;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 12px;
}
.quiz summary { cursor: pointer; font-weight: 600; color: var(--accent-deep); font-size: 14px; }
.quiz details pre { margin: 8px 0 0; }

/* ---------- 章间导航 ---------- */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.chapter-nav a {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 48%;
}
.chapter-nav a:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.chapter-nav a.next { text-align: right; margin-left: auto; }
.chapter-nav .cap { display: block; font-size: 12px; color: var(--muted); }
.chapter-nav .txt { font-weight: 600; }

/* ---------- 页脚 ---------- */
.sitefoot {
  background: #10231f;
  color: #8fb3a8;
  text-align: center;
  padding: 18px 20px;
  font-size: 13px;
}
.sitefoot code { background: none; color: #7dd3c0; }

/* ---------- 目录卡索引（首页） ---------- */
.ch-index { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 900px) { .ch-index { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .ch-index { grid-template-columns: 1fr; } }
.ch-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ch-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,122,107,0.12); }
.ch-item .no { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 700; }
.ch-item .tt { font-size: 16px; font-weight: 700; }
.ch-item .ds { font-size: 13px; color: var(--muted); line-height: 1.6; }
.ch-item.stage {
  background: #10231f;
  color: #e9f5f1;
  border: none;
}
.ch-item.stage .no { color: #4fd1a6; }
.ch-item.stage .ds { color: #9fc4b9; }

/* ---------- 进度/学习清单 ---------- */
.checklist { list-style: none; padding-left: 0; }
.checklist li { padding-left: 28px; position: relative; margin: 8px 0; }
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
}

/* 打印 */
@media print {
  .topbar, .toc, .chapter-nav, .sitefoot { display: none; }
  body { background: #fff; }
  main { display: block; }
  pre { white-space: pre-wrap; }
  a { color: var(--ink); }
}

/* 移动端微调 */
@media (max-width: 700px) {
  body { font-size: 15px; }
  h1 { font-size: 25px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 27px; }
  .topbar { padding: 8px 14px; }
  .roadmap .rm-stage { grid-template-columns: 66px 1fr; gap: 10px; }
  .roadmap .rm-stage::before { left: 32px; }
  table { font-size: 13.5px; }
  thead th { white-space: normal; }
}
