/* ========== reset ========== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul { margin: 0; }

/* ========== tokens ========== */
:root {
  --primary: #2f6df6;
  --primary-700: #1d4ed8;
  --primary-50: #eef4ff;
  --text: #1f2329;
  --text-2: #595e66;
  --text-3: #8a9099;
  --border: #e8eaed;
  --border-strong: #d4d7dd;
  --bg: #ffffff;
  --bg-soft: #f8f9fb;
  --bg-code: #f3f4f6;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --warn-bd: #fed7aa;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-bd: #c7efcf;
  --sidebar-w: 268px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.06);
  --maxw: 800px;
}

/* ========== base ========== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.72;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

/* ========== layout ========== */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #fff; z-index: 40; padding-bottom: 32px;
}
.main { margin-left: var(--sidebar-w); min-height: 100vh; }

/* ========== sidebar ========== */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #7aa2ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand .title { font-weight: 680; font-size: 14.5px; line-height: 1.2; }
.brand .subtitle { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.search { padding: 14px 18px 4px; }
.search input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; background: var(--bg-soft);
  outline: none; transition: .15s; color: var(--text);
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-50); }

.nav-section { padding: 4px 10px; }
.nav-label {
  font-size: 11px; font-weight: 660; color: var(--text-3);
  letter-spacing: .07em; padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 7px;
  font-size: 13.8px; color: var(--text-2); transition: .12s;
}
.nav-link:hover { background: var(--bg-soft); color: var(--text); }
.nav-link.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); opacity: .45; flex-shrink: 0; }
.nav-link.active .dot { background: var(--primary); opacity: 1; }

.sidebar-foot { padding: 16px 20px; font-size: 11.5px; color: var(--text-3); }

/* ========== topbar ========== */
.topbar {
  position: sticky; top: 0; z-index: 25;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; height: 54px;
}
.breadcrumb { font-size: 13px; color: var(--text-3); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 8px; opacity: .5; }
.breadcrumb .cur { color: var(--text-2); }

.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg a { padding: 4px 13px; font-size: 12.5px; border-radius: 6px; color: var(--text-2); }
.seg a.on { background: #fff; color: var(--primary-700); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.06); }

.nav-toggle { display: none; }

/* ========== content ========== */
.content { max-width: var(--maxw); margin: 0 auto; padding: 32px 36px 96px; }
.content h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; font-weight: 720; letter-spacing: -.01em; }
.content .lead { font-size: 16.5px; color: var(--text-2); margin: 0 0 22px; }
.content h2 {
  font-size: 21px; margin: 40px 0 14px; font-weight: 680;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.content h2 .num { color: var(--primary); font-variant-numeric: tabular-nums; font-size: 18px; }
.content h3 { font-size: 16.5px; margin: 26px 0 8px; font-weight: 640; }
.content p { margin: 0 0 14px; }
.content ul { padding-left: 20px; margin-bottom: 14px; }
.content li { margin: 6px 0; }
.content a.link { color: var(--primary); border-bottom: 1px solid transparent; transition: .12s; }
.content a.link:hover { border-bottom-color: var(--primary); }
.content strong { font-weight: 640; }

.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 11px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
}
.tag.blue { background: var(--primary-50); color: var(--primary-700); border-color: transparent; }
.tag.amber { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* ========== feature table ========== */
table.fm { width: 100%; border-collapse: collapse; margin: 8px 0 22px; font-size: 14px; }
table.fm th, table.fm td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.fm th { font-weight: 600; color: var(--text-2); font-size: 12.5px; background: var(--bg-soft); }
table.fm tr:hover td { background: #fcfcfe; }
table.fm td.name { font-weight: 600; white-space: nowrap; }
table.fm td .sub { display: block; color: var(--text-3); font-size: 12.5px; font-weight: 400; margin-top: 2px; }

/* ========== cards (index) ========== */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 4px 0 8px; }
.card {
  border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  transition: .16s; background: #fff; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.card .ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.card.web .ico { background: var(--primary-50); color: var(--primary-700); }
.card.pos .ico { background: #fff1e6; color: #c2410c; }
.card h3 { margin: 0 0 4px; font-size: 18px; font-weight: 680; }
.card p { color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.card .mini { font-size: 12.8px; color: var(--text-3); margin-bottom: 18px; line-height: 1.9; }
.card .go { color: var(--primary); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; margin-top: auto; }

/* ========== callout ========== */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; margin: 18px 0; border: 1px solid; font-size: 14px; }
.callout .ic { flex-shrink: 0; width: 18px; height: 18px; margin-top: 3px; opacity: .85; }
.callout .body { color: var(--text); }
.callout .body strong { display: block; margin-bottom: 2px; }
.callout.info { background: var(--primary-50); border-color: #dbe7ff; color: var(--primary-700); }
.callout.tip { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn); }

/* ========== todo / placeholder block ========== */
.todo {
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 20px 22px; margin: 16px 0; background: #fafbfc;
}
.todo .th { display: flex; align-items: center; gap: 8px; font-weight: 640; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.todo .td { font-size: 13.5px; color: var(--text-3); margin: 0; }
.todo ul { color: var(--text-3); font-size: 13.5px; }

/* ========== steps ========== */
ol.steps { counter-reset: s; list-style: none; padding-left: 0; margin: 10px 0 20px; }
ol.steps > li {
  position: relative; padding: 0 0 18px 38px; margin: 0;
  border-left: 2px solid var(--border); margin-left: 13px;
}
ol.steps > li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: -14px; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary); color: var(--primary);
  font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
ol.steps > li:last-child { border-left-color: transparent; }
ol.steps .st { font-weight: 600; display: block; margin-bottom: 2px; }

/* ========== screenshot figure ========== */
.shot { margin: 22px 0 28px; }
.shot img { width: 100%; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); display: block; }
.shot figcaption { font-size: 12.5px; color: var(--text-3); margin-top: 9px; text-align: center; }
.shot { position: relative; }
.shot img { cursor: zoom-in; }
.zoom-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: rgba(17,20,26,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity .15s, background .15s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.shot:hover .zoom-btn, .shot:focus-within .zoom-btn { opacity: 1; }
.zoom-btn:hover { background: rgba(17,20,26,.72); }
@media (hover: none) { .zoom-btn { opacity: 1; } }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,18,22,.86);
  display: none; align-items: center; justify-content: center;
  padding: 36px;
}
.lightbox.open { display: flex; animation: lb-fade .15s ease; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 6px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.lightbox .lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.16); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-close:hover { background: rgba(255,255,255,.28); }

/* ========== pager (prev/next at bottom) ========== */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager a { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: 13.5px; transition: .14s; max-width: 48%; }
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager a .lab { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.pager a.next { margin-left: auto; text-align: right; }

/* ========== responsive ========== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; margin-right: 12px;
  }
  .nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
    content: ""; display: block; width: 16px; height: 2px; background: var(--text-2); position: relative; border-radius: 2px;
  }
  .nav-toggle span::before { position: absolute; top: -5px; }
  .nav-toggle span::after { position: absolute; top: 5px; }
  .content { padding: 24px 20px 80px; }
  .topbar { padding: 0 20px; }
  .cards { grid-template-columns: 1fr; }
  .content h1 { font-size: 26px; }
}
