/* ===== 技术发文：阅读页共享样式 =====
   两篇文章页（article-*.html）共用这一份，改版式只改这里。
   配色与首页 index.html 保持一致。 */

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(37, 99, 235, 0.07), transparent 60%),
    radial-gradient(700px 500px at -10% 20%, rgba(56, 189, 248, 0.07), transparent 60%),
    linear-gradient(180deg, #f4f7fb 0%, #e9eff9 55%, #f4f7fb 100%);
}
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image:
    linear-gradient(rgba(15,23,42,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
}

.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  z-index: 50; box-shadow: 0 0 12px rgba(37,99,235,.35);
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 247, 251, 0.86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}
.topbar-inner {
  max-width: 800px; margin: 0 auto; padding: .8rem 1.6rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.back {
  display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none; color: var(--faint);
  font-size: .82rem; font-weight: 600;
  transition: color .25s ease;
}
.back:hover { color: var(--accent); }
.back svg { width: 15px; height: 15px; }
.brand { font-size: .74rem; font-weight: 800; letter-spacing: .14em; color: var(--accent); }

/* ===== 正文 ===== */
.wrap {
  position: relative; z-index: 2;
  max-width: 800px; margin: 0 auto;
  padding: 3.4rem 1.6rem 4.5rem;
}

.kicker {
  display: inline-block;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, .22);
  padding: .22rem .68rem; border-radius: 20px;
  margin-bottom: 1.15rem;
}

h1.title {
  font-size: 2.05rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.32;
  background: linear-gradient(120deg, #0f172a 20%, #1d4ed8 70%, #0ea5e9 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { margin-top: .75rem; font-size: 1rem; color: var(--muted); }

.meta {
  margin-top: 1.5rem; padding-bottom: 1.6rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  font-size: .78rem; color: var(--faint); letter-spacing: .03em;
}
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }

article { margin-top: 2.2rem; }

article h2 {
  font-size: 1.22rem; font-weight: 700; letter-spacing: -0.01em;
  margin: 2.6rem 0 .9rem;
  display: flex; align-items: center; gap: .8rem;
}
article h2::before {
  content: ""; width: 4px; height: 1.05em; border-radius: 2px;
  background: linear-gradient(180deg, #2563eb, #38bdf8); flex: none;
}
article h3 {
  font-size: 1.02rem; font-weight: 700; color: #1e293b;
  margin: 1.9rem 0 .6rem;
}
article p { margin: .95rem 0; color: #1e293b; font-size: .96rem; }
article strong { color: var(--text); font-weight: 700; }
article strong.hl { color: #1d4ed8; }

article ul { margin: 1rem 0 1.1rem 1.15rem; }
article li { margin: .38rem 0; color: var(--muted); font-size: .94rem; }
article li::marker { color: var(--accent); }

/* ===== 表格 ===== */
.tab {
  margin: 1.9rem 0 .55rem;
  font-size: .76rem; font-weight: 700; letter-spacing: .06em; color: var(--faint);
}
.tbl-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: .86rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
th, td { padding: .62rem .85rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: #f1f5fb; font-weight: 700; font-size: .8rem; color: #334155;
  letter-spacing: .02em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(37, 99, 235, 0.045); }
td strong { color: #1d4ed8; }

/* ===== 插图 ===== */
figure.fig { margin: 2.1rem 0 2.3rem; }
.fig-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.15rem .95rem;
  overflow-x: auto;
}
figure.fig svg { width: 100%; height: auto; display: block; min-width: 520px; }
figure.fig figcaption {
  margin-top: .7rem; font-size: .78rem; line-height: 1.75; color: var(--faint);
}
figure.fig figcaption b { color: var(--muted); font-weight: 700; }
.swipe { display: none; }
.fig-box { -webkit-overflow-scrolling: touch; }

/* ===== 伪代码 ===== */
.code {
  margin: 1.6rem 0 1.8rem;
  background: #0f1a2b;
  border: 1px solid #1e293b;
  border-radius: 12px;
  overflow: hidden;
}
.code-cap {
  padding: .5rem .95rem; font-size: .72rem; letter-spacing: .06em;
  color: #94a3b8; background: #0b1424; border-bottom: 1px solid #1e293b;
}
.code pre { margin: 0; padding: .95rem 1.1rem 1.1rem; overflow-x: auto; }
.code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Cascadia Mono", monospace;
  font-size: .79rem; line-height: 1.7; color: #dbe6f5;
  white-space: pre; display: block;
}
.code .c { color: #7d93ad; font-style: italic; }
.code .k { color: #7dd3fc; }
.code .s { color: #a7e3a1; }

/* ===== 翻页 ===== */
.pager {
  margin-top: 3.6rem; padding-top: 1.6rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.pager a {
  display: inline-flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--muted);
  font-size: .85rem; font-weight: 600;
  padding: .62rem 1rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  transition: border-color .25s ease, color .25s ease, transform .25s ease, background .25s ease;
}
.pager a:hover {
  color: var(--accent); border-color: rgba(37, 99, 235, 0.45);
  background: var(--accent-soft); transform: translateY(-2px);
}
/* 箭头没有 width/height 时 SVG 会撑成默认 300×150，必须限定 */
.pager a svg { width: 15px; height: 15px; flex: none; }
.pager .empty { display: none; }
.pager .next { margin-left: auto; }

footer.note {
  margin-top: 2.4rem; font-size: .76rem; color: #64748b; letter-spacing: .03em;
}

@media (max-width: 640px) {
  .swipe { display: inline; color: var(--accent); font-weight: 600; }
  figure.fig svg { min-width: 460px; }
  .wrap { padding: 2.4rem 1.25rem 3.5rem; }
  h1.title { font-size: 1.6rem; }
  article h2 { font-size: 1.12rem; margin-top: 2.1rem; }
  table { font-size: .8rem; }
  th, td { padding: .5rem .6rem; }
}
