/* ═══════════════════════════════════════════════════
   hltx 发卡系统 · 商家后台使用教程
   编辑风格中文文档站 — 暖纸 × 朱砂 × 墨色
   ═══════════════════════════════════════════════════ */

:root {
  /* 纸与墨：暖调，不用纯黑纯白 */
  --paper:        oklch(97.5% 0.008 85);
  --paper-deep:   oklch(94.5% 0.012 82);
  --paper-sink:   oklch(92% 0.014 80);
  --ink:          oklch(26% 0.018 60);
  --ink-soft:     oklch(42% 0.016 62);
  --ink-mute:     oklch(56% 0.014 65);
  --rule:         oklch(87% 0.014 80);
  --rule-soft:    oklch(91% 0.012 82);

  /* 朱砂主色 */
  --accent:       oklch(53% 0.185 32);
  --accent-deep:  oklch(44% 0.17 30);
  --accent-tint:  oklch(94% 0.035 35);
  --accent-mist:  oklch(96.5% 0.02 35);

  /* 语义色 */
  --note:         oklch(48% 0.10 245);
  --note-tint:    oklch(95% 0.025 245);
  --tip:          oklch(47% 0.10 155);
  --tip-tint:     oklch(95% 0.025 155);
  --warn:         oklch(55% 0.115 75);
  --warn-tint:    oklch(95% 0.035 80);
  --danger:       oklch(50% 0.18 28);
  --danger-tint:  oklch(94.5% 0.04 30);

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans:  "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono:  "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Noto Sans Mono CJK SC", monospace;

  --w-content: 47rem;
  --w-side: 16.5rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-tint); color: var(--accent-deep); }

/* ── 顶栏 ─────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  height: 3.6rem; padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--rule-soft);
}

.topbar .brand {
  font-family: var(--serif);
  font-weight: 700; font-size: 1.02rem;
  letter-spacing: 0.04em;
  color: var(--ink); text-decoration: none;
  white-space: nowrap;
}
.topbar .brand em {
  font-style: normal; color: var(--accent);
  margin-right: 0.45em;
}

.topbar .ver {
  font-size: 0.72rem; letter-spacing: 0.08em;
  color: var(--ink-mute);
  border: 1px solid var(--rule);
  padding: 0.15em 0.6em; border-radius: 2px;
  white-space: nowrap;
}

.menu-btn {
  display: none;
  margin-left: auto;
  background: none; border: 1px solid var(--rule);
  border-radius: 3px; cursor: pointer;
  width: 2.3rem; height: 2.3rem;
  color: var(--ink-soft); font-size: 1.1rem;
}

/* ── 骨架布局：侧栏 + 内容，非对称 ─────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--w-side) minmax(0, 1fr);
  max-width: 82rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

/* ── 侧边导航 ─────────────────────────────────── */

.side {
  position: sticky; top: 4.6rem;
  max-height: calc(100vh - 5.6rem);
  overflow-y: auto;
  padding: 2rem 0 3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.side .side-title {
  font-size: 0.72rem; letter-spacing: 0.22em;
  color: var(--ink-mute); font-weight: 600;
  padding: 0 0.2rem 0.85rem;
}

.side ol { list-style: none; }

.side li a {
  display: flex; align-items: baseline; gap: 0.55em;
  padding: 0.38rem 0.65rem 0.38rem 0.2rem;
  font-size: 0.86rem; line-height: 1.5;
  color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.side li a .num {
  font-family: var(--serif); font-size: 0.78rem;
  color: var(--ink-mute); min-width: 1.6em;
  letter-spacing: 0.05em;
  transition: color 0.18s ease;
}

.side li a:hover { color: var(--ink); background: var(--accent-mist); }

.side li a.on {
  color: var(--accent-deep); font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-mist);
}
.side li a.on .num { color: var(--accent); }

.side li.sep {
  margin: 0.8rem 0 0.55rem; padding: 0 0.2rem;
  font-size: 0.7rem; letter-spacing: 0.2em;
  color: var(--ink-mute);
}

/* ── 首屏 ─────────────────────────────────────── */

.hero {
  padding: clamp(2.8rem, 6vw, 5rem) 0 clamp(2.2rem, 4vw, 3.2rem);
  border-bottom: 1px solid var(--rule);
  max-width: var(--w-content);
}

.hero .kicker {
  font-size: 0.75rem; letter-spacing: 0.32em;
  color: var(--accent); font-weight: 600;
  margin-bottom: 1.4rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.95rem, 1.4rem + 2.6vw, 3.15rem);
  line-height: 1.28; font-weight: 800;
  letter-spacing: 0.015em;
  color: var(--ink);
}

.hero h1 .accent { color: var(--accent); }

