/* 西门华莱硕官网 — main.css
 * 约束：零 JavaScript、零外部资源（字体/CDN）、无内联样式（站点 CSP: style-src 'self'）。
 * 主题：:root 定义设计变量，跟随系统明暗（prefers-color-scheme）。
 */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #edf1f6;
  --ink: #0e1726;
  --ink-2: #334155;
  --muted: #5f6f84;
  --line: #d9e1ea;
  --brand: #0a6c8a;
  --brand-strong: #075a73;
  --brand-ink: #ffffff;
  --brand-soft: #e2f1f6;
  --accent: #c76a05;
  --accent-soft: #fdf1e2;
  --hero-bg: #08111f;
  --hero-ink: #e7eef6;
  --hero-muted: #a2b4c8;
  --hero-line: #1c2b42;
  --code-bg: #0c1626;
  --code-ink: #d8e5f2;
  --ok: #157a3c;
  --warn: #a8540a;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 6%);
  --radius: 10px;
  --wrap: 1160px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f19;
    --surface: #101826;
    --surface-2: #152033;
    --ink: #e5ecf4;
    --ink-2: #c2cedb;
    --muted: #8d9db2;
    --line: #22314a;
    --brand: #3cb4e0;
    --brand-strong: #6ccbee;
    --brand-ink: #03131c;
    --brand-soft: #0f2939;
    --accent: #f0a23b;
    --accent-soft: #2b1d0b;
    --hero-bg: #060b14;
    --hero-line: #17243a;
    --code-bg: #070d17;
    --ok: #4ac27a;
    --warn: #f0a23b;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .6em; letter-spacing: .01em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li + li { margin-top: .3em; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
:not(pre) > code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
  margin: 0 0 1.2em;
  font-size: .86rem;
}
pre code { background: none; padding: 0; font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
sup { font-size: .68em; color: var(--muted); font-weight: 400; margin-left: .2em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- 顶栏与导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.12rem; letter-spacing: .08em; }
.brand-sub { font-size: .7rem; color: var(--muted); letter-spacing: .22em; }
.nav-desktop ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-desktop li + li, .nav-mobile li + li { margin-top: 0; }
.nav-desktop a, .nav-mobile a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: .95rem;
}
.nav-desktop a:hover, .nav-mobile a:hover { background: var(--surface-2); color: var(--ink); }
.nav-desktop a[aria-current="page"], .nav-mobile a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.nav-mobile { display: none; position: relative; }
.nav-mobile summary {
  list-style: none; cursor: pointer; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 8px; font-size: .95rem; color: var(--ink-2); user-select: none;
}
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile summary::after { content: " ☰"; }
.nav-mobile[open] summary::after { content: " ✕"; }
.nav-mobile ul {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
  list-style: none; margin: 0; padding: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .nav-mobile { display: block; }
}

/* ---------- 首屏 ---------- */
.hero { background: var(--hero-bg); color: var(--hero-ink); border-bottom: 1px solid var(--hero-line); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 40px; align-items: center; padding: 72px 20px 64px; }
.hero h1 { color: #fff; }
.hero .lead { color: var(--hero-muted); font-size: 1.08rem; max-width: 36em; }
.hero .eyebrow { color: #62c8ee; }
.hero-art img { width: 100%; height: auto; }
.page-hero { padding: 52px 20px 40px; }
.page-hero .lead { margin-bottom: 0; }
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding: 48px 20px 40px; gap: 28px; }
  .hero-art { order: -1; max-width: 520px; }
}
.eyebrow { display: inline-block; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); font-weight: 600; margin-bottom: .8em; }
.lead { font-size: 1.06rem; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 9px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; font-size: .98rem;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); color: var(--brand-ink); }
.hero .btn-ghost { color: var(--hero-ink); border-color: #3a4c66; }
.hero .btn-ghost:hover { background: #12213a; color: #fff; }
.btn-ghost { color: var(--ink); border-color: var(--line); }

/* ---------- 版块 ---------- */
.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 32px; }
.section-head p { color: var(--ink-2); }
.prose { max-width: 820px; }
.prose h2 { margin-top: 2.2em; padding-top: .4em; }
.prose h3 { margin-top: 1.8em; }
.prose > :first-child { margin-top: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.section.alt .card { background: var(--bg); box-shadow: none; }
.card h3 { margin-bottom: .4em; }
.card p, .card li { color: var(--ink-2); font-size: .96rem; }
.card ul { margin-bottom: 0; }
.card .more { margin-top: auto; padding-top: 12px; font-weight: 600; text-decoration: none; }
.card-icon { width: 48px; height: 48px; margin-bottom: 14px; }
a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--brand); }
a.card h3 { color: var(--ink); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; counter-reset: step; }
.steps li { counter-increment: step; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.steps li::before {
  content: counter(step, decimal-leading-zero); display: block; font-family: var(--mono);
  color: var(--accent); font-weight: 700; font-size: 1.1rem; margin-bottom: 6px;
}
.steps strong { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: .9rem; }
@media (max-width: 960px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.figure { margin: 0 0 1.5em; }
.figure img { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.figure figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.photo img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

/* ---------- 提示框 / 标签 ---------- */
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1.4em; }
.callout.warn { border-color: var(--accent); background: var(--accent-soft); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 4px; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); vertical-align: middle; }
.meta-line { color: var(--muted); font-size: .88rem; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 2em; }
.toc ol { margin: 0; columns: 2; column-gap: 32px; }
@media (max-width: 560px) { .toc ol { columns: 1; } }

/* ---------- 数据表 ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap:focus-visible { outline-offset: 0; }
table.spec { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.55; min-width: 860px; }
table.spec.tools { min-width: 720px; }
table.spec caption { text-align: left; font-weight: 700; padding: 14px 16px 10px; color: var(--ink); font-size: 1rem; }
table.spec th, table.spec td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; text-align: left; }
table.spec thead th { background: var(--surface-2); color: var(--ink-2); font-weight: 600; white-space: nowrap; font-size: .84rem; }
table.spec tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
table.spec td strong { color: var(--ink); }
table.spec .sub { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
table.spec .note { display: block; color: var(--warn); font-size: .8rem; margin-top: 4px; }
table.spec td.nw { white-space: nowrap; }
table.spec code { font-size: .78rem; }
a.dl { font-weight: 600; }
table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0 0 1.4em; }
table.simple th, table.simple td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.simple th { color: var(--ink-2); font-weight: 600; }

/* ---------- 联系 / 页脚 ---------- */
.contact-band { background: var(--hero-bg); color: var(--hero-ink); padding: 48px 0; }
.contact-band h2 { color: #fff; }
.contact-band p { color: var(--hero-muted); }
.contact-band a.mail { color: #7fd6f4; font-size: 1.3rem; font-weight: 700; font-family: var(--mono); text-decoration: none; }
.contact-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 20px 0; font-size: .9rem; color: var(--ink-2); }
.copyright { color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- 错误页 ---------- */
.error-page { min-height: 52vh; display: flex; flex-direction: column; justify-content: center; padding: 64px 20px; }
.error-code { font-family: var(--mono); font-size: 4rem; font-weight: 700; color: var(--brand); line-height: 1; margin-bottom: .2em; }

@media print {
  .site-header, .nav-mobile, .contact-band, .actions { display: none; }
  body { background: #fff; color: #000; }
  .table-wrap { overflow: visible; border: 0; }
  table.spec { min-width: 0; }
}
