/* =========================================================
   RTFM — leisure(1) 个人手册
   一套以 Unix man page / 印刷技术文档为母题的视觉系统
   ========================================================= */

/* 前台与后台共用的字体、配色、间距与动效。页面专属变量留在各自的样式表。
   JetBrains Mono（OFL，见 fonts/OFL.txt）：自托管的可变字体子集，400–800，
   只含拉丁、标点、箭头、制表符与几何符号（约 36 KB）。中文走系统字体栈。 */
@font-face {
  font-family: "JetBrains Mono";
  src: url(../fonts/jetbrains-mono.4d925ce413.woff2) format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-23FF, U+2500-25FF, U+FFFD;
}

:root {
  --paper: #EEECE4; --paper-2: #E4E1D6;
  --ink: #16150F; --ink-2: #3A382F; --muted: #67635A;
  --rule: #CDC9BB; --rule-2: #A9A493;
  --accent: #B83510; --on-accent: #FFF8F0;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", "Noto Sans Mono CJK SC", "Noto Sans SC", "Microsoft YaHei", monospace;
  --f-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --maxw: 1440px;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --s6: 64px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 140ms; --t-mid: 240ms; --t-slow: 520ms;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #0F0F0C; --paper-2: #191915;
  --ink: #E8E5DA; --ink-2: #C4C0B3; --muted: #928E81;
  --rule: #2B2A24; --rule-2: #4A483F;
  --accent: #FF6A3D; --on-accent: #140A05;
  color-scheme: dark;
}


/* ---------- 1. Tokens ---------- */
:root {
  --sel-bg:  #16150F;
  --sel-ink: #EEECE4;
  /* code */
  --c-kw:  #B83510;
  --c-str: #44692F;
  --c-num: #7E5300;
  --c-com: #67635A;
  --c-fn:  #16150F;

  --f-serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;

  --gutter: clamp(20px, 3.4vw, 48px);
  --gap: 24px;
  --s7: 104px; --s8: 168px;

  --ease-io: cubic-bezier(.65, 0, .35, 1);
}
[data-theme="dark"] {
  --sel-bg:  #E8E5DA;
  --sel-ink: #0F0F0C;
  --c-kw:  #FF6A3D;
  --c-str: #A9C47E;
  --c-num: #E3B25C;
  --c-com: #868275;
  --c-fn:  #E8E5DA;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--f-sans);
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-mid) var(--ease-out), color var(--t-mid) var(--ease-out);
  padding-bottom: 40px; /* 状态栏 */
}
::selection { background: var(--accent); color: var(--on-accent); }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd {
  font: 500 11px/1 var(--f-mono);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 3px;
  color: var(--ink-2); background: var(--paper);
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.acc { color: var(--accent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; font: 500 13px var(--f-mono); }
.skip:focus { top: 12px; }

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

/* ---------- 3. Man header (顶部页眉，左/中/右三段式) ---------- */
.manhead {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(6px);
  -webkit-backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--rule);
  transition: background-color var(--t-mid) var(--ease-out);
}
.manhead .wrap {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 52px; gap: var(--s3);
  font: 500 12px/1 var(--f-mono); letter-spacing: .04em; text-transform: uppercase;
}
.manhead .brand { font-weight: 800; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 8px; justify-self: start; }
.manhead .brand::before { content: ""; width: 9px; height: 15px; background: var(--accent); display: inline-block; }
.manhead .mid { color: var(--muted); text-align: center; }
.manhead nav { justify-self: end; display: flex; align-items: center; gap: 4px; }
.manhead nav a, .manhead nav button {
  padding: 8px 10px; color: var(--ink-2); border-radius: 2px;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
  text-transform: uppercase; font: inherit; letter-spacing: inherit;
}
.manhead nav a:hover, .manhead nav button:hover { background: var(--ink); color: var(--paper); }
.manhead nav a[aria-current="page"] { color: var(--accent); }
.cmdk-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule-2) !important; margin-left: 6px; }
.cmdk-btn kbd { height: 18px; min-width: 18px; border-bottom-width: 1px; background: transparent; }
.cmdk-btn:hover kbd { color: var(--paper); border-color: var(--paper); }
.theme-btn .ico { display: inline-block; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); vertical-align: -1px; }

/* ---------- 4. Ruler（蓝图式 12 栏刻度） ---------- */
.ruler { border-bottom: 1px solid var(--rule); }
.ruler .wrap { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); height: 22px; }
.ruler span {
  font: 400 10px/22px var(--f-mono); color: var(--muted); letter-spacing: .06em;
  border-left: 1px solid var(--rule); padding-left: 6px; position: relative;
}
.ruler span::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 5px; background: var(--rule); }

/* ---------- 5. Hero ---------- */
.hero { padding: var(--s6) 0 var(--s7); border-bottom: 1px solid var(--ink); }
.hero .prompt { font: 400 14px/1 var(--f-mono); color: var(--muted); margin-bottom: var(--s3); }
.hero .prompt b { color: var(--accent); font-weight: 500; }
.wordmark {
  font: 800 clamp(76px, 17.2vw, 262px)/.82 var(--f-mono);
  letter-spacing: -.065em;
  margin-left: -.05em;
  display: flex; align-items: flex-end; white-space: nowrap;
}
.wordmark .ch { display: inline-block; }
.wordmark .caret {
  display: inline-block; width: .5em; height: .74em; background: var(--accent);
  margin-left: .1em; margin-bottom: .04em;
  animation: blink 1.06s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.manbody { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); margin-top: var(--s6); }
.manbody dl { grid-column: 1 / span 8; display: grid; grid-template-columns: subgrid; row-gap: var(--s4); }
.manbody dt { grid-column: span 2; font: 700 13px/1.9 var(--f-mono); letter-spacing: .08em; }
.manbody dd { grid-column: span 6; font-size: 17px; line-height: 1.8; color: var(--ink-2); max-width: 36em; }
.manbody dd code, .synopsis { font: 400 15px/1.8 var(--f-mono); color: var(--ink); }
.synopsis .opt { color: var(--muted); }
.synopsis u { text-decoration-color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.manbody aside {
  grid-column: 10 / span 3; align-self: end;
  font: 400 12px/1.9 var(--f-mono); color: var(--muted);
  border-left: 1px solid var(--rule); padding-left: var(--s3);
}
.manbody aside strong { color: var(--ink); font-weight: 500; }
.manbody aside .live::before { content: "●"; color: var(--accent); margin-right: 6px; animation: blink 2.4s steps(1) infinite; }

/* ---------- 6. Section scaffold ---------- */
.sec { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); padding: var(--s7) 0; border-bottom: 1px solid var(--rule); }
.sec-label { grid-column: 1 / span 3; position: relative; }
.sec-label .inner { position: sticky; top: 84px; }
.sec-label .no { font: 400 12px/1 var(--f-mono); color: var(--accent); letter-spacing: .06em; display: block; margin-bottom: 10px; }
.sec-label h2 { font: 800 15px/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; }
.sec-label p { font: 400 13px/1.7 var(--f-sans); color: var(--muted); margin-top: 8px; max-width: 18em; }
.sec-body { grid-column: 4 / span 9; min-width: 0; }

