@charset "utf-8";
/*!
 * GIS-Proj · 样式
 *
 * 配色令牌与 02-universe / 01-blog 同源（暖黑 / 暖白 + 三级灰），
 * 由 _tools/probe.js 现读比对，不在这里抄第二份真相。
 * 界面零彩度；唯一的色相来自地图本身（专题图的分级设色）。
 */

:root {
  --bg-alt-rgb: 15, 15, 15;      /* 页底   ← blog --bg      */
  --bg-rgb: 24, 24, 24;          /* 卡片   ← blog --card    */
  --bg-2-rgb: 33, 33, 33;        /* 加深   ← blog --card-2  */
  --fg-rgb: 242, 241, 237;       /* 主文字 ← blog --ink     */
  --fg-alt-rgb: 181, 180, 174;   /* 次级   ← blog --ink-2   */
  --fg-weak-rgb: 130, 129, 122;  /* 弱     ← blog --ink-3   */
  --line-rgb: 255, 255, 255;
  --hl-rgb: 242, 241, 237;
  --hl-ink-rgb: 15, 15, 15;

  --r: 5px;
  --r-sm: 4px;
  --shadow: 0 18px 44px -22px rgba(0, 0, 0, .85);
  --shadow-rest: 0 10px 26px -16px rgba(0, 0, 0, .6);
  --max: 1080px;
  --pad: clamp(20px, 5vw, 72px);

  --f-cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --f-serif: Georgia, "Times New Roman", "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* 地图：填充/描边/悬停/选中。零彩度基调，悬停用明度抬升而非上色 */
  --map-fill: rgba(var(--fg-rgb), .07);
  --map-fill-hi: rgba(var(--fg-rgb), .30);
  --map-stroke: rgba(var(--fg-rgb), .34);
  --map-stroke-hi: rgba(var(--fg-rgb), .95);
}

