:root {
    --brand-orange: #ff6a00;
    --brand-orange-light: #ff8b33;
    --brand-dark: #0d1c2e;
    --text-muted: #5f6b7a;
    --bg-light: #f6f7fb;
    --border-color: rgba(13, 28, 46, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 移除头部导航的浏览器默认 focus-visible 样式 */
.global-header .primary-navigation button:focus-visible {
    outline: none;
}

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-light);
    color: var(--brand-dark);
    line-height: 1.8;
}

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

/* 文章布局 - 侧边栏在右侧额外空间 */
.article-layout {
    position: relative;
    display: block;
}

.article-main {
    width: 100%;
}

/* 文章大纲侧边栏 - 固定在右侧空白区域 */
.article-toc-sidebar {
    position: fixed;
    right: max(20px, calc((100vw - 1200px) / 2 - 280px));
    top: 100px;
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    z-index: 50;
}

/* 当屏幕宽度足够时，侧边栏显示在内容右侧 */
@media (min-width: 1560px) {
    .article-toc-sidebar {
        right: calc((100vw - 1200px) / 2 - 300px);
    }
}

/* 中等屏幕：侧边栏贴近内容区域右侧 */
@media (max-width: 1559px) and (min-width: 1280px) {
    .article-toc-sidebar {
        right: 20px;
    }
}

.toc-wrapper {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(13, 28, 46, 0.08);
    border: 1px solid var(--border-color);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.toc-wrapper::-webkit-scrollbar {
    width: 4px;
}

.toc-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.toc-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 106, 0, 0.3);
    border-radius: 2px;
}

.toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--brand-orange);
}

.toc-icon {
    font-size: 1.1rem;
}

.toc-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.toc-nav {
    margin-bottom: 0;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-item {
    margin-bottom: 4px;
}

.toc-item.toc-level-1 {
    padding-left: 12px;
}

.toc-item.toc-level-2 {
    padding-left: 24px;
}

.toc-link {
    display: block;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1.4;
    border-left: 2px solid transparent;
}

.toc-link:hover {
    color: var(--brand-orange);
    background: rgba(255, 106, 0, 0.06);
}

.toc-link.is-active {
    color: var(--brand-orange);
    background: rgba(255, 106, 0, 0.1);
    border-left-color: var(--brand-orange);
    font-weight: 600;
}

/* 相关文章区域 */
.toc-related {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.toc-related-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.toc-related-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand-dark);
}

.related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.related-list li {
    margin-bottom: 8px;
}

.related-list a {
    display: block;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-list a:hover {
    color: var(--brand-orange);
    background: rgba(255, 106, 0, 0.06);
}

/* 响应式 - 屏幕宽度不够时隐藏侧边栏 */
@media (max-width: 1279px) {
    .article-toc-sidebar {
        display: none;
    }
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.breadcrumb a {
    color: var(--brand-orange);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.article-header {
    background: #fff;
    border-radius: 12px;
    padding: 48px;
    margin-bottom: 32px;
}

.article-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-category {
    color: var(--brand-orange);
    font-weight: 600;
    text-decoration: none;
}

.article-category:hover {
    text-decoration: underline;
}

.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 20px;
    line-height: 1.3;
}

.article-excerpt {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.article-featured-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 40px;
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-content {
    background: #fff;
    border-radius: 12px;
    padding: 48px;
    margin-bottom: 32px;
}

.article-content h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--brand-dark);
    margin: 40px 0 20px;
    line-height: 1.4;
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--brand-dark);
    margin: 32px 0 16px;
    line-height: 1.4;
}

.article-content p {
    margin-bottom: 20px;
    color: var(--brand-dark);
    line-height: 1.8;
}

.article-content ul,
.article-content ol {
    margin: 20px 0;
    padding-left: 24px;
}

.article-content li {
    margin-bottom: 12px;
    color: var(--brand-dark);
    line-height: 1.8;
}

.article-content img {
    width: 100%;
    border-radius: 8px;
    margin: 32px 0;
}

.article-content blockquote {
    border-left: 4px solid var(--brand-orange);
    padding-left: 24px;
    margin: 32px 0;
    color: var(--text-muted);
    font-style: italic;
}

/* 表格样式 */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(13, 28, 46, 0.06);
    border: 1px solid var(--border-color);
}