/* ---------- 7. Featured ---------- */
.feature { display: block; position: relative; }
.feature .meta { font: 400 12px/1 var(--f-mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; letter-spacing: .03em; }
.feature .meta .flag { color: var(--on-accent); background: var(--accent); padding: 4px 6px; margin: -4px 0; font-weight: 700; }
.feature h3 {
  font: 900 clamp(34px, 4.6vw, 66px)/1.12 var(--f-sans); letter-spacing: -.02em;
  margin: var(--s4) 0 var(--s4); max-width: 14em; text-wrap: balance;
}
.feature h3 .en { font-family: var(--f-mono); font-weight: 800; letter-spacing: -.04em; }
.feature h3 span.u { background: linear-gradient(var(--accent), var(--accent)) 0 92% / 0 3px no-repeat; transition: background-size var(--t-slow) var(--ease-out); }
.feature:hover h3 span.u, .feature:focus-visible h3 span.u { background-size: 100% 3px; }
.feature .dek { font-size: 18px; line-height: 1.8; color: var(--ink-2); max-width: 34em; }
.feature .row { display: grid; grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); margin-top: var(--s5); align-items: end; }
.feature .dek { grid-column: 1 / span 5; }
.feature .go { grid-column: 7 / span 3; justify-self: end; font: 500 13px/1 var(--f-mono); display: inline-flex; gap: 10px; align-items: center; padding: 14px 16px; border: 1px solid var(--ink); transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.feature:hover .go { background: var(--ink); color: var(--paper); }
.feature .go .arr { transition: transform var(--t-mid) var(--ease-out); }
.feature:hover .go .arr { transform: translateX(4px); }

.fig { margin-top: var(--s6); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); }
.fig pre { grid-column: 1 / span 6; font: 400 16px/1.5 var(--f-mono); color: var(--ink-2); padding: var(--s4) 0; overflow-x: auto; }
.fig pre b { color: var(--accent); font-weight: 800; }
.fig pre i { font-style: normal; color: var(--muted); }
.fig figcaption { grid-column: 7 / span 3; padding: var(--s4) 0; font: 400 12px/1.8 var(--f-mono); color: var(--muted); border-left: 1px solid var(--rule); padding-left: var(--s3); }
.fig figcaption strong { color: var(--ink); display: block; font-weight: 700; letter-spacing: .06em; margin-bottom: 6px; }

/* ---------- 8. ls -la 文章列表 ---------- */
.ls-head, .ls a {
  display: grid;
  grid-template-columns: 44px 104px minmax(0, 1fr) 190px 56px;
  column-gap: var(--s3); align-items: baseline;
}
.ls-cmd { font: 400 14px/1 var(--f-mono); color: var(--muted); margin-bottom: var(--s4); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ls-cmd b { color: var(--ink); font-weight: 500; }
.ls-cmd .hint { font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.ls-head { font: 400 11px/1 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 10px; border-bottom: 1px solid var(--ink); }
.ls li { border-bottom: 1px solid var(--rule); }
.ls a {
  padding: 18px 12px; position: relative;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.ls a::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform var(--t-mid) var(--ease-out); }
.ls .date, .ls .tags, .ls .min { font: 400 12.5px/1.4 var(--f-mono); color: var(--muted); }
.ls .title { font: 500 19px/1.45 var(--f-sans); letter-spacing: -.005em; }
.ls .title .en { font-family: var(--f-mono); font-size: .92em; letter-spacing: -.02em; }
.ls .min { text-align: right; }
.ls a:hover, .ls a.is-active { background: var(--ink); color: var(--paper); }
.ls a:hover .date, .ls a:hover .tags, .ls a:hover .min,
.ls a.is-active .date, .ls a.is-active .tags, .ls a.is-active .min { color: color-mix(in srgb, var(--paper) 70%, var(--ink)); }
.ls a:hover::before, .ls a.is-active::before { transform: scaleY(1); }
.ls a.is-active .title::after { content: "  ⏎"; color: var(--accent); font-family: var(--f-mono); font-size: 14px; }
.ls-foot { margin-top: var(--s4); font: 400 12px/1 var(--f-mono); color: var(--muted); }

/* ---------- 9. Tags 直方图 + Now (反相整栏) ---------- */
.split { display: grid; grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); }
.hist { grid-column: 1 / span 5; }
.hist li a { display: grid; grid-template-columns: 96px 1fr 34px; gap: 14px; align-items: center; padding: 7px 0; font: 400 13px/1 var(--f-mono); }
.hist .bar { height: 12px; --c: var(--ink); background: linear-gradient(90deg, var(--c) 6px, transparent 6px) 0 0 / 8px 100% round; width: var(--w); }
.hist li a:hover .name { color: var(--accent); }
.hist li a:hover .bar { --c: var(--accent); }
.hist .n { text-align: right; color: var(--muted); }
.archive { grid-column: 7 / span 3; }
.archive li { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule); padding: 10px 0; }
.archive .y { font: 800 40px/1 var(--f-mono); letter-spacing: -.05em; }
.archive .c { font: 400 12px/1 var(--f-mono); color: var(--muted); }
.archive li:first-child .y { color: var(--accent); }
.mini-h { font: 700 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s3); }

