/* 界智通 · 全站设计规范 + 页头页脚（第 1 阶段）
 * 只在 <html class="jp-ui"> 下生效；颜色跟随主题变量，深色模式自动适配 */

:root {
    /* 品牌 */
    --jp-brand: #7c3aed;
    --jp-brand-2: #c026d3;
    --jp-brand-3: #f43f5e;
    --jp-grad: linear-gradient(135deg, #7c3aed 0%, #c026d3 55%, #f43f5e 100%);
    --jp-brand-soft: rgba(124, 58, 237, .1);
    /* 表面与文字（映射主题变量，浅/深色随主题切换） */
    --jp-bg: var(--background-color, #f7f7fb);
    --jp-card: var(--front-bg-color, #fff);
    --jp-title: var(--title-color, #222);
    --jp-text: var(--text-color, #333);
    --jp-muted: var(--light-text-color, #888);
    --jp-line: var(--line-color, #eee);
    /* 尺寸 */
    --jp-r-s: 8px;
    --jp-r-m: 12px;
    --jp-r-l: 16px;
    --jp-r-xl: 22px;
    --jp-header-h: 56px;
    --jp-tabbar-h: 58px;
    /* 字号 */
    --jp-fs-xs: 12px;
    --jp-fs-s: 13px;
    --jp-fs-m: 14px;
    --jp-fs-l: 16px;
    --jp-fs-xl: 20px;
    --jp-fs-2xl: 26px;
    /* 阴影 */
    --jp-shadow-s: 0 1px 2px rgba(20, 16, 50, .06);
    --jp-shadow-m: 0 12px 30px -18px rgba(30, 20, 80, .35);
    --jp-shadow-l: 0 24px 60px -28px rgba(30, 20, 80, .5);
    --jp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html.jp-ui body { font-family: var(--jp-font); -webkit-font-smoothing: antialiased; }
html.jp-ui .card { border-radius: var(--jp-r-l); }
html.jp-ui .breadthumb { font-size: var(--jp-fs-s); color: var(--jp-muted); }
html.jp-ui .jp-toolbar { top: var(--jp-header-h) !important; }
html.jp-ui ::selection { background: rgba(124, 58, 237, .18); }

/* ---------- 页头 ---------- */
.jp-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9999; height: var(--jp-header-h);
    background: color-mix(in srgb, var(--jp-card) 86%, transparent);
    backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--jp-line);
}
.jp-header-in { max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 18px; box-sizing: border-box; }
.jp-logo { flex: none; display: flex; align-items: center; gap: 9px; color: var(--jp-title) !important; text-decoration: none; font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.jp-logo img { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; }
.jp-nav { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.jp-nav > li { position: relative; }
.jp-nav-link {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px; border-radius: 10px;
    color: var(--jp-text) !important; font-size: var(--jp-fs-m); font-weight: 500; text-decoration: none; white-space: nowrap;
    background: none; border: 0; cursor: pointer; transition: background .15s, color .15s;
}
.jp-nav-link svg { flex: none; opacity: .75; }
.jp-nav-link:hover { background: var(--jp-brand-soft); color: var(--jp-brand) !important; }
.jp-nav-link.is-active { color: var(--jp-brand) !important; background: var(--jp-brand-soft); font-weight: 650; }
.jp-nav-link.is-active svg { opacity: 1; }
.jp-caret { opacity: .55; transition: transform .2s; }
.jp-nav > li:hover .jp-caret, .jp-nav > li:focus-within .jp-caret { transform: rotate(180deg); }
.jp-drop {
    position: absolute; top: 100%; left: 0; min-width: 190px; padding: 6px; margin: 6px 0 0; list-style: none;
    background: var(--jp-card); border: 1px solid var(--jp-line); border-radius: var(--jp-r-m); box-shadow: var(--jp-shadow-l);
    opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all .16s;
}
.jp-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.jp-nav > li:hover .jp-drop, .jp-nav > li:focus-within .jp-drop { opacity: 1; visibility: visible; transform: none; }
.jp-drop a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--jp-text) !important; font-size: var(--jp-fs-m); text-decoration: none; }
.jp-drop a:hover { background: var(--jp-brand-soft); color: var(--jp-brand) !important; }
.jp-drop a svg { opacity: .7; }
.jp-header-tools { flex: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.jp-search-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; width: 220px; padding: 0 10px 0 12px; border-radius: 10px;
    border: 1px solid var(--jp-line); background: var(--jp-bg); color: var(--jp-muted); font-size: var(--jp-fs-s); cursor: pointer; text-align: left;
}
.jp-search-btn span { flex: 1; }
.jp-search-btn kbd { font: 11px/1 ui-monospace, monospace; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--jp-line); color: var(--jp-muted); background: var(--jp-card); }
.jp-search-btn:hover { border-color: rgba(124, 58, 237, .45); }
.jp-icon-btn2 {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; padding: 0;
    background: transparent; color: var(--jp-text); cursor: pointer;
}
.jp-icon-btn2:hover { background: var(--jp-brand-soft); color: var(--jp-brand); }
.jp-user { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; font-size: var(--jp-fs-s); font-weight: 600; color: #fff !important; background: var(--jp-grad); text-decoration: none; }
.jp-user.is-in { background: var(--jp-brand-soft); color: var(--jp-brand) !important; }
.jp-only-m { display: none !important; }

/* 手机抽屉 */
.jp-drawer { position: fixed; inset: 0; z-index: 10001; visibility: hidden; }
.jp-drawer.is-open { visibility: visible; }
.jp-drawer-mask { position: absolute; inset: 0; background: rgba(6, 4, 14, .45); opacity: 0; transition: opacity .2s; }
.jp-drawer.is-open .jp-drawer-mask { opacity: 1; }
.jp-drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
    background: var(--jp-card); box-shadow: var(--jp-shadow-l); transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
    display: flex; flex-direction: column; gap: 4px; overflow-y: auto; box-sizing: border-box;
}
.jp-drawer.is-open .jp-drawer-panel { transform: none; }
.jp-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jp-drawer a.jp-dlink { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; color: var(--jp-title) !important; font-size: 15px; text-decoration: none; }
.jp-drawer a.jp-dlink.is-active, .jp-drawer a.jp-dlink:hover { background: var(--jp-brand-soft); color: var(--jp-brand) !important; }
.jp-drawer a.jp-dsub { padding: 9px 12px 9px 42px; font-size: 14px; color: var(--jp-text) !important; }
.jp-drawer .jp-user { justify-content: center; margin-top: auto; height: 44px; font-size: 15px; }

/* 手机底部 Tab 栏 */
.jp-tabbar {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9998; height: calc(var(--jp-tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--jp-card) 92%, transparent);
    backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--jp-line);
}
.jp-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--jp-muted) !important; font-size: 11px; text-decoration: none; }
.jp-tabbar a.is-active { color: var(--jp-brand) !important; font-weight: 650; }

/* ---------- 页脚 ---------- */
html.jp-ui .copyright, html.jp-ui body > footer:not(.jp-footer) { display: none !important; }
.jp-footer { margin-top: 48px; border-top: 1px solid var(--jp-line); background: var(--jp-card); color: var(--jp-text); }
.jp-footer-in { max-width: 1280px; margin: 0 auto; padding: 36px 20px 22px; box-sizing: border-box; }
.jp-footer-top { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 28px; }
.jp-footer-brand p { margin: 12px 0 14px; font-size: var(--jp-fs-s); line-height: 1.8; color: var(--jp-muted); max-width: 360px; }
.jp-footer-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.jp-footer-tags a { padding: 3px 10px; border-radius: 99px; font-size: 12px; color: var(--jp-muted) !important; border: 1px solid var(--jp-line); text-decoration: none; }
.jp-footer-tags a:hover { color: var(--jp-brand) !important; border-color: rgba(124, 58, 237, .4); }
.jp-footer h4 { margin: 4px 0 12px; font-size: var(--jp-fs-m); font-weight: 700; color: var(--jp-title); }
.jp-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.jp-footer ul a { font-size: var(--jp-fs-s); color: var(--jp-muted) !important; text-decoration: none; }
.jp-footer ul a:hover { color: var(--jp-brand) !important; }
.jp-footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--jp-line); font-size: 12px; color: var(--jp-muted); }
.jp-footer-bottom a { color: var(--jp-muted) !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
    .jp-search-btn { width: 38px; padding: 0; justify-content: center; }
    .jp-search-btn span, .jp-search-btn kbd { display: none; }
}
@media (max-width: 980px) {
    .jp-nav { display: none; }
    .jp-only-m { display: inline-grid !important; }
    .jp-header-tools .jp-user { display: none; }
    .jp-header-in { padding: 0 12px; gap: 10px; }
}
@media (max-width: 768px) {
    .jp-tabbar { display: flex; }
    html.jp-ui body { padding-bottom: calc(var(--jp-tabbar-h) + env(safe-area-inset-bottom)); }
    html.jp-ui .site-tools { bottom: calc(var(--jp-tabbar-h) + 14px + env(safe-area-inset-bottom)) !important; }
    .jp-footer-top { grid-template-columns: 1fr 1fr; }
    .jp-footer-brand { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .jp-drawer-panel, .jp-drop, .jp-caret { transition: none; }
}

/* ---------- 文章页（第 4 阶段） ---------- */
.jp-progress { position: fixed; top: var(--jp-header-h); left: 0; right: 0; height: 3px; z-index: 9998; pointer-events: none; }
.jp-progress span { display: block; height: 100%; background: var(--jp-grad); transform-origin: 0 50%; transform: scaleX(0); }
.jp-art-wrap { max-width: 1180px; margin: 0 auto; padding: 8px 20px 20px; box-sizing: border-box; }
.jp-art-crumb { margin: 10px 0 14px; display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--jp-fs-s); color: var(--jp-muted); }
.jp-art-crumb a { color: var(--jp-muted) !important; text-decoration: none; }
.jp-art-crumb a:hover { color: var(--jp-brand) !important; }
.jp-art-crumb span { opacity: .5; }
.jp-art-crumb em { font-style: normal; color: var(--jp-title); }
.jp-art-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; align-items: start; }
.jp-art { min-width: 0; padding: 34px 40px 30px; background: var(--jp-card); border: 1px solid var(--jp-line); border-radius: var(--jp-r-xl); box-sizing: border-box; }
.jp-art-cat { display: inline-block; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 700; color: var(--jp-brand) !important; background: var(--jp-brand-soft); text-decoration: none; }
.jp-art-title { margin: 14px 0 14px; font-size: clamp(24px, 3vw, 32px); line-height: 1.35; font-weight: 800; color: var(--jp-title); letter-spacing: -.01em; }
.jp-art-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: var(--jp-fs-s); color: var(--jp-muted); padding-bottom: 18px; border-bottom: 1px solid var(--jp-line); }
.jp-art-meta a { color: var(--jp-muted) !important; text-decoration: none; }
.jp-art-author { display: inline-flex; align-items: center; gap: 7px; color: var(--jp-title) !important; font-weight: 600; }
.jp-art-author img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.jp-art-edit:empty { display: none; }
.jp-art-excerpt { margin: 18px 0 0; padding: 14px 16px; border-radius: var(--jp-r-m); background: var(--jp-bg); border-left: 3px solid var(--jp-brand); font-size: 14.5px; line-height: 1.8; color: var(--jp-text); }