html[data-theme="light"] {
  --bg-alt-rgb: 240, 238, 234;
  --bg-rgb: 251, 250, 248;
  --bg-2-rgb: 227, 224, 217;
  --fg-rgb: 22, 22, 22;
  --fg-alt-rgb: 92, 91, 86;
  --fg-weak-rgb: 104, 103, 95;
  --line-rgb: 20, 20, 20;
  --hl-rgb: 22, 22, 22;
  --hl-ink-rgb: 255, 255, 255;
  --shadow: 0 18px 44px -24px rgba(0, 0, 0, .35);
  --shadow-rest: 0 10px 26px -18px rgba(0, 0, 0, .22);
  --map-fill: rgba(var(--fg-rgb), .06);
  --map-fill-hi: rgba(var(--fg-rgb), .26);
  --map-stroke: rgba(var(--fg-rgb), .30);
  --map-stroke-hi: rgba(var(--fg-rgb), .95);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: rgb(var(--bg-alt-rgb));
  color: rgb(var(--fg-rgb));
  font-family: var(--f-cn);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

a { color: inherit; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(var(--bg-alt-rgb), .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(var(--line-rgb), .10);
}
.top-in { display: flex; align-items: center; gap: 16px; padding: 14px 0; }
.brand {
  font-family: var(--f-serif);
  font-size: 19px; letter-spacing: .02em;
  text-decoration: none; font-weight: 600;
}
.brand .sub { font-size: 12px; color: rgb(var(--fg-weak-rgb)); font-family: var(--f-cn); font-weight: 400; margin-left: 8px; letter-spacing: 0; }
.top-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.top-nav a { font-size: 14px; color: rgb(var(--fg-alt-rgb)); text-decoration: none; }
.top-nav a:hover, .top-nav a:focus-visible { color: rgb(var(--fg-rgb)); }
.icon-btn {
  border: 1px solid rgba(var(--line-rgb), .16);
  background: transparent; color: rgb(var(--fg-alt-rgb));
  border-radius: var(--r-sm); padding: 5px 10px;
  font-size: 13px; cursor: pointer; font-family: inherit;
  min-height: 32px;
}
.icon-btn:hover { color: rgb(var(--fg-rgb)); border-color: rgba(var(--line-rgb), .34); }

/* ---------- 通用排版 ---------- */
h1, h2, h3 { font-family: var(--f-serif); font-weight: 600; line-height: 1.35; }
h1 { font-size: clamp(28px, 5vw, 42px); margin: 0 0 12px; letter-spacing: .01em; }
h2 { font-size: clamp(21px, 3vw, 27px); margin: 0 0 14px; }
h3 { font-size: 17px; margin: 0 0 8px; }
p { margin: 0 0 14px; }
.lede { font-size: 17px; color: rgb(var(--fg-alt-rgb)); max-width: 46em; }
.muted { color: rgb(var(--fg-weak-rgb)); font-size: 14px; }

section { padding: 52px 0; border-top: 1px solid rgba(var(--line-rgb), .09); }
section:first-of-type { border-top: 0; }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  padding: 72px 0 48px;
}
/* 制图学经纬网格底纹：极低透明度纯发丝线 + 边缘径向淡出，零彩度 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--pad) * -0.5);
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(var(--line-rgb), .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--line-rgb), .045) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at 32% 45%, #000 18%, transparent 78%);
  mask-image: radial-gradient(ellipse 78% 72% at 32% 45%, #000 18%, transparent 78%);
}
.hero > * { position: relative; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11.5px; letter-spacing: .24em; text-transform: uppercase;
  color: rgb(var(--fg-weak-rgb)); margin-bottom: 16px;
}
.hero .kicker::before {
  content: ""; width: 18px; height: 1px;
  background: rgba(var(--line-rgb), .32);
}
.hero .meta {
  display: flex; gap: 22px; flex-wrap: wrap; margin-top: 24px;
  font-size: 13px; color: rgb(var(--fg-weak-rgb));
  font-variant-numeric: tabular-nums;
}
.hero .meta b { color: rgb(var(--fg-rgb)); font-weight: 600; }

/* ---------- 地图 ---------- */
.map-card {
  background: rgb(var(--bg-rgb));
  border: 1px solid rgba(var(--line-rgb), .12);
  border-radius: var(--r);
  box-shadow: inset 0 0 0 1px rgba(var(--line-rgb), .03);
  padding: 20px;
  margin-top: 20px;
}
.map-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.map-title { font-family: var(--f-serif); font-size: 16px; font-weight: 600; }
.map-hint { font-size: 12.5px; color: rgb(var(--fg-weak-rgb)); }

.map-stage { position: relative; }
.map-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }

.map-feature {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: .8;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;   /* 缩放时线宽恒定，不随 viewBox 变粗 */
  transition: fill .16s var(--ease);
  cursor: pointer;
}
.map-feature:hover,
.map-feature:focus-visible {
  fill: var(--map-fill-hi);
  stroke: var(--map-stroke-hi);
  outline: none;
}
.map-feature.is-on { fill: var(--map-fill-hi); stroke: var(--map-stroke-hi); }

/* 悬停标签：跟在鼠标旁，不遮挡地图 */
.map-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: rgb(var(--hl-rgb)); color: rgb(var(--hl-ink-rgb));
  font-size: 12.5px; padding: 4px 9px; border-radius: var(--r-sm);
  white-space: nowrap; transform: translate(-50%, -140%);
  opacity: 0; transition: opacity .12s var(--ease);
  box-shadow: var(--shadow-rest);
}
.map-tip.on { opacity: 1; }

.map-legend { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: 12.5px; color: rgb(var(--fg-weak-rgb)); }
.map-legend .sw { display: inline-block; width: 26px; height: 12px; border-radius: 2px; border: 1px solid var(--map-stroke); background: var(--map-fill); }

/* 下钻：切换到市级 */
.map-switch { display: flex; gap: 8px; margin-left: auto; }
.map-switch button {
  border: 1px solid rgba(var(--line-rgb), .16); background: transparent;
  color: rgb(var(--fg-alt-rgb)); border-radius: var(--r-sm);
  padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
  min-height: 32px;
}
.map-switch button[aria-pressed="true"] {
  background: rgb(var(--hl-rgb)); color: rgb(var(--hl-ink-rgb));
  border-color: rgb(var(--hl-rgb));
}
.map-status { font-size: 12.5px; color: rgb(var(--fg-weak-rgb)); margin-top: 10px; min-height: 1.4em; }

