/* =====================================================================
 * Gandi 3.0 文档站
 *
 * 页面由 tools/build-docs.js 从 docs/features/*.md 生成，这里只管样子。
 *
 * 调子：中性石墨灰，不是官网那套蓝黑；字号小、字重轻，标题不用特粗体
 * （中文特粗体一放大就土）。强调色只有品牌蓝一个，只用在链接、当前项、
 * 少量图标上。两套主题写在 localStorage 的 gandi-docs-theme 里，首帧之前
 * 就定好，不闪。
 * =================================================================== */

:root {
  --font-cjk: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --font-latin: "Sora", var(--font-cjk);
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --top-h: 56px;
  --side-w: 268px;
  --toc-w: 200px;
  --ease: cubic-bezier(0.22, 0.85, 0.24, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg-2: #101014;
  --raise: #131317;
  --raise-2: #191a1f;
  --ink: #f0f1f4;
  --ink-2: #c2c5cd;
  --ink-3: #979ba5;
  --mute: #6e727c;
  --hair: rgb(255 255 255 / 7%);
  --hair-2: rgb(255 255 255 / 13%);
  --acc: #5ba0ff;
  --acc-ink: #8bbcff;
  --acc-soft: rgb(91 160 255 / 13%);
  --acc-line: rgb(91 160 255 / 34%);
  --shadow: 0 20px 50px rgb(0 0 0 / 55%);
  --shot-bg: #0e0e12;
  --halo: radial-gradient(58% 34% at 50% -6%, rgb(91 160 255 / 9%), transparent 72%);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #fafafb;
  --raise: #ffffff;
  --raise-2: #f4f5f7;
  --ink: #101318;
  --ink-2: #3a414d;
  --ink-3: #5f6673;
  --mute: #8a909b;
  --hair: rgb(16 20 28 / 9%);
  --hair-2: rgb(16 20 28 / 15%);
  --acc: #1f6feb;
  --acc-ink: #1a5fcc;
  --acc-soft: rgb(31 111 235 / 9%);
  --acc-line: rgb(31 111 235 / 30%);
  --shadow: 0 16px 40px rgb(16 20 28 / 10%);
  --shot-bg: #f4f5f7;
  --halo: radial-gradient(58% 34% at 50% -6%, rgb(31 111 235 / 6%), transparent 72%);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--top-h) + 20px);
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg) var(--halo) no-repeat fixed;
  color: var(--ink);
  font-family: var(--font-cjk);
  font-size: 15.5px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 6px; }

kbd {
  padding: 0.1em 0.4em;
  font: 500 0.74em var(--font-mono);
  color: var(--mute);
  background: var(--raise-2);
  border: 1px solid var(--hair);
  border-radius: 5px;
}

::selection { background: var(--acc-soft); }

.side-in, .sheet-out { scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }
.side-in::-webkit-scrollbar, .sheet-out::-webkit-scrollbar { width: 8px; }
.side-in::-webkit-scrollbar-thumb, .sheet-out::-webkit-scrollbar-thumb {
  background: var(--hair-2);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}

/* ---- 顶栏 -------------------------------------------------------- */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top-h);
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid var(--hair);
  view-transition-name: top;
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 2px;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0.85;
}