/* 正文排版 */
.jp-art-body { margin-top: 22px; font-size: 16.5px; line-height: 1.9; color: var(--jp-text); word-break: break-word; }
.jp-art-body > *:first-child { margin-top: 0; }
.jp-art-body p { margin: 0 0 1.1em; }
.jp-art-body h2, .jp-art-body h3 { scroll-margin-top: 80px; color: var(--jp-title); line-height: 1.45; }
.jp-art-body h2 { margin: 2em 0 .8em; font-size: 1.45em; padding-left: 12px; border-left: 4px solid #a855f7; }
.jp-art-body h3 { margin: 1.6em 0 .6em; font-size: 1.18em; }
.jp-art-body a { color: var(--jp-brand) !important; text-decoration: underline; text-decoration-color: rgba(124, 58, 237, .35); text-underline-offset: 3px; }
.jp-art-body img { max-width: 100%; height: auto; border-radius: var(--jp-r-m); cursor: zoom-in; }
.jp-art-body blockquote { margin: 1.2em 0; padding: 12px 16px; border-radius: var(--jp-r-m); background: var(--jp-bg); border-left: 3px solid var(--jp-brand); color: var(--jp-text); }
.jp-art-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14.5px; display: block; overflow-x: auto; }
.jp-art-body th, .jp-art-body td { padding: 9px 12px; border: 1px solid var(--jp-line); text-align: left; }
.jp-art-body th { background: var(--jp-bg); font-weight: 700; }
.jp-art-body ul, .jp-art-body ol { padding-left: 1.4em; }
.jp-art-body li { margin: .3em 0; }
.jp-art-body :not(pre) > code { padding: 2px 6px; border-radius: 6px; background: var(--jp-brand-soft); color: var(--jp-brand); font-size: .9em; }
.jp-art-body pre { position: relative; border-radius: var(--jp-r-m) !important; }
.jp-code-copy { position: absolute; top: 8px; right: 10px; z-index: 2; height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .1); color: #ddd; font-size: 12px; cursor: pointer; opacity: .75; transition: opacity .15s; }
.jp-art-body pre:hover .jp-code-copy, .jp-code-copy:focus-visible { opacity: 1; }

