/* ====================================================================
   共享样式 · 公开阅读端 + 管理后台都引用
   ==================================================================== */
:root {
    --primary: #0052cc;
    --primary-light: #4c9aff;
    --primary-dark: #003d99;
    --success: #00c853;
    --danger: #dc2626;
    --warning: #ff6d00;
    --info: #0052cc;
    --text-main: #1e293b;
    --text-muted: #5b6e8c;
    --bg-soft: #f0f7ff;
    --border: rgba(0, 82, 204, 0.15);
    --shadow-card: 0 4px 16px rgba(0, 82, 204, 0.08);
    --shadow-hover: 0 10px 30px rgba(0, 82, 204, 0.18);
    --radius: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 顶部导航条 — 复用首页风格但略紧凑 */
.navbar {
    background: linear-gradient(135deg, #0a2540 0%, #0052cc 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(10, 37, 64, 0.15);
}
.nav-container {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 14px; padding-bottom: 14px; gap: 16px; flex-wrap: wrap;
}
.logo h1 {
    margin: 0; font-size: 1.1rem; font-weight: 600;
    color: white; line-height: 1.2;
}
.contact-header {
    display: flex; gap: 10px; align-items: center; flex-wrap: nowrap;
}
.contact-item {
    font-size: clamp(0.65rem, 2.6vw, 0.85rem);
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.contact-item i { color: #4c9aff; }
.contact-item strong { color: #ffd54f; }
.contact-divider { width: 1px; height: 14px; background: rgba(255,255,255,0.3); }

.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); margin: 24px 0 12px; font-size: 0.9rem;
}
.back-link:hover { color: var(--primary); text-decoration: none; }

.hero {
    text-align: center;
    background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}
.hero-icon {
    width: 38px; height: 38px; margin: 0 auto 6px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.2);
}
.hero h1 { margin: 0 0 4px; font-size: 1.15rem; color: var(--text-main); }
.hero-subtitle { margin: 0; color: var(--text-muted); font-size: 0.8rem; }
.hero-title-row {
    display: flex; align-items: center; justify-content: center; gap: 12px;
}
.hero-share-btn {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: var(--primary); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 82, 204, 0.2);
    transition: transform .15s, box-shadow .15s;
    font-size: 0.8rem;
}
.hero-share-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(0, 82, 204, 0.3); }

/* ✅ 列表顶部筛选 / 排序工具栏 */
.kb-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 0 18px;
    flex-wrap: wrap;
}
.kb-categories {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    flex: 1 1 auto; min-width: 0;
}
.kb-cat-chip {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-main);
    transition: all .15s ease;
    font-family: inherit;
    white-space: nowrap;
}
.kb-cat-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}
.kb-cat-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.22);
}
.kb-sort {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.kb-sort select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.85rem;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
}
.kb-sort select:focus { outline: none; border-color: var(--primary); }
@media (max-width: 720px) {
    .kb-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .kb-sort { justify-content: flex-end; }
}

/* 搜索框 */
.search-box {
    position: relative;
    background: white;
    border: 2px solid var(--border);
    border-radius: 30px;
    padding: 8px 16px;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
    transition: all .2s;
}
.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 82, 204, 0.08);
}
.search-box > i.fa-search { color: var(--primary); }
.search-box input {
    flex: 1; border: 0; outline: 0;
    font-size: 0.95rem; background: transparent; color: var(--text-main);
}
.search-box input::placeholder { color: #94a3b8; }
.search-clear {
    background: transparent; border: 0; color: #94a3b8;
    cursor: pointer; padding: 4px; border-radius: 50%; font-size: 0.9rem;
}
.search-clear:hover { color: var(--danger); background: rgba(220, 38, 38, 0.08); }

.article-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; }

