/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --bg-hover: #f3f4f6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--secondary-color);
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.site-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    padding: 3rem 0 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: visible; /* 允许菜单溢出显示 */
}

/* 网格纹理 - 限制在header内 */
.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0px, transparent 1px, transparent 2px, rgba(255,255,255,0.03) 3px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, transparent 1px, transparent 2px, rgba(255,255,255,0.03) 3px);
    opacity: 0.5;
    pointer-events: none;
    overflow: hidden; /* 防止网格溢出 */
}

/* 代码装饰 */
.site-header::after {
    content: 'const blockchain = {\A    node: "decentralized",\A    tech: ["AI", "Web3", "DAO"]\A};';
    white-space: pre;
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.75rem;
    color: rgba(100, 255, 218, 0.4);
    line-height: 1.6;
    pointer-events: none;
    z-index: 0; /* 确保在最底层 */
}

.header-content {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    padding: 0 60px; /* 为移动端菜单按钮留出空间 */
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.site-title a {
    color: #ffffff;
    text-decoration: none;
}

.site-title a:hover {
    color: rgba(100, 255, 218, 0.9);
}

.site-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* ===== Navigation ===== */
.main-nav {
    position: relative;
    z-index: 10; /* 提高z-index，确保菜单在最上层 */
    min-height: 60px; /* 确保有足够高度容纳菜单按钮 */
}

.mobile-menu-toggle {
    display: none;
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 6px;
    cursor: pointer;
    padding: 0.75rem;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: rgba(100, 255, 218, 0.5);
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.9);
    margin: 4px 0;
    transition: var(--transition);
    border-radius: 2px;
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-menu li a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-menu li a:hover {
    background-color: rgba(100, 255, 218, 0.15);
    color: rgba(100, 255, 218, 0.95);
    border-color: rgba(100, 255, 218, 0.3);
}

.nav-menu li a.active {
    background-color: rgba(100, 255, 218, 0.2);
    color: rgba(100, 255, 218, 1);
    border-color: rgba(100, 255, 218, 0.4);
}

/* ===== Main Layout ===== */
.main-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* ===== Articles List ===== */
.content-area {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.articles-list {
    min-height: 600px;
}

.article-item {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.article-item:hover {
    transform: translateX(8px);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.article-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.article-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.article-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-title a {
    color: var(--text-color);
}

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

.article-excerpt {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-light);
    color: var(--text-light);
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.tag:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.btn-page {
    padding: 0.5rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-page:disabled {
    background-color: var(--bg-hover);
    color: var(--text-light);
    cursor: not-allowed;
}

.page-info {
    color: var(--text-light);
    font-weight: 500;
}

/* ===== Sidebar ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.widget {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

/* About Widget */
.about-content {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.about-content p {
    margin-bottom: 0.75rem;
}

/* Categories Widget */
.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 0.75rem;
}

.category-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.category-list li a:hover {
    background-color: var(--bg-hover);
    transform: translateX(5px);
}

.count {
    background-color: var(--bg-light);
    color: var(--text-light);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Tags Widget */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud .tag {
    cursor: pointer;
}

/* Links Widget */
.links-list {
    list-style: none;
}

.links-list li {
    margin-bottom: 0.75rem;
}

.links-list li a {
    color: var(--text-color);
    padding: 0.25rem 0;
    display: inline-block;
    transition: var(--transition);
}

.links-list li a:hover {
    transform: translateX(5px);
}

/* ===== Footer ===== */
.site-footer {
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.icp a {
    color: var(--text-light);
}

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

.tech-info {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--text-color);
    transform: rotate(90deg);
}

.about-detail h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.about-detail h3 {
    margin: 1.5rem 0 0.75rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.about-detail ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.about-detail li {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

/* ===== Loading State ===== */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .site-title {
        font-size: 1.8rem;
    }
    
    .site-subtitle {
        font-size: 0.9rem;
    }
    
    .header-content {
        padding: 0 50px; /* 移动端调整padding */
    }

    .main-nav {
        min-height: 50px;
    }

    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        top: 10px; /* 从顶部10px */
        transform: none;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        gap: 0;
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        position: absolute;
        top: calc(100% + 0.5rem); /* 在导航栏下方，留出0.5rem间距 */
        left: 0;
        right: 0;
        padding: 0;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(100, 255, 218, 0.2);
        border-radius: 8px;
        z-index: 1000; /* 非常高的z-index，确保在所有内容之上 */
        overflow: hidden;
        max-height: 80vh; /* 最大高度，防止超出屏幕 */
        overflow-y: auto; /* 如果内容过多，允许滚动 */
    }

    .nav-menu.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(100, 255, 218, 0.1);
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu li a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 1rem;
    }

    .content-area {
        padding: 1.5rem;
    }

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

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

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .site-header {
        padding: 1.5rem 0 1rem;
    }
    
    .header-content {
        padding: 0 10px; /* 超小屏幕更窄的padding */
    }

    .site-title {
        font-size: 1.5rem;
    }

    .site-subtitle {
        font-size: 0.85rem;
    }
    
    .mobile-menu-toggle {
        top: 8px;
        right: 10px;
        padding: 0.6rem;
    }
    
    .mobile-menu-toggle span {
        width: 22px;
        height: 2.5px;
    }

    .content-area {
        padding: 1rem;
    }

    .article-item {
        padding: 1.5rem 0;
    }

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

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    .site-header,
    .sidebar,
    .pagination,
    .site-footer {
        display: none;
    }

    .main-wrapper {
        grid-template-columns: 1fr;
    }

    .article-item {
        page-break-inside: avoid;
    }
}

