/* --- 全局变量与重置 --- */
:root {
    --bg-color: #f0f2f5;
    --text-color: #333333;
    --nav-bg: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-border: rgba(255, 255, 255, 0.8);
    --accent-color: #4a90e2;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --heatmap-color: #ebedf0;
    --heatmap-active: #40c463;
}

/* 黑夜模式变量 */
body.dark-mode {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --nav-bg: rgba(22, 27, 34, 0.7);
    --glass-bg: rgba(22, 27, 34, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-color: #58a6ff;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --heatmap-color: #161b22;
    --heatmap-active: #39d353;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    /* 背景图片覆盖 */
    background-image: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?q=80&w=2072&auto=format&fit=crop');
    background-size: cover;
    background-attachment: fixed;
    background-blend-mode: overlay; 
}
body.dark-mode {
    background-blend-mode: multiply;
}

/* --- 工具类：毛玻璃效果 --- */
.glass-nav, .glass-box, .glass-card, .glass-footer, .glass-btn {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
}

/* --- 导航栏 --- */
nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    height: 60px;
    border-radius: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}

.nav-left .logo {
    font-weight: bold;
    font-size: 1.2rem;
}

.nav-center {
    display: flex;
    gap: 20px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    position: relative;
    padding: 5px 10px;
}

.nav-item:hover, .nav-item.active {
    color: var(--accent-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
}

.avatar img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

/* --- 头部 Hero --- */
.hero-section {
    height: 25vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 80px; /* 避开导航栏 */
}

.hero-content {
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.quote {
    font-style: italic;
    margin-bottom: 20px;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 50px;
    width: 100%;
}

.search-box i {
    margin-right: 10px;
    opacity: 0.7;
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    color: var(--text-color);
    font-size: 1rem;
}

/* --- 主内容区 --- */
main {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto 50px;
    min-height: 50vh;
}

.page-section {
    display: none; /* 默认隐藏所有部分 */
    animation: fadeIn 0.5s ease;
}

.page-section.active {
    display: block; /* 激活时显示 */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 40px 0 20px;
    position: relative;
}

/* 网格布局系统 */
.grid-4-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.grid-3-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.grid-2-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* 卡片样式 */
.glass-card {
    border-radius: 15px;
    padding: 20px;
    transition: transform 0.3s;
}

.glass-card:hover {
    transform: translateY(-5px);
}

.info-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
}

.info-box i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.core-box ul {
    list-style: none;
    margin-top: 10px;
    padding-left: 0;
}

.core-box li::before {
    content: "• ";
    color: var(--accent-color);
}

.action-btn {
    margin-top: 15px;
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
}

/* --- 最新内容 (热力图) --- */
.latest-content {
    margin-top: 20px;
}

.content-header {
    margin-bottom: 20px;
}

.heatmap-container {
    display: grid;
    grid-template-columns: repeat(30, 1fr); /* 模拟30列 */
    gap: 4px;
    padding: 10px;
    overflow-x: auto;
}

.heat-box {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--heatmap-color);
    border-radius: 2px;
}

.heat-box.active {
    background-color: var(--heatmap-active);
}

/* --- 技术指南 & 项目卡片 --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.tech-card, .project-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 10px;
}

.card-body {
    padding: 15px 0 0;
}

.card-meta {
    font-size: 0.85rem;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.glass-btn {
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
}

/* --- 惊喜页面 --- */
.surprise-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 40px;
}

.payment-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.pay-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.qr-code-area {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.qr-code-area img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

/* --- 页脚 --- */
.glass-footer {
    margin-top: 50px;
    padding: 40px 20px 20px;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h4 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.footer-section a {
    color: var(--text-color);
    text-decoration: none;
}

.copyright {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
    nav {
        top: 10px;
        width: 95%;
        padding: 0 10px;
    }
    .nav-item {
        font-size: 0.9rem;
        padding: 5px;
    }
    .hero-section {
        height: 20vh;
    }
    .grid-4-cols, .grid-3-cols, .grid-2-cols {
        grid-template-columns: 1fr;
    }
    .heatmap-container {
        grid-template-columns: repeat(15, 1fr); /* 移动端减少列数 */
    }
}

/* ==================== 文章详情弹窗 ==================== */
.article-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-overlay.active {
    display: flex;
    opacity: 1;
}

.article-modal {
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.article-overlay.active .article-modal {
    transform: scale(1) translateY(0);
}

.article-overlay.active.closing .article-modal {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
}

/* 加载动画 */
.article-modal.loading .article-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.terminal-loading {
    font-family: 'Courier New', monospace;
    color: #0f0;
    background: #1a1a1a;
    padding: 20px;
    border-radius: 8px;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 打字机效果 */
.article-modal.typing .article-content {
    overflow: hidden;
}

/* 详情头部 */
.article-header {
    position: relative;
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--glass-border);
}

.article-header h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    padding-right: 40px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.article-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* 详情内容 */
.article-content {
    padding: 25px;
    line-height: 1.8;
    min-height: 200px;
}

.article-content h1, .article-content h2, .article-content h3 {
    margin: 1.5em 0 0.8em;
    color: var(--accent-color);
}

.article-content p {
    margin-bottom: 1em;
}

.article-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.article-content pre {
    background: #1e1e1e;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
}

.article-content pre code {
    background: none;
    padding: 0;
    color: #d4d4d4;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 15px;
    margin: 1em 0;
    opacity: 0.8;
}

.article-content ul, .article-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

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

/* 详情底部 */
.article-footer {
    padding: 15px 25px 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ==================== 文章卡片样式更新 ==================== */
.article-card {
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.article-card .card-cover {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.article-card .card-cover img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .card-cover img {
    transform: scale(1.08);
}

.article-card .card-body {
    padding: 15px 0;
}

.article-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .card-desc {
    font-size: 0.9rem;
    opacity: 0.75;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.article-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    opacity: 0.7;
}

.article-card .card-meta {
    display: flex;
    gap: 12px;
}

.article-card .card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 项目卡片价格标签 */
.project-card .price-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 最新内容卡片 */
.latest-content .latest-header {
    margin-bottom: 15px;
}

.latest-content .latest-header h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.latest-content .latest-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    opacity: 0.7;
}

.latest-desc {
    opacity: 0.8;
    line-height: 1.6;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .article-modal {
        max-height: 90vh;
        margin: 0;
    }
    .article-header h2 {
        font-size: 1.2rem;
    }
    .article-meta {
        gap: 10px;
        font-size: 0.8rem;
    }
}
