/* ============================================================
   style.css — 电子版说明书样式
   纯 CSS，无框架、无外链字体、无 CDN，整站可离线 / 可整体搬迁
   ============================================================ */

:root {
  --bg:            #ffffff;
  --surface:       #f6f8fa;
  --surface-2:     #eef2f6;
  --border:        #e3e8ee;
  --border-strong: #cdd6e0;
  --text:          #1b1f24;
  --text-soft:     #414a55;
  --muted:         #6b7684;
  --accent:        #1a63c0;
  --accent-soft:   #eaf2fd;
  --accent-text:   #124a91;
  --shadow:        0 4px 24px rgba(20, 34, 52, .08);
  --radius:        12px;
  --fs-base:       16px;
  --sidebar-w:     252px;
  --header-h:      60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg:            #14181d;
  --surface:       #1c222a;
  --surface-2:     #232b35;
  --border:        #2d3742;
  --border-strong: #3c4855;
  --text:          #e9edf2;
  --text-soft:     #c6cfd9;
  --muted:         #96a2b0;
  --accent:        #6ba8f5;
  --accent-soft:   #1b2c42;
  --accent-text:   #9cc6fa;
  --shadow:        0 4px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 18px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
svg { display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------------- Header ---------------- */
.header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.brand-text { min-width: 0; }
.brand-title {
  font-size: 14px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 11px; color: var(--muted); line-height: 1.3; }

.header-spacer { flex: 1; }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-soft);
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.menu-btn { display: none; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1240px; margin: 0 auto;
  align-items: start;
}

/* ---------------- Sidebar / TOC ---------------- */
.sidebar {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 26px 18px 40px 24px;
  border-right: 1px solid var(--border);
}
.toc-label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
  margin: 0 0 12px 10px;
}
.toc a {
  display: block; padding: 7px 10px; margin-bottom: 2px;
  border-radius: 8px; font-size: 13.5px; color: var(--text-soft);
  border-left: 2px solid transparent;
}
.toc a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.toc a.active {
  background: var(--accent-soft); color: var(--accent-text);
  border-left-color: var(--accent); font-weight: 600;
}
.toc-num { display: inline-block; width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc a.active .toc-num { color: var(--accent); }

.sidebar-foot {
  margin-top: 26px; padding: 14px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.7;
}

/* ---------------- Main ---------------- */
.main { min-width: 0; padding: 34px 40px 80px; max-width: 860px; }

.hero { padding-bottom: 26px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.hero-kicker { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: .08em; }
.hero h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.3; margin: 8px 0 10px; letter-spacing: -.02em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font-size: 12px; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px;
}

.demo-notice {
  margin: 22px 0 0; padding: 14px 16px;
  border: 1px solid #f0d08a; border-left: 3px solid #d99a20;
  border-radius: 10px; background: #fff9ec; color: #6b4c12;
  font-size: 13.5px; line-height: 1.7;
}
html[data-theme="dark"] .demo-notice { background: #2c2618; border-color: #6b5526; color: #e8cf96; }
.demo-notice strong { font-weight: 600; }
.demo-notice code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.section { padding-top: 34px; scroll-margin-top: calc(var(--header-h) + 18px); }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.section-index {
  font-size: 13px; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums; flex: none;
}
.section h2 { font-size: 22px; margin: 0; letter-spacing: -.01em; line-height: 1.4; }
.section-tag { font-size: 12px; color: var(--muted); margin-left: auto; flex: none; }
.section-body { display: grid; gap: 16px; }

/* ---------------- Blocks ---------------- */
.p { margin: 0; color: var(--text-soft); }
.ul { margin: 0; padding-left: 20px; color: var(--text-soft); }
.ul li { margin: 6px 0; padding-left: 2px; }
.ul li::marker { color: var(--accent); }

.steps { display: grid; gap: 12px; counter-reset: step; }
.step {
  display: flex; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.step-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  display: grid; place-items: center; counter-increment: step;
}
.step-num::before { content: counter(step); }
.step-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.step-text { color: var(--text-soft); font-size: 14.5px; }

.callout {
  padding: 15px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); border-left-width: 3px;
  background: var(--surface); font-size: 14.5px;
}
.callout-title { font-weight: 600; margin-bottom: 4px; font-size: 14.5px; }
.callout-text { color: var(--text-soft); }
.callout.danger  { border-left-color: #d92d20; background: #fef3f2; }
.callout.danger  .callout-title { color: #912018; }
.callout.warning { border-left-color: #dc6803; background: #fffaeb; }
.callout.warning .callout-title { color: #93370d; }
.callout.info    { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.info    .callout-title { color: var(--accent-text); }
.callout.success { border-left-color: #079455; background: #ecfdf3; }
.callout.success .callout-title { color: #067647; }
html[data-theme="dark"] .callout.danger  { background: #2e1b1a; }
html[data-theme="dark"] .callout.warning { background: #2d2416; }
html[data-theme="dark"] .callout.success { background: #15291f; }
html[data-theme="dark"] .callout.danger  .callout-title { color: #f5a9a2; }
html[data-theme="dark"] .callout.warning .callout-title { color: #f0c07a; }
html[data-theme="dark"] .callout.success .callout-title { color: #8ed9a8; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 420px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface); font-weight: 600; color: var(--text); white-space: nowrap; }
td { color: var(--text-soft); }
tr:last-child td { border-bottom: none; }

.specs { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.spec-row { display: grid; grid-template-columns: 160px 1fr; border-bottom: 1px solid var(--border); }
.spec-row:last-child { border-bottom: none; }
.spec-row > div { padding: 11px 16px; font-size: 14.5px; }
.spec-row > div:first-child { background: var(--surface); color: var(--text); font-weight: 500; }
.spec-row > div:last-child { color: var(--text-soft); }

.faq { display: grid; gap: 10px; }
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.faq summary {
  padding: 13px 16px; font-weight: 600; font-size: 14.5px;
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 18px; font-weight: 400; line-height: 1.2; }
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq .faq-a { padding: 13px 16px; color: var(--text-soft); font-size: 14.5px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.card {
  padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.card-title { font-weight: 600; font-size: 14.5px; margin-bottom: 5px; }
.card-text { color: var(--text-soft); font-size: 13.5px; line-height: 1.65; }

/* ---------------- Footer ---------------- */
.footer {
  margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); line-height: 1.9;
}
.footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.changelog { margin-top: 18px; font-size: 12.5px; }
.changelog-item { display: flex; gap: 10px; }
.changelog-item b { color: var(--text-soft); font-weight: 600; flex: none; }

/* ---------------- Search ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 24, 36, .42);
  display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.overlay.open { display: flex; }
.panel {
  width: min(600px, 100%); max-height: 74vh; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.panel-input {
  flex: 1; border: none; outline: none; background: transparent;
  color: var(--text); font-size: 15px; font-family: inherit; min-width: 0;
}
.panel-close { border: none; background: var(--surface-2); color: var(--text-soft); border-radius: 6px; font-size: 11px; padding: 3px 8px; }
.panel-body { overflow-y: auto; padding: 10px; }
.result {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: transparent;
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.result:hover { background: var(--surface); text-decoration: none; }
.result-sec { font-size: 11.5px; color: var(--accent); font-weight: 600; }
.result-txt { color: var(--text-soft); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result mark { background: var(--accent-soft); color: var(--accent-text); border-radius: 3px; padding: 0 2px; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.panel-foot { padding: 9px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }

/* ---------------- Share QR panel ---------------- */
.qr-panel { text-align: center; padding: 22px; }
.qr-panel h3 { margin: 0 0 4px; font-size: 16px; }
.qr-panel p { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.qr-frame { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.qr-frame svg { width: 190px; height: 190px; }
.qr-url { margin-top: 16px; font-size: 12px; color: var(--muted); word-break: break-all; }
.qr-note { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 35;
    width: 270px; height: auto;
    background: var(--bg); border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(-102%); transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 34;
    background: rgba(16,24,36,.35); display: none;
  }
  .scrim.open { display: block; }
  .main { padding: 26px 20px 70px; }
  .section-tag { display: none; }
  .spec-row { grid-template-columns: 120px 1fr; }
}

@media (max-width: 480px) {
  .header { padding: 0 12px; gap: 7px; }
  .brand-sub { display: none; }
  .icon-btn { width: 32px; height: 32px; }
  .hero h1 { font-size: 25px; }
  .section h2 { font-size: 19px; }
  .spec-row { grid-template-columns: 1fr; }
  .spec-row > div:first-child { padding-bottom: 2px; }
  .spec-row > div { padding: 8px 14px; }
  .step { padding: 14px; }
}

/* ---------------- PDF 模式 ---------------- */
body.pdf-mode .menu-btn { display: none; }
body.pdf-mode .layout { grid-template-columns: minmax(0, 1fr); }
body.pdf-mode .sidebar { display: none; }
body.pdf-mode .main { max-width: 760px; margin: 0 auto; }

.pdf-landing { padding-top: 28px; }
.pdf-cover {
  display: flex; gap: 16px; align-items: center;
  padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.pdf-cover-icon {
  flex: none; width: 52px; height: 62px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
}
.pdf-cover-title { font-size: 17px; font-weight: 600; line-height: 1.4; }
.pdf-cover-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.pdf-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; font-size: 14.5px; font-weight: 500;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.btn-primary:hover { background: #124a91; color: #fff; text-decoration: none; }
.btn-primary span { font-size: 16px; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pdf-block-title { font-size: 18px; margin: 34px 0 14px; }

@media (max-width: 900px) {
  body.pdf-mode .main { padding: 26px 20px 70px; }
}
@media (max-width: 480px) {
  .pdf-actions { flex-direction: column; }
  .btn-primary, .btn-ghost { width: 100%; }
  .pdf-cover { padding: 16px; }
}

/* ---------------- 机型选择页 / 切换机型 ---------------- */
.model-picker .sidebar { display: none; }
.model-picker .menu-btn { display: none; }
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 4px 0 8px;
}
.model-card {
  display: block; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.model-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.model-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.model-tag {
  font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-text);
}
.model-id { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.model-name { font-size: 19px; font-weight: 600; margin-bottom: 6px; line-height: 1.35; }
.model-meta { font-size: 13px; color: var(--muted); min-height: 20px; }
.model-go { margin-top: 16px; font-size: 13.5px; color: var(--accent-text); font-weight: 600; }
.model-go span { margin-left: 4px; }
.model-switch {
  margin-top: 20px; padding: 14px 16px; border-radius: 10px;
  background: var(--accent-soft); font-size: 14px; color: var(--text-soft);
}
.model-switch a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
@media (max-width: 560px) { .model-grid { grid-template-columns: 1fr; } }

/* ---------------- Print / 导出 PDF ---------------- */
@media print {
  :root { --fs-base: 11pt; }
  html[data-theme="dark"] {
    --bg:#fff; --surface:#fff; --surface-2:#fff; --border:#ccc;
    --text:#000; --text-soft:#222; --muted:#555; --accent:#000; --accent-soft:#f2f2f2;
  }
  body { background:#fff; color:#000; }
  .header, .sidebar, .scrim, .overlay, .demo-notice, .hero-meta, .footer .no-print { display: none !important; }
  .layout { display: block; max-width: none; }
  .main { padding: 0; max-width: none; }
  .hero { padding-bottom: 14px; }
  .section { padding-top: 20px; break-inside: avoid-page; }
  .section h2 { break-after: avoid; }
  .faq details { break-inside: avoid; }
  .faq .faq-a { display: block !important; }
  .callout, .step, .card, .table-wrap, .specs { break-inside: avoid; }
  .footer { margin-top: 28px; }
  a { color: #000; text-decoration: none; }
}