/* 文末 */
.jp-art-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; }
.jp-art-tags a { padding: 5px 12px; border-radius: 99px; font-size: 13px; color: var(--jp-text) !important; background: var(--jp-bg); border: 1px solid var(--jp-line); text-decoration: none; }
.jp-art-tags a:hover { color: var(--jp-brand) !important; border-color: rgba(124, 58, 237, .4); }
.jp-art-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 28px 0 8px; }
.jp-art-like, .jp-art-share {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 99px; cursor: pointer;
    border: 1px solid var(--jp-line); background: var(--jp-card); color: var(--jp-title) !important; font-size: 14px; font-weight: 600; text-decoration: none;
}
.jp-art-like { color: #e11d48 !important; border-color: rgba(244, 63, 94, .35); background: rgba(244, 63, 94, .06); }
.jp-art-like:hover, .jp-art-share:hover { border-color: rgba(124, 58, 237, .45); }
.jp-art-copyright { margin: 22px 0 0; padding: 12px 16px; border-radius: var(--jp-r-m); background: var(--jp-bg); font-size: 13px; color: var(--jp-muted); line-height: 1.8; }
.jp-art-copyright p { margin: 0; }
.jp-art-copyright a { color: var(--jp-muted) !important; word-break: break-all; }
.jp-art-author-card { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; padding: 16px; border-radius: var(--jp-r-l); border: 1px solid var(--jp-line); }
.jp-art-author-card img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; }
.jp-art-author-card a { font-weight: 700; color: var(--jp-title) !important; text-decoration: none; }
.jp-art-author-card p { margin: 4px 0 0; font-size: 13px; color: var(--jp-muted); }
.jp-art-neighbor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.jp-art-neighbor a { display: block; padding: 12px 14px; border-radius: var(--jp-r-m); background: var(--jp-bg); color: var(--jp-title) !important; font-size: 14px; line-height: 1.5; text-decoration: none; }
.jp-art-neighbor a:hover { box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .4); }
.jp-art-neighbor a.r { text-align: right; grid-column: 2; }
.jp-art-neighbor small { display: block; color: var(--jp-muted); font-size: 12px; margin-bottom: 3px; }

