:root {
  --ink: #171a21;
  --ink2: #454c5a;
  --ink3: #767e8e;
  --line: #e2e6ee;
  --line2: #cfd6e3;
  --bg: #ffffff;
  --soft: #f7f9fc;
  --brand: #17457a;
  --brand2: #2563a8;
  --brand-soft: #eef4fb;
  --warn-bg: #fdf6e8;
  --warn-line: #e6c987;
  --warn-ink: #7a5210;
  --ok-bg: #eef7f2;
  --ok-line: #a9d4bd;
  --ok-ink: #1a5c40;
  --radius: 10px;
  --wrap: 1120px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.78;
}

a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- header ---------- */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; }
.brand a { color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.brand a:hover { text-decoration: none; color: var(--brand); }
.brand span { font-size: 12.5px; color: var(--ink3); }

.site-nav { display: flex; gap: 22px; flex-wrap: wrap; padding: 12px 0; }
.site-nav a { font-size: 14.5px; color: var(--ink2); }
.site-nav a.on { color: var(--brand); font-weight: 600; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line2);
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--ink2);
  cursor: pointer;
}

/* ---------- hero ---------- */
.hero { padding: 52px 0 34px; border-bottom: 1px solid var(--line); background: var(--soft); }
.hero h1 { font-size: 30px; line-height: 1.4; margin: 0 0 14px; font-weight: 600; letter-spacing: .3px; }
.hero p { margin: 0; color: var(--ink2); max-width: 760px; font-size: 16px; }
.hero .kicker {
  display: inline-block; font-size: 13px; color: var(--brand);
  background: var(--brand-soft); border: 1px solid #d6e4f5;
  padding: 3px 10px; border-radius: 99px; margin-bottom: 16px;
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: 48px; padding: 40px 0 64px; }
/* 没有侧栏的页面（首页/404）：必须切回单栏，否则 main 会被塞进 246px 的侧栏列，右侧整块留白 */
.layout--full { grid-template-columns: minmax(0, 1fr); gap: 0; }
.layout > main { min-width: 0; }

/* 首页顶部：左文右表，把整行宽度用满 */
.home-top { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); gap: 46px; align-items: start; }
.home-top .section-title { margin-top: 0; }
.home-side .facts { margin-bottom: 0; }
.home-side .muted { margin: 0 0 14px; font-size: 14px; color: var(--ink3); }
/* 首页正文与文章正文用同一个文字颜色，不然两处读起来像两个站 */
.home-lead p { color: var(--ink2); }
.narrow { max-width: 820px; }
.side { position: sticky; top: 20px; align-self: start; }
.side h2 {
  font-size: 12.5px; text-transform: none; letter-spacing: .6px;
  color: var(--ink3); margin: 0 0 12px; font-weight: 600;
}
.side ul { list-style: none; margin: 0 0 26px; padding: 0; border-left: 2px solid var(--line); }
.side li a { display: block; padding: 5px 0 5px 14px; font-size: 14.5px; color: var(--ink2); margin-left: -2px; border-left: 2px solid transparent; }
.side li a:hover { color: var(--brand); text-decoration: none; border-left-color: var(--line2); }
.side li a.on { color: var(--brand); font-weight: 600; border-left-color: var(--brand); }
.side .colhead { font-size: 15px; font-weight: 600; color: var(--ink); display: block; padding: 4px 0 8px; }

