/* ==========================================================================
   Rust 程序设计语言 · 离线文档  —— 鸿蒙 / 仓颉 文档风格主题
   ========================================================================== */
:root {
  --brand: #0A59F7;
  --brand-hover: #3E7BFA;
  --brand-soft: rgba(10, 89, 247, .08);
  --brand-soft-2: rgba(10, 89, 247, .14);
  --text: #1C1C28;
  --text-2: rgba(0, 0, 0, .66);
  --text-3: #8F90A6;
  --bg: #FFFFFF;
  --bg-soft: #F1F3F5;
  --bg-page: #FFFFFF;
  --bg-side: #FAFAFC;
  --border: #EBECED;
  --border-2: #E1E3E8;
  --code-bg: #F7F8FA;
  --code-head: #EEF0F4;
  --inline-code-bg: rgba(10, 89, 247, .06);
  --inline-code: #C7254E;
  --quote-bg: #F2F6FF;
  --warn-bg: #FFF4F4;
  --warn-border: #F5C2C2;
  --shadow: 0 2px 12px rgba(0, 36, 125, .08);
  --shadow-lg: 0 8px 32px rgba(0, 36, 125, .14);
  --header-h: 56px;
  --side-w: 288px;
  --toc-w: 232px;
  --radius: 12px;
  --font: "HarmonyOS Sans SC", "HarmonyOS Sans", -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono",
          "Noto Sans Mono CJK SC", monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: #4A8CFF;
  --brand-hover: #73A5FF;
  --brand-soft: rgba(74, 140, 255, .12);
  --brand-soft-2: rgba(74, 140, 255, .2);
  --text: rgba(255, 255, 255, .88);
  --text-2: rgba(255, 255, 255, .66);
  --text-3: rgba(255, 255, 255, .45);
  --bg: #17181B;
  --bg-soft: #22242A;
  --bg-page: #17181B;
  --bg-side: #1B1C20;
  --border: #2A2C33;
  --border-2: #34363E;
  --code-bg: #1F2127;
  --code-head: #262930;
  --inline-code-bg: rgba(74, 140, 255, .12);
  --inline-code: #FF8FA3;
  --quote-bg: #1C2433;
  --warn-bg: #2E1D20;
  --warn-border: #5B2E33;
  --shadow: 0 2px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%;
  overflow-y: scroll; scrollbar-gutter: stable; background: var(--bg-page); }
/* 跨页面导航：支持的浏览器使用极短的淡入淡出代替白屏闪烁 */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }
@media (prefers-reduced-motion: reduce) { *, ::view-transition-group(*) { transition: none !important; animation: none !important; } }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.75; color: var(--text);
  background: var(--bg-page); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
svg { fill: currentColor; }
button { font-family: inherit; }