.now {
  background: var(--ink); color: var(--paper);
  padding: var(--s7) 0;
  transition: background-color var(--t-mid) var(--ease-out), color var(--t-mid) var(--ease-out);
}
.now .grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }
.now .sec-label .no { color: var(--accent); }
.now .sec-label p { color: color-mix(in srgb, var(--paper) 62%, var(--ink)); }
.now .cat { grid-column: 4 / span 6; }
.now .cat .cmd { font: 400 13px/1 var(--f-mono); color: color-mix(in srgb, var(--paper) 62%, var(--ink)); margin-bottom: var(--s4); }
.now .lead { font: 700 clamp(26px, 2.9vw, 40px)/1.45 var(--f-sans); letter-spacing: -.01em; text-wrap: pretty; }
.now .lead em { font-style: normal; color: var(--accent); }
.now ul.items { margin-top: var(--s5); border-top: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink)); }
.now ul.items li { display: grid; grid-template-columns: 110px 1fr; gap: var(--s3); padding: 14px 0; border-bottom: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink)); font-size: 15px; }
.now ul.items li span:first-child { font: 400 12px/1.9 var(--f-mono); color: color-mix(in srgb, var(--paper) 62%, var(--ink)); text-transform: uppercase; letter-spacing: .08em; }
.now .stats { grid-column: 11 / span 2; display: flex; flex-direction: column; gap: var(--s5); align-self: end; }
.now .stats div { border-top: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink)); padding-top: 10px; }
.now .stats b { display: block; font: 800 44px/1 var(--f-mono); letter-spacing: -.05em; }
.now .stats span { font: 400 11px/1.6 var(--f-mono); color: color-mix(in srgb, var(--paper) 62%, var(--ink)); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- 10. SEE ALSO / 联系 ---------- */
.seealso { display: grid; grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); align-items: end; }
.seealso .big { grid-column: 1 / span 6; font: 800 clamp(34px, 4.4vw, 64px)/1.12 var(--f-sans); letter-spacing: -.02em; }
.seealso .big a { font-family: var(--f-mono); letter-spacing: -.05em; font-weight: 800; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 4px no-repeat; transition: color var(--t-fast); word-break: break-all; }
.seealso .big a:hover { color: var(--accent); }
.seealso ul { grid-column: 7 / span 3; font: 400 14px/1 var(--f-mono); }
.seealso li a { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--rule); transition: padding var(--t-mid) var(--ease-out), color var(--t-fast); }
.seealso li:first-child a { border-top: 1px solid var(--rule); }
.seealso li a:hover { color: var(--accent); padding-left: 8px; }
.seealso li a span:last-child { color: var(--muted); }

/* ---------- 11. Footer（man page 页脚） ---------- */
.manfoot > div.wrap { display: grid; grid-template-columns: 1fr auto 1fr; padding-top: var(--s4); padding-bottom: var(--s4); font: 400 12px/1.6 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; gap: var(--s3); }
.manfoot > div.wrap > :nth-child(2) { text-align: center; }
.manfoot > div.wrap > :last-child { text-align: right; }

/* ---------- 12. Statusline（vim 风格底部状态栏） ---------- */
.statusline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: 30px; display: flex; align-items: stretch;
  font: 500 11.5px/30px var(--f-mono); letter-spacing: .03em;
  background: var(--paper-2); color: var(--ink-2); border-top: 1px solid var(--rule);
  transition: background-color var(--t-mid) var(--ease-out);
}
.statusline > * { padding: 0 12px; white-space: nowrap; }
.statusline .mode { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.statusline .file { border-right: 1px solid var(--rule); }
.statusline .fill { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.statusline .keys { display: flex; gap: 14px; align-items: center; color: var(--muted); }
.statusline .keys b { color: var(--ink); font-weight: 700; }
.statusline .pos { background: var(--ink); color: var(--paper); min-width: 64px; text-align: center; }
.statusline button { padding: 0 12px; }
.statusline button:hover { color: var(--accent); }

/* ---------- 13. Command palette ---------- */
.palette[hidden] { display: none; }
.palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: 12vh 16px 16px; }
.palette .scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--paper) 72%, transparent); animation: fade var(--t-mid) var(--ease-out); }
.palette .box {
  position: relative; width: min(680px, 100%);
  background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  animation: pop var(--t-mid) var(--ease-out);
  display: flex; flex-direction: column; max-height: 70vh;
}
.palette .bar { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--ink); }
.palette .bar label { font: 800 18px/1 var(--f-mono); color: var(--accent); }
.palette input {
  flex: 1; min-width: 0; height: 58px; border: 0; background: transparent; color: var(--ink);
  font: 400 17px/1 var(--f-mono); caret-color: var(--accent);
}
.palette input::placeholder { color: var(--muted); }
.palette input:focus-visible { outline: none; }
.palette .bar kbd { flex: none; }
.palette ul { overflow-y: auto; padding: 6px 0; }
.palette .grp { font: 700 10.5px/1 var(--f-mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; padding: 12px 16px 6px; }
.palette li[role="option"] { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 10px 16px; cursor: pointer; font-size: 15px; }
.palette li[role="option"] .k { font: 400 12px/1 var(--f-mono); color: var(--muted); }
.palette li[role="option"] .s { font: 400 11.5px/1 var(--f-mono); color: var(--muted); }
.palette li[role="option"] mark { background: none; color: var(--accent); font-weight: 700; }
.palette li[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.palette li[aria-selected="true"] .k, .palette li[aria-selected="true"] .s { color: color-mix(in srgb, var(--paper) 70%, var(--ink)); }
.palette .empty { padding: 28px 16px; font: 400 13px/1.6 var(--f-mono); color: var(--muted); }
.palette .foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--rule); font: 400 11px/1 var(--f-mono); color: var(--muted); flex-wrap: wrap; }
.palette .foot span { display: inline-flex; gap: 6px; align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } }

/* 快捷键帮助 */
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 12px 20px; padding: 20px 16px; font-size: 14px; align-items: center; }
.help dt { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- 14. Reveal ---------- */
.js .rv { opacity: 0; transform: translateY(10px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
.js .rv.in { opacity: 1; transform: none; }
.js .wordmark .ch { opacity: 0; transform: translateY(.12em); }
.js.ready .wordmark .ch { opacity: 1; transform: none; transition: opacity 380ms var(--ease-out), transform 520ms var(--ease-out); transition-delay: calc(var(--i) * 55ms); }

/* =========================================================
   POST PAGE
   ========================================================= */
.progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); z-index: 50; }

.post-head { padding: var(--s6) 0 var(--s6); border-bottom: 1px solid var(--ink); }
.crumb { font: 400 13px/1 var(--f-mono); color: var(--muted); margin-bottom: var(--s5); }
.crumb a:hover { color: var(--accent); }
.post-head h1 {
  font: 900 clamp(38px, 5.6vw, 84px)/1.1 var(--f-sans); letter-spacing: -.025em;
  max-width: 13em; text-wrap: balance;
}
.post-head h1 .en { font-family: var(--f-mono); font-weight: 800; letter-spacing: -.05em; }
.post-head .dek { margin-top: var(--s4); font: 400 20px/1.75 var(--f-serif); color: var(--ink-2); max-width: 32em; }
.post-meta { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); margin-top: var(--s6); border-top: 1px solid var(--rule); }
.post-meta div { grid-column: span 3; padding-top: 14px; font: 400 13px/1.6 var(--f-mono); }
.post-meta dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.post-meta dd a:hover { color: var(--accent); }