/* 表头样式 - 有thead时应用到thead */
.article-content thead {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-light));
    color: #fff;
}

.article-content thead th,
.article-content thead td {
    padding: 14px 18px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #fff;
    border-bottom: none;
}

/* 表头样式 - 无thead时应用到第一行（仅当表格没有thead时） */
.article-content table:not(:has(thead)) tr:first-child {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-light));
    color: #fff;
}

.article-content table:not(:has(thead)) tr:first-child td {
    padding: 14px 18px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #fff;
    border-bottom: none;
}

/* 表头悬停时保持原样 */
.article-content thead tr:hover,
.article-content table:not(:has(thead)) tr:first-child:hover {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-light)) !important;
}

.article-content th {
    padding: 14px 18px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.article-content td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--brand-dark);
    font-size: 0.95rem;
}

.article-content tbody tr:last-child td,
.article-content table:not(:has(thead)) tr:last-child td {
    border-bottom: none;
}

/* 斑马纹 - 有thead时从tbody第一行开始，无thead时跳过第一行 */
.article-content tbody tr:nth-child(even) {
    background: rgba(246, 247, 251, 0.6);
}

.article-content table:not(:has(thead)) tr:nth-child(even):not(:first-child) {
    background: rgba(246, 247, 251, 0.6);
}

/* 悬停效果 - 排除表头 */
.article-content tbody tr:hover {
    background: rgba(255, 106, 0, 0.04);
}

.article-content table:not(:has(thead)) tr:hover:not(:first-child) {
    background: rgba(255, 106, 0, 0.04);
}

.article-content table code {
    background: rgba(255, 106, 0, 0.1);
    color: var(--brand-orange);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .article-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .article-content th,
    .article-content td {
        padding: 12px 14px;
        white-space: nowrap;
    }
}

.article-content code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.9em;
}

.article-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.article-tag {
    font-size: 0.85rem;
    padding: 6px 12px;
    background: rgba(255, 106, 0, 0.1);
    color: var(--brand-orange);
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
}

.article-tag:hover {
    background: rgba(255, 106, 0, 0.15);
}

.article-footer {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.article-share {
    display: flex;
    gap: 12px;
    align-items: center;
}

.article-share span {
    color: var(--text-muted);
    font-weight: 600;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--brand-dark);
    text-decoration: none;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: var(--brand-orange);
    color: #fff;
}

.article-nav {
    display: flex;
    gap: 24px;
    margin-top: 32px;
}

.article-nav .nav-item {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.article-nav .nav-item:hover {
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.article-nav .nav-item-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.article-nav .nav-item-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--brand-dark);
    line-height: 1.4;
}

.article-nav .nav-prev .nav-item-label::before {
    content: "← ";
}

.article-nav .nav-next {
    text-align: right;
}

.article-nav .nav-next .nav-item-label::after {
    content: " →";
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .article-header,
    .article-content {
        padding: 32px 24px;
    }

    .article-title {
        font-size: 1.8rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.2rem;
    }

    .article-nav {
        flex-direction: column;
    }
}

/* 推荐软件区域 */
.article-recommend {
    margin-top: 48px;
    padding-top: 48px;
}

.recommend-header {
    margin-bottom: 32px;
}

.recommend-eyebrow {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-orange);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.recommend-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.rec-card {
  display: block;
}
.rec-card > a {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px;
    text-decoration: none;
    color: var(--brand-dark);
    align-items: center;
    box-shadow: 0 16px 36px rgba(15, 20, 40, 0.08);
    transition: all 0.2s ease;
}

.rec-card:hover > a,
.rec-card > a:hover {
    border-color: var(--brand-orange);
    box-shadow: 0 20px 40px rgba(255, 106, 0, 0.15);
    transform: translateY(-2px);
}

.rec-card img,
.rec-card > a img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 12px;
}

.rec-card h3,
.rec-card > a h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-dark);
    line-height: 1.4;
}

.rec-card .card-tags,
.rec-card > a .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.rec-card .card-tags span,
.rec-card > a .card-tags span {
    background: rgba(255, 106, 0, 0.1);
    color: var(--brand-orange);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .article-recommend {
        margin-top: 32px;
        padding-top: 32px;
    }

    .recommend-header h2 {
        font-size: 1.5rem;
    }

    .recommend-grid {
        grid-template-columns: 1fr;
    }
}