/* 侧栏 */
.jp-art-side { position: sticky; top: calc(var(--jp-header-h) + 18px); display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - var(--jp-header-h) - 36px); overflow-y: auto; scrollbar-width: thin; }
.jp-toc, .jp-side-hot { padding: 16px; border-radius: var(--jp-r-l); background: var(--jp-card); border: 1px solid var(--jp-line); }
.jp-side-h { font-size: 13px; font-weight: 800; color: var(--jp-title); margin-bottom: 10px; letter-spacing: .04em; }
.jp-toc ol, .jp-toc-inline ol { list-style: none; margin: 0; padding: 0; }
.jp-toc li a { display: block; padding: 5px 10px; border-left: 2px solid var(--jp-line); font-size: 13px; line-height: 1.5; color: var(--jp-muted) !important; text-decoration: none; }
.jp-toc li.lv3 a { padding-left: 22px; font-size: 12.5px; }
.jp-toc li a:hover { color: var(--jp-title) !important; }
.jp-toc li a.is-active { color: var(--jp-brand) !important; border-left-color: var(--jp-brand); font-weight: 650; background: var(--jp-brand-soft); }
.jp-side-hot a { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; line-height: 1.5; color: var(--jp-text) !important; text-decoration: none; }
.jp-side-hot a b { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--jp-grad); }
.jp-side-hot a span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jp-side-hot a:hover span { color: var(--jp-brand); }
.jp-toc-inline { display: none; margin: 18px 0 0; border-radius: var(--jp-r-m); background: var(--jp-bg); }
.jp-toc-inline summary { padding: 11px 14px; font-weight: 700; cursor: pointer; color: var(--jp-title); }
.jp-toc-inline ol { padding: 0 14px 12px; }
.jp-toc-inline li a { display: block; padding: 5px 0; color: var(--jp-text) !important; font-size: 14px; text-decoration: none; }
.jp-toc-inline li.lv3 a { padding-left: 14px; font-size: 13px; }