.post-grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); padding: var(--s6) 0 var(--s7); }
.toc { grid-column: 1 / span 3; }
.toc .inner { position: sticky; top: 84px; }
.toc h2 { font: 700 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s3); }
.toc ol { counter-reset: toc; border-left: 1px solid var(--rule); }
.toc li a { display: grid; grid-template-columns: 28px 1fr; padding: 7px 0 7px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 14px; line-height: 1.5; color: var(--muted); transition: color var(--t-fast), border-color var(--t-fast); }
.toc li a::before { counter-increment: toc; content: counter(toc, decimal-leading-zero); font: 400 11px/2 var(--f-mono); }
.toc li a:hover { color: var(--ink); }
.toc li a.on { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
.toc li a.on::before { color: var(--accent); }
.toc .tools { margin-top: var(--s5); font: 400 12px/2 var(--f-mono); color: var(--muted); }
.toc .tools div { display: flex; gap: 8px; align-items: center; }

.prose { grid-column: 4 / span 6; min-width: 0; font: 400 18px/1.95 var(--f-serif); color: var(--ink); }
.prose > * + * { margin-top: 1.15em; }
.prose p { text-align: justify; text-justify: inter-character; hanging-punctuation: allow-end; }
.prose h2 {
  font: 800 28px/1.35 var(--f-sans); letter-spacing: -.01em; margin-top: 2.6em;
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: baseline;
  padding-top: 18px; border-top: 1px solid var(--ink);
}
.prose h2 .n { font: 400 13px/1 var(--f-mono); color: var(--accent); }
.prose h2 a.hash { opacity: 0; font-family: var(--f-mono); color: var(--muted); margin-left: 8px; transition: opacity var(--t-fast); }
.prose h2:hover a.hash, .prose h2 a.hash:focus-visible { opacity: 1; }
.prose h3 { font: 700 20px/1.5 var(--f-sans); margin-top: 2em; }
.prose a { background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; transition: color var(--t-fast); }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 700; font-family: var(--f-sans); font-size: .95em; }
.prose :not(pre) > code { font: 400 .84em/1 var(--f-mono); background: var(--paper-2); border: 1px solid var(--rule); padding: .14em .36em; border-radius: 2px; white-space: nowrap; }
.prose ul { padding-left: 0; }
.prose ul li { position: relative; padding-left: 1.6em; }
.prose ul li + li { margin-top: .4em; }
.prose ul li::before { content: "—"; position: absolute; left: 0; color: var(--accent); font-family: var(--f-mono); }
.prose .lead::first-letter { font: 900 3.3em/.9 var(--f-sans); float: left; margin: .08em .12em 0 0; color: var(--accent); }

.prose blockquote {
  margin: 2em 0; padding: 0 0 0 var(--s4); border-left: 3px solid var(--accent);
  font: 600 23px/1.7 var(--f-serif); color: var(--ink);
}
.prose blockquote footer { margin-top: 10px; font: 400 13px/1.5 var(--f-mono); color: var(--muted); }

.code { margin: 2em 0; border: 1px solid var(--ink); background: var(--paper-2); }
.code .hd { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule-2); font: 400 12px/1 var(--f-mono); color: var(--muted); }
.code .hd span { padding: 10px 14px; }
.code .hd span b { color: var(--ink); font-weight: 500; }
.code .copy { padding: 10px 14px; border-left: 1px solid var(--rule-2); font: 500 12px/1 var(--f-mono); color: var(--ink-2); transition: background-color var(--t-fast), color var(--t-fast); }
.code .copy:hover { background: var(--ink); color: var(--paper); }
.code pre { overflow-x: auto; padding: 16px 0; font: 400 14px/1.75 var(--f-mono); tab-size: 2; counter-reset: ln; }
.code code { display: block; min-width: max-content; }
.code .ln { display: block; padding: 0 18px 0 0; }
.code .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 3.4em; padding-right: 1.2em; text-align: right; color: var(--muted); opacity: .6; user-select: none; }
.code .ln.hl { background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 3px 0 var(--accent); }
.tok-k { color: var(--c-kw); font-weight: 500; }
.tok-s { color: var(--c-str); }
.tok-n { color: var(--c-num); }
.tok-c { color: var(--c-com); }
.tok-f { color: var(--c-fn); font-weight: 700; }