/* ---------- 卡片 / 列表 ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card {
  background: rgb(var(--bg-rgb));
  border: 1px solid rgba(var(--line-rgb), .10);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-rest);
}
.card h3 { margin-bottom: 6px; }
.card p { font-size: 14.5px; color: rgb(var(--fg-alt-rgb)); margin-bottom: 8px; }
.card .tag {
  display: inline-block; font-size: 11.5px; letter-spacing: .06em;
  color: rgb(var(--fg-weak-rgb)); border: 1px solid rgba(var(--line-rgb), .16);
  border-radius: 999px; padding: 2px 9px; margin-bottom: 10px;
}

/* 文章卡片（首页列表，整张可点） */
.post-card {
  display: block; text-decoration: none; color: inherit;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.post-card:hover, .post-card:focus-visible {
  border-color: rgba(var(--line-rgb), .30);
  transform: translateY(-2px);
}
.post-card .muted { display: block; margin-top: 6px; font-size: 12.5px; }

/* 文章正文 */
.post { max-width: 42em; padding: 46px 0; }
.post-head { margin-bottom: 30px; }
.post h1 { font-size: clamp(26px, 4vw, 36px); margin: 8px 0 6px; }
.post h2 { font-size: clamp(20px, 3vw, 25px); margin: 34px 0 12px; }
.post h3 { font-size: 17px; margin: 26px 0 8px; }
.post p { margin: 0 0 15px; }
/* 文章页语言提示：正文只有中文，切到英文时必须明说，不能让读者以为整篇
   都翻好了。默认（中文态）隐藏，靠 html[data-lang="en"] 显形。
   ⚠️ 隐藏写默认、显示写条件 —— 方向不能反：post-lang.js 挂掉时它应保持
   隐藏（那是正确态），写成「默认显示、JS 负责隐藏」则脚本一挂就永远挂着。 */
.lang-note {
  display: none;
  margin: 0 0 18px; padding: 9px 13px;
  font-size: 13px; line-height: 1.6;
  color: rgb(var(--fg-weak-rgb));
  border-left: 2px solid rgba(var(--line-rgb), .5);
  background: rgba(var(--bg-2-rgb), .5);
}
html[data-lang="en"] .lang-note { display: block; }
.post ul, .post ol { margin: 0 0 18px; padding-left: 1.4em; }
.post li { margin-bottom: 7px; }
.post code {
  background: rgb(var(--bg-2-rgb)); padding: 1px 6px;
  border-radius: 3px; font-size: .9em;
}
.post pre {
  background: rgb(var(--bg-2-rgb)); padding: 14px 16px;
  border-radius: var(--r-sm); overflow-x: auto; margin: 0 0 18px;
}
.post pre code { background: none; padding: 0; }
.post blockquote {
  border-left: 2px solid rgb(var(--fg-alt-rgb));
  margin: 0 0 18px; padding: 2px 0 2px 16px;
  color: rgb(var(--fg-alt-rgb));
}
.post table {
  width: 100%; border-collapse: collapse; margin: 0 0 20px;
  font-size: 14.5px; display: block; overflow-x: auto;
}
.post th, .post td {
  border: 1px solid rgba(var(--line-rgb), .16);
  padding: 8px 11px; text-align: left;
}
.post th { background: rgb(var(--bg-2-rgb)); font-weight: 600; }
.post hr { border: 0; border-top: 1px solid rgba(var(--line-rgb), .14); margin: 30px 0; }
.post a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 文章页两栏（正文 + 侧栏） ----------
 * 为什么是 38em 而不是原来的 42em：两栏要共存，正文列必须让出宽度。
 * 38em ≈ 608px，按正文 14px 算约 43 字/行，仍在舒适区间（35–45 字）；
 * 42em 时右侧只剩 208px，放文章标题会折成 4 行，反而更难读。
 * 容器仍是 .wrap 的 1080px —— 不放大，顶栏/正文/页脚左边缘才对得齐。
 */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 38em) minmax(0, 1fr);
  gap: 0 48px;
  align-items: start;   /* ⚠️ 必须：不加这句侧栏会被拉伸到整行高，sticky 永远不生效 */
}
.post-layout .post { max-width: none; }