/* ---------- article ---------- */
.crumb { font-size: 13.5px; color: var(--ink3); margin-bottom: 14px; }
.crumb a { color: var(--ink3); }
article h1 { font-size: 27px; line-height: 1.45; margin: 0 0 12px; font-weight: 600; letter-spacing: .2px; }
.meta { font-size: 13.5px; color: var(--ink3); padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.lede { font-size: 17px; color: var(--ink2); background: var(--soft); border-left: 3px solid var(--brand2); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 0 0 30px; }

article h2 {
  font-size: 20px; margin: 40px 0 14px; font-weight: 600;
  padding-top: 6px; letter-spacing: .2px;
}
article h3 { font-size: 17px; margin: 28px 0 10px; font-weight: 600; }
article p { margin: 0 0 16px; color: var(--ink2); }
article ul, article ol { margin: 0 0 18px; padding-left: 22px; color: var(--ink2); }
article li { margin-bottom: 7px; }
article strong { color: var(--ink); font-weight: 600; }
article code {
  background: var(--soft); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 14.5px; }
th, td { border: 1px solid var(--line); padding: 10px 13px; text-align: left; vertical-align: top; }
th { background: var(--soft); font-weight: 600; color: var(--ink); white-space: nowrap; }
td { color: var(--ink2); }

/* 表格外面套的横向滚动容器。
   手机上 4~5 列的表会撑破整页、导致全页横滑，套上它之后只有表格自己能滑。 */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.table-wrap > table { margin: 0; min-width: 480px; }
.table-wrap > table th,
.table-wrap > table td { border-top: 0; border-left: 0; }
.table-wrap > table th:last-child,
.table-wrap > table td:last-child { border-right: 0; }
.table-wrap > table tr:last-child td { border-bottom: 0; }

blockquote {
  margin: 0 0 20px; padding: 12px 18px;
  background: var(--soft); border-left: 3px solid var(--line2);
  color: var(--ink2); border-radius: 0 8px 8px 0;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

/* ---------- callouts ---------- */
.callout { border-radius: var(--radius); padding: 14px 18px; margin: 0 0 22px; border: 1px solid; font-size: 15px; }
.callout p:last-child { margin-bottom: 0; }
.callout .tag { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.callout.answer { background: var(--ok-bg); border-color: var(--ok-line); }
.callout.answer .tag { color: var(--ok-ink); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.callout.warn .tag { color: var(--warn-ink); }

/* ---------- fact table ---------- */
.facts { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 24px; }
.facts .row { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.facts .row:last-child { border-bottom: 0; }
.facts .k { background: var(--soft); padding: 11px 16px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.facts .v { padding: 11px 16px; font-size: 14.5px; color: var(--ink2); }
.facts .v small { display: block; color: var(--ink3); font-size: 13px; margin-top: 2px; }

/* ---------- 图片（插图 / 图注 / 并排） ---------- */
.fig { margin: 0 0 26px; }
.fig img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--soft);
}
.fig figcaption {
  margin-top: 10px; font-size: 13.5px; color: var(--ink3);
  text-align: center; line-height: 1.7;
}
/* 宽度档位：在 Markdown 里写 ![](images/x.jpg){.w60} 即可 */
.fig.w25, .fig.w33, .fig.w50, .fig.w60, .fig.w70, .fig.w80, .fig.w90 {
  margin-left: auto; margin-right: auto;
}
.fig.w25 { max-width: 25%; }
.fig.w33 { max-width: 33%; }
.fig.w50 { max-width: 50%; }
.fig.w60 { max-width: 60%; }
.fig.w70 { max-width: 70%; }
.fig.w80 { max-width: 80%; }
.fig.w90 { max-width: 90%; }

/* 并排图：用 ::: imgs 包住若干张单图 */
.img-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 0 0 26px; align-items: start; }
.img-row.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.img-row .fig { margin-bottom: 0; }
.img-row .fig.w25, .img-row .fig.w33, .img-row .fig.w50,
.img-row .fig.w60, .img-row .fig.w70, .img-row .fig.w80, .img-row .fig.w90 { max-width: 100%; }

/* 正文里夹在文字中的小图 */
article p img, .lede img, .callout img { max-width: 100%; height: auto; border-radius: 8px; }

/* ---------- faq ---------- */
.faq { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 6px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 15px 0; font-size: 16px; font-weight: 600;
  color: var(--ink); list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "＋"; color: var(--brand2); margin-right: 10px; font-weight: 400; }
.faq details[open] summary::before { content: "－"; }
.faq .a { padding: 0 0 18px 26px; color: var(--ink2); font-size: 15px; }

/* ---------- action box ---------- */
.action {
  margin: 44px 0 0; padding: 22px 24px; border: 1px solid #d6e4f5;
  background: var(--brand-soft); border-radius: var(--radius);
}
.action h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--brand); }
.action p { margin: 0 0 12px; font-size: 15px; color: var(--ink2); }
.action ul { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink2); }
.action .cta { margin-top: 14px; font-size: 15px; color: var(--ink2); }

/* ---------- article cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 0 0 34px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  background: var(--bg); display: block;
}
.card:hover { border-color: var(--line2); text-decoration: none; }
.card .col { font-size: 12.5px; color: var(--brand2); }
.card h3 { margin: 6px 0 8px; font-size: 16.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.card p { margin: 0; font-size: 14px; color: var(--ink3); line-height: 1.65; }

.section-title { font-size: 19px; font-weight: 600; margin: 44px 0 18px; letter-spacing: .2px; }
.section-title:first-child { margin-top: 0; }

/* ---------- machine readable strip ---------- */
.machine {
  margin: 40px 0 0; padding: 16px 20px; border: 1px dashed var(--line2);
  border-radius: var(--radius); background: var(--soft);
}
.machine h3 { margin: 0 0 8px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.machine p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink3); }
.machine ul { margin: 0; padding-left: 20px; font-size: 13.5px; }
.machine li { margin-bottom: 4px; }
.machine code { background: #fff; border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--soft); margin-top: 20px; padding: 34px 0 44px; }
.site-foot .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.site-foot h4 { font-size: 13.5px; margin: 0 0 10px; color: var(--ink); font-weight: 600; }
.site-foot p, .site-foot li { font-size: 13.5px; color: var(--ink3); margin: 0 0 6px; line-height: 1.7; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot .legal { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink3); }

/* 站群互链：只在有第二个已上线站点时才会出现（见 build.py 的 build_siblings） */
.siblings { margin-top: 18px; }
.siblings li { margin-bottom: 10px; }
.siblings span { font-size: 12.5px; color: var(--ink3); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  /* minmax(0,1fr) 而不是 1fr：否则里面的宽表格会把整列撑开、页面横滑 */
  .layout { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 28px 0 48px; }
  .home-top { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .side { position: static; display: none; }
  .side.open { display: block; }
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; }
  .hero { padding: 34px 0 26px; }
  .hero h1 { font-size: 23px; }
  article h1 { font-size: 22px; }
  article h2 { font-size: 18.5px; }
  .facts .row { grid-template-columns: 110px minmax(0, 1fr); }
  table { font-size: 13.5px; }
  th, td { padding: 8px 10px; }
}

@media (max-width: 640px) {
  .img-row, .img-row.cols3 { grid-template-columns: minmax(0, 1fr); }
  .fig.w25, .fig.w33, .fig.w50, .fig.w60, .fig.w70, .fig.w80, .fig.w90 { max-width: 100%; }
}