.table-wrap { margin: 2em 0; overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.prose table { width: 100%; border-collapse: collapse; font: 400 14px/1.6 var(--f-sans); min-width: 520px; }
.prose caption { caption-side: bottom; text-align: left; padding: 10px 0; font: 400 12px/1.5 var(--f-mono); color: var(--muted); }
.prose th { font: 700 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; text-align: left; color: var(--muted); padding: 14px 12px 10px 0; border-bottom: 1px solid var(--rule-2); }
.prose td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose td.num, .prose th.num { text-align: right; font-family: var(--f-mono); padding-right: 0; }
.prose tr:last-child td { border-bottom: 0; }
.prose tr.win td { color: var(--accent); font-weight: 500; }

.prose figure.ascii pre { font: 400 13px/1.5 var(--f-mono); color: var(--ink-2); overflow-x: auto; padding: 18px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.prose figure.ascii b { color: var(--accent); }
.prose figcaption { font: 400 12px/1.6 var(--f-mono); color: var(--muted); margin-top: 8px; }

.callout { font: 400 15px/1.8 var(--f-sans); border: 1px dashed var(--rule-2); padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.callout .tag { font: 800 11px/1.9 var(--f-mono); color: var(--on-accent); background: var(--accent); padding: 0 6px; height: fit-content; letter-spacing: .06em; }

sup.fn a { font: 500 11px/1 var(--f-mono); color: var(--accent); background: none; padding: 0 2px; }
.footnotes { margin-top: 4em; padding-top: 18px; border-top: 1px solid var(--ink); font: 400 14px/1.8 var(--f-sans); color: var(--ink-2); }
.footnotes h2 { all: unset; display: block; font: 700 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.footnotes ol { list-style: none; counter-reset: fn; }
.footnotes li { counter-increment: fn; position: relative; padding: 6px 0 6px 34px; }
.footnotes li::before { content: "[" counter(fn) "]"; position: absolute; left: 0; top: 6px; font: 400 12px/2.1 var(--f-mono); color: var(--accent); }
.footnotes li:target { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.footnotes a.back { font-family: var(--f-mono); color: var(--muted); margin-left: 4px; background: none; }

.margin { grid-column: 10 / span 3; }
.margin .inner { position: sticky; top: 84px; font: 400 12px/1.8 var(--f-mono); color: var(--muted); border-left: 1px solid var(--rule); padding-left: var(--s3); }
.margin .inner b { color: var(--ink); font-weight: 500; display: block; }
.margin .inner > div + div { margin-top: var(--s4); }

.next { border-top: 1px solid var(--ink); }
.next a { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); padding: var(--s6) 0; transition: color var(--t-fast); }
.next .l { grid-column: 1 / span 3; font: 400 12px/1.8 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.next .t { grid-column: 4 / span 8; font: 800 clamp(26px, 3.4vw, 46px)/1.25 var(--f-sans); letter-spacing: -.015em; }
.next .arr { grid-column: 12; justify-self: end; font: 400 clamp(26px, 3.4vw, 46px)/1.25 var(--f-mono); transition: transform var(--t-mid) var(--ease-out); }
.next a:hover .t { color: var(--accent); }
.next a:hover .arr { transform: translateX(6px); color: var(--accent); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .ls-head, .ls a { grid-template-columns: 40px 96px minmax(0, 1fr) 56px; }
  .ls .tags, .ls-head span:nth-child(4) { display: none; }
  .now .cat { grid-column: 4 / span 7; }
  .now .stats { grid-column: 11 / span 2; }
  .margin { grid-column: 4 / span 8; margin-top: var(--s6); }
  .margin .inner { position: static; }
  .prose { grid-column: 4 / span 8; }
}

@media (max-width: 960px) {
  :root { --gap: 18px; }
  .manhead .mid { display: none; }
  .manhead .wrap { grid-template-columns: auto 1fr; }
  .ruler .wrap { grid-template-columns: repeat(6, 1fr); }
  .ruler span:nth-child(n+7) { display: none; }
  .manbody dl { grid-column: 1 / -1; }
  .manbody dt { grid-column: span 3; }
  .manbody dd { grid-column: span 9; }
  .manbody aside { grid-column: 1 / -1; margin-top: var(--s5); display: flex; flex-wrap: wrap; gap: 4px 24px; border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: var(--s3); }
  .sec { padding: var(--s6) 0; }
  .sec-label, .sec-body { grid-column: 1 / -1; }
  .sec-label { margin-bottom: var(--s5); }
  .sec-label .inner { position: static; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  .sec-label .no { margin: 0; }
  .sec-label p { margin: 0; flex-basis: 100%; }
  .now .grid > .sec-label, .now .cat, .now .stats { grid-column: 1 / -1; }
  .now .stats { flex-direction: row; margin-top: var(--s5); gap: var(--gap); }
  .now .stats div { flex: 1; }
  .post-grid .toc { display: none; }
  .post-grid .prose, .post-grid .margin { grid-column: 1 / -1; width: 100%; max-width: 680px; margin-left: auto; margin-right: auto; }
  .post-meta div { grid-column: span 6; }
  .next .l { grid-column: 1 / -1; }
  .next .t { grid-column: 1 / span 11; }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .manhead .wrap { height: 48px; }
  .manhead nav a.hide-sm { display: none; }
  .cmdk-btn kbd { display: none; }
  .hero { padding: var(--s5) 0 var(--s6); }
  .wordmark { font-size: 19vw; letter-spacing: -.07em; }
  .manbody { margin-top: var(--s5); }
  .manbody dl { row-gap: var(--s2); }
  .manbody dt, .manbody dd { grid-column: 1 / -1; }
  .manbody dd { font-size: 16px; margin-bottom: var(--s3); }
  .manbody dd code, .synopsis { font-size: 13.5px; }
  .feature .row, .fig, .split, .seealso { grid-template-columns: 1fr; row-gap: var(--s4); }
  .feature .dek, .feature .go, .fig pre, .fig figcaption, .hist, .archive, .seealso .big, .seealso ul { grid-column: 1 / -1; }
  .feature .go { justify-self: start; }
  .feature .dek { font-size: 16px; }
  .fig pre { font-size: 10.5px; }
  .fig figcaption { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: var(--s3); }
  .archive { margin-top: var(--s5); }
  .ls-head { display: none; }
  .ls-cmd .hint { display: none; }
  .ls a { grid-template-columns: auto 1fr auto; grid-template-areas: "lang date min" "title title title" "tags tags tags"; column-gap: 10px; row-gap: 6px; padding: 16px 4px 16px 12px; }
  .ls .lang { grid-area: lang; }
  .ls .tags { display: block; }
  .ls .date { grid-area: date; }
  .ls .min { grid-area: min; }
  .ls .title { grid-area: title; font-size: 17px; }
  .ls .tags { grid-area: tags; }
  .hist li a { grid-template-columns: 78px 1fr 28px; }
  .now { padding: var(--s6) 0; }
  .now ul.items li { grid-template-columns: 1fr; gap: 2px; }
  .now .stats b { font-size: 32px; }
  .manfoot > div.wrap { grid-template-columns: 1fr 1fr; }
  .manfoot > div.wrap > :nth-child(2) { display: none; }
  .statusline .keys, .statusline .file { display: none; }
  .post-head .dek { font-size: 17px; }
  .prose { font-size: 17px; line-height: 1.9; }
  .prose p { text-align: left; }
  .prose h2 { font-size: 23px; }
  .prose blockquote { font-size: 19px; padding-left: var(--s3); }
  .code pre { font-size: 12.5px; }
  .post-meta div { grid-column: span 6; }
  .next .arr { display: none; }
  .next .t { grid-column: 1 / -1; }
  .palette { padding-top: 10vh; }
  .palette .box { box-shadow: 5px 5px 0 var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .wordmark .caret { animation: none; }
  .js .rv, .js .wordmark .ch { opacity: 1; transform: none; }
}

@media print {
  .manhead, .statusline, .progress, .toc, .margin, .palette, .ruler { display: none !important; }
  body { padding: 0; }
  .prose { grid-column: 1 / -1; }
}
.help .help-title { flex: 1; height: 58px; line-height: 58px; font: 500 14px/58px var(--f-mono); color: var(--ink); }
/* 反相区块内的强调色：始终保证与反相背景的对比度 */
.now { --accent: #FF6A3D; }
[data-theme="dark"] .now { --accent: #B83510; }

.prose em { font-style: normal; font-weight: 600; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 22%, transparent) 62%); }
.synopsis .g { white-space: nowrap; }
@media (max-width: 680px) {
  .archive ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); }
  .archive .y { font-size: 34px; }
}

/* 反相选中态中的强调色 */
.palette li[aria-selected="true"] mark, .ls a.is-active .title::after { color: #FF6A3D; }
[data-theme="dark"] .palette li[aria-selected="true"] mark, [data-theme="dark"] .ls a.is-active .title::after { color: #B83510; }
@media (max-width: 680px) {
  .post-head { padding-top: var(--s5); }
  .crumb { margin-bottom: var(--s4); }
  .post-head h1 { font-size: 34px; }
  .post-meta { margin-top: var(--s5); }
  .post-grid { padding-top: var(--s5); }
}

/* =========================================================
   v2 · koritry — 数据驱动组件
   ========================================================= */
.ul { background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; }
.ul:hover { color: var(--accent); }

/* 语言徽标：单色，靠字形区分 */
.ls .lang { font: 700 11px/1 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; justify-self: start; padding: 4px 5px 3px; border: 1px solid currentColor; color: var(--ink-2); align-self: center; }
.ls .lang[data-lang="rs"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ls .pin { font: 500 10px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--rule-2); padding: 3px 5px 2px; margin-left: 10px; vertical-align: 3px; }
.ls a:hover .lang, .ls a.is-active .lang { color: inherit; }
.ls a:hover .pin, .ls a.is-active .pin { color: inherit; border-color: currentColor; }

/* 滑动高亮（光标跟随）：一块墨色在行间平移，代替逐行背景 */
.ls { position: relative; }
.ls-hl { position: absolute; left: 0; right: 0; top: 0; height: 0; background: var(--ink); z-index: 0; pointer-events: none; opacity: 0; transform: translateY(var(--y, 0)); transition: transform var(--t-mid) var(--ease-out), height var(--t-mid) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
.ls-hl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.ls-hl.on { opacity: 1; }
.ls li { position: relative; z-index: 1; }
.has-hl .ls a:hover, .has-hl .ls a.is-active { background: transparent; }
.has-hl .ls a::before { display: none; }

.langbar { display: flex; gap: 3px; height: 34px; margin-top: 4px; }
.langbar .seg { flex: var(--f) 1 0; min-width: 0; display: flex; align-items: center; padding: 0 8px; font: 400 11px/1 var(--f-mono); white-space: nowrap; overflow: hidden; color: var(--paper); background: var(--ink); }
.langbar .seg b { font-weight: 700; margin-right: 6px; }
.langbar .seg[data-lang="py"] { background: var(--ink-2); }
.langbar .seg[data-lang="rs"] { background: var(--accent); color: var(--on-accent); }
.langbar .seg[data-lang="js"] { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.lang-h { margin-top: var(--s5); }
.hist li a .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist li a { grid-template-columns: 150px 1fr 34px; }

/* 时间线：滚动联动的进度轨 */
.timeline { grid-column: 7 / span 3; position: relative; }
.timeline > ol { position: relative; padding-left: 26px; }
.tl-rail { position: absolute; left: 4px; top: 44px; bottom: 6px; width: 1px; background: var(--rule); }
.tl-rail i { position: absolute; inset: 0; background: var(--accent); transform-origin: top; transform: scaleY(var(--tp, 1)); }
.tl-m { position: relative; padding: 0 0 var(--s4); }
.tl-m::before { content: ""; position: absolute; left: -26px; top: 5px; width: 9px; height: 9px; border: 1px solid var(--ink); background: var(--paper); transition: background-color var(--t-mid) var(--ease-out), border-color var(--t-mid) var(--ease-out); }
.tl-m.passed::before { background: var(--accent); border-color: var(--accent); }
.tl-d { display: block; font: 800 22px/1 var(--f-mono); letter-spacing: -.04em; margin-bottom: 8px; }
.tl-m ul li { display: flex; justify-content: space-between; gap: 12px; font: 400 13px/1.9 var(--f-mono); border-bottom: 1px solid var(--rule); }
.tl-m ul li a:hover { color: var(--accent); }
.tl-m ul li span { color: var(--muted); font-size: 12px; }

/* LOG：提交列表 */
.now ul.commits li { grid-template-columns: 128px 116px 1fr; align-items: baseline; }
.now ul.commits time { font: 400 12px/1.9 var(--f-mono); color: color-mix(in srgb, var(--paper) 62%, var(--ink)); }
.now ul.commits .r { font: 700 12px/1.9 var(--f-mono); color: var(--accent); }
.now ul.commits code { font: 400 13.5px/1.7 var(--f-mono); }
.now .lead em { white-space: nowrap; }

/* 代码块头部 */
.code .hd .acts { display: flex; }
.code .src { padding: 10px 14px; border-left: 1px solid var(--rule-2); font: 500 12px/1 var(--f-mono); color: var(--ink-2); transition: background-color var(--t-fast), color var(--t-fast); background: none; }
.code .src:hover { background: var(--ink); color: var(--paper); }
.code .ln::before { content: attr(data-n); counter-increment: none; }
.tok-v { color: var(--c-num); }
.prose figure.code { margin: 2em 0; }

/* 仓库卡片 */
.repo-card .rc-h { font: 700 11px/1 var(--f-mono); letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.repo-card .rc-name { display: block; font: 400 14px/1.4 var(--f-mono); color: var(--ink); margin-bottom: 14px; word-break: break-all; }
.repo-card .rc-name b { font-weight: 800; }
.repo-card .rc-name:hover { color: var(--accent); }
.repo-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.repo-card dt { color: var(--muted); }
.repo-card dd { color: var(--ink); text-align: right; }
.repo-card .rc-note { margin-top: 14px; font-size: 11px; }
.margin .inner.repo-card > div + div { margin-top: 0; }
.repo-cta { margin-top: 3em !important; }
.repo-cta a { display: block; background: none; border: 1px solid var(--ink); padding: 16px 18px; font: 500 14px/1.5 var(--f-mono); word-break: break-all; transition: background-color var(--t-fast), color var(--t-fast); }
.repo-cta a:hover { background: var(--ink); color: var(--paper); }

/* 上一篇 / 下一篇 */
.pager { border-top: 1px solid var(--ink); }
.pager .wrap { display: grid; grid-template-columns: 1fr 1fr; }
.pager a, .pager .none { display: flex; flex-direction: column; gap: 10px; padding: var(--s6) var(--s4) var(--s6) 0; transition: color var(--t-fast); }
.pager .older { text-align: right; padding: var(--s6) 0 var(--s6) var(--s4); border-left: 1px solid var(--rule); }
.pager .l { font: 400 12px/1.8 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.pager .t { font: 800 clamp(20px, 2.4vw, 32px)/1.3 var(--f-sans); letter-spacing: -.01em; text-wrap: balance; }
.pager .t .en { font-family: var(--f-mono); letter-spacing: -.04em; }
.pager .none .t { color: var(--muted); font-weight: 500; }
.pager a:hover .t { color: var(--accent); }

/* 刻度尺上的光标读数（蓝图十字线） */
.ruler .wrap { position: relative; }
.ruler-x { position: absolute; top: 0; bottom: -1px; left: 0; width: 1px; background: var(--accent); opacity: 0; transform: translateX(var(--x, 0)); pointer-events: none; transition: opacity var(--t-mid) var(--ease-out); }
.ruler-x b { position: absolute; left: 4px; top: 0; font: 700 10px/22px var(--f-mono); color: var(--accent); background: var(--paper); padding: 0 4px; letter-spacing: .06em; }
.ruler:hover .ruler-x, body.cx .ruler-x { opacity: 1; }

/* =========================================================
   Motion v2
   ========================================================= */
/* 开机：提示符打字 → 字标逐字敲出 → 手册条目逐行亮起 */
.js [data-type] .tc { visibility: hidden; }
.js [data-type] .tc.on { visibility: visible; }
.js .wordmark .ch { opacity: 1; transform: none; visibility: hidden; }
.js .wordmark .ch.on { visibility: visible; }
.js.ready .wordmark .ch { transition: none; }
.wordmark .caret { will-change: transform; }
.js .wordmark .caret.typing { animation: none; }
.js .boot { opacity: 0; transform: translateY(6px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
.js .boot.in { opacity: 1; transform: none; }

/* 列表逐行打印 */
.js [data-stagger] > li { opacity: 0; transform: translateY(8px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); transition-delay: calc(var(--i, 0) * 45ms); }
.js [data-stagger].in > li { opacity: 1; transform: none; }
.js .hist [data-stagger] .bar { transform: scaleX(0); transform-origin: left; transition: transform 900ms var(--ease-out); transition-delay: calc(var(--i, 0) * 45ms + 120ms); }
.js .hist [data-stagger].in .bar { transform: none; }

/* 跨文档页面过渡（View Transitions API） */
@view-transition { navigation: auto; }
.manhead { view-transition-name: manhead; }
.statusline { view-transition-name: statusline; }
::view-transition-old(root) { animation: vt-out 140ms var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 520ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
/* 不支持时的回退：离场淡出 */
body.leaving main { opacity: 0; transition: opacity var(--t-fast) var(--ease-out); }

@media (max-width: 960px) {
  .timeline { grid-column: 1 / -1; }
  .now ul.commits li { grid-template-columns: 1fr; gap: 0; }
  .now ul.commits li > * { display: block; }
}
@media (max-width: 680px) {
  .timeline { margin-top: var(--s5); }
  .hist li a { grid-template-columns: 116px 1fr 28px; }
  .langbar .seg { font-size: 10px; padding: 0 5px; }
  .pager .wrap { grid-template-columns: 1fr; }
  .pager .older { text-align: left; border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; }
  .ls .pin { display: none; }
  .ruler-x { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .js [data-type] .tc, .js .wordmark .ch { visibility: visible; }
  .js .boot, .js [data-stagger] > li { opacity: 1; transform: none; }
  .js .hist [data-stagger] .bar { transform: none; }
  .ls-hl { transition: none; }
}
@media (hover: none) { .ruler-x { display: none; } }
@media (max-width: 680px) {
  .langbar .seg b { display: none; }
  .langbar .seg::before { content: attr(data-lang); font-weight: 700; margin-right: 4px; }
}
/* v2 正文修正：中英混排 + 行内代码时，两端对齐会拉出大字距，改为左对齐 */
.prose p { text-align: left; text-wrap: pretty; }
.prose :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
.prose .lead::first-letter { all: unset; }
.prose .lead { font-size: 1.12em; line-height: 1.85; color: var(--ink); }

/* ---------- v3 · 交互细节（与后台共用同一组时长 / 缓动） ---------- */
/* 滑动高亮：高度改用 scaleY，滑动全程只动 transform */
.ls-hl { height: 100px; transform-origin: 0 0; transform: translateY(var(--y, 0)) scaleY(calc(var(--h, 0) / 100)); transition: transform var(--t-mid) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
/* 按压反馈：所有按钮式控件按下下沉 1px */
.theme-btn, .cmdk-btn, .code .copy, .repo-cta a, .pager a { transition-property: background-color, color, border-color, transform; transition-duration: var(--t-fast); transition-timing-function: var(--ease-out); }
.theme-btn:active, .cmdk-btn:active, .code .copy:active, .repo-cta a:active { transform: translateY(1px); }
.theme-btn .ico { transition: transform var(--t-mid) var(--ease-out); }
[data-theme="dark"] .theme-btn .ico { transform: rotate(180deg); }
.pager a .l { display: inline-block; transition: transform var(--t-mid) var(--ease-out), color var(--t-fast) var(--ease-out); }
.pager a.newer:hover .l { transform: translateX(-4px); color: var(--accent); }
.pager a.older:hover .l { transform: translateX(4px); color: var(--accent); }
/* 复制结果：成功变绿、失败变橙，1.6s 后复原 */
.code .copy.is-ok { background: var(--c-str); color: var(--paper); }
.code .copy.is-err { background: var(--accent); color: var(--on-accent); }
/* 文章头部标签：一个标签不拆成两行 */
.post-meta dd a { white-space: nowrap; display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  .ls-hl, .pager a .l, .theme-btn .ico { transition: none; }
  .theme-btn:active, .cmdk-btn:active, .code .copy:active, .repo-cta a:active { transform: none; }
}

/* =========================================================
   Tags · Series · See also · 404（v4 批次 3）
   ========================================================= */
/* 标签页：沿用文章页头与 §ls 列表，只把标题换成 mono */
.tag-head h1 { font-family: var(--f-mono); font-weight: 800; letter-spacing: -.04em; }
.tag-sec { border-bottom: 0; padding-top: var(--s6); }
.tag-index li a { grid-template-columns: minmax(96px, 12em) 1fr 34px; font-size: 14px; }
.ls-cmd .hint a { color: var(--accent); }
.ls-cmd .hint a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ls-foot a { color: var(--ink); }
.ls-foot a:hover { color: var(--accent); }

/* 系列导航：正文开头的一张小目录卡，当前篇用强调色竖条标出 */
.series { margin: 0 0 var(--s5); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: var(--s3) 0; }
.series-h { display: flex; gap: var(--s3); align-items: baseline; font: 400 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s2); }
.series-h b { color: var(--ink); font-weight: 800; letter-spacing: .04em; text-transform: none; font-size: 13px; }
.series-h .c { margin-left: auto; color: var(--accent); }
.series ol { list-style: none; margin: 0; padding: 0; }
.series li { font: 400 15px/1.5 var(--f-sans); }
.series li > a, .series li[aria-current] { display: grid; grid-template-columns: 32px 1fr; gap: var(--s2); padding: 6px 0 6px 10px; position: relative; }
.series li .n { font: 400 12px/1.9 var(--f-mono); color: var(--muted); }
.series li > a { color: var(--ink-2); text-decoration: none; transition: color var(--t-fast) var(--ease-out); }
.series li > a:hover { color: var(--accent); }
.series li[aria-current] { color: var(--ink); font-weight: 600; }
.series li[aria-current]::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; background: var(--accent); }
.series li .en { font-family: var(--f-mono); font-size: .92em; }

/* 文章页底部 SEE ALSO：复用 .ls 行 */
.related { padding: var(--s5) 0 var(--s6); border-top: 1px solid var(--ink); }
.related .mini-h { margin-bottom: var(--s3); }

/* 404：No manual entry for … */
.notfound { padding: var(--s7) 0 var(--s7); max-width: 60em; }
.notfound .prompt { font: 400 14px/1 var(--f-mono); color: var(--muted); margin-bottom: var(--s4); }
.notfound .prompt b { color: var(--accent); }
.nf-h { font: 800 clamp(30px, 5vw, 64px)/1.1 var(--f-mono); letter-spacing: -.04em; overflow-wrap: anywhere; }
.nf-path { color: var(--accent); }
.notfound .dek { margin-top: var(--s4); font: 400 18px/1.75 var(--f-serif); color: var(--ink-2); }
.nf-go { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s4) 0 var(--s6); }
.nf-go a, .nf-go button { font: 500 13px/1 var(--f-mono); border: 1px solid var(--ink); padding: 10px 14px; background: transparent; color: var(--ink); cursor: pointer; transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.nf-go a:hover, .nf-go button:hover { background: var(--ink); color: var(--paper); }
.nf-go kbd { margin-left: 6px; }
.notfound .mini-h { margin-bottom: var(--s3); }

@media (max-width: 680px) {
  .tag-index li a { grid-template-columns: minmax(80px, 9em) 1fr 28px; }
  .series li { font-size: 14px; }
  .notfound { padding: var(--s6) 0; }
}

/* 评论（giscus，可选）：只是一个带标题的容器，iframe 自己负责内容 */
.comments { padding: var(--s5) 0 var(--s6); border-top: 1px solid var(--ink); }
.comments .mini-h { margin-bottom: var(--s3); }
.comments .giscus { max-width: 46em; }

/* 归档、阅读清单与移动端目录沿用手册的网格、字体与配色。 */
[hidden] { display: none !important; }
.browse-nav { display: flex; flex-wrap: wrap; gap: 12px 24px; padding-top: 20px; padding-bottom: 24px; font-size: 13px; }
.browse-nav a:hover, .manfoot a:hover { color: var(--accent); }
.reader-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: var(--s4); font: 400 13px/1.5 var(--f-mono); }
.reader-actions button, .reader-button, .archive-pages button { border: 1px solid var(--rule-2); padding: 10px 14px; min-height: 44px; }
.reader-actions button:hover, .reader-button:hover, .archive-pages button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.reader-actions button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.reader-actions a { padding: 10px 0; color: var(--muted); }
.reader-actions a:hover { color: var(--accent); }
.reader-notice:not(:empty):not(.sr-only) { position: fixed; z-index: 100; bottom: 48px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); border: 1px solid var(--rule-2); padding: 12px 18px; font-size: 14px; }
.mobile-toc { display: none; margin-top: var(--s4); border-bottom: 1px solid var(--rule); padding: 14px 0; font: 400 14px/1.8 var(--f-sans); }
.mobile-toc summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.mobile-toc nav { padding: 14px 0; }
.mobile-toc a { display: block; padding: 8px 12px; border-left: 2px solid var(--rule); }
.mobile-toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.archive-jumps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: var(--s4); font: 500 14px/1.5 var(--f-mono); }
.archive-jumps a { padding: 8px 0; color: var(--accent); }
.archive-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-bottom: var(--s4); border-bottom: 1px solid var(--rule); }
.archive-filters label { min-width: 0; display: flex; flex-direction: column; gap: 6px; font: 500 12px/1.5 var(--f-mono); color: var(--muted); }
.archive-filters .archive-query { grid-column: 1 / -1; }
.archive-filters input[type="search"], .archive-filters select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--rule-2); border-radius: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--f-sans); padding: 10px 12px; }
.archive-filters .saved-filter { flex-direction: row; align-items: center; grid-column: span 2; min-height: 44px; font-size: 13px; color: var(--ink); }
.saved-filter input { width: 18px; height: 18px; accent-color: var(--accent); }
.archive-filters .reader-button { justify-self: end; align-self: end; font: 400 13px/1.5 var(--f-mono); }
.archive-summary { margin: 20px 0 32px; color: var(--muted); font: 400 13px/1.6 var(--f-mono); }
.archive-year + .archive-year { margin-top: var(--s6); }
.archive-year { scroll-margin-top: 84px; }
.archive-year > h2 { display: flex; align-items: baseline; gap: 18px; font: 800 36px/1.3 var(--f-mono); letter-spacing: -.04em; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.archive-year > h2 > span, .archive-month > h3 > span { font: 400 12px/1.5 var(--f-mono); color: var(--muted); letter-spacing: normal; }
.archive-month > h3 { display: flex; gap: 12px; align-items: baseline; margin: 24px 0 8px; font-size: 15px; }
.archive-empty { padding: var(--s5) 0; color: var(--muted); line-height: 1.8; }
.archive-excerpt { padding: 0 12px 16px; font: 400 14px/1.8 var(--f-sans); color: var(--muted); overflow-wrap: anywhere; }
.archive-excerpt mark, .search-hit mark { background: none; color: var(--accent); font-weight: 600; }
.archive-pages { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: var(--s5); font: 400 13px/1.5 var(--f-mono); }
.archive-pages button:disabled { opacity: .45; cursor: default; }
.series-group + .series-group { margin-top: var(--s6); }
.series-group { scroll-margin-top: 84px; }
.series-group > h2 { font: 700 26px/1.4 var(--f-sans); overflow-wrap: anywhere; }
.series-summary { margin: 8px 0 20px; color: var(--muted); font: 400 13px/1.7 var(--f-mono); }
.series-h a:hover { color: var(--accent); }
.search-hit { min-width: 0; overflow-wrap: anywhere; }
.search-hit small { display: block; margin-top: 4px; font: 400 12px/1.6 var(--f-sans); color: var(--muted); }
.palette li[aria-selected="true"] .search-hit small { color: color-mix(in srgb, var(--paper) 80%, var(--ink)); }
.search-status { font: 400 12px/1.6 var(--f-sans); color: var(--muted); }
.search-status:not(:empty) { padding: 10px 0; }
.palette .search-status:not(:empty) { padding: 10px 16px; }
.palette .bar > button { flex: none; font: 400 12px/1.5 var(--f-sans); min-height: 44px; }
.palette .help-title { min-width: 0; }
.help dl { overflow-y: auto; }
@media (max-width: 1180px) and (min-width: 961px) {
  .manhead .mid { display: none; }
  .manhead .wrap { grid-template-columns: auto 1fr; }
}
@media (max-width: 960px) {
  .mobile-toc { display: block; }
}
@media (max-width: 680px) {
  .archive-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .archive-filters .saved-filter { grid-column: auto; }
  .archive-filters .reader-button { justify-self: start; }
  .archive-year > h2 { font-size: 30px; }
  .series-group > h2 { font-size: 22px; }
  .palette li[role="option"] { grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
  .palette li[role="option"] .s { grid-column: 2; font-size: 11px; }
  .help .help-title { font: 500 12px/1.4 var(--f-mono); }
  .help dl { gap: 12px; font-size: 12px; grid-template-columns: minmax(0, 1fr); }
  .help dt { justify-content: start; flex-wrap: wrap; }
  .help dd { padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
}
@media print {
  .reader-actions, .mobile-toc, .reader-notice, .archive-filters, .archive-pages { display: none !important; }
}