.post-side {
  position: sticky;
  top: 84px;
  align-self: start;
  /* 侧栏独立滚动：目录 + 全部文章在长文里会比一屏高，必须能滚。
   * max-height 用 96px 而不是 104px —— 1440×900 这个最常见尺寸下，侧栏内容
   * 恰好 805px、可视 796px，只溢出 9px 会冒出一条"几乎看不见"的滚动条，
   * 看着像渲染 bug。留 8px 余量让它在这个尺寸下干净地放得下。 */
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;   /* 滚到侧栏底部别把整页一起带着滚 */
  padding: 40px 0;
  font-size: 14px;
  scrollbar-width: thin;
}

.side-block { margin-bottom: 30px; }
.side-block:last-child { margin-bottom: 0; }
.side-h {
  font-family: var(--f-cn);
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em;
  color: rgb(var(--fg-weak-rgb));
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(var(--line-rgb), .10);
}
.side-n { font-weight: 400; letter-spacing: 0; }

/* 本文目录 */
.toc, .post-nav { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 5px 0 5px 11px;
  border-left: 1px solid rgba(var(--line-rgb), .14);
  color: rgb(var(--fg-alt-rgb)); text-decoration: none;
  line-height: 1.5;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.toc a:hover, .toc a:focus-visible { color: rgb(var(--fg-rgb)); border-left-color: rgb(var(--fg-alt-rgb)); }
.toc li.lv3 a { padding-left: 24px; font-size: 13.5px; }
/* 当前小节由 post.js 标 aria-current=location；样式跟着它走，不另设类名 */
.toc a[aria-current] { color: rgb(var(--fg-rgb)); border-left-color: rgb(var(--fg-rgb)); font-weight: 600; }

/* 全部文章 */
.post-nav li { margin: 0; }
.post-nav a {
  display: block; padding: 6px 10px; border-radius: var(--r-sm);
  color: rgb(var(--fg-alt-rgb)); text-decoration: none; line-height: 1.45;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.post-nav a:hover, .post-nav a:focus-visible { background: rgb(var(--bg-rgb)); color: rgb(var(--fg-rgb)); }
.post-nav li.is-cur a {
  background: rgb(var(--bg-rgb)); color: rgb(var(--fg-rgb)); font-weight: 600;
  box-shadow: inset 2px 0 0 rgb(var(--fg-rgb));
}

/* 文末上一篇 / 下一篇 */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 34px; padding-top: 22px;
  border-top: 1px solid rgba(var(--line-rgb), .10);
}
.pager a {
  display: block; padding: 12px 14px;
  border: 1px solid rgba(var(--line-rgb), .12); border-radius: var(--r-sm);
  text-decoration: none; color: rgb(var(--fg-rgb));
  font-size: 14.5px; line-height: 1.5;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.pager a:hover, .pager a:focus-visible { border-color: rgba(var(--line-rgb), .30); background: rgb(var(--bg-rgb)); }
.pager a span {
  display: block; font-size: 11.5px; letter-spacing: .08em;
  color: rgb(var(--fg-weak-rgb)); margin-bottom: 4px;
}
.pg-next { text-align: right; }
/* 首篇没有上一篇、末篇没有下一篇：让唯一的那个占满整行，不要留半格空位 */
.pager a:only-child { grid-column: 1 / -1; }

/* 目录跳转后标题别被 sticky 顶栏盖住 */
.post h2, .post h3 { scroll-margin-top: 76px; }

/* 资源清单 */
.res-list { list-style: none; margin: 0; padding: 0; }
.res-item {
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 1px solid rgba(var(--line-rgb), .08);
}
.res-item:last-child { border-bottom: 0; }
.res-name { font-weight: 600; min-width: 8em; }
.res-desc { color: rgb(var(--fg-alt-rgb)); font-size: 14.5px; flex: 1; min-width: 14em; }
.res-kind { font-size: 11.5px; color: rgb(var(--fg-weak-rgb)); border: 1px solid rgba(var(--line-rgb), .16); border-radius: 999px; padding: 2px 9px; }
/* 链接是主要可点目标：内联元素默认高度只有行高（约 20px），低于 WCAG 2.2
   的 24px 最小尺寸。改成 inline-block + 内边距把热区撑到 ≥24px。 */
.res-item a {
  color: rgb(var(--fg-rgb)); text-decoration: underline; text-underline-offset: 3px;
  display: inline-block; padding: 3px 0; min-height: 24px;
}

/* 步骤条（经验分享用） */
.steps { counter-reset: s; list-style: none; margin: 18px 0 0; padding: 0; }
.steps li {
  counter-increment: s; position: relative;
  padding: 0 0 18px 40px; border-left: 1px solid rgba(var(--line-rgb), .14);
  margin-left: 12px;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(s);
  position: absolute; left: -13px; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgb(var(--bg-2-rgb)); color: rgb(var(--fg-rgb));
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-serif);
}
.steps b { display: block; font-size: 15px; margin-bottom: 2px; }
.steps span { font-size: 14.5px; color: rgb(var(--fg-alt-rgb)); }

/* 坑（踩坑记录） */
.pit { background: rgb(var(--bg-rgb)); border: 1px solid rgba(var(--line-rgb), .10); border-left: 2px solid rgb(var(--fg-alt-rgb)); border-radius: var(--r-sm); padding: 14px 16px; margin: 12px 0; }
.pit b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.pit span { font-size: 14px; color: rgb(var(--fg-alt-rgb)); }

/* ---------- 页脚 ---------- */
footer { border-top: 1px solid rgba(var(--line-rgb), .10); padding: 34px 0 46px; font-size: 13.5px; color: rgb(var(--fg-weak-rgb)); }
footer a { color: rgb(var(--fg-alt-rgb)); }

/* 跳转链接 */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: rgb(var(--hl-rgb)); color: rgb(var(--hl-ink-rgb));
  padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px;
}
.skip:focus { left: 12px; top: 12px; }