/* 文章卡片 */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    /* ✅ 防搜索/筛选时页面跳动：保持最小高度与典型内容一致 */
    min-height: 300px;
}
.article-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: all .25s ease;
    display: flex; flex-direction: column;
}
.article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}
.article-cover {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #f0f7ff, #e8edf5);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 48px;
    border-bottom: 1px solid var(--border);
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-body {
    padding: 18px 18px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px;
}
.article-title {
    margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--text-main);
    line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-summary {
    margin: 0; color: var(--text-muted); font-size: 0.85rem; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-tags {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.article-tag {
    background: var(--bg-soft); color: var(--primary);
    padding: 2px 10px; font-size: 0.75rem; border-radius: 12px;
    border: 1px solid var(--border);
}
.article-footer {
    display: flex; align-items: center;
    margin-top: auto; padding-top: 12px;
    border-top: 1px dashed var(--border);
    color: var(--text-muted); font-size: 0.78rem;
}
.article-footer .article-meta-info {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.article-footer .article-meta-info span {
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 3px;
}

/* ✅ 桌面端文章列表更紧凑：顶部 hero 已缩小，卡片加宽以完整显示内容 */
@media (min-width: 721px) {
    .article-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 18px;
        margin-bottom: 24px;
    }
    .article-card { border-radius: 12px; }
    .article-cover {
        aspect-ratio: auto;
        height: 124px;
        font-size: 34px;
    }
    .article-body {
        padding: 14px;
        gap: 7px;
    }
    .article-title {
        font-size: 1rem;
        line-height: 1.45;
    }
    .article-summary {
        font-size: 0.82rem;
        line-height: 1.45;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .article-tags {
        gap: 4px;
        margin-top: 4px;
    }
    .article-tag {
        font-size: 0.68rem;
        padding: 1px 6px;
    }
    .article-footer {
        padding-top: 8px;
        font-size: 0.72rem;
    }
    .article-footer .article-meta-info {
        flex-wrap: nowrap;
        gap: 8px;
    }
}

.empty-state, .loading-spinner {
    grid-column: 1 / -1;
    text-align: center; padding: 40px 20px;
    color: var(--text-muted); font-size: 0.95rem;
}
.empty-state i { font-size: 3rem; color: var(--primary-light); opacity: 0.5; display: block; margin-bottom: 12px; }


/* 分页 */
.pagination {
    display: flex; justify-content: center; gap: 6px; padding: 16px 0 32px;
    flex-wrap: wrap;
}
.pagination button {
    min-width: 36px; height: 36px;
    border: 1px solid var(--border); border-radius: 8px;
    background: white; color: var(--text-main);
    cursor: pointer; font-size: 0.85rem;
    transition: all .15s;
}
.pagination button:hover:not(:disabled) {
    border-color: var(--primary); color: var(--primary);
}
.pagination button.active {
    background: var(--primary); color: white; border-color: var(--primary);
}
.pagination button:disabled { opacity: 0.45; cursor: not-allowed; }

/* 文章详情弹窗 */
.article-modal { position: fixed; inset: 0; z-index: 9999; }
.article-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(10, 37, 64, 0.55);
    backdrop-filter: blur(4px);
    animation: fade-in .2s ease;
}
.article-modal-content {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(960px, 92vw); max-height: 88vh;
    overflow-y: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    padding: 36px;
    animation: pop-in .25s ease;
}
.article-modal-close {
    position: absolute; top: 16px; right: 16px;
    background: transparent; border: 0;
    cursor: pointer; font-size: 1.1rem; color: var(--text-muted);
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.article-modal-close:hover { background: var(--bg-soft); color: var(--primary); }
.article-modal[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.95); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.article-detail h1.article-detail-title {
    margin: 0 0 8px; font-size: 1.6rem; line-height: 1.4; color: var(--text-main);
}
.article-detail-meta {
    color: var(--text-muted); font-size: 0.85rem;
    display: flex; gap: 16px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.article-detail-meta i { margin-right: 4px; color: var(--primary); }

.article-html {
    font-size: 1rem; line-height: 1.8; color: var(--text-main);
}
.article-html h1, .article-html h2, .article-html h3, .article-html h4 {
    margin: 24px 0 12px; line-height: 1.4;
    font-weight: 600;
}
.article-html h1 { font-size: 1.5rem; }
.article-html h2 { font-size: 1.3rem; border-left: 4px solid var(--primary); padding-left: 12px; }
.article-html h3 { font-size: 1.15rem; color: var(--primary-dark); }
.article-html p { margin: 0 0 14px; }
/* ✅ 文章详情页图片：铺满整个阅读区域宽度，与文字左对齐，不居中。
   配合 srcset 多档缩略图保证清晰度，大图自然缩放到容器宽度。 */
.article-html img {
    /* ✅ 桌面端：按原图自然宽度显示，不做响应式拉伸放大。
       小图（窄于栏宽）保持原尺寸、不会被拉到栏宽变糊；大图由 max-width:100% 等比收到栏宽，
       仍是清晰的下采样。原图清晰度由服务端 format=original 保证。
       移动端的响应式铺满见下方 @media(max-width:768px)。 */
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    box-shadow: var(--shadow-card);
    display: block;
    /* ✅ 性能：加载前浅灰占位，避免白一下再弹出的布局跳动(CLS) */
    background: #eef2f7;
    /* ✅ 桌面端不启用点击放大灯箱（仅移动端可点图看原图），故用默认光标不误导；
       移动端的 zoom-in 光标在 @media(max-width:768px) 中单独设置 */
    cursor: default;
    touch-action: manipulation;
}
/* ✅ 移动端：保留响应式放大（铺满屏宽），与桌面端「自然宽、不拉伸」区分 */
@media (max-width: 768px) {
    .article-html img { width: 100%; }
}
/* ✅ 加载中骨架：图片未就绪时显示 shimmer，加载完成由 JS 移除 .kb-img-loading。
   配合 img 的 width/height 属性（浏览器据此推导 aspect-ratio）在加载前就有正确高度，
   因此骨架可见、加载完成后不跳动（零 CLS）。不替换 src，所以全程无闪烁。 */
.kb-img-loading {
    background: linear-gradient(90deg, #f5f5f5 25%, #ececec 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: kb-shimmer 1.5s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .kb-img-loading { animation: none; }
}
/* 旧版渐进式 wrapper（历史文章缓存可能仍带此结构），保留以兼容，不影响新版 */
.kb-progressive-wrap {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(90deg, #f5f5f5 25%, #ececec 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: kb-shimmer 1.5s ease-in-out infinite;
}
@keyframes kb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.article-html img.kb-progressive {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
}
@media (max-width: 768px) {
    .article-html img.kb-progressive { width: 100%; }
}
/* ✅ 编辑器里显式设为「居中」的图片 */
.article-html img.kb-img-center {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}
.article-html img.kb-img-center.kb-progressive {
    width: 100%;
    max-width: 100%;
}
.article-html blockquote {
    margin: 16px 0; padding: 12px 18px;
    background: var(--bg-soft);
    border-left: 4px solid var(--primary);
    color: var(--text-muted); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-html pre, .article-html code {
    background: #1e293b; color: #f1f5f9;
    border-radius: 6px; padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
}
.article-html pre { padding: 14px 18px; overflow-x: auto; }
.article-html pre code { padding: 0; background: transparent; }
.article-html ul, .article-html ol { margin: 12px 0 14px; padding-left: 28px; }
.article-html li { margin-bottom: 4px; }
.article-html a { color: var(--primary); text-decoration: underline; }
.article-html table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.article-html th, .article-html td {
    border: 1px solid var(--border); padding: 8px 12px;
    text-align: left; font-size: 0.9rem;
}
.article-html th { background: var(--bg-soft); color: var(--primary-dark); font-weight: 600; }
.article-html iframe { max-width: 100%; border-radius: var(--radius-sm); }
.article-html video,
.article-html audio {
    max-width: min(100%, 720px);
    height: auto;
    border-radius: var(--radius-sm);
    margin: 8px auto;
    box-shadow: var(--shadow-card);
    display: block;
}
.article-html video { max-height: 540px; }

/* footer */
footer {
    background: #0a2540; color: rgba(255,255,255,0.8);
    margin-top: 40px; padding: 32px 0 20px;
}
.footer-bottom p {
    margin: 0; text-align: center; font-size: 0.85rem;
}
.admin-entry {
    color: rgba(255,255,255,0.7); font-size: 0.85rem; text-decoration: none;
}
.admin-entry:hover { color: #ffd54f; }

/* 通用按钮 */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 0.9rem; font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer; transition: all .15s;
    background: white; color: var(--text-main);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: white; text-decoration: none; }
.btn-secondary { background: white; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }

/* 卡片作为链接 */
.article-card { text-decoration: none; color: inherit; }
.article-card:hover { text-decoration: none; }

/* 详情页（独立页面） */
.article-detail-page {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 36px 40px;
    margin-bottom: 32px;
}
.article-detail h1.article-detail-title { margin-top: 0; }
.article-detail-summary {
    color: var(--text-muted); font-size: 1rem; line-height: 1.7;
    background: var(--bg-soft); border-radius: var(--radius-sm);
    padding: 14px 18px; margin: 0 0 20px;
}
.detail-stat { display: inline-flex; align-items: center; gap: 5px; }
.article-detail-actions {
    margin-top: 28px; padding-top: 20px;
    border-top: 1px dashed var(--border);
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.share-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary); color: white; border: 0;
    padding: 10px 22px; border-radius: 24px;
    font-size: 0.95rem; cursor: pointer; transition: all .15s;
}
.share-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.share-hint { color: var(--success); font-size: 0.85rem; }

/* ====================================================================
   ✅ 多平台分享（详情页元信息区）
   - meta 行内的「阅读 N / 分享 N」统一使用 .detail-stat 纯标签样式
   - 单独增加一个动作按钮「分享文章」(.detail-share-action)，点击弹出多平台分享菜单
   ==================================================================== */

/* 防止全局 .article-detail-meta span 把 .detail-stat-num 的强调色一并淡化 */
.article-detail-meta .detail-stat .detail-stat-num {
    color: var(--primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
}
.article-detail-meta .detail-stat i { color: var(--primary); }

/* 独立"分享文章"动作按钮：朴素主色边框、圆角矩形、非胶囊 */
.detail-share-action {
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(0, 82, 204, 0.35);
    padding: 3px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all .15s ease;
    position: relative; /* 让 .share-popover(absolute) 相对此按钮定位 */
    font-family: inherit;
    font-weight: 500;
    line-height: 1.5;
}
.detail-share-action:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-1px);
}
.detail-share-action i { color: inherit; }

.share-popover {
    position: absolute;
    margin-top: 8px;
    z-index: 200;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 82, 204, 0.10);
    padding: 14px;
    min-width: 320px;
    animation: share-pop-in .18s ease;
}
/* ✅ 默认隐藏：点击分享按钮才显示，避免打开详情页自动弹出分享面板 */
.share-popover[hidden] { display: none !important; }

/* ✅ 同样兜底 .share-wechat：display:flex 会覆盖 HTML hidden 属性的默认 display:none */
.share-wechat[hidden] { display: none !important; }
@keyframes share-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.share-popover-arrow {
    position: absolute; top: -7px; left: 22px;
    width: 14px; height: 14px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid rgba(0, 82, 204, 0.10);
    border-left: 1px solid rgba(0, 82, 204, 0.10);
    border-radius: 2px;
}

.share-popover-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.share-opt {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 14px 8px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
    font-size: 0.85rem;
}
.share-opt i {
    font-size: 1.6rem;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-soft);
    color: var(--primary);
    border-radius: 12px;
    transition: all .15s;
}
.share-opt:hover { background: var(--bg-soft); text-decoration: none; transform: translateY(-2px); }
.share-opt:hover i { background: var(--primary); color: white; box-shadow: 0 6px 16px rgba(0, 82, 204, 0.25); }
.share-opt[disabled] { opacity: 0.4; cursor: not-allowed; }
.share-opt[disabled]:hover { background: transparent; transform: none; }
.share-opt[disabled]:hover i { background: var(--bg-soft); color: var(--primary); box-shadow: none; }

/* 微信分享小浮层（让用户复制链接发到微信） */
.share-wechat {
    position: fixed; inset: 0; z-index: 250;
    background: rgba(10, 37, 64, 0.45);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    animation: share-pop-in .2s ease;
}
.share-wechat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    padding: 24px;
    width: min(440px, 92vw);
}
.share-wechat-title {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 12px;
    font-weight: 500;
}
.share-wechat-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    color: var(--text-main);
    background: var(--bg-soft);
    margin-bottom: 14px;
    user-select: all;
    font-family: 'Consolas', 'Monaco', monospace;
}
.share-wechant-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btn.copy { background: var(--primary); color: white; }
.share-btn.copy:hover { background: var(--primary-dark); }
.share-btn.ghost { background: white; color: var(--text-muted); border: 1px solid var(--border); }
.share-btn.ghost:hover { background: var(--bg-soft); color: var(--text-main); }

/* 分享动作完成的轻提示（与 share-sheet.css 保持一致：浅色胶囊，无黑底） */
/* ✅ 位置改到页面顶部导航下方，红箭头所指区域，更醒目 */
.share-toast {
    position: fixed;
    left: 50%;
    top: 80px;
    bottom: auto;
    transform: translateX(-50%) translateY(-10px) scale(0.96);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 86vw;
    padding: 11px 18px;
    background: rgba(255, 255, 255, 0.97);
    color: #1f2937;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
    white-space: nowrap;
}

.share-toast .toast-ico {
    color: #16a34a;
    font-size: 15px;
    display: inline-flex;
}

.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

@media (max-width: 720px) {
    .share-toast { top: 64px; }
    .share-popover { min-width: 280px; }
    .share-popover-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .share-opt i { font-size: 1.4rem; width: 40px; height: 40px; }
}

/* 响应式 */
@media (max-width: 720px) {
    .hero h1 { font-size: 1.3rem; }
    .article-modal-content { width: 96vw; max-height: 92vh; padding: 24px 18px; }
    .article-detail h1.article-detail-title { font-size: 1.3rem; }
    .article-detail-page { padding: 22px 18px; }
    .article-footer .article-meta-info { gap: 8px; font-size: 0.72rem; }
}

/* ====================================================================
   ✅ 移动端阅读模式适配（文章列表 + 文章详情）
   - 列表：卡片单列、封面占满、meta/footer 换行更易读
   - 详情：正文加大字号/行高、图片自适应、分享按钮缩窄、meta 自动换行
   ==================================================================== */
@media (max-width: 720px) {
    /* —— 列表页 —— */
    /* ✅ 小屏也显示一行两列，减少翻屏长度 */
    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .article-card {
        border-radius: 10px;
    }
    .article-cover {
        height: 96px;
    }
    .article-body {
        padding: 10px;
    }
    .article-title {
        font-size: 0.85rem;
        line-height: 1.35;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
    .article-summary {
        font-size: 0.72rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
    .article-tags {
        gap: 4px;
        margin-top: 4px;
    }
    .article-tag {
        font-size: 0.62rem;
        padding: 1px 5px;
    }
    .article-footer {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding-top: 6px;
        font-size: 0.65rem;
    }
    .article-meta-info {
        flex-wrap: nowrap;
        gap: 6px !important;
        font-size: 0.65rem;
    }
    .article-meta-info span { white-space: nowrap; }
    .article-footer > span:last-child {
        margin-left: auto;
    }

    /* 顶部联系方式保持一行、自动缩小字号 */
    .nav-container { gap: 8px; }
    .contact-header { gap: 6px; }
    .contact-item { gap: 3px; }
    .contact-divider { height: 11px; }

    /* —— 详情页 —— */
    .article-detail {
        padding-top: 4px;
    }
    .article-detail-title {
        font-size: 1.45rem !important;
        line-height: 1.35;
        margin-bottom: 12px;
    }
    .article-detail-meta {
        flex-wrap: wrap;
        gap: 8px 14px;
        font-size: 0.78rem;
        padding-bottom: 12px;
        row-gap: 10px;
    }
    .article-detail-summary {
        font-size: 0.9rem;
        padding: 10px 12px;
        margin: 12px 0 18px;
    }
    /* 阅读模式核心：正文舒适字号 + 行高，图片/代码块自适应 */
    .article-html {
        font-size: 1.02rem;
        line-height: 1.85;
    }
    .article-html p,
    .article-html li {
        font-size: 1.02rem;
        line-height: 1.85;
    }
    .article-html img,
    .article-html video,
    .article-html audio {
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        margin: 14px 0;
        border-radius: 8px;
        /* ✅ 仅移动端显示「可放大」光标（桌面端不启用点击放大灯箱） */
        cursor: zoom-in;
    }
    .article-html pre,
    .article-html table {
        width: 100% !important;
        overflow-x: auto;
        display: block;
        font-size: 0.85rem;
    }
    .article-html h2 { font-size: 1.2rem; margin: 22px 0 10px; }
    .article-html h3 { font-size: 1.08rem; margin: 18px 0 8px; }
    .article-html blockquote {
        margin: 14px 0;
        padding: 10px 14px;
    }
    .share-popover {
        position: fixed;
        left: 12px !important;
        right: 12px;
        top: auto !important;
        bottom: 16px;
        margin-top: 0 !important;
        min-width: 0;
        width: auto;
    }
    .share-popover-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .share-wechat {
        position: fixed;
        left: 12px; right: 12px; bottom: 16px;
        top: auto;
    }
    .share-wechat-card {
        width: 100%;
    }

}

/* ====================================================================
   ✅ 文章详情页 meta 行互动按钮：点赞 / 收藏 / 分享（图标+计数）
   放在标题下方 meta 行内，与其他 meta 信息并列，不浮动。
   ==================================================================== */
.article-meta-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding-left: 8px;
}

.meta-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    font-family: inherit;
    border-radius: 999px;
}

.meta-action-btn:hover {
    background: var(--bg-soft);
}

.meta-action-btn:active { transform: scale(0.96); }
.meta-action-btn i { font-size: 0.95rem; transition: color 0.15s ease; }

/* 阅读数仅展示，不可点击，但仍保持与操作按钮一致的视觉 */
.meta-action-btn.view-btn {
    cursor: default;
    pointer-events: none;
}

.meta-action-btn.liked { color: #ef4444; }
.meta-action-btn.share-btn { color: var(--primary); }
/* 分享箭头 SVG 图标：与截图中箭头模式一致，尺寸跟随按钮字号 */
.kb-share-arrow {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
    transition: color 0.15s ease, transform 0.15s ease;
}
.meta-action-btn.share-btn:hover .kb-share-arrow { transform: translateX(1px); }

.meta-action-count {
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .article-detail-meta {
        /* 允许 meta 行内操作按钮自然换行 */
        align-items: center;
    }
    .article-meta-actions {
        margin-left: 0;
        padding-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
    .meta-action-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .meta-action-btn i { font-size: 1rem; }
    .meta-action-count { font-size: 0.85rem; }
}

/* ============ 文章图片「点击查看原图」灯箱 ============ */
.kb-img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.kb-img-lightbox.open { display: flex; }
.kb-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    animation: kb-lb-fade .18s ease-out;
}
.kb-lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.kb-lightbox-img {
    max-width: 96vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
    transform-origin: center center;
    will-change: transform;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    transition: opacity 0.25s ease;
}
.kb-lightbox-close {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.kb-lightbox-close:hover { background: rgba(255, 255, 255, .28); }
.kb-lightbox-hint {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
    pointer-events: none;
}
@keyframes kb-lb-fade { from { opacity: 0; } to { opacity: 1; } }

.kb-lightbox-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: kb-lb-spin 0.8s linear infinite;
    display: none;
}
@keyframes kb-lb-spin { to { transform: rotate(360deg); } }

/* ============================================================
   ✅ SEO：可见面包屑导航（与 BreadcrumbList 结构化数据一一对应）
   ============================================================ */
.kb-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .875rem;
    color: #64748b;
    margin: 12px 0 4px;
}
.kb-breadcrumb a {
    color: #64748b;
    text-decoration: none;
    transition: color .2s ease;
}
.kb-breadcrumb a:hover { color: var(--primary, #1677ff); }
.kb-breadcrumb-sep { color: #cbd5e1; }
.kb-breadcrumb-current {
    color: var(--gray-800, #1f2937);
    font-weight: 600;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   ✅ SEO：相关文章内链（详情页 → 其他文章，让权重在文章间流动）
   ============================================================ */
.kb-related {
    margin: 40px 0 8px;
    padding: 20px 20px 18px;
    background: var(--bg-soft, #f8fafc);
    border: 1px solid #e6ecf3;
    border-top: 1px solid #d1d5db;
    border-radius: var(--radius-sm, 8px);
}
.kb-related-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--gray-800, #1f2937);
}
.kb-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.kb-related-list li a {
    color: #334155;
    text-decoration: none;
    font-size: .95rem;
    line-height: 1.6;
    display: block;
}
.kb-related-list li a:hover {
    color: var(--primary, #1677ff);
    text-decoration: underline;
}
@media (max-width: 768px) {
    .kb-related { padding: 14px 16px; }
    .kb-breadcrumb { font-size: .82rem; }
}

/* ✅ 正文分割线（后台"分割线"按钮插入 <hr class="kb-hr">，前台原样透传渲染） */
.article-html hr,
.article-html hr.kb-hr {
    border: none;
    height: 1px;
    background: var(--gray-200, #e7ebf0);
    margin: 28px 0;
}

/* ✅ 正文目录锚点(TOC) */
.kb-toc {
    margin: 18px 0 26px;
    padding: 14px 18px;
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--gray-200, #e7ebf0);
    border-left: 3px solid var(--primary, #1677ff);
    border-radius: 10px;
}
.kb-toc > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--gray-800, #1f2937);
    list-style: none;
    user-select: none;
}
.kb-toc > summary::-webkit-details-marker { display: none; }
.kb-toc > summary::before {
    content: "\f03a"; /* fa-list */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
    color: var(--primary, #1677ff);
}
.kb-toc-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}
.kb-toc-list li { margin: 0; padding: 4px 0; }
.kb-toc-list li.kb-toc-sub { padding-left: 18px; }
.kb-toc-list a {
    color: var(--gray-600, #475569);
    text-decoration: none;
    font-size: .95rem;
    transition: color .15s;
}
.kb-toc-list a:hover { color: var(--primary, #1677ff); text-decoration: underline; }
/* 锚点跳转不被固定导航遮挡（h2/h3 的 sec-N + TinyMCE 自定义锚点 <a id="..."> 均生效） */
.article-html h2, .article-html h3, .article-html a[id] { scroll-margin-top: 86px; }
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