.brand { display: flex; align-items: center; gap: 8px; }
/* 品牌标：还是原来那个「C + 一撇」，只是重画成两条等宽的线，稍微粗一点 */
.brand .mark {
  width: 21.4px;
  height: 18.8px;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-n { font-family: var(--font-latin); font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }
.brand-n b { font-weight: 600; color: var(--ink-3); }
.brand-sep { width: 1px; height: 14px; background: var(--hair-2); }
.brand-d { font-size: 0.86rem; color: var(--ink-3); transition: color 0.2s var(--ease); }
.brand:hover .brand-d { color: var(--ink); }

.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(290px, 30vw);
  margin-left: 8px;
  padding: 0 9px 0 10px;
  height: 32px;
  color: var(--mute);
  font-size: 0.84rem;
  background: var(--raise-2);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.search-btn:hover { color: var(--ink-2); border-color: var(--hair-2); }
.search-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.search-btn span:first-of-type { flex: 1; text-align: left; }
.sk { display: flex; gap: 3px; }

.top-r { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.top-link {
  padding: 5px 10px;
  font-size: 0.85rem;
  color: var(--ink-3);
  border-radius: 7px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.top-link:hover { color: var(--ink); background: var(--raise-2); }
.top-link.cta { color: var(--acc); }
.top-link.cta:hover { background: var(--acc-soft); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink-3);
  border-radius: 8px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--raise-2); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.theme svg { grid-area: 1 / 1; transition: opacity 0.3s var(--ease), rotate 0.45s var(--spring), scale 0.35s var(--spring); }
.theme .i-moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .theme .i-sun { opacity: 0; rotate: -70deg; scale: 0.6; }
[data-theme="light"] .theme .i-moon { opacity: 0; rotate: 70deg; scale: 0.6; }
.menu { display: none; }

/* ---- 骨架 -------------------------------------------------------- */
.wrap {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  width: min(1440px, 100%);
  margin-inline: auto;
}

.side {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  border-right: 1px solid var(--hair);
  view-transition-name: side;
}
.side-in { height: 100%; overflow-y: auto; padding: 20px 12px 60px 20px; }

.side-home {
  display: block;
  margin-bottom: 12px;
  padding: 6px 11px;
  font-size: 0.86rem;
  color: var(--ink-2);
  border-radius: 8px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.side-home:hover { background: var(--raise-2); color: var(--ink); }
.side-home.on { color: var(--acc); background: var(--acc-soft); }

/* 分组可折叠：50 篇平铺一列翻不动，只让当前这组展开 */
.side-g { margin-bottom: 2px; }
.side-gt {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
  border-radius: 7px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.side-gt:hover { color: var(--ink); background: var(--raise-2); }
.side-gt span { flex: 1; }
.side-gt em {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: normal;
  color: var(--mute);
}
.caret {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: var(--mute);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: rotate 0.26s var(--ease);
}
.side-g.open .caret { rotate: 90deg; }
/* 0fr → 1fr 的高度过渡，不用写死 max-height */
.side-l { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s var(--ease); }
.side-g.open .side-l { grid-template-rows: 1fr; }
.side-l-in { overflow: hidden; }
.side-g.open .side-l-in { overflow: visible; }

.side-i {
  display: block;
  margin-left: 17px;
  padding: 4px 10px;
  font-size: 0.845rem;
  line-height: 1.55;
  color: var(--ink-3);
  border-left: 1px solid var(--hair);
  border-radius: 0 7px 7px 0;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.side-i:first-child { margin-top: 2px; }
.side-i:last-child { margin-bottom: 8px; }
.side-i:hover { color: var(--ink); background: var(--raise-2); border-left-color: var(--hair-2); }
.side-i.on { color: var(--acc); background: var(--acc-soft); border-left-color: var(--acc); }

.main {
  display: grid;
  grid-template-columns: minmax(0, 760px) var(--toc-w);
  justify-content: center;
  gap: 60px;
  padding: 30px 44px 120px;
  animation: enter 0.45s var(--ease) both;
}
@keyframes enter { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

.doc { min-width: 0; }

/* ---- 本页目录 ---------------------------------------------------- */
.toc {
  position: sticky;
  top: calc(var(--top-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--top-h) - 70px);
  overflow-y: auto;
  padding-left: 14px;
}
.toc-t { padding-bottom: 7px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; color: var(--mute); }
.toc-i {
  position: relative;
  display: block;
  padding: 3.5px 0 3.5px 12px;
  font-size: 0.81rem;
  line-height: 1.6;
  color: var(--mute);
  border-left: 1px solid var(--hair);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.toc-i.l3 { padding-left: 24px; font-size: 0.79rem; }
.toc-i:hover { color: var(--ink-2); }
.toc-i.on { color: var(--acc); border-left-color: var(--acc); }

/* ---- 正文排版 ---------------------------------------------------- */
.crumb { display: flex; gap: 7px; font-size: 0.8rem; color: var(--mute); }
.crumb a { color: var(--ink-3); transition: color 0.18s var(--ease); }
.crumb a:hover { color: var(--acc); }
.crumb i { font-style: normal; opacity: 0.45; }

.doc h1 {
  margin: 12px 0 22px;
  font-size: 1.82rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.doc h2, .doc h3, .doc h4 { scroll-margin-top: calc(var(--top-h) + 24px); letter-spacing: -0.01em; }
.doc h2 { margin: 2.5em 0 0.8em; font-size: 1.18rem; font-weight: 600; }
.doc h3 { margin: 1.9em 0 0.6em; font-size: 1rem; font-weight: 600; color: var(--ink); }
.doc h4 { margin: 1.5em 0 0.5em; font-size: 0.93rem; font-weight: 600; color: var(--ink-2); }

.anchor {
  margin-left: 0.45em;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--acc);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus-visible { opacity: 0.65; }

.doc p { margin: 1.05em 0; color: var(--ink-2); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc em { color: var(--ink); font-style: normal; background: linear-gradient(transparent 64%, var(--acc-soft) 0); }

.doc a:not(.anchor):not(.step) {
  color: var(--acc);
  text-decoration: underline;
  text-decoration-color: var(--acc-line);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s var(--ease), color 0.2s var(--ease);
}
.doc a:not(.anchor):not(.step):hover { color: var(--acc-ink); text-decoration-color: currentColor; }

.doc ul, .doc ol { margin: 1.05em 0; padding-left: 1.3em; color: var(--ink-2); }
.doc li { margin: 0.38em 0; }
.doc li::marker { color: var(--mute); }
.doc ul ul, .doc ol ol, .doc ul ol, .doc ol ul { margin: 0.3em 0; }

.doc code {
  padding: 0.12em 0.38em;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--ink);
  background: var(--raise-2);
  border-radius: 5px;
  word-break: break-word;
}

.doc blockquote {
  margin: 1.4em 0;
  padding: 0.15em 0 0.15em 1.1em;
  color: var(--ink-3);
  border-left: 2px solid var(--hair-2);
}
.doc blockquote p { margin: 0.45em 0; }

.doc hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--hair); }

/* 代码块 */
.code { position: relative; margin: 1.5em 0; }
.code pre {
  margin: 0;
  padding: 15px 17px;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.72;
  background: var(--bg-2);
  border: 1px solid var(--hair);
  border-radius: 10px;
}
.code code { padding: 0; font-size: 1em; color: var(--ink-2); background: none; }
.copy {
  position: absolute;
  top: 8px;
  right: 9px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--mute);
  background: var(--raise);
  border: 1px solid var(--hair-2);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--ink); }
.copy.done { color: var(--acc); opacity: 1; }
.tok-cm { color: var(--mute); }
.tok-str { color: #7dcb96; }
.tok-kw { color: #c4a2f0; }
.tok-num { color: #e0a06a; }
.tok-fn { color: var(--acc); }
[data-theme="light"] .tok-str { color: #146c43; }
[data-theme="light"] .tok-kw { color: #7c3aed; }
[data-theme="light"] .tok-num { color: #b45309; }

/* 表格 */
.tw { margin: 1.5em 0; overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.doc th, .doc td { padding: 9px 14px 9px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
.doc th {
  padding-top: 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--mute);
  white-space: nowrap;
  border-bottom-color: var(--hair-2);
}
.doc td { color: var(--ink-2); }
.doc td:first-child { color: var(--ink); }
.doc tbody tr:last-child td { border-bottom: 0; }

/* 截图 */
/* 截图按 @2x 的一半显示（build-docs 标了 width/height），别再拉满整栏；
   竖长的那种再压一道高度，不然一张图能占掉两屏 */
.shot { margin: 1.7em 0; }
.shot img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  background: var(--shot-bg);
  border: 1px solid var(--hair);
  border-radius: 10px;
  cursor: zoom-in;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.shot img:hover { border-color: var(--hair-2); box-shadow: var(--shadow); }
/* 竖着的图（面板、菜单那种）再压一道高度，居中放 */
.shot.tall img { max-height: 560px; }
/* 手画的 SVG 是按整栏宽画的，让它铺满 */
.shot img[src$=".svg"] { width: 100%; max-height: none; padding: 8px; }

/* 上一篇 / 下一篇 */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4em; }
.step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--hair);
  border-radius: 10px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.step:hover { border-color: var(--hair-2); background: var(--raise-2); }
.step.next { text-align: right; }
.step-l { font-size: 0.74rem; color: var(--mute); }
.step-t { font-size: 0.92rem; color: var(--ink); }

.edit { margin-top: 1.8em; font-size: 0.82rem; color: var(--mute); }
.edit a { color: var(--mute); text-decoration: underline; text-decoration-color: var(--hair-2); text-underline-offset: 3px; }
.edit a:hover { color: var(--acc); }

/* ---- 首页 -------------------------------------------------------- */
.is-home .main { grid-template-columns: minmax(0, 980px); padding-top: 44px; }
.hero { padding-bottom: 6px; border-bottom: 1px solid var(--hair); }
.hero-k {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--acc);
}
.hero-k::before { content: ""; width: 16px; height: 1.5px; background: var(--acc); border-radius: 2px; }
.hero h1 {
  margin: 14px 0 16px;
  font-family: var(--font-latin);
  font-size: clamp(1.9rem, 3.4vw, 2.45rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
}
.hero h1 span { font-family: var(--font-cjk); color: var(--ink-3); font-weight: 500; }
.hero-s { max-width: 56ch; margin: 0 0 8px; font-size: 1rem; color: var(--ink-2); }
.hero-n { max-width: 60ch; margin: 0; font-size: 0.9rem; color: var(--mute); }
.hero-m { margin: 20px 0 18px; font-size: 0.84rem; color: var(--mute); }
.hero-m b { color: var(--ink-2); font-family: var(--font-mono); font-weight: 500; }

.grp { margin-top: 32px; }
.grp-t { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.grp-n { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400; color: var(--mute); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 38px 15px 16px;
  border: 1px solid var(--hair);
  border-radius: 11px;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease);
}
.card:hover { border-color: var(--hair-2); background: var(--raise-2); }
.card-t { font-size: 0.93rem; font-weight: 600; color: var(--ink); }
.card-d { font-size: 0.82rem; line-height: 1.6; color: var(--mute); }
.card-a {
  position: absolute;
  top: 17px;
  right: 14px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--acc);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.22s var(--ease), translate 0.22s var(--ease);
}
.card:hover .card-a { opacity: 1; translate: 3px 0; }

/* ---- 搜索面板 ---------------------------------------------------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: clamp(56px, 11vh, 130px) 20px 20px;
  background: rgb(4 5 8 / 52%);
  backdrop-filter: blur(5px);
  animation: fade 0.18s var(--ease);
}
.sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-card {
  width: min(620px, 100%);
  overflow: hidden;
  background: var(--raise);
  border: 1px solid var(--hair-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.3s var(--spring);
}
@keyframes rise { from { opacity: 0; translate: 0 -10px; scale: 0.98; } to { opacity: 1; translate: 0 0; scale: 1; } }
.sheet-in { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--hair); }
.sheet-in svg { width: 16px; height: 16px; fill: none; stroke: var(--mute); stroke-width: 1.7; stroke-linecap: round; }
.sheet-in input {
  flex: 1;
  font: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  background: none;
  border: 0;
  outline: none;
}
.sheet-in input::placeholder { color: var(--mute); }
.sheet-out { max-height: min(56vh, 500px); overflow-y: auto; padding: 7px; }
.hit { display: block; padding: 8px 11px; border-radius: 9px; transition: background 0.14s var(--ease); }
.hit:hover, .hit.on { background: var(--acc-soft); }
.hit-t { font-size: 0.91rem; font-weight: 600; color: var(--ink); }
.hit-g { margin-left: 8px; font-size: 0.75rem; font-weight: 400; color: var(--mute); }
.hit-x { font-size: 0.81rem; line-height: 1.6; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit mark { color: var(--acc); background: none; font-weight: 600; }
.sheet-none { padding: 24px 12px; text-align: center; font-size: 0.88rem; color: var(--mute); }
.sheet-tip { padding: 16px 12px 20px; text-align: center; font-size: 0.82rem; color: var(--mute); }

/* ---- 看大图 ------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 3vh 3vw;
  background: rgb(4 5 8 / 84%);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  animation: fade 0.18s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 94vh;
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 60%);
  animation: rise 0.32s var(--spring);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgb(4 5 8 / 45%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease);
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }

/* ---- 跨页切换：正文淡入淡出，顶栏和侧栏不动 ---------------------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.16s var(--ease) both; }
::view-transition-new(root) { animation: vt-in 0.26s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; translate: 0 6px; } }

/* ---- 窄屏 -------------------------------------------------------- */
@media (max-width: 1180px) {
  .main { grid-template-columns: minmax(0, 760px); gap: 0; padding: 28px 34px 100px; }
  .toc { display: none; }
}

@media (max-width: 940px) {
  .menu { display: grid; }
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    top: var(--top-h);
    left: 0;
    z-index: 38;
    width: 288px;
    background: var(--bg);
    border-right: 1px solid var(--hair);
    translate: -100% 0;
    transition: translate 0.3s var(--ease);
  }
  body.nav-open .side { translate: 0 0; box-shadow: var(--shadow); }
  .main { padding: 22px 20px 90px; animation: none; }
  .search-btn { width: auto; margin-left: auto; padding: 0 8px; }
  .search-btn span:first-of-type, .sk { display: none; }
  .top-r { margin-left: 0; }
  .top-link { display: none; }
  .steps { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---- 更新日志：时间线；首页的「最近更新」也用这一套 ---- */
.side-log { margin-top: -6px; }
.log-lead { margin: 0.4em 0 2.2em; color: var(--ink-2); }
.log-tl { list-style: none; margin: 0; padding: 0; }
.log-day { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 0 20px; }
.log-when { position: sticky; top: calc(var(--top-h) + 20px); align-self: start; padding-top: 2px; }
.doc .log-when h2 { margin: 0; font-family: var(--font-mono); font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.log-body { position: relative; padding: 0 0 40px 26px; border-left: 1px solid var(--hair-2); }
.log-body::before {
  content: ""; position: absolute; left: -5px; top: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink-3); box-shadow: 0 0 0 3px var(--bg);
}
.log-day:first-child .log-body::before { background: var(--acc); }
.log-day:last-child .log-body { padding-bottom: 8px; }
.log-area + .log-area { margin-top: 22px; }
.doc .log-h, .log-in .log-h { margin: 0 0 4px; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.doc .log-area ul, .log-in .log-area ul { margin: 0; padding: 0; list-style: none; }
.doc .log-it, .log-in .log-it { margin: 0; padding: 6px 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.65; }
.doc .log-it + .log-it, .log-in .log-it + .log-it { border-top: 0; }
.doc .log-tl { padding-left: 0; }
.doc .log-day { margin: 0; }
.doc .log-area ul { padding-left: 16px; list-style: disc; }
.doc .log-it::marker { color: var(--ink-3); }
.log-in { padding: 4px 20px 12px; border: 1px solid var(--hair); border-radius: 14px; background: var(--raise); }
.log-in .log-area + .log-area { margin-top: 12px; }
.log-in .log-h { margin-top: 14px; }
.log-in .log-it { font-size: 0.88rem; }
.log-more { display: inline-block; margin-top: 12px; font-size: 0.86rem; color: var(--acc); }
.log-more:hover { color: var(--acc-ink); text-decoration: underline; text-underline-offset: 3px; }
.hero-m a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--hair-2); text-underline-offset: 3px; }
.hero-m a:hover { color: var(--acc); }
@media (max-width: 940px) {
  .log-day { grid-template-columns: 1fr; }
  .log-when { position: static; margin-bottom: 8px; padding: 0; }
  .log-body { padding-left: 18px; }
}
