/* CLREQ: §3.1 字体、§6.1 标点禁则、§6.3.3 中西间距、§7.1.1 版心与行长。
   https://www.w3.org/TR/clreq/ — 限宽居中，正文左对齐；只用本机字体。 */
html { color-scheme: light dark; }
:root {
  --bg: #fff;
  --fg: #222;
  --muted: #666;
  --faint: #8e8e8e;
  --border: #e0e0e0;
  --border-light: #ececec;
  --link: #245842;
  --link-hover: #163d2d;
  --pill-bg: #f3f5f4;
  --pill-hover: #e6ece8;
  --toast-bg: rgba(23, 23, 23, .9);
  --toast-fg: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #dedede;
    --muted: #999;
    --faint: #666;
    --border: #2c2c2c;
    --border-light: #242424;
    --link: #58b88d;
    --link-hover: #72cca1;
    --pill-bg: #1e2521;
    --pill-hover: #27342d;
    --toast-bg: rgba(240, 240, 240, .92);
    --toast-fg: #111;
  }
}
body {
  box-sizing: border-box;
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.75 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
:lang(zh) { line-break: strict; word-break: normal; text-autospace: normal; }
header, .intro { text-align: center; }
header > p { margin: 0 0 .6rem; font-size: 1.5rem; font-weight: 600; }
header small { font-size: .6em; font-weight: 400; color: var(--muted); }
h1, h2 { line-height: 1.4; }
main > h1, .intro > h1 { margin: .75rem 0; font-size: 1.35rem; }
h2 { margin: 2.5rem 0 1rem; font-size: 1.15rem; }
h2 small { font-size: .8em; font-weight: 400; color: var(--muted); }
h3 { margin: 1.8rem 0 .6rem; font-size: 1.05rem; line-height: 1.4; }
p { margin: .75rem 0; }
main ul:not(nav ul), main ol { padding-left: 1.4rem; margin: .85rem 0; }
main li { margin: .35rem 0; }
blockquote { margin: 1.2rem 0; padding: .6rem 1rem; border-left: 3px solid var(--link); background: var(--pill-bg); border-radius: 0 4px 4px 0; }
blockquote p { margin: .25rem 0; }
a { color: var(--link); text-underline-offset: .25em; text-decoration-thickness: .06em; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
nav { font-size: .94rem; }
nav ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1rem; margin: 1.25rem 0; padding: 0; list-style: none; }
nav a { text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav a[aria-current="page"] {
  font-weight: 600;
  color: var(--fg);
  border-bottom: 2px solid var(--link);
  padding-bottom: 2px;
}
nav small { color: var(--muted); font-size: .85em; }
/* 文章列表与正文排版 */
.article-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.article-list li { margin: 1.5rem 0; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border-light); }
.article-list li:last-child { border-bottom: none; }
.article-list h2 { margin: 0 0 .35rem; font-size: 1.2rem; }
.article-list .meta { font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
.article-list p { margin: .35rem 0; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.article-meta { font-size: .88rem; color: var(--muted); margin: -.25rem 0 1.5rem; }
.back-link { display: inline-block; margin-bottom: .8rem; font-size: .9rem; }
.article-box { margin: 2.5rem 0 1rem; padding: 1.2rem; border-radius: 8px; background: var(--pill-bg); border: 1px solid var(--border-light); text-align: center; }
.article-box p { margin: .35rem 0; }
hr { margin: 1.75rem 0; border: 0; border-top: 1px solid var(--border); }
/* 目录列表与栏目排版 */
dt { margin-top: 1.4rem; font-weight: 600; }
dt a { text-decoration: none; color: var(--fg); }
dt a:hover { color: var(--link); text-decoration: underline; }
dt a::after { content: " ↗"; font-size: .78em; color: var(--faint); font-weight: 400; text-decoration: none; }
dd { margin: .35rem 0 1.25rem; line-height: 1.6; overflow-wrap: break-word; color: var(--muted); }
dd a {
  display: inline-block;
  padding: 1px 4px;
  margin: 1px 0;
  border-radius: 3px;
  color: var(--link);
  text-decoration: none;
  cursor: pointer;
}
dd a:hover {
  background: var(--pill-bg);
  color: var(--link-hover);
}
dd .sep { color: var(--border); user-select: none; margin: 0 1px; }

/* 按钮与输入框 */
.btn, a.btn {
  display: inline-block;
  padding: .3em .8em;
  border-radius: 999px;
  background: var(--link);
  color: var(--bg);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.btn:hover, a.btn:hover {
  background: var(--link-hover);
  color: var(--bg);
}

/* 搜索筛选框 */
.filter-box {
  margin: 1rem auto 0;
  display: flex;
  justify-content: center;
}
.filter-input {
  width: min(100%, 20rem);
  padding: .45em .8em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: .94rem;
}
.filter-input:focus {
  border-color: var(--link);
  outline: none;
}
.filter-count {
  font-size: .85rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* 轻量复制提示 Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .88rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 工具页表单 */
fieldset {
  box-sizing: border-box;
  min-width: 0;
  margin: 1.25rem 0;
  padding: .85rem 1.1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
}
fieldset p { margin: .2rem 0 .6rem; }
legend { padding: 0 .4em; font-weight: 600; color: var(--fg); }
input, button {
  box-sizing: border-box;
  max-width: 100%;
  margin: .25rem 0;
  padding: .4em .7em;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
}
input[type="search"] { width: min(100%, 24rem); }
input[readonly] { width: min(100%, 32rem); background: var(--pill-bg); border-color: var(--border-light); }
button { cursor: pointer; background: var(--link); color: var(--bg); border: none; font-weight: 500; }
button:hover { background: var(--link-hover); }

.input-group {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: .4rem 0;
}
.input-group input {
  flex: 1 1 16rem;
  margin: 0;
}
.input-group button, .input-group .btn {
  margin: 0;
  white-space: nowrap;
}

code { font-size: .9em; overflow-wrap: anywhere; background: var(--pill-bg); padding: .1em .3em; border-radius: 3px; }
footer {
  color: var(--muted);
  text-align: center;
  font-size: .88rem;
  margin: 1.5rem 0 0;
}
footer small { font-size: 1em; }

/* 无障碍跳跃链接 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 1rem;
  padding: .4em .8em;
  background: var(--bg);
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .88rem;
  z-index: 9999;
  text-decoration: none;
}
.skip-link:focus {
  left: 1.25rem;
}
body > a:first-child:not(.skip-link) { font-size: .85rem; }
@media (max-width: 40rem) {
  body { padding: 1.25rem 1rem 3rem; }
  .filter-input { width: 100%; }
  .input-group input { width: 100%; flex: 1 1 100%; }
}