:focus-visible { outline: 2px solid rgb(var(--fg-rgb)); outline-offset: 2px; }

/* 两栏在窄屏收成一栏。
 * 断点取 980px 而不是 720px：正文列固定 38em(608px) + 48px 间距 + 侧栏，
 * 视口一旦低于约 980px，侧栏就只剩 150px 上下，中文标题会折成三四行、
 * 比不放还难读。所以在「侧栏已经不好用」的那一刻就收，而不是等手机断点。
 */
@media (max-width: 980px) {
  /* 单栏时仍要把正文钉在 38em：不加这条，980px 视口下正文会被拉到 882px
   * ≈ 63 字/行（中文舒适区 30–45 字），一栏反而比两栏更难读 —— 这是
   * 删掉 .post{max-width} 后最容易漏掉的一半。
   * 侧栏跟着同宽，否则下方「全部文章」比正文宽一截，左边缘对不齐。 */
  .post-layout {
    grid-template-columns: minmax(0, 38em);
    justify-content: start;
    gap: 0;
  }
  .post-side {
    position: static; max-height: none; overflow: visible;
    padding: 0 0 8px; order: 2;
    border-top: 1px solid rgba(var(--line-rgb), .10); margin-top: 8px; padding-top: 24px;
  }
  /* 一栏时目录没有「跟着读」的意义（它不在旁边了），只剩占屏高；
     「全部文章」留着 —— 手机上文末能直接跳下一篇是刚需。
     无小节的文章没有目录块，此时「全部文章」是首个子块也是末个，不会被误藏。 */
  .post-side .side-block:first-child:not(:last-child) { display: none; }
  .post-side .side-block { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 720px) {
  .top-in { flex-wrap: wrap; }
  .top-nav { gap: 14px; }
  section { padding: 38px 0; }
  .hero { padding: 46px 0 32px; }
}