/* 相关阅读 + 评论 */
.jp-art-related { margin-top: 28px; }
.jp-art-related h2 { font-size: 18px; margin: 0 0 14px; color: var(--jp-title); }
.jp-rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.jp-rel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--jp-r-l); background: var(--jp-card); border: 1px solid var(--jp-line); text-decoration: none; transition: transform .2s, box-shadow .2s; }
.jp-rel:hover { transform: translateY(-2px); box-shadow: var(--jp-shadow-m); }
.jp-rel img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--jp-r-m); background: var(--jp-line); }
.jp-rel-t { font-size: 14px; font-weight: 700; line-height: 1.5; color: var(--jp-title); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jp-rel-m { font-size: 12px; color: var(--jp-muted); }
.jp-art-comments { margin-top: 28px; border-radius: var(--jp-r-xl) !important; }
.jp-toast2 { position: fixed; left: 50%; bottom: 90px; z-index: 10100; transform: translate(-50%, 16px); padding: 10px 18px; border-radius: 12px; background: #111; color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: all .22s; }
.jp-toast2.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
    .jp-art-grid { grid-template-columns: minmax(0, 1fr); }
    .jp-art-side { display: none; }
    .jp-toc-inline { display: block; }
}
@media (max-width: 640px) {
    .jp-art-wrap { padding: 4px 10px 12px; }
    .jp-art { padding: 20px 16px 18px; border-radius: var(--jp-r-l); }
    .jp-art-body { font-size: 16px; line-height: 1.85; }
    .jp-rel-grid { grid-template-columns: 1fr; }
    .jp-rel { flex-direction: row; align-items: center; }
    .jp-rel img { width: 110px; flex: none; aspect-ratio: 4 / 3; }
    .jp-art-neighbor { grid-template-columns: 1fr; }
    .jp-art-neighbor a.r { grid-column: auto; text-align: left; }
}

/* 工具箱文章：沿用主题链接头部，统一按钮样式 */
.jp-art-linkhead .link-info { padding: 0 0 22px !important; }
.jp-art-linkhead .visit-btn .btn-primary { background: var(--jp-grad) !important; border: 0 !important; border-radius: 99px !important; padding: 10px 22px !important; box-shadow: 0 10px 24px -12px rgba(192, 38, 211, .8); }
.jp-art-linkhead .visit-btn .btn-primary:hover { filter: brightness(1.08); }
