/* ===== 基础重置与CSS变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #165DFF;
    --primary-light: #E8F3FF;
    --success: #00B42A;
    --warning: #FF7D00;
    --danger: #F53F3F;
    --text-1: #1D2129;
    --text-2: #4E5969;
    --text-3: #86909C;
    --border: #E5E6EB;
    --bg-1: #FFFFFF;
    --bg-2: #F7F8FA;
    --bg-3: #F2F3F5;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1D2129;
    background-color: #F7F8FA;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    outline: none;
    border: none;
}

/* ===== 通用容器与布局 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-wrap {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}

.main-content {
    padding: 12px 0 28px;
}

/* ===== 顶部导航 ===== */
.header {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
}

.logo-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;  
    border-radius: var(--radius-sm);
}

.nav-menu {
    display: flex;
    gap: 32px;
}

.nav-menu a {
    font-size: 15px;
    color: var(--text-2);
}

.nav-menu a.active,
.nav-menu a:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0E42D2;
}

.hamburger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-2);
}

.hamburger:hover {
    background: var(--bg-3);
}

.mobile-menu {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    padding: 12px 20px;
}

.mobile-menu a {
    display: block;
    padding: 12px 0;
    color: var(--text-2);
    border-bottom: 1px solid var(--bg-3);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu .mobile-btn {
    margin-top: 12px;
    width: 100%;
    text-align: center;
    padding: 10px;
}

/* ===== 面包屑 ===== */
.breadcrumb {
    font-size: 13px;
    color: var(--text-3);
    padding: 2px 0 14px 0;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .sep {
    margin: 0 6px;
    color: var(--text-3);
}

.breadcrumb .current {
    color: var(--text-2);
}

/* ===== 侧边栏通用 ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 20px;
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 热门文章列表 */
.hot-list li {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.hot-list li:last-child {
    margin-bottom: 0;
}

.hot-rank {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-top: 1px;
}

.rank-1 { background: var(--danger); }
.rank-2 { background: var(--warning); }
.rank-3 { background: #FF9A2E; }
.rank-other {
    background: var(--bg-3);
    color: var(--text-3);
}

.hot-list a {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
}

.hot-list a:hover {
    color: var(--primary);
}

/* 随机文章列表 */
.random-list li{
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.random-list li:last-child {
    margin-bottom: 0;
}

.random-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 8px;
    flex-shrink: 0;
}

.random-list a {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
}

.random-list a:hover {
    color: var(--primary);
}
/* 侧边栏广告 */
.sidebar-ad-widget {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.sidebar-ad-wrap {
    position: relative;
    height: 140px;
}

.sidebar-ad-item {
    display: none;
    position: absolute;
    inset: 0;
}

.sidebar-ad-item.active {
    display: block;
}

.sidebar-ad-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.ad-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
}

.ad1 { background: #FF7D00; }
.ad2 { background: #165DFF; }
.ad3 { background: #00B42A; }
/* ===== 文章列表通用 ===== */
.article-list {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.article-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-3);
    transition: background 0.2s;
}

.article-item:last-child {
    border-bottom: none;
}

.article-item:hover {
    background: var(--bg-2);
}

.article-item h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.5;
    margin-bottom: 8px;
}

.article-item h4 a:hover {
    color: var(--primary);
}

.article-item .excerpt {
    font-size: 13px;
    color: var(--text-3);
    line-height: 1.7;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    font-size: 12px;
    color: var(--text-3);
}

.article-meta .tag {
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    transition: all 0.2s;
}

.article-meta .tag:hover {
    background: #D0E4FF;
}

.article-meta .meta-info {
    display: flex;
    gap: 14px;
    align-items: center;
}

/* ===== 相关阅读模块 ===== */
.related-wrap {
    margin-top: 28px;
    background: var(--bg-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.related-heading {
    font-size: 18px;
    font-weight: 600;
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-3);
}

/* ===== 文章正文通用样式 ===== */
.article-card {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 32px;
}

.article-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.article-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.4;
}

.article-body {
    font-size: 16px;
    color: var(--text-1);
    line-height: 1.8;
}

.article-body h2 {
    font-size: 22px;
    margin: 32px 0 14px;
    font-weight: 600;
}

.article-body h3 {
    font-size: 19px;
    margin: 26px 0 12px;
    font-weight: 600;
}

.article-body p {
    margin-bottom: 16px;
}

.article-body ul {
    margin: 14px 0 16px 22px;
    list-style: disc;
}

.article-body ol {
    margin: 14px 0 16px 26px;
    list-style: decimal;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body strong {
    color: var(--text-1);
}

.article-body em {
    color: var(--text-2);
}

.article-inline-code {
    background: var(--bg-3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92em;
    color: var(--danger);
}

.article-blockquote {
    border-left: 4px solid var(--primary);
    background: var(--primary-light);
    padding: 14px 18px;
    margin: 18px 0;
    color: var(--text-2);
}

/* 代码块 */
.article-code-wrap {
    margin: 18px 0;
}

.article-code {
    background: #1E293B;
    color: #E2E8F0;
    padding: 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
}

/* ===== 页脚 ===== */
.footer {
    background: #1D2129;
    color: #86909C;
    padding: 32px 0 24px;
    margin-top: 20px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

/* ===== 返回顶部 ===== */
.back-top {
    position: fixed;
    right: 28px;
    bottom: 32px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-1);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 99;
}

.back-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-top:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ===== 推广合作弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    padding: 32px;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--bg-3);
}

.modal h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-1);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-3);
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.contact-text span {
    display: block;
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 2px;
}

.contact-text strong {
    font-size: 15px;
    color: var(--text-1);
    font-weight: 500;
}

/* ===== 公共响应式 ===== */
@media (max-width: 992px) {
    .content-wrap {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-menu,
    .nav-actions .btn-primary {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .mobile-menu.active {
        display: block;
    }

    .article-card {
        padding: 20px;
    }

    .article-title {
        font-size: 22px;
    }

    .related-heading {
        padding: 16px 20px;
    }

    .article-item {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .article-card {
        padding: 16px;
    }
}
