/* =====================================================
   亚马逊开店手册 v2
   视觉参考：储能产品学习手册（indigo 渐变 + 卡片 + 图示）
   ===================================================== */

:root {
  --bg: #f5f6fa;
  --bg-soft: #eceef6;
  --card: #ffffff;
  --ink: #1f2937;
  --body: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef2ff;
  --grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --good: #059669;
  --good-soft: #ecfdf5;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --gray-soft: #f3f4f6;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 6px 24px rgba(23, 25, 60, .06);
  --shadow-lg: 0 16px 40px -20px rgba(23, 25, 60, .35);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.35; font-weight: 680; letter-spacing: -.01em; }
code { font-family: var(--mono); font-size: .86em; background: var(--gray-soft); padding: .12em .4em; border-radius: 5px; border: 1px solid var(--border); }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 .1em; }
::selection { background: #ddd6fe; }

.scrollbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--grad); z-index: 60; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 26px;
  background: rgba(245, 246, 250, .88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand-t { color: var(--ink); font-weight: 720; font-size: 14.5px; letter-spacing: -.01em; }

.searchbox {
  position: relative; flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  height: 37px; padding: 0 10px 0 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .16s, box-shadow .16s;
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.searchbox svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.7; flex: none; }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 13.5px; color: var(--ink); }
.searchbox input::placeholder { color: #9ca3af; }
.searchbox kbd { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

.results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 70;
  max-height: 60vh; overflow: auto; padding: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.r-item { display: block; padding: 10px 12px; border-radius: 9px; }
.r-item:hover, .r-item.active { background: var(--accent-soft); }
.r-title { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.r-meta { font-size: 11px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.r-snip { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.r-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.pill {
  margin-left: auto; flex: none; font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--border); background: var(--card);
  padding: 5px 12px; border-radius: 999px;
}
.pill b { color: var(--ink); }

/* ---------- 布局 ---------- */
.shell {
  display: grid; grid-template-columns: 232px minmax(0, 1fr);
  gap: 52px; max-width: 1150px; margin: 0 auto; padding: 32px 26px 80px;
}
.side { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
.side-label { font-size: 11px; letter-spacing: .12em; color: #9ca3af; text-transform: uppercase; margin: 0 0 12px 10px; }
.nav-item {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) 8px;
  align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px;
  font-size: 13px; color: var(--body);
}
.nav-item:hover { background: var(--card); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-num { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.nav-item.active .nav-num { color: var(--accent); }
.nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; justify-self: end; }
.nav-dot.on { background: var(--good); }
.side-foot { margin-top: 16px; padding: 14px 10px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.9; }
.side-foot button { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.side-foot button:hover { color: var(--accent); }

.page { min-width: 0; max-width: 780px; }

/* ---------- 首页 hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 44px 44px 40px; border-radius: var(--radius-lg);
  background: var(--grad); color: #fff;
  box-shadow: 0 20px 50px -30px rgba(79, 70, 229, .8);
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -60px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%);
}
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.75); margin: 0 0 16px; }
.hero h1 { color: #fff; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.3; letter-spacing: -.025em; max-width: 16em; }
.hero .sub { margin: 18px 0 0; max-width: 38em; color: rgba(255,255,255,.82); font-size: 15.5px; }
.hero-meta { display: flex; gap: 22px; margin: 24px 0 0; font-size: 12.5px; color: rgba(255,255,255,.72); }
.hero-meta b { color: #fff; font-size: 20px; font-weight: 700; margin-right: 4px; }
.hero .actions { display: flex; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); color: var(--ink); }
.btn.primary { background: #fff; border-color: #fff; color: #4f46e5; }
.btn.ghost-light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.btn.ghost-light:hover { color: #fff; background: rgba(255,255,255,.22); }

/* ---------- 目录卡片 ---------- */
.chapters { margin-top: 46px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.sec-head h2 { font-size: 21px; }
.sec-head p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.card {
  display: flex; flex-direction: column; min-height: 168px;
  padding: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c7d2fe; color: inherit; }
.card-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); align-self: flex-start; padding: 2px 8px; border-radius: 6px;
}
.card h3 { font-size: 16.5px; margin: 12px 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 12.8px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; padding-top: 14px; font-size: 11.5px; color: #9ca3af; }
.card.done { border-color: #a7f3d0; background: #fbfefd; }
.card.done .card-num { background: var(--good-soft); color: var(--good); }

.howto { margin-top: 46px; }
.howto h2 { font-size: 21px; margin-bottom: 16px; }
.howto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.howto-grid div { padding: 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.howto-grid b { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 6px; }
.howto-grid p { margin: 0; font-size: 12.8px; color: var(--muted); line-height: 1.7; }

.note {
  margin-top: 24px; padding: 16px 18px; background: #fffdf7;
  border: 1px solid #fde68a; border-radius: 12px; font-size: 13px; color: #78350f;
}

/* ---------- 章节头 ---------- */
.crumb { font-size: 12px; color: var(--muted); display: flex; gap: 8px; margin-bottom: 16px; }
.chapter-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 6px; }
.chapter-no {
  flex: none; width: 56px; height: 56px; border-radius: 14px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 19px; font-weight: 700;
  box-shadow: 0 8px 20px -10px rgba(79, 70, 229, .8);
}
.chapter-head h1 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.02em; padding-top: 4px; }
.lede { font-size: 16.5px; color: #4b5563; margin: 12px 0 16px; max-width: 40em; }
.meta { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.meta span::after { content: "·"; margin-left: 14px; color: #d1d5db; }
.meta span:last-of-type::after { content: ""; margin: 0; }
.read-btn {
  margin-left: auto; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; transition: all .15s;
}
.read-btn:hover { border-color: var(--accent); color: var(--accent); }
.read-btn.on { background: var(--good-soft); border-color: #a7f3d0; color: var(--good); }

.page-toc { margin: 22px 0 4px; }
.page-toc summary {
  cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--muted);
  display: inline-block; padding: 6px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.page-toc summary::-webkit-details-marker { display: none; }
.page-toc nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.page-toc a {
  font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 11px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-toc a:hover { color: var(--accent); border-color: #c7d2fe; background: var(--accent-soft); }

/* ---------- 正文 ---------- */
.prose { margin-top: 22px; font-size: 16.5px; line-height: 1.9; color: var(--body); }
.prose h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; margin: 46px 0 14px; padding-top: 16px; border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.prose h2 .sec-no {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: var(--grad); padding: 2px 7px; border-radius: 6px;
}
.prose h3 { font-size: 17px; margin: 28px 0 8px; scroll-margin-top: 80px; }
.prose p { margin: 0 0 15px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 1.3em; }
.prose li { margin-bottom: 5px; }
.prose li::marker { color: #a5b4fc; }
.prose blockquote {
  margin: 20px 0; padding: 14px 18px; background: var(--accent-soft);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  color: #3730a3; font-size: 15px;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 680; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13.5px; line-height: 1.7; background: var(--card); }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--gray-soft); color: var(--ink); font-weight: 650; }
.prose tbody tr:nth-child(even) { background: #fbfbfd; }
.table-wrap { overflow-x: auto; margin: 20px 0; }
.table-wrap table { margin: 0; }
.prose code { background: var(--gray-soft); }
.prose pre { background: #1e1b4b; color: #e0e7ff; padding: 16px 18px; border-radius: 12px; overflow: auto; font-size: 13px; line-height: 1.7; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose input[type="checkbox"] { margin-right: 8px; accent-color: var(--accent); }

/* ---------- 图示 / 标注 / 数字卡 ---------- */
.fig {
  margin: 26px 0; padding: 20px 20px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: center;
}
.fig svg { width: 100%; height: auto; max-width: 100%; display: block; margin: 0 auto; }
.fig figcaption { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.fig.wide { padding: 16px 12px 10px; }

.callout {
  margin: 20px 0; padding: 14px 18px 14px 16px;
  border-radius: 12px; border: 1px solid var(--border); border-left-width: 4px;
  background: var(--card); font-size: 15px; line-height: 1.8;
}
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout .label {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 1px 7px; border-radius: 5px; margin-right: 8px; vertical-align: 1px;
}
.callout.tip { border-left-color: var(--accent); background: #fafaff; }
.callout.tip .label { background: var(--accent-soft); color: var(--accent); }
.callout.warn { border-left-color: #f59e0b; background: #fffdf5; }
.callout.warn .label { background: #fef3c7; color: var(--warn); }
.callout.bad { border-left-color: #ef4444; background: #fffafa; }
.callout.bad .label { background: #fee2e2; color: var(--bad); }
.callout.good { border-left-color: #10b981; background: #f7fefb; }
.callout.good .label { background: #d1fae5; color: #047857; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 24px 0; }
.kpi { padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.kpi b { display: block; font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.kpi b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi span { font-size: 12px; color: var(--muted); }

.steps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0; }
.steps .step {
  flex: 1 1 120px; min-width: 110px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12.5px; line-height: 1.5;
}
.steps .step b { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--accent); margin-bottom: 3px; }
.steps .arrow { color: #c7d2fe; font-size: 16px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.tag {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.tag.gray { background: var(--gray-soft); color: var(--muted); }

/* ---------- 翻页 ---------- */
.pager { display: flex; gap: 12px; margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager a {
  flex: 1; padding: 14px 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
.pager a:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.pager .lbl { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.pager .ttl { font-weight: 650; color: var(--ink); }
.pager .next { text-align: right; }

.foot {
  max-width: 1150px; margin: 0 auto; padding: 22px 26px 38px;
  border-top: 1px solid var(--border); display: flex; justify-content: space-between;
  color: #9ca3af; font-size: 11.5px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding-top: 18px; }
  .side {
    position: static; max-height: none; overflow: visible;
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .side::-webkit-scrollbar { display: none; }
  .side-label, .side-foot { display: none; }
  .nav-item { border: 1px solid var(--border); background: var(--card); white-space: nowrap; grid-template-columns: 1fr; flex: 0 0 auto; }
  .nav-item.active { border-color: #c7d2fe; }
  .nav-num, .nav-dot { display: none; }
  .grid { grid-template-columns: 1fr; }
  .howto-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .top { padding: 0 14px; gap: 10px; }
  .brand-t { display: none; }
  .searchbox kbd { display: none; }
  .pill { font-size: 11px; padding: 4px 9px; }
  .shell { padding: 18px 14px 56px; }
  .hero { padding: 30px 24px 28px; }
  .chapter-head { gap: 12px; }
  .chapter-no { width: 44px; height: 44px; font-size: 15px; border-radius: 11px; }
  .prose { font-size: 16px; }
  .prose h2 { font-size: 19.5px; margin-top: 36px; }
  .prose table { font-size: 12.5px; }
  .prose th, .prose td { padding: 7px 9px; }
  .pager { flex-direction: column; }
  .fig { padding: 12px 10px 6px; }
  .hero-meta { gap: 14px; }
}
@media print {
  .top, .side, .pager, .foot, .page-toc, .read-btn, .scrollbar { display: none !important; }
  .shell { display: block; max-width: none; padding: 0; }
  body { background: #fff; }
}
