- 后端 goldmark 渲染管线:/docs/:slug 页面 + /docs/search-data.json 搜索索引, manifest.json 驱动分组导航,正文剥 H1 避免与页面头重复 - 三栏布局(分组侧栏/内容/本页目录)+ 顶栏(品牌/版本徽章/搜索面板/官网入口), docs.css 品牌绿版 + docs.js(代码复制/轻量高亮/提示块/TOC 滚动高亮/移动端抽屉) - 替换 docsify;无上一页时空占位无边框;visual-judge 两轮评审(初版 fail → 修复后 pass)
256 lines
12 KiB
CSS
256 lines
12 KiB
CSS
/* OpsxAPI 文档站 —— 清爽专业风格(浅色) */
|
|
:root {
|
|
--blue: #059669;
|
|
--blue-dark: #047857;
|
|
--blue-soft: rgba(5, 150, 105, 0.08);
|
|
--bg: #f6f8fb;
|
|
--panel: #ffffff;
|
|
--border: #e4e9f1;
|
|
--text: #1c2434;
|
|
--text-2: #5b6880;
|
|
--text-3: #98a2b3;
|
|
--code-bg: #f3f6fb;
|
|
--code-border: #e1e8f3;
|
|
--green: #059669;
|
|
--amber: #b45309;
|
|
--red: #dc2626;
|
|
--sidebar-w: 262px;
|
|
--toc-w: 220px;
|
|
--topbar-h: 56px;
|
|
--radius: 10px;
|
|
--shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.05);
|
|
--mono: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
|
|
body {
|
|
margin: 0;
|
|
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font-size: 14.5px;
|
|
line-height: 1.75;
|
|
}
|
|
a { color: var(--blue); text-decoration: none; }
|
|
.i { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
|
|
a:hover { color: var(--blue-dark); text-decoration: underline; }
|
|
|
|
/* ---------- 顶栏 ---------- */
|
|
.topbar {
|
|
position: sticky; top: 0; z-index: 50;
|
|
background: rgba(255, 255, 255, 0.92);
|
|
backdrop-filter: saturate(1.4) blur(8px);
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
.topbar-inner {
|
|
max-width: 1440px; margin: 0 auto; height: var(--topbar-h);
|
|
display: flex; align-items: center; gap: 14px; padding: 0 20px;
|
|
}
|
|
.menu-btn {
|
|
display: none; border: 1px solid var(--border); background: #fff;
|
|
border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--text-2);
|
|
place-items: center;
|
|
}
|
|
.menu-btn .i { width: 17px; height: 17px; }
|
|
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none !important; }
|
|
.brand-logo { display: inline-flex; }
|
|
.brand-logo svg { display: block; border-radius: 7px; }
|
|
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); }
|
|
.brand-name em { font-style: normal; font-weight: 500; color: var(--text-2); margin-left: 2px; }
|
|
.ver-badge {
|
|
font-size: 11px; font-weight: 600; color: var(--blue);
|
|
background: var(--blue-soft); border: 1px solid rgba(5, 150, 105, 0.22);
|
|
padding: 1px 9px; border-radius: 999px; white-space: nowrap;
|
|
}
|
|
.search { position: relative; flex: 1; max-width: 420px; margin-left: 8px; }
|
|
.search input {
|
|
width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 9px;
|
|
background: var(--bg); padding: 0 14px 0 34px; font-size: 13.5px; color: var(--text); outline: none;
|
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2398a2b3' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
|
|
background-repeat: no-repeat; background-position: 12px center;
|
|
}
|
|
.search input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-soft); }
|
|
.search-panel {
|
|
position: absolute; top: 44px; left: 0; right: 0; background: #fff;
|
|
border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
|
|
max-height: 420px; overflow: auto; padding: 6px;
|
|
}
|
|
.search-item { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none !important; }
|
|
.search-item:hover, .search-item.sel { background: var(--blue-soft); }
|
|
.search-item .si-title { font-weight: 600; color: var(--text); font-size: 13.5px; }
|
|
.search-item .si-group { color: var(--text-3); font-size: 11px; margin-left: 6px; }
|
|
.search-item .si-snippet { color: var(--text-2); font-size: 12px; margin-top: 2px; display: block; }
|
|
.search-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; }
|
|
.top-links { margin-left: auto; display: flex; gap: 16px; align-items: center; }
|
|
.top-links a { font-size: 13.5px; font-weight: 500; }
|
|
|
|
/* ---------- 三栏布局 ---------- */
|
|
.layout {
|
|
max-width: 1440px; margin: 0 auto; display: grid;
|
|
grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
|
|
gap: 0 28px; padding: 24px 20px 60px;
|
|
}
|
|
|
|
/* 侧栏 */
|
|
.sidebar { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; padding-right: 8px; }
|
|
.sidebar::-webkit-scrollbar { width: 4px; }
|
|
.sidebar::-webkit-scrollbar-thumb { background: #d6dde8; border-radius: 4px; }
|
|
.nav-group { margin-bottom: 18px; }
|
|
.nav-group-title {
|
|
font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
|
|
color: var(--text-3); padding: 0 10px 6px;
|
|
}
|
|
.nav-link {
|
|
display: block; padding: 6px 10px; border-radius: 8px; font-size: 13.5px;
|
|
color: var(--text-2); text-decoration: none !important; border-left: 2px solid transparent;
|
|
}
|
|
.nav-link:hover { background: rgba(5, 150, 105, 0.06); color: var(--text); }
|
|
.nav-link.active {
|
|
background: var(--blue-soft); color: var(--blue-dark); font-weight: 600;
|
|
border-left-color: var(--blue);
|
|
}
|
|
.sidebar-foot { margin-top: 24px; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
|
|
|
|
/* 内容 */
|
|
.content { min-width: 0; max-width: 860px; }
|
|
.breadcrumb { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
|
|
.breadcrumb span { margin: 0 6px; }
|
|
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.3; }
|
|
.page-meta { font-size: 12.5px; color: var(--text-3); margin-bottom: 22px; }
|
|
|
|
/* Markdown 排版 */
|
|
.md h2 { font-size: 21px; font-weight: 700; margin: 38px 0 12px; padding-top: 8px; letter-spacing: -0.01em; }
|
|
.md h3 { font-size: 16.5px; font-weight: 700; margin: 26px 0 8px; }
|
|
.md h2 + h3, .md h1 + h2 { margin-top: 18px; }
|
|
.md p { margin: 10px 0; color: #2a3348; }
|
|
.md ul, .md ol { padding-left: 22px; margin: 10px 0; }
|
|
.md li { margin: 5px 0; color: #2a3348; }
|
|
.md li::marker { color: var(--blue); }
|
|
.md strong { color: var(--text); }
|
|
.md hr { border: none; border-top: 1px solid var(--border); margin: 30px 0; }
|
|
.md img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
|
|
.md blockquote {
|
|
margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--blue);
|
|
background: var(--blue-soft); border-radius: 0 8px 8px 0; color: #33415e;
|
|
}
|
|
|
|
/* 表格 */
|
|
.md table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13.5px; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
|
|
.md th, .md td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
|
|
.md th { background: #f9fbfe; font-weight: 600; color: var(--text); white-space: nowrap; }
|
|
.md tr:last-child td { border-bottom: none; }
|
|
|
|
/* 代码块 */
|
|
.md code { font-family: var(--mono); font-size: 12.8px; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 5px; padding: 1px 6px; color: #334155; }
|
|
.md pre {
|
|
position: relative; background: #0f172a; color: #dbe4f3; border-radius: var(--radius);
|
|
padding: 16px 16px 14px; overflow-x: auto; margin: 16px 0; font-size: 13px; line-height: 1.65;
|
|
}
|
|
.md pre code { background: none; border: none; color: inherit; padding: 0; font-size: inherit; }
|
|
.md pre .lang-tag {
|
|
position: absolute; top: 8px; right: 12px; font-size: 10.5px; color: #7c8db0;
|
|
font-family: var(--mono); text-transform: lowercase; letter-spacing: 0.04em;
|
|
}
|
|
.md pre .copy-btn {
|
|
position: absolute; top: 6px; right: 60px; font-size: 11px; color: #9fb0d0;
|
|
background: rgba(255, 255, 255, 0.07); border: none; border-radius: 6px; padding: 2px 9px; cursor: pointer;
|
|
opacity: 0; transition: opacity 0.15s;
|
|
}
|
|
.md pre:hover .copy-btn { opacity: 1; }
|
|
.md pre .copy-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
|
|
/* 行内高亮 token */
|
|
.md pre .tok-key { color: #7dd3fc; }
|
|
.md pre .tok-str { color: #86efac; }
|
|
.md pre .tok-num { color: #fcd34d; }
|
|
.md pre .tok-com { color: #64748b; font-style: italic; }
|
|
|
|
/* 提示块(通过 blockquote 首字符约定) */
|
|
.md blockquote.tip { border-left-color: var(--green); background: rgba(5, 150, 105, 0.07); }
|
|
.md blockquote.warn { border-left-color: var(--amber); background: rgba(180, 83, 9, 0.07); }
|
|
|
|
/* 上下页 */
|
|
.pn-nav { display: flex; gap: 14px; margin-top: 48px; }
|
|
.pn {
|
|
flex: 1; border: 1px solid var(--border); background: #fff; border-radius: var(--radius);
|
|
padding: 13px 16px; text-decoration: none !important; transition: border-color 0.15s, box-shadow 0.15s;
|
|
}
|
|
.pn:hover { border-color: var(--blue); box-shadow: var(--shadow); }
|
|
.pn.next { text-align: right; }
|
|
.pn-label { display: block; font-size: 11.5px; color: var(--text-3); }
|
|
.pn-title { display: block; font-weight: 600; color: var(--text); font-size: 14px; margin-top: 2px; }
|
|
|
|
/* 右侧目录 */
|
|
.toc { position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; padding-top: 34px; }
|
|
.toc-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 8px; }
|
|
.toc-nav { display: flex; flex-direction: column; gap: 1px; border-left: 2px solid var(--border); padding-left: 0; }
|
|
.toc-nav a {
|
|
font-size: 12.5px; color: var(--text-2); padding: 4px 0 4px 12px; text-decoration: none !important;
|
|
border-left: 2px solid transparent; margin-left: -2px; line-height: 1.5;
|
|
}
|
|
.toc-nav a:hover { color: var(--blue); }
|
|
.toc-nav a.toc-l3 { padding-left: 26px; font-size: 12px; color: var(--text-3); }
|
|
.toc-nav a.active { color: var(--blue); border-left-color: var(--blue); font-weight: 600; }
|
|
/* 404 */
|
|
.doc-404 { display: grid; place-items: center; min-height: 100vh; text-align: center; }
|
|
.doc-404 h1 { font-size: 56px; margin: 0; color: var(--blue); }
|
|
.doc-404 .btn {
|
|
display: inline-block; margin-top: 12px; background: var(--blue); color: #fff;
|
|
padding: 8px 18px; border-radius: 8px; text-decoration: none !important; font-weight: 600;
|
|
}
|
|
|
|
/* ---------- 响应式 ---------- */
|
|
@media (max-width: 1200px) {
|
|
.layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
|
|
.toc { display: none; }
|
|
}
|
|
@media (max-width: 880px) {
|
|
.menu-btn { display: inline-grid; place-items: center; }
|
|
.layout { grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
|
|
.sidebar {
|
|
position: fixed; z-index: 60; left: 0; top: var(--topbar-h); bottom: 0;
|
|
width: 280px; background: #fff; border-right: 1px solid var(--border);
|
|
padding: 16px; transform: translateX(-100%); transition: transform 0.2s; max-height: none;
|
|
}
|
|
.sidebar.open { transform: none; box-shadow: var(--shadow); }
|
|
.ver-badge { display: none; }
|
|
.top-links a { font-size: 12.5px; }
|
|
.page-title { font-size: 24px; }
|
|
}
|
|
|
|
/* ---------- 打印 ---------- */
|
|
@media print {
|
|
.topbar, .sidebar, .toc, .pn-nav, .feedback, .menu-btn { display: none !important; }
|
|
.layout { display: block; max-width: none; padding: 0; }
|
|
body { background: #fff; }
|
|
.md pre { background: #f1f5f9 !important; color: #1e293b !important; }
|
|
.md pre .copy-btn, .md pre .lang-tag { display: none; }
|
|
}
|
|
|
|
/* ---------- LokiStack 品牌适配 ---------- */
|
|
.brand-logo {
|
|
display: inline-flex; align-items: center; justify-content: center;
|
|
width: 28px; height: 28px; border-radius: 8px;
|
|
background: linear-gradient(135deg, #10b981, #047857);
|
|
color: #fff; font-weight: 800; font-size: 17px;
|
|
}
|
|
|
|
/* 响应式(窄屏收起侧栏与目录) */
|
|
@media (max-width: 1100px) {
|
|
.layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
|
|
.toc { display: none; }
|
|
}
|
|
@media (max-width: 860px) {
|
|
.layout { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 40px; }
|
|
.menu-btn { display: grid; }
|
|
.sidebar {
|
|
position: fixed; z-index: 60; top: var(--topbar-h); left: 0; bottom: 0;
|
|
width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border);
|
|
transform: translateX(-100%); transition: transform 0.2s; max-height: none; padding: 14px 10px;
|
|
}
|
|
.sidebar.open { transform: none; box-shadow: var(--shadow); }
|
|
.search { max-width: none; }
|
|
.top-links { display: none; }
|
|
}
|
|
|
|
.pn-empty { flex: 1; }
|