.hero .lede {
  margin-top: 1.35rem;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.14rem);
  color: var(--ink-soft);
  max-width: 38rem;
}

.hero .meta {
  display: flex; flex-wrap: wrap; gap: 0.55rem;
  margin-top: 1.8rem;
}

.hero .meta span {
  font-size: 0.76rem; letter-spacing: 0.06em;
  color: var(--ink-mute);
  border: 1px solid var(--rule);
  background: color-mix(in oklab, var(--paper-deep) 55%, transparent);
  padding: 0.28em 0.75em; border-radius: 2px;
}

.hero .jump {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem;
  margin-top: 1.7rem;
}
.hero .jump a {
  font-size: 0.85rem; color: var(--accent-deep);
  text-decoration: none; border-bottom: 1px solid var(--accent-tint);
  padding-bottom: 1px;
}
.hero .jump a:hover { border-bottom-color: var(--accent); }

/* ── 正文 ─────────────────────────────────────── */

main { padding-bottom: 6rem; max-width: var(--w-content); }

section.doc {
  padding-top: clamp(2.6rem, 5vw, 4.2rem);
}

section.doc > h2 {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 1.25rem + 1.3vw, 2.15rem);
  font-weight: 800; line-height: 1.35;
  letter-spacing: 0.01em;
  display: flex; align-items: baseline; gap: 0.55em;
}
section.doc > h2 .h2num {
  font-size: 0.62em; color: var(--accent);
  font-weight: 700; letter-spacing: 0.12em;
  white-space: nowrap;
}

section.doc > h2 + .h2rule {
  width: 3.2rem; height: 3px;
  background: var(--accent);
  margin: 1.15rem 0 0.3rem;
}

h3 {
  font-family: var(--serif);
  font-size: clamp(1.18rem, 1.06rem + 0.5vw, 1.42rem);
  font-weight: 700; letter-spacing: 0.01em;
  margin: 2.4rem 0 0.9rem;
  display: flex; align-items: baseline; gap: 0.5em;
}
h3 .h3mark {
  font-size: 0.62em; color: var(--accent);
  letter-spacing: 0.18em; font-weight: 600;
  white-space: nowrap;
}

h4 {
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  font-weight: 700; color: var(--ink);
  margin: 1.85rem 0 0.65rem;
  letter-spacing: 0.02em;
}

p { margin: 0.85rem 0; }

main a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid var(--accent-tint); transition: border-color 0.15s; }
main a:hover { border-bottom-color: var(--accent); }

strong { font-weight: 700; color: var(--ink); }

hr.soft {
  border: 0; border-top: 1px dashed var(--rule);
  margin: 2.8rem 0;
}

/* ── 表格 ─────────────────────────────────────── */

.tbl-wrap { overflow-x: auto; margin: 1.25rem 0 1.6rem; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 0.885rem; line-height: 1.7;
}

thead th {
  text-align: left; font-weight: 600;
  font-size: 0.78rem; letter-spacing: 0.12em;
  color: var(--ink-mute);
  background: var(--paper-deep);
  padding: 0.75em 1em;
  border-bottom: 2px solid var(--rule);
  white-space: nowrap;
}

tbody td {
  padding: 0.8em 1em;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

tbody tr:hover td { background: var(--accent-mist); }

tbody td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ── 代码 ─────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--paper-sink);
  border: 1px solid var(--rule-soft);
  padding: 0.12em 0.42em; border-radius: 2px;
  color: var(--accent-deep);
  word-break: break-word;
}

pre {
  background: oklch(27% 0.012 60);
  color: oklch(91% 0.01 85);
  padding: 1.15rem 1.35rem;
  border-radius: 3px;
  overflow-x: auto;
  margin: 1.15rem 0 1.55rem;
  font-size: 0.825rem; line-height: 1.85;
}
pre code {
  background: none; border: 0; padding: 0;
  color: inherit; font-size: 1em;
}
pre .cm { color: oklch(64% 0.02 80); }
pre .hl { color: oklch(82% 0.12 65); }

/* ── 提示块 ───────────────────────────────────── */

.callout {
  margin: 1.35rem 0 1.55rem;
  padding: 1.05rem 1.35rem 1.15rem;
  border-radius: 3px;
  border-left: 3px solid var(--note);
  background: var(--note-tint);
  font-size: 0.915rem;
}
.callout .tag {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--note);
  margin-bottom: 0.35rem;
}
.callout p:first-of-type { margin-top: 0.25rem; }
.callout p:last-child { margin-bottom: 0; }

.callout.tip    { border-left-color: var(--tip);    background: var(--tip-tint); }
.callout.tip .tag { color: var(--tip); }

