/* =========================================================================== 深入理解 AI Agent — 把 Material 主题「去装饰」,复刻 icyfenix.cn 的扁平风 =========================================================================== 设计参考:实测 icyfenix.cn 的 computed style(2026-07) - navbar 57px / 白底 / 1px 浅灰下划线 - sidebar 320px / 白底 / 1px 浅灰右边线 - 主文字色 #2c3e50(深蓝灰,而非纯黑) - h1 41.6px - 正文 16px / 1.7 - 链接默认与正文同色,hover 时变蓝(扁平、不张扬) 策略:不换主题(保留 Material 的搜索/多语言/暗色/i18n/分享卡等所有功能), 只用 CSS 关掉它的「卡片化」「阴影」「圆角」「紫色调」等装饰, 让页面回归「白底 + 左侧栏 + 文字」的扁平形态。 =========================================================================== */ /* ── 0. 设计 token(对齐 fenix 实测值) ─────────────────────────── */ :root { --md-text-font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; --md-code-font: "JetBrains Mono", "Fira Code", SFMono-Regular, Consolas, Menlo, monospace; /* fenix 调色板 */ --fenix-ink: #2c3e50; /* 主文字 + h1 + 链接默认色 */ --fenix-ink-soft: #57606a; /* 次级文字 */ --fenix-ink-mute: #8b949e; /* 弱化文字 */ --fenix-border: #eaecef; /* navbar/sidebar 的细分隔线 */ --fenix-link: #3884fe; /* fenix 实测的正文链接蓝 */ --fenix-link-hover: #42b983; /* fenix 经典墨绿 hover */ --fenix-bg: #ffffff; --fenix-bg-soft: #f6f8fa; --fenix-code-bg: rgba(27, 31, 35, 0.05); --fenix-code-ink: #476582; /* 让 Material 也用上这些 token */ --md-primary-fg-color: #2c3e50; --md-primary-bg-color: #ffffff; --md-default-fg-color: #2c3e50; --md-default-fg-color--soft: #57606a; --md-accent-fg-color: #42b983; } /* Prefer Korean glyph forms only while viewing the Korean edition. Keeping this override language-scoped avoids changing Chinese glyphs site-wide. */ html[lang="ko"] { --md-text-font: "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans SC", "PingFang SC", -apple-system, blinkmacsystemfont, "Segoe UI", helvetica, arial, sans-serif; } /* ── 1. 关掉 Material 的卡片化、阴影、圆角 ────────────────────── */ /* 全局去掉 box-shadow —— 这是 Material 最显眼的装饰 */ .md-header, .md-sidebar, .md-tabs, .md-search, .md-nav, .md-typeset .admonition, .md-typeset details, .md-typeset pre, .md-typeset table:not([class]) { box-shadow: none !important; } /* navbar:扁平、白底、单线分隔(对齐 fenix 的 57px / 1px #eaecef) */ .md-header { background-color: var(--fenix-bg) !important; border-bottom: 1px solid var(--fenix-border) !important; color: var(--fenix-ink) !important; height: 57px; box-shadow: none !important; transition: none; } .md-header__title { color: var(--fenix-ink) !important; font-weight: 600; } .md-header__topic { color: var(--fenix-ink) !important; } /* 顶部 header 里的搜索框 —— 扁平化 */ .md-search__input { background-color: var(--fenix-bg-soft) !important; color: var(--fenix-ink) !important; border-radius: 4px !important; } .md-search__input::placeholder { color: var(--fenix-ink-mute); } /* ── 1b. 整页布局:全宽(fenix/VitePress 几何)────────────────── Material 默认把整页装进 61rem 的 .md-grid 盒子:1920px 屏上两侧 各浪费 ~350px,正文却只有 ~660px,宽图和代码块很挤。桌面端解除 上限:header 与左侧栏贴住视口左缘;正文限制在书页式行宽内 (~50 汉字/行),与右侧大纲作为一个整体在剩余空间居中——正文的 margin-left:auto 和大纲的 margin-right:auto 平分空白,大纲因此 紧贴正文而不是漂到视口最右缘。 只在桌面端覆写:移动端抽屉几何被 Material 硬编码(见 2 节)。 */ @media screen and (min-width: 76.25em) { .md-grid { max-width: 100%; } .md-header__inner { padding-left: 0.8rem; padding-right: 0.8rem; } .md-content { max-width: 42rem; margin-left: auto; margin-right: 0; } .md-sidebar--secondary { margin-right: auto; } } /* Material turns the chapter navigation into a drawer below 76.25rem and already provides its own menu button there. On persistent-sidebar layouts, expose the companion control added in the header override. Hiding the primary sidebar removes it from the flex layout, so the article and its outline automatically recenter in the newly available reading space. */ .sidebar-toggle:not([hidden]) { display: none; } @media screen and (min-width: 76.25em) { .sidebar-toggle:not([hidden]) { display: inline-flex; } .sidebar-toggle svg { transition: transform 0.15s ease; } .sidebar-nav-collapsed .sidebar-toggle svg { transform: scaleX(-1); } .sidebar-nav-collapsed .md-sidebar--primary { display: none; } } /* ── 2. 左侧栏(书的目录树):白底、单线分隔 ───────────────────── 结构(navigation.sections + navigation.indexes):
  • 桌面端的折叠行为由 nav-collapse.js 注入的 CSS 控制。 */ /* 宽度只在桌面端覆写:移动端抽屉的收起位置被 Material 硬编码为 -12.1rem,改宽会让抽屉在收起时露出一条边(之前的 320px 全局 覆写正是这个 bug 的来源)。 */ @media screen and (min-width: 76.25em) { .md-sidebar--primary { width: 15.5rem; padding-left: 0.6rem; /* 全宽布局下不让内容贴死视口左缘 */ border-right: 1px solid var(--fenix-border); } } /* 侧边栏链接 —— 扁平、深蓝灰、无 hover 背景,只在 hover 时变墨绿 */ .md-nav__link { color: var(--fenix-ink) !important; font-size: 0.78rem; margin: 0; padding: 6px 0 6px 0; transition: color .12s; } .md-nav__link:hover, .md-nav__link:hover * { color: var(--fenix-link-hover) !important; } /* 章节标题行:标题 占满剩余宽度,箭头