/* ---------------- top bar ---------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 50;
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.logo-mark { width: 30px; height: 30px; }
.brand-text { font-size: 18px; font-weight: 600; letter-spacing: .3px; }
.brand-tag { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 1px 8px; border-radius: 10px; }
.topnav { display: flex; gap: 4px; height: 100%; }
.topnav a {
  display: flex; align-items: center; padding: 0 14px; color: var(--text-2); font-size: 15px;
  position: relative; height: 100%;
}
.topnav a:hover { color: var(--brand); }
.topnav a.active { color: var(--text); font-weight: 600; }
.topnav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px;
  background: var(--brand); border-radius: 3px 3px 0 0;
}
.search { position: relative; margin-left: auto; width: 320px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); }
.search-icon svg { width: 18px; height: 18px; display: block; }
#search-input {
  width: 100%; height: 36px; border-radius: 18px; border: 1px solid transparent; outline: none;
  background: var(--bg-soft); color: var(--text); padding: 0 14px 0 38px; font-size: 14px; font-family: inherit;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
#search-input:focus { border-color: var(--brand); background: var(--bg); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-panel {
  position: absolute; right: 0; top: 46px; width: min(620px, 92vw); max-height: min(70vh, 640px); overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px;
}
.search-panel .sr-meta { font-size: 12px; color: var(--text-3); padding: 6px 12px 8px; }
.search-panel a.sr {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); border: 1px solid transparent;
}
.search-panel a.sr:hover, .search-panel a.sr.sel { background: var(--brand-soft); border-color: var(--brand-soft-2); }
.sr-title { font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.sr-title .sr-h { color: var(--brand); font-weight: 500; }
.sr-title .sr-arrow { color: var(--text-3); font-weight: 400; }
.sr-snip { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-panel mark, .markdown-body mark.rd-hl { background: rgba(255, 196, 0, .35); color: inherit; border-radius: 2px; padding: 0 1px; }
.sr-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }
.menu-btn { display: none; }

/* ---------------- layout ---------------- */
.layout { padding-top: var(--header-h); }
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--side-w); z-index: 30;
  background: var(--bg-side); border-right: 1px solid var(--border); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 0 40px; scrollbar-width: thin; scrollbar-gutter: stable; overflow-anchor: none;
}
.sidebar-head {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 20px 6px 24px;
  font-size: 13px; color: var(--text-3);
}
.collapse-all { border: none; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.collapse-all:hover { color: var(--brand); background: var(--brand-soft); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { display: none; }
.tree li.open > ul { display: block; }
.tree .part-title {
  font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 1px;
  padding: 18px 24px 6px; text-transform: uppercase;
}
.tree .row { display: flex; align-items: flex-start; padding: 0 12px 0 8px; }
.tree .toggle, .tree .toggle-spacer { width: 22px; height: 22px; flex-shrink: 0; margin-top: 7px; }
.tree .toggle {
  border: none; background: none; padding: 0; cursor: pointer; color: var(--text-3); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.tree .toggle:hover { background: var(--bg-soft); color: var(--brand); }
.tree .toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.tree li.open > .row .toggle svg { transform: rotate(90deg); }
.tree a {
  display: block; flex: 1; padding: 7px 12px; margin: 1px 0; border-radius: 8px; color: var(--text-2);
  font-size: 14px; line-height: 1.55; border: 0;
}
.tree a:hover { background: var(--bg-soft); color: var(--text); }
.tree li.active > .row a { background: var(--brand-soft); color: var(--brand); font-weight: 500; text-shadow: 0 0 .01px currentColor, .25px 0 0 currentColor; }
.tree ul .row { padding-left: 26px; }
.tree ul ul .row { padding-left: 44px; }
.tree a code { font-family: var(--mono); font-size: .9em; }
.sidebar-mask { display: none; }

.main { margin-left: var(--side-w); display: flex; justify-content: center; gap: 40px; padding: 0 32px; }
.content-wrap { flex: 1; min-width: 0; max-width: 880px; padding: 24px 8px 40px; }
.toc {
  width: var(--toc-w); flex-shrink: 0; position: sticky; top: var(--header-h); align-self: flex-start;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 32px 0 24px; scrollbar-width: thin;
}
.toc-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; padding-left: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a {
  display: block; padding: 4px 12px; margin-left: -2px; border-left: 2px solid transparent;
  font-size: 13px; line-height: 1.6; color: var(--text-2);
}
.toc li.lv1 a { padding-left: 26px; font-size: 12.5px; }
.toc li.lv2 a { padding-left: 38px; font-size: 12.5px; color: var(--text-3); }
.toc li a:hover { color: var(--brand); }
.toc li a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 500; }

.breadcrumb { font-size: 13px; color: var(--text-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .cur { color: var(--text-2); }
.breadcrumb .sep { color: var(--border-2); }
.breadcrumb code { font-family: var(--mono); font-size: .92em; }

/* ---------------- article ---------------- */
.markdown-body { word-wrap: break-word; }
.markdown-body > :first-child { margin-top: 8px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
  position: relative; color: var(--text); line-height: 1.4; font-weight: 600; margin: 1.8em 0 .7em;
}
.markdown-body > h1:first-child, .markdown-body > h2:first-child {
  font-size: 30px; font-weight: 600; margin: 8px 0 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.markdown-body h1 { font-size: 28px; }
.markdown-body h2 { font-size: 24px; }
.markdown-body h3 { font-size: 20px; }
.markdown-body h4 { font-size: 17px; }
.markdown-body h5, .markdown-body h6 { font-size: 15px; }
.header-anchor {
  margin-left: 8px; color: var(--brand); opacity: 0; font-weight: 400; transition: opacity .15s;
}
.markdown-body :is(h1,h2,h3,h4,h5,h6):hover .header-anchor { opacity: .8; }
.markdown-body p { margin: 0 0 1em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.6em; margin: 0 0 1em; }
.markdown-body li { margin: .3em 0; }
.markdown-body li > p { margin: .3em 0; }
.markdown-body ul li::marker { color: var(--brand); }
.markdown-body strong { font-weight: 600; color: var(--text); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.markdown-body img { max-width: 100%; height: auto; }
.markdown-body img.center, .markdown-body .center { display: block; margin: 16px auto; }
.markdown-body img[src$=".svg"]:not(.ferris):not(.ferris-explain), .markdown-body img[src$=".png"] {
  display: block; margin: 20px auto; background: #fff; border-radius: 10px; padding: 8px; border: 1px solid var(--border);
}
.markdown-body img.ferris-explain { width: 90px; }
.markdown-body kbd {
  font-family: var(--mono); font-size: .85em; padding: 2px 6px; border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 5px; background: var(--bg-soft);
}
.markdown-body :not(pre) > code {
  font-family: var(--mono); font-size: .88em; padding: .15em .45em; border-radius: 6px;
  background: var(--inline-code-bg); color: var(--inline-code);
}
.markdown-body a :not(pre) > code, .markdown-body a > code { color: var(--brand); }
.markdown-body h1 code, .markdown-body h2 code, .markdown-body h3 code, .markdown-body h4 code { color: inherit; font-size: .9em; }

.markdown-body blockquote {
  margin: 1.2em 0; padding: 14px 18px 14px 20px; background: var(--quote-bg); color: var(--text);
  border-left: 4px solid var(--brand); border-radius: 0 10px 10px 0; font-size: 15px;
}
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body blockquote > :first-child { margin-top: 0; }

.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: 10px; }
.markdown-body table { border-collapse: collapse; width: 100%; font-size: 14px; }
.markdown-body th, .markdown-body td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.markdown-body th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
.markdown-body tr:last-child td { border-bottom: none; }
.markdown-body tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 50%, transparent); }

/* listings / captions */
.markdown-body figure { margin: 1.4em 0; }
.markdown-body figure.listing { margin: 1.4em 0; }
.markdown-body figure > img { margin: 0 auto; }
.markdown-body figcaption, .markdown-body span.caption {
  display: block; margin: 8px 0 1.4em; font-size: 13.5px; color: var(--text-2); text-align: center; line-height: 1.6;
}
.markdown-body figcaption::before, .markdown-body span.caption::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  margin-right: 8px; vertical-align: middle; position: relative; top: -1px;
}
.markdown-body span.filename, .markdown-body span.file-name {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
  background: var(--bg-soft); padding: 3px 12px; border-radius: 8px 8px 0 0; margin-bottom: -1px;
  font-family: var(--mono); border: 1px solid var(--border); border-bottom: none;
}

.markdown-body p:has(> span.filename:only-child), .markdown-body p:has(> span.file-name:only-child) { margin: 1.2em 0 0; line-height: 1; }
.markdown-body p:has(> span.filename:only-child) + .code-block,
.markdown-body p:has(> span.file-name:only-child) + .code-block { margin-top: 0; border-top-left-radius: 0; }
.markdown-body p:has(> span.caption:only-child) { margin: 0; }
.markdown-body .footnotes { font-size: 14px; color: var(--text-2); }
.markdown-body .footnote-ref a, .markdown-body .footnote-backref { font-size: .85em; }

/* ---------------- code blocks ---------------- */
.code-block {
  position: relative; margin: 1.2em 0; border-radius: var(--radius); background: var(--code-bg);
  border: 1px solid var(--border); overflow: hidden;
}
.cb-head {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 16px;
  background: var(--code-head); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-3);
}
.cb-lang { font-family: var(--mono); font-weight: 600; letter-spacing: .4px; }
.cb-flag { color: #D93026; background: rgba(217, 48, 38, .1); padding: 1px 8px; border-radius: 10px; font-size: 12px; }
[data-theme="dark"] .cb-flag { color: #FF8A80; background: rgba(255, 138, 128, .14); }
.cb-actions { margin-left: auto; display: flex; gap: 2px; }
.cb-btn {
  width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
}
.cb-btn svg { width: 16px; height: 16px; }
.cb-btn:hover { background: var(--bg); color: var(--brand); }
.cb-btn.done { color: #1BA854; }
.cb-btn.done::after {
  content: "已复制"; position: absolute; right: 32px; top: 3px; font-size: 12px; white-space: nowrap;
  background: #1BA854; color: #fff; padding: 1px 8px; border-radius: 6px;
}
.code-block.show-hidden .cb-eye { color: var(--brand); background: var(--brand-soft); }
.code-block pre.highlight {
  margin: 0; padding: 14px 18px; overflow-x: auto; background: var(--code-bg); font-family: var(--mono);
  font-size: 13.5px; line-height: 1.65; tab-size: 4; color: var(--text);
}
.code-block pre code { font-family: inherit; background: none; padding: 0; color: inherit; }
.code-block .hidden-line { display: none; }
.code-block.show-hidden .hidden-line { display: inline; opacity: .55; }
.code-block.does-not-compile, .code-block.panics, .code-block.not-desired-behavior { border-color: var(--warn-border); }
.code-block.does-not-compile pre.highlight, .code-block.panics pre.highlight,
.code-block.not-desired-behavior pre.highlight { background: var(--warn-bg); padding-right: 100px; }
.ferris-link { position: absolute; right: 12px; top: 44px; z-index: 2; }
.ferris { display: block; height: auto; }
.ferris-large { width: 72px; }
.ferris-small { width: 38px; }
.lang-console pre.highlight, .lang-text pre.highlight { font-size: 13px; }

/* ---------------- meta / pager / footer ---------------- */
.doc-meta { display: flex; gap: 12px; flex-wrap: wrap; margin: 40px 0 16px; padding-top: 20px; border-top: 1px solid var(--border); }
.meta-link {
  font-size: 13px; color: var(--text-2); padding: 4px 12px; border-radius: 14px; background: var(--bg-soft);
}
.meta-link:hover { color: var(--brand); background: var(--brand-soft); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 32px; }
.pager a {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); transition: border-color .2s, box-shadow .2s, transform .2s;
}
.pager a:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.pager .next { text-align: right; grid-column: 2; }
.pager .dir { font-size: 12px; color: var(--text-3); }
.pager .prev .dir::before { content: "← "; }
.pager .next .dir::after { content: " →"; }
.pager .t { font-size: 15px; font-weight: 600; color: var(--brand); }
.pager .t code { font-family: var(--mono); font-size: .9em; }
.footer { font-size: 12.5px; color: var(--text-3); text-align: center; padding: 24px 0 8px; border-top: 1px solid var(--border); line-height: 1.8; }
.footer a { color: var(--text-3); text-decoration: underline; }

.back-top {
  position: fixed; right: 28px; bottom: 32px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-2); box-shadow: var(--shadow); cursor: pointer; z-index: 40;
  display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .25s, transform .25s, color .2s;
}
.back-top svg { width: 22px; height: 22px; }
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-top:hover { color: var(--brand); border-color: var(--brand); }

/* ---------------- home ---------------- */
.hero {
  padding: calc(var(--header-h) + 56px) 32px 56px;
  background:
    radial-gradient(1000px 420px at 85% 0%, rgba(10, 89, 247, .14), transparent 70%),
    radial-gradient(800px 380px at 0% 100%, rgba(100, 160, 255, .12), transparent 70%),
    linear-gradient(180deg, #F3F7FF 0%, var(--bg) 100%);
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(1000px 420px at 85% 0%, rgba(74, 140, 255, .18), transparent 70%),
    linear-gradient(180deg, #1A2030 0%, var(--bg) 100%);
}
.hero-inner { max-width: 1200px; margin: 0 auto; display: flex; gap: 48px; align-items: center; }
.hero-text { flex: 1.1; }
.hero-badge { display: inline-block; font-size: 13px; color: var(--brand); background: var(--brand-soft); padding: 4px 14px; border-radius: 14px; margin-bottom: 18px; }
.hero h1 { font-size: 48px; line-height: 1.2; margin: 0 0 18px; font-weight: 700; letter-spacing: 1px; }
.hero p { font-size: 17px; color: var(--text-2); margin: 0 0 28px; max-width: 580px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; height: 40px; padding: 0 24px; border-radius: 20px; font-size: 15px;
  border: 1px solid var(--border-2); color: var(--text); background: var(--bg); transition: all .2s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); color: #fff; }
.hero-stats { display: flex; gap: 28px; margin-top: 32px; color: var(--text-3); font-size: 14px; flex-wrap: wrap; }
.hero-stats b { color: var(--text); font-size: 20px; margin-right: 4px; }
.hero-art { flex: .9; min-width: 0; }
.art-card { background: #1E2230; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px 20px 18px; color: #D7DCE6; }
.art-card .dots { display: flex; gap: 7px; margin-bottom: 10px; }
.art-card .dots i { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
.art-card .dots i:nth-child(2) { background: #FEBC2E; }
.art-card .dots i:nth-child(3) { background: #28C840; }
.art-card pre { margin: 0; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; overflow-x: auto; }
.art-card .k { color: #C678DD; } .art-card .t { color: #E5C07B; } .art-card .f { color: #61AFEF; }
.art-card .s { color: #98C379; } .art-card .n { color: #D19A66; } .art-card .m { color: #56B6C2; }
.home-main { max-width: 1200px; margin: 0 auto; padding: 8px 32px 40px; }
.home-part h2 { font-size: 22px; font-weight: 600; margin: 36px 0 16px; display: flex; align-items: center; gap: 10px; }
.home-part h2::before { content: ""; width: 4px; height: 20px; background: var(--brand); border-radius: 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card {
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; background: var(--bg);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--brand-soft-2); }
.card-tag { font-size: 12px; color: var(--brand); font-weight: 600; margin-bottom: 4px; }
.card-title { display: block; font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 10px; line-height: 1.45; }
.card ul { list-style: none; padding: 0; margin: 0; }
.card li { font-size: 13.5px; line-height: 1.5; padding: 3px 0; }
.card li a { color: var(--text-2); }
.card li a:hover { color: var(--brand); }
.card li.more { color: var(--text-3); font-size: 12px; }
.card code, .card-title code { font-family: var(--mono); font-size: .9em; }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-links a { padding: 8px 18px; border-radius: 20px; background: var(--bg-soft); color: var(--text); font-size: 14px; }
.quick-links a:hover { background: var(--brand-soft); color: var(--brand); }
.home-page .footer { margin-top: 48px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1280px) {
  .toc { display: none; }
}
@media (max-width: 1000px) {
  .topnav { display: none; }
  .menu-btn { display: inline-flex; }
  .home-page .menu-btn { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); width: min(320px, 86vw); background: var(--bg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-mask { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main { margin-left: 0; padding: 0 20px; }
  .hero-inner { flex-direction: column; align-items: stretch; }
  .hero h1 { font-size: 36px; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand-tag, .brand-text { display: none; }
  .search { width: auto; flex: 1; }
  .main { padding: 0 14px; }
  .markdown-body > h1:first-child, .markdown-body > h2:first-child { font-size: 24px; }
  .code-block pre.highlight { font-size: 12.5px; padding: 12px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .hero { padding: calc(var(--header-h) + 28px) 18px 32px; }
  .home-main { padding: 0 16px 32px; }
  .back-top { right: 14px; bottom: 18px; }
}
@media print {
  .topbar, .sidebar, .toc, .back-top, .pager, .cb-actions { display: none !important; }
  .main { margin: 0; }
  .code-block .hidden-line { display: none; }
}