.callout.warn   { border-left-color: var(--warn);   background: var(--warn-tint); }
.callout.warn .tag { color: var(--warn); }

.callout.danger { border-left-color: var(--danger); background: var(--danger-tint); }
.callout.danger .tag { color: var(--danger); }

/* ── 列表 ─────────────────────────────────────── */

ul.plain, ol.plain { padding-left: 1.35rem; margin: 0.85rem 0 1.25rem; }
ul.plain li, ol.plain li { margin: 0.38rem 0; padding-left: 0.25rem; }
ul.plain li::marker { color: var(--accent); }
ol.plain li::marker { color: var(--accent); font-family: var(--serif); font-weight: 700; }

.checklist { list-style: none; padding-left: 0; margin: 1.15rem 0 1.55rem; }
.checklist li {
  position: relative;
  padding: 0.48rem 0 0.48rem 2.25rem;
  border-bottom: 1px dashed var(--rule-soft);
}
.checklist li::before {
  content: "✓"; position: absolute; left: 0.35rem; top: 0.52rem;
  width: 1.35rem; height: 1.35rem;
  display: grid; place-items: center;
  border: 1.5px solid var(--rule); border-radius: 2px;
  color: var(--accent); font-size: 0.78rem; font-weight: 700;
  background: var(--paper-deep);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.checklist li:hover::before {
  background: var(--accent-tint); border-color: var(--accent); color: var(--accent-deep);
}

/* ── 流程图（文字版） ─────────────────────────── */

.flow {
  font-family: var(--mono); font-size: 0.82rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 1.05rem 1.35rem;
  margin: 1.15rem 0 1.55rem;
  overflow-x: auto;
  line-height: 2.1;
  color: var(--ink-soft);
}
.flow b { color: var(--accent-deep); }

/* ── 页脚 ─────────────────────────────────────── */

footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 2.6rem clamp(1rem, 3vw, 2.5rem) 3rem;
}

footer .inner {
  max-width: 82rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  justify-content: space-between; align-items: baseline;
}
footer .fbrand {
  font-family: var(--serif); font-weight: 700;
  letter-spacing: 0.04em; color: var(--ink);
}
footer .fbrand em { font-style: normal; color: var(--accent); margin-right: 0.4em; }
footer .fnote { font-size: 0.82rem; color: var(--ink-mute); }

/* ── 回到顶部 ─────────────────────────────────── */

.totop {
  position: fixed; right: 1.6rem; bottom: 1.8rem;
  width: 2.6rem; height: 2.6rem;
  border: 1px solid var(--rule); border-radius: 3px;
  background: var(--paper); color: var(--ink-soft);
  font-size: 1rem; cursor: pointer;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s;
}
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { background: var(--accent-tint); color: var(--accent-deep); }

/* ── 进场动效：仅一次性、轻微 ─────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .hero .kicker, .hero h1, .hero .lede, .hero .meta, .hero .jump {
    opacity: 0; transform: translateY(12px);
    animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .hero h1 { animation-delay: 0.08s; }
  .hero .lede { animation-delay: 0.18s; }
  .hero .meta { animation-delay: 0.28s; }
  .hero .jump { animation-delay: 0.36s; }
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── 响应式 ───────────────────────────────────── */

@media (max-width: 60rem) {
  .shell {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .menu-btn { display: grid; place-items: center; }

  .side {
    position: fixed;
    top: 3.6rem; left: 0; bottom: 0;
    width: min(19rem, 84vw);
    background: var(--paper);
    border-right: 1px solid var(--rule);
    padding: 1.4rem 1.25rem 3rem;
    transform: translateX(-102%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 45;
    box-shadow: 1rem 0 2.4rem oklch(30% 0.02 60 / 0.07);
  }
  .side.open { transform: none; }

  .scrim {
    position: fixed; inset: 3.6rem 0 0 0;
    background: oklch(30% 0.02 60 / 0.28);
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 40;
  }
  .scrim.open { opacity: 1; pointer-events: auto; }

  main, .hero { max-width: none; }
}

@media (max-width: 34rem) {
  body { line-height: 1.8; }
  .topbar .ver { display: none; }
  thead th, tbody td { padding: 0.62em 0.72em; }
  tbody td:first-child { white-space: normal; }
  pre { padding: 0.95rem 1rem; }
  .callout { padding: 0.92rem 1.05rem 1rem; }
}

/* ── 打印 ─────────────────────────────────────── */

@media print {
  .topbar, .side, .scrim, .totop, .hero .jump { display: none !important; }
  .shell { display: block; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  section.doc { page-break-inside: avoid; padding-top: 1.6rem; }
  pre { white-space: pre-wrap; background: #f4f2ef; color: #222; }
}
