/* ============================================================
   图书带货 · 从 0 到第 1 单（book.09688.cn）
   移动端优先 / 米白底 + 深灰正文 + 暖棕强调 / 零外链资源
   ============================================================ */

:root {
  --bg: #f7f3ec;          /* 米白底 */
  --bg-soft: #efe8da;     /* 稍深米色（表头、代码块） */
  --ink: #33302a;         /* 深灰正文 */
  --ink-soft: #6f675b;    /* 次级灰 */
  --accent: #8a5a2b;      /* 暖棕强调色 */
  --accent-deep: #6d451f;
  --line: #e2d9c8;        /* 分隔线 */
  --warn: #b0492f;        /* 红线警示边框 */
  --warn-bg: #faeee7;     /* 红线警示浅底 */
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

/* 无障碍：跳到正文 */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 14px;
  border-radius: 0 0 8px 0; text-decoration: none;
}
.skip:focus { left: 0; }

/* ---------- 顶部导航（sticky，高 48px，移动端不超 60px） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  background: rgba(247, 243, 236, 0.96);
  border-bottom: 1px solid var(--line);
}
.brand {
  flex: 0 0 auto;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent-deep); text-decoration: none;
}
.chipnav {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chipnav::-webkit-scrollbar { display: none; }
.chipnav a {
  flex: 0 0 auto;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 12.5px; line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}
.chipnav a.is-active { background: var(--accent); color: #fff; }

/* ---------- 版心 ---------- */
.wrap { max-width: 768px; margin: 0 auto; padding: 0 18px; }

.hero { padding: 36px 0 6px; scroll-margin-top: 58px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 6.4vw, 34px);
  line-height: 1.35;
  letter-spacing: 0.01em;
}
.hero-sub { margin: 0 0 8px; }
.hero-tagline { margin: 0 0 26px; color: var(--ink-soft); font-size: 14px; }
.hero-path-title { font-size: 17px; margin: 0 0 4px; }

.chapter { padding: 32px 0 6px; border-top: 1px solid var(--line); scroll-margin-top: 58px; }

h2 {
  margin: 0 0 6px;
  font-size: clamp(20px, 5vw, 26px);
  line-height: 1.4;
  color: var(--accent-deep);
}
h3 {
  margin: 26px 0 10px;
  font-size: 17.5px;
  line-height: 1.5;
}
h3::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: 4px;
}

p { margin: 12px 0; }
ol, ul { margin: 12px 0; padding-left: 24px; }
li { margin: 6px 0; }
li::marker { color: var(--accent); font-weight: 700; }

.muted { color: var(--ink-soft); font-weight: 400; font-size: 14px; }
.small { font-size: 12.5px; }

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

/* ---------- 表格（容器内横向滚动，375px 不撑破页面） ---------- */
.table-wrap {
  margin: 14px 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 430px;
  border-collapse: collapse;
  background: #fdfbf7;
  font-size: 14.5px;
  line-height: 1.65;
}
.table-narrow { min-width: 300px; }
.table-wide { min-width: 520px; }
th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
th { background: var(--bg-soft); font-weight: 700; white-space: nowrap; }
tbody tr:nth-child(even) { background: #f9f5ed; }

/* 红线/禁止内容：左边框 + 浅底色（醒目但克制） */
.warn-table {
  padding: 6px 6px 6px 10px;
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
}

/* ---------- 代码块（公式/流水线） ---------- */
pre {
  margin: 14px 0 18px;
  padding: 13px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- 引用 / 警示块 ---------- */
blockquote {
  margin: 14px 0 18px;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: #f1ebdf;
  border-radius: 0 8px 8px 0;
}
blockquote p { margin: 6px 0; }

.callout {
  margin: 14px 0 18px;
  padding: 10px 16px 8px;
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
}
.callout > :first-child { margin-top: 4px; }
.callout > :last-child { margin-bottom: 4px; }

/* ---------- 按钮 ---------- */
.cta-row { margin: 16px 0 6px; }
.btn {
  display: inline-block;
  padding: 9px 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover, .btn:focus-visible { background: var(--accent-deep); color: #fff; }

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

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 42px;
  padding: 30px 0 64px;
  border-top: 2px solid var(--accent);
  background: #f2ecdf;
  scroll-margin-top: 58px;
}
.site-footer h2 { font-size: 20px; }
.toolbox { list-style: none; margin: 10px 0 18px; padding: 0; }
.toolbox li {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.toolbox li:last-child { border-bottom: none; }

.daizuo { margin-top: 22px; }
.site-footer blockquote { margin: 20px 0 14px; font-size: 14px; }
.legal { margin: 4px 0; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- 回到顶部 ---------- */
.backtop {
  position: fixed; right: 16px; bottom: 18px; z-index: 60;
  width: 44px; height: 44px;
  border: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 20px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(51, 48, 42, 0.22);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.backtop.is-visible { opacity: 1; visibility: visible; }
.backtop:hover { background: var(--accent-deep); }

/* ---------- 桌面端微调 ---------- */
@media (min-width: 768px) {
  .topbar { padding: 0 24px; }
  .brand { font-size: 15px; }
  .hero { padding-top: 52px; }
  .toolbox li { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .backtop { transition: none; }
}
