:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #d946ef;
    --bg: #0f172a;
    --bg-darker: #020617;
    --card-bg: rgba(30, 41, 59, 0.5);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 30px 60px rgba(0, 0, 0, 0.4);
    --transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    --gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
}

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

body {
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(217, 70, 239, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 10% 10%, #fff, transparent),
        radial-gradient(1px 1px at 20% 50%, #fff, transparent),
        radial-gradient(2px 2px at 40% 80%, #fff, transparent),
        radial-gradient(2px 2px at 60% 20%, #fff, transparent),
        radial-gradient(1px 1px at 80% 40%, #fff, transparent),
        radial-gradient(1px 1px at 90% 70%, #fff, transparent);
    background-size: 200px 200px;
    opacity: 0.1;
    z-index: -1;
    animation: stars 100s linear infinite;
}

@keyframes stars {
    from { background-position: 0 0; }
    to { background-position: 1000px 1000px; }
}

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

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
}

/* Header & Nav */
.site-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.brand {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    letter-spacing: -1.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-bar {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    padding: 6px 16px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    width: 280px;
}

.search-bar:focus-within {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 12px;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
}

.search-bar button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding-left: 5px;
}

.btn-admin {
    padding: 10px 24px;
    background: var(--gradient);
    border-radius: 100px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.2);
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.4);
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    gap: 2.5rem;
    margin-top: 3rem;
    align-items: start;
}

/* Sidebar Navigation */
.sidebar-nav {
    position: sticky;
    top: 110px;
}

.nav-group {
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 16px;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(8px);
}

.nav-link.active {
    color: #fff;
    background: var(--gradient);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.2);
}

/* Post Grid */
.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

.post-card {
    display: flex;
    flex-direction: column; /* 改为垂直布局 */
    padding: 0;
    gap: 0;
    overflow: hidden;
    animation: slideUp 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.post-cover-link {
    width: 100%;
    height: 320px;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
    display: block;
}

.post-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-cover-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, var(--bg), transparent);
    pointer-events: none;
}

/* 骨架屏加载动画：遮盖住生硬的“生成中”占位图 */
.post-cover-link:not(.loaded)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        rgba(255,255,255,0.03) 25%, 
        rgba(255,255,255,0.08) 50%, 
        rgba(255,255,255,0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 2;
    backdrop-filter: blur(10px);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.post-card:hover .post-cover {
    transform: scale(1.05);
}

.post-info {
    padding: 2.5rem;
    background: var(--bg);
    position: relative;
    z-index: 1;
    margin-top: -20px; /* 稍微向上移动以与渐变衔接 */
    border-radius: 24px 24px 0 0;
}

.post-info h2 a {
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.post-info h2 a:hover {
    color: var(--primary);
}

.post-category {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 6px;
    margin-bottom: 1.25rem;
}

.post-info h2 {
    font-size: 1.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.35;
}

.post-summary {
    font-size: 1.05rem;
    -webkit-line-clamp: 3; /* 允许显示 3 行摘要 */
    margin-bottom: 2rem;
    color: var(--text-main);
    opacity: 0.9;
    line-height: 1.6;
}

.post-meta {
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    justify-content: space-between;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Weiyu Sidebar */
.weiyu-sidebar {
    position: sticky;
    top: 110px;
}

.weiyu-list {
    padding: 0.5rem 0;
}

.weiyu-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
}

.weiyu-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.weiyu-item:last-child { border: none; }

.weiyu-item p { 
    font-size: 1rem; 
    margin-bottom: 1rem; 
    color: #e2e8f0;
    line-height: 1.6;
}

.weiyu-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Article Page */
.article-container {
    max-width: 850px;
    margin: 4rem auto;
    padding: 4rem;
}

.article-header { text-align: left; margin-bottom: 4rem; }
.article-header h1 { font-size: 3rem; margin-bottom: 2rem; font-weight: 900; letter-spacing: -2px; line-height: 1.2; }

.article-body {
    font-size: 1.15rem;
    line-height: 1.85;
    color: #e2e8f0;
}

.article-body p {
    margin-bottom: 1.8rem;
    text-align: justify;
}

.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
    color: #fff;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.article-body h1 { font-size: 2.4rem; border-bottom: 2px solid var(--glass-border); padding-bottom: 1rem; }

.article-body h2 { 
    font-size: 1.85rem; 
    position: relative;
    padding-left: 1.25rem;
    background: none;
    -webkit-text-fill-color: initial;
    display: block;
}

.article-body h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.3rem;
    bottom: 0.3rem;
    width: 6px;
    background: var(--gradient);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

.article-body h3 { 
    font-size: 1.45rem; 
    border-bottom: 1px dashed var(--glass-border);
    padding-bottom: 0.5rem;
}

.article-body strong {
    color: var(--accent);
    font-weight: 700;
}

.article-body ul, .article-body ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.8rem;
    position: relative;
    list-style: none;
}

.article-body li::before {
    content: "✦";
    position: absolute;
    left: -1.5rem;
    color: var(--primary);
    font-size: 0.8rem;
}

.article-body blockquote {
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--accent);
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    font-style: italic;
    color: var(--text-muted);
    border-radius: 0 16px 16px 0;
}

.expert-tip {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(217, 70, 239, 0.05) 100%);
    border: 1px solid var(--glass-border);
    border-left: 6px solid var(--primary);
    padding: 2.5rem;
    border-radius: 0 24px 24px 0;
    margin: 5rem 0;
    position: relative;
    overflow: hidden;
}

.expert-tip::after {
    content: "PRO TIP";
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--primary);
    opacity: 0.5;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    margin: 2.5rem 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* Footer */
.site-footer {
    padding: 6rem 0;
    margin-top: 8rem;
    background: var(--bg-darker);
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-logo { 
    font-size: 1.8rem; 
    font-weight: 900; 
    margin-bottom: 1.5rem; 
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.footer-copy { color: var(--text-muted); font-size: 1rem; }

/* Responsive & Navigation Fixes */
@media (max-width: 1200px) {
    .main-layout { grid-template-columns: 1fr; }
    .sidebar-nav { display: block; margin-bottom: 2rem; position: relative; top: 0; }
    .weiyu-sidebar { display: none; }
    .sidebar-nav .nav-group { display: flex; flex-wrap: wrap; gap: 1rem; }
    .sidebar-nav .nav-link { margin-bottom: 0; }
}

@media (max-width: 900px) {
    .article-container { padding: 2.5rem; margin-top: 2rem; }
    .article-header h1 { font-size: 2rem; }
    .post-card { flex-direction: column; }
    .post-cover-link { width: 100%; height: 220px; }
    .hero-section h1 { font-size: 3.5rem; }
}
