Files
website/.vitepress/theme/styles/portal.css
T
Dai0814 6944652966
mirror-to-gitee / mirror (push) Successful in 3s
fix(portal): 官方文档导航直接跳文档站,不再停在本站锚点
原先导航「官方文档」指向 /#docs(首页内的文档区块),
用户期望点它直接进 http://open.5iot.com:5051/docs/。

改动
- 导航项改为外链 http://open.5iot.com:5051/docs/,
  带 target=_blank 与 rel=noopener,新开标签页不打断阅读
- 首页 hero 的「官方文档」按钮同样改为外链直跳
- 文档站地址收敛为单一来源:data/content.ts 导出 DOCS_BASE / DOCS_HOME,
  可用环境变量 DOCS_BASE 覆盖;config.mts 与 HomePage.vue 都引用它,
  消除原先三处硬编码
- 首页的「官方文档」区块(#docs)保留,仍是各手册入口的聚合卡片

验证
- 导航渲染实测:href=http://open.5iot.com:5051/docs/, target=_blank
- 点击实测:新开标签页到目标地址,原页面 URL 不变
- 锚点项高亮不受影响(点「产品功能」仍正常变蓝)
- 构建 13 页 262 引用 0 失效
2026-11-04 15:36:04 +08:00

1078 lines
21 KiB
CSS

/* ============================================================
雪羊科技开源门户 —— 视觉系统
独立的排版语言:中性底色 + 单一强调色,正文以留白和层级取胜。
============================================================ */
:root {
--p-accent: #4f46e5;
--p-accent-2: #06b6d4;
--p-accent-soft: rgba(79, 70, 229, 0.08);
--p-accent-line: rgba(79, 70, 229, 0.22);
--p-surface: #ffffff;
--p-surface-alt: #f7f8fb;
--p-line: rgba(15, 23, 42, 0.08);
--p-line-strong: rgba(15, 23, 42, 0.14);
--p-ink: #0f172a;
--p-ink-2: #475569;
--p-ink-3: #8a94a6;
--p-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
--p-shadow-hover: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 40px -18px rgba(15, 23, 42, 0.22);
--p-radius: 16px;
--p-radius-sm: 10px;
--p-max: 1180px;
}
.portal {
color: var(--p-ink);
background: var(--p-surface);
}
html.dark {
--p-accent: #8b8bfa;
--p-accent-2: #45d3e8;
--p-accent-soft: rgba(139, 139, 250, 0.12);
--p-accent-line: rgba(139, 139, 250, 0.28);
--p-surface: #0c0f16;
--p-surface-alt: #11151e;
--p-line: rgba(255, 255, 255, 0.09);
--p-line-strong: rgba(255, 255, 255, 0.16);
--p-ink: #eef1f6;
--p-ink-2: #a8b2c4;
--p-ink-3: #6f7a8d;
--p-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
--p-shadow-hover: 0 1px 2px rgba(0, 0, 0, 0.35), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}
/* 让 page 布局摆脱默认窄栏,门户整页自管宽度 */
.portal-page .VPPage,
.portal-page .vp-doc.container {
max-width: none !important;
padding: 0 !important;
}
.portal-page .VPContent {
padding: 0 !important;
}
.portal-page .vp-doc > div > h1:first-child,
.portal-page .vp-doc > h1:first-child {
display: none;
}
.portal *,
.portal *::before,
.portal *::after {
box-sizing: border-box;
}
/* ---------- 容器与分区 ---------- */
.p-wrap {
max-width: var(--p-max);
margin: 0 auto;
padding: 0 28px;
}
.p-section {
padding: 96px 0;
border-top: 1px solid var(--p-line);
}
.p-section--alt {
background: var(--p-surface-alt);
}
.p-section--tight {
padding: 72px 0;
}
/* ---------- 区块标题(居中) ---------- */
.p-head {
max-width: 720px;
margin: 0 auto 56px;
text-align: center;
}
.p-head--left {
margin-left: 0;
text-align: left;
}
.p-eyebrow {
display: inline-flex;
align-items: center;
gap: 8px;
margin-bottom: 16px;
padding: 4px 12px;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.06em;
color: var(--p-accent);
background: var(--p-accent-soft);
border: 1px solid var(--p-accent-line);
border-radius: 999px;
}
.p-title {
margin: 0;
font-size: 36px;
font-weight: 650;
line-height: 1.25;
letter-spacing: -0.02em;
color: var(--p-ink);
}
.p-desc {
margin: 16px 0 0;
font-size: 16px;
line-height: 1.75;
color: var(--p-ink-2);
}
@media (max-width: 720px) {
.p-section {
padding: 64px 0;
}
.p-title {
font-size: 26px;
}
.p-desc {
font-size: 15px;
}
.p-head {
margin-bottom: 36px;
}
}
/* ---------- Hero ---------- */
.p-hero {
position: relative;
padding: 104px 0 88px;
text-align: center;
overflow: hidden;
}
.p-hero::before {
content: '';
position: absolute;
inset: -40% -20% auto;
height: 620px;
background: radial-gradient(50% 50% at 50% 50%, var(--p-accent-soft) 0%, transparent 70%);
pointer-events: none;
}
.p-hero > .p-wrap {
position: relative;
}
.p-hero-title {
margin: 20px 0 0;
font-size: 60px;
font-weight: 700;
line-height: 1.1;
letter-spacing: -0.035em;
color: var(--p-ink);
}
.p-hero-title em {
font-style: normal;
background: linear-gradient(100deg, var(--p-accent), var(--p-accent-2));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
.p-hero-sub {
margin: 22px auto 0;
max-width: 640px;
font-size: 17px;
line-height: 1.8;
color: var(--p-ink-2);
}
.p-hero-actions {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 12px;
margin-top: 34px;
}
.p-btn {
display: inline-flex;
align-items: center;
gap: 8px;
height: 46px;
padding: 0 26px;
font-size: 15px;
font-weight: 600;
border-radius: 999px;
border: 1px solid transparent;
text-decoration: none !important;
transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.p-btn:hover {
transform: translateY(-1px);
}
.p-btn--primary {
color: #fff !important;
background: var(--p-accent);
box-shadow: 0 8px 20px -8px var(--p-accent);
}
.p-btn--primary:hover {
box-shadow: 0 14px 28px -10px var(--p-accent);
}
.p-btn--ghost {
color: var(--p-ink) !important;
background: var(--p-surface);
border-color: var(--p-line-strong);
}
.p-btn--ghost:hover {
border-color: var(--p-accent);
color: var(--p-accent) !important;
}
@media (max-width: 720px) {
.p-hero {
padding: 56px 0 48px;
}
.p-hero-title {
font-size: 29px;
letter-spacing: -0.02em;
line-height: 1.28;
}
.p-hero-sub {
font-size: 14.5px;
line-height: 1.75;
margin-top: 18px;
}
.p-hero-actions {
margin-top: 26px;
}
.p-btn {
height: 44px;
padding: 0 22px;
font-size: 14.5px;
}
}
/* ---------- 数据条 ---------- */
.p-stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 0;
max-width: 900px;
margin: 64px auto 0;
padding: 28px 0;
border-top: 1px solid var(--p-line);
border-bottom: 1px solid var(--p-line);
}
.p-stat {
text-align: center;
padding: 0 12px;
}
.p-stat + .p-stat {
border-left: 1px solid var(--p-line);
}
.p-stat-num {
display: block;
font-size: 34px;
font-weight: 700;
letter-spacing: -0.03em;
line-height: 1.1;
color: var(--p-ink);
}
.p-stat-num span {
font-size: 18px;
font-weight: 600;
color: var(--p-accent);
}
.p-stat-label {
display: block;
margin-top: 8px;
font-size: 13px;
color: var(--p-ink-3);
}
@media (max-width: 720px) {
.p-stats {
grid-template-columns: repeat(2, 1fr);
gap: 24px 0;
margin-top: 44px;
}
.p-stat:nth-child(3) {
border-left: none;
}
.p-stat-num {
font-size: 26px;
}
}
/* ---------- 通用卡片网格 ---------- */
.p-grid {
display: grid;
gap: 20px;
}
.p-grid--3 {
grid-template-columns: repeat(3, 1fr);
}
.p-grid--4 {
grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1024px) {
.p-grid--4 {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 860px) {
.p-grid--3,
.p-grid--4 {
grid-template-columns: 1fr;
}
}
.p-card {
display: flex;
flex-direction: column;
padding: 28px 26px;
background: var(--p-surface);
border: 1px solid var(--p-line);
border-radius: var(--p-radius);
box-shadow: var(--p-shadow);
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.p-card:hover {
transform: translateY(-3px);
border-color: var(--p-accent-line);
box-shadow: var(--p-shadow-hover);
}
.p-card-index {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
margin-bottom: 16px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.02em;
color: var(--p-accent);
background: var(--p-accent-soft);
border-radius: 8px;
}
.p-card-title {
margin: 0;
font-size: 16px;
font-weight: 650;
line-height: 1.4;
color: var(--p-ink);
}
.p-card-text {
margin: 10px 0 0;
font-size: 14px;
line-height: 1.75;
color: var(--p-ink-2);
}
/* ---------- 标签切换 ---------- */
.p-tabs {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
margin-bottom: 40px;
}
.p-tab {
height: 38px;
padding: 0 18px;
font-family: inherit;
font-size: 14px;
font-weight: 500;
color: var(--p-ink-2);
background: transparent;
border: 1px solid var(--p-line-strong);
border-radius: 999px;
cursor: pointer;
transition: all 0.18s;
}
.p-tab:hover {
color: var(--p-ink);
border-color: var(--p-ink-3);
}
.p-tab.is-active {
color: #fff;
background: var(--p-accent);
border-color: var(--p-accent);
}
html.dark .p-tab.is-active {
color: #0c0f16;
}
/* ---------- 左右图文 ---------- */
.p-split {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 64px;
align-items: center;
}
@media (max-width: 960px) {
.p-split {
grid-template-columns: 1fr;
gap: 40px;
}
}
.p-list {
margin: 28px 0 0;
padding: 0;
list-style: none;
}
.p-list li {
position: relative;
padding: 14px 0 14px 30px;
font-size: 15px;
line-height: 1.7;
color: var(--p-ink-2);
border-top: 1px solid var(--p-line);
}
.p-list li::before {
content: '';
position: absolute;
left: 4px;
top: 22px;
width: 7px;
height: 7px;
border-radius: 2px;
background: var(--p-accent);
}
.p-list strong {
color: var(--p-ink);
font-weight: 600;
}
/* ---------- 代码面板 ---------- */
.p-panel {
padding: 22px 24px;
font-family: var(--vp-font-family-mono);
font-size: 13px;
line-height: 1.9;
color: var(--p-ink-2);
background: var(--p-surface-alt);
border: 1px solid var(--p-line);
border-radius: var(--p-radius);
}
.p-panel .c {
color: var(--p-ink-3);
}
.p-panel .k {
color: var(--p-accent);
}
/* ---------- 步骤 ---------- */
.p-steps {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
margin-top: 8px;
}
@media (max-width: 860px) {
.p-steps {
grid-template-columns: 1fr;
}
}
.p-step {
padding: 26px;
background: var(--p-surface);
border: 1px solid var(--p-line);
border-radius: var(--p-radius);
}
.p-step-num {
display: inline-block;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.08em;
color: var(--p-accent);
}
.p-step h3 {
margin: 10px 0 0;
font-size: 16px;
font-weight: 650;
color: var(--p-ink);
}
.p-step p {
margin: 8px 0 0;
font-size: 14px;
line-height: 1.75;
color: var(--p-ink-2);
}
.p-step code {
display: block;
margin-top: 14px;
padding: 10px 12px;
font-size: 12.5px;
color: var(--p-ink);
background: var(--p-surface-alt);
border: 1px solid var(--p-line);
border-radius: var(--p-radius-sm);
word-break: break-all;
white-space: pre-wrap;
}
/* ---------- 底部 CTA ---------- */
.p-cta {
text-align: center;
padding: 88px 0;
}
.p-cta .p-title {
font-size: 32px;
}
/* ---------- 项目卡片 ---------- */
.p-proj {
display: flex;
flex-direction: column;
padding: 30px 28px;
background: var(--p-surface);
border: 1px solid var(--p-line);
border-radius: var(--p-radius);
box-shadow: var(--p-shadow);
color: var(--p-ink) !important;
text-decoration: none !important;
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.p-proj:hover {
transform: translateY(-3px);
border-color: var(--p-accent-line);
box-shadow: var(--p-shadow-hover);
}
.p-proj-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.p-proj-name {
margin: 0;
font-size: 21px;
font-weight: 680;
letter-spacing: -0.01em;
color: var(--p-ink);
border: none;
padding: 0;
}
.p-badge {
flex: none;
padding: 3px 10px;
font-size: 11.5px;
font-weight: 600;
color: var(--p-accent);
background: var(--p-accent-soft);
border: 1px solid var(--p-accent-line);
border-radius: 999px;
}
.p-proj-tagline {
margin: 10px 0 0;
font-size: 14px;
font-weight: 600;
color: var(--p-ink-2);
}
.p-proj-summary {
margin: 12px 0 0;
font-size: 14px;
line-height: 1.8;
color: var(--p-ink-2);
}
.p-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 18px 0 0;
padding: 0;
list-style: none;
}
.p-tags li {
padding: 3px 9px;
font-size: 11.5px;
color: var(--p-ink-3);
background: var(--p-surface-alt);
border: 1px solid var(--p-line);
border-radius: 6px;
}
.p-proj-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 22px;
padding-top: 18px;
border-top: 1px solid var(--p-line);
font-size: 12.5px;
color: var(--p-ink-3);
}
.p-proj-more {
font-weight: 600;
color: var(--p-accent);
}
/* ============================================================
内容页(非首页)的细节调整
============================================================ */
/* 属性表首列不要挤成竖排 */
.vp-doc table th:first-child,
.vp-doc table td:first-child {
white-space: nowrap;
}
/* 表格更轻,去掉重边框感 */
.vp-doc table {
display: table;
width: 100%;
}
.vp-doc tr {
background: transparent !important;
}
.vp-doc th {
font-weight: 600;
color: var(--p-ink, inherit);
}
/* 详情页一级标题更醒目 */
.vp-doc h1 {
font-size: 38px;
font-weight: 700;
letter-spacing: -0.025em;
line-height: 1.2;
}
@media (max-width: 720px) {
.vp-doc h1 {
font-size: 28px;
}
}
/* 二级标题加一条短强调线 */
.vp-doc h2 {
padding-top: 40px;
margin-top: 56px;
font-size: 26px;
font-weight: 650;
letter-spacing: -0.02em;
}
.vp-doc h2::before {
content: '';
display: block;
width: 32px;
height: 3px;
margin-bottom: 18px;
border-radius: 2px;
background: var(--p-accent, #4f46e5);
}
.vp-doc h3 {
font-size: 18px;
font-weight: 650;
}
/* 提示块圆角统一 */
.vp-doc .custom-block {
border-radius: 10px;
}
/* 行内代码轻一点 */
.vp-doc :not(pre) > code {
border-radius: 5px;
font-size: 0.86em;
}
/* 内容页正文用强调色变量,避免与默认主题脱节 */
.vp-doc a {
color: var(--p-accent);
text-decoration-color: var(--p-accent-line);
}
.vp-doc a:hover {
text-decoration-color: var(--p-accent);
}
/* ============================================================
产品功能卡片
============================================================ */
.pf-card {
position: relative;
}
.pf-name {
font-size: 17px;
}
.pf-tagline {
margin: 8px 0 0;
font-size: 13.5px;
font-weight: 600;
color: var(--p-accent);
}
.pf-list {
margin: 20px 0 0;
padding: 0;
list-style: none;
flex: 1;
}
.pf-list li {
position: relative;
padding: 9px 0 9px 22px;
font-size: 13.5px;
line-height: 1.6;
color: var(--p-ink-2);
border-top: 1px solid var(--p-line);
}
.pf-list li:first-child {
border-top: none;
}
.pf-list li::before {
content: '';
position: absolute;
left: 2px;
top: 17px;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--p-accent);
opacity: 0.55;
}
.pf-more {
display: inline-block;
margin-top: 20px;
font-size: 13px;
font-weight: 600;
color: var(--p-accent);
text-decoration: none !important;
}
.pf-more:hover {
text-decoration: underline !important;
text-underline-offset: 3px;
}
/* ============================================================
核心能力卡片
============================================================ */
.ca-card {
position: relative;
padding: 26px 24px;
}
.ca-tag {
display: inline-block;
align-self: flex-start;
width: auto;
margin-bottom: 14px;
padding: 2px 9px;
font-size: 11.5px;
font-weight: 600;
letter-spacing: 0.04em;
color: var(--p-accent);
background: var(--p-accent-soft);
border-radius: 5px;
}
.ca-card .p-card-title {
font-size: 15.5px;
}
.ca-card .p-card-text {
font-size: 13.5px;
line-height: 1.7;
}
/* ============================================================
官方文档
============================================================ */
.doc-grid {
margin-bottom: 8px;
}
.doc-card {
text-decoration: none !important;
color: var(--p-ink) !important;
}
.doc-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.doc-top .p-card-title {
font-size: 15.5px;
}
.doc-arrow {
flex: none;
margin-top: 3px;
color: var(--p-ink-3);
transition: color 0.18s, transform 0.18s;
}
.doc-card:hover .doc-arrow {
color: var(--p-accent);
transform: translate(1px, -1px);
}
.doc-card .p-card-text {
flex: 1;
font-size: 13.5px;
line-height: 1.7;
}
.doc-project {
display: inline-block;
align-self: flex-start;
margin-top: 18px;
padding: 2px 9px;
font-size: 11.5px;
color: var(--p-ink-3);
background: var(--p-surface-alt);
border: 1px solid var(--p-line);
border-radius: 5px;
}
html.dark .doc-project {
background: rgba(255, 255, 255, 0.04);
}
.doc-note {
margin: 28px 0 0;
text-align: center;
font-size: 13px;
color: var(--p-ink-3);
}
.doc-note a {
color: var(--p-accent);
text-decoration: none;
}
.doc-note a:hover {
text-decoration: underline;
text-underline-offset: 3px;
}
/* ============================================================
导航:锚点项在窄屏隐藏,避免挤压
============================================================ */
@media (max-width: 860px) {
.VPNavBarMenuGroup:nth-child(n + 5):nth-child(-n + 7) {
display: none;
}
}
/* ============================================================
强调区块 —— 深色底,用于需要跳出视觉节奏的区块
浅色主题下用近黑底,暗色主题下用略亮于页面底的深灰,
两种主题下都能形成明显层次,而不是和相邻区块同一色阶。
============================================================ */
.p-section--deep {
position: relative;
border-top: none;
background: #0d1220;
color: #e8edf7;
overflow: hidden;
}
.p-section--deep::before {
content: '';
position: absolute;
inset: -30% -10% auto;
height: 460px;
background: radial-gradient(46% 60% at 50% 0%, rgba(99, 102, 241, 0.28) 0%, transparent 72%);
pointer-events: none;
}
.p-section--deep > .p-wrap {
position: relative;
}
/* 强调区内的标题与正文反白 */
.p-section--deep .p-eyebrow {
color: #a9b4ff;
background: rgba(129, 140, 248, 0.14);
border-color: rgba(129, 140, 248, 0.35);
}
.p-section--deep .p-title {
color: #f4f7fd;
}
.p-section--deep .p-desc {
color: #a8b4c9;
}
/* 强调区内的卡片:半透明白,压在深底上 */
.p-section--deep .p-card {
background: rgba(255, 255, 255, 0.055);
border-color: rgba(255, 255, 255, 0.12);
box-shadow: none;
}
.p-section--deep .p-card:hover {
background: rgba(255, 255, 255, 0.075);
border-color: rgba(129, 140, 248, 0.5);
box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
}
.p-section--deep .p-card-title {
color: #f0f4fb;
}
.p-section--deep .p-card-text {
color: #b0bccf;
}
.p-section--deep .ca-tag {
color: #b9c2ff;
background: rgba(129, 140, 248, 0.16);
}
/* 强调区顶部/底部加一道极细的高光线,强化分隔 */
.p-section--deep::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.55), transparent);
}
/* 暗色主题下:页面底是 #0c0f16,强调区改用略亮的冷色并加强光晕,
靠"提亮"而不是"压深"来形成层次 */
html.dark .p-section--deep {
background: #161b2c;
}
html.dark .p-section--deep::before {
height: 520px;
background: radial-gradient(52% 64% at 50% 0%, rgba(99, 102, 241, 0.34) 0%, transparent 70%);
}
html.dark .p-section--deep .p-card {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(255, 255, 255, 0.11);
}
html.dark .p-section--deep .p-card:hover {
background: rgba(255, 255, 255, 0.08);
border-color: rgba(165, 174, 255, 0.55);
}
html.dark .p-section--deep .p-title {
color: #ffffff;
}
html.dark .p-section--deep .p-card-text {
color: #c2cbdb;
}
/* ============================================================
导航栏锚点高亮
VitePress 只按 path 判定 active,同一路径下的多个锚点会一起亮。
这里用 data-anchor-active 属性接管,并压掉错误的默认 active。
选择器用 :not([data-anchor-active]) 精确排除正确项。
============================================================ */
/* 压制 VitePress 默认 active 只在首页生效:
首页上「/」「/#features」等路径部分相同,默认逻辑会把多个项同时点亮;
其它页面(/projects/、/about)必须保留正常高亮。 */
html.portal-nav-home .VPNavBarMenuLink.active:not([data-anchor-active]) {
color: var(--vp-c-text-1);
}
.VPNavBarMenuLink[data-anchor-active],
.VPNavBarMenuLink.active[data-anchor-active] {
color: var(--vp-c-brand-1);
}
/* 首页内锚点项未激活时保持常态色,并补一个 hover 反馈 */
.VPNavBarMenuLink[href*='#']:not([data-anchor-active]):hover {
color: var(--vp-c-brand-1);
}
/* ============================================================
左上角站点标题两行排版
第一行:雪羊科技(主标题)
第二行:物联网卡与设备管理平台(副标题,更弱)
副标题用 display:block 自然换行,无需 <br>
============================================================ */
.VPNavBarTitle .title-text {
line-height: 1.2;
}
.VPNavBarTitle .title-text .site-subtitle {
display: block;
margin-top: 2px;
font-size: 11.5px;
font-weight: 500;
letter-spacing: 0.02em;
color: var(--p-ink-3);
}
@media (max-width: 860px) {
.VPNavBarTitle .title-text .site-subtitle {
font-size: 10.5px;
}
}