/* ========================================
   3D 星空个人博客 - 主样式表
   配色：深色太空背景 + 姜黄/砖红/墨绿 + 毛玻璃卡片
   ======================================== */

/* === CSS 变量 === */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0d0d24;
    --bg-card: rgba(255, 255, 255, 0.04);
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent-blue: #2A9D8F;
    --accent-purple: #BC4749;
    --accent-pink: #D4A373;
    --accent-green: #6bff8a;
    --accent-orange: #f0b86c;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 12px 40px rgba(42, 157, 143, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.7;
    position: relative;
}

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

a:hover {
    color: var(--accent-purple);
}

img {
    max-width: 100%;
    height: auto;
}

code {
    font-family: var(--font-mono);
    background: rgba(42, 157, 143, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--accent-blue);
}

pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

blockquote {
    border-left: 3px solid var(--accent-purple);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* === Three.js 星空背景 === */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

/* 渐变遮罩增强深度感 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, rgba(188, 71, 73, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(42, 157, 143, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* === 页面过渡 === */
#page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#page-transition.active {
    opacity: 1;
}

/* === 导航栏 === */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.logo-icon {
    display: inline-block;
    font-size: 1.4rem;
    animation: float 3s ease-in-out infinite;
    background: #BC4749;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-links a {
    display: block;
    padding: 8px 18px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 18px;
    right: 18px;
    height: 2px;
    background: #D4A373;
    border-radius: 2px;
}

/* 移动端导航 */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
}

/* === 主内容区 === */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px 60px;
    min-height: calc(100vh - 64px - 80px);
}

/* === Hero 区域 === */
.hero {
    text-align: center;
    padding: 80px 20px 60px;
    position: relative;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: #fff;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
}

/* === 文章网格 === */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* ====================================
   3D 卡片系统（核心 3D 效果）
   ==================================== */
.card {
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* 卡片整体可点击 */
.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.card-link:hover {
    color: inherit;
}

.card-inner {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    box-shadow: var(--shadow-card);
}

/* 毛玻璃光晕 */
.card-inner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                rgba(42, 157, 143, 0.06) 0%,
                rgba(188, 71, 73, 0.03) 40%,
                transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card-inner:hover::before {
    opacity: 1;
}

.card-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.03);
    transition: left 0.6s;
}

.card-inner:hover::after {
    left: 100%;
}

.card-inner:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.card-content {
    position: relative;
    z-index: 1;
}

/* 卡片分类 */
.card-category {
    display: inline-block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-purple);
    margin-bottom: 10px;
    font-weight: 600;
}

.card-category a {
    color: var(--accent-purple);
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
    line-height: 1.5;
}

.card-title a {
    color: #fff;
    transition: var(--transition);
}

.card-title a:hover {
    background: #BC4749;
}

.card-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 8px;
}

.card-date {
    white-space: nowrap;
}

/* === 分页 === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    text-decoration: none;
}

.page-btn:hover {
    background: rgba(42, 157, 143, 0.1);
    border-color: rgba(42, 157, 143, 0.3);
    color: #fff;
}

.page-btn.active {
    background: rgba(42, 157, 143, 0.2);
    border-color: var(--accent-blue);
    color: #fff;
    font-weight: 600;
}

/* === 按钮 === */
.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background: #BC4749;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(188, 71, 73, 0.2);
    color: #fff;
}

.btn-outline {
    display: inline-block;
    padding: 8px 18px;
    background: transparent;
    border: 1px solid rgba(42, 157, 143, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline:hover {
    background: rgba(42, 157, 143, 0.1);
    border-color: var(--accent-blue);
    color: #fff;
}

/* === 区块标题 === */
.section-header {
    text-align: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 8px;
}

/* === 文章详情 === */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

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

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.updated-badge {
    background: rgba(188, 71, 73, 0.15);
    color: var(--accent-purple);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.article-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #fff;
}


/* 文章内容渲染 */
.markdown-body {
    line-height: 1.9;
    font-size: 1.05rem;
    word-break: break-word;
}

.markdown-body h1 { font-size: 2rem; margin: 32px 0 16px; color: #fff; }
.markdown-body h2 { font-size: 1.6rem; margin: 28px 0 14px; color: #fff; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; }
.markdown-body h3 { font-size: 1.3rem; margin: 24px 0 12px; color: #fff; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { color: var(--text-secondary); }

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

.markdown-body ul, .markdown-body ol {
    margin: 12px 0;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body a {
    color: var(--accent-blue);
    border-bottom: 1px dashed rgba(42, 157, 143, 0.4);
}

.markdown-body a:hover {
    border-bottom-style: solid;
}

.markdown-body img {
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

/* 行内代码 */
.markdown-body code {
    background: rgba(42, 157, 143, 0.1);
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* 代码块 */
.markdown-body pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 20px;
    overflow-x: auto;
    margin: 16px 0;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.7;
    color: #d4d4d4;
    position: relative;
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}

/* 代码块语言标签 */
.markdown-body pre[data-lang]::before {
    content: attr(data-lang);
    display: block;
    color: #666;
    font-size: 0.7rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.markdown-body pre[data-lang=""]::before {
    display: none;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.markdown-body th,
.markdown-body td {
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.markdown-body th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    color: var(--text-secondary);
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 32px 0;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent-purple);
    padding: 10px 20px;
    margin: 16px 0;
    color: #aaa;
    font-style: italic;
    background: rgba(188, 71, 73, 0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* === 评论 === */
.comments-section {
    max-width: 800px;
    margin: 60px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
}

.comments-section h2 {
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 20px;
}

.comment-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

.comment-form {
    margin-bottom: 32px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
}

.form-group {
    flex: 1;
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(42, 157, 143, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.captcha-row {
    align-items: flex-end;
}

.captcha-row .form-group {
    flex: 0 0 auto;
}

.captcha-img {
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.1);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.comment-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #BC4749;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-nickname {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

.comment-time {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.comment-content {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* === 提示信息 === */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(107, 255, 138, 0.08);
    border: 1px solid rgba(107, 255, 138, 0.25);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ff6b6b;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

/* === 关于页面 === */
.about-section {
    max-width: 800px;
    margin: 0 auto;
}

.about-card {
    margin-bottom: 30px;
}

.about-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 3px solid var(--accent-blue);
    box-shadow: 0 0 30px rgba(42, 157, 143, 0.2);
}

.about-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: #BC4749;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
}

.about-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.about-bio {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #BC4749;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.social-links {
    margin-bottom: 30px;
}

.social-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* === 分类/标签页面 === */
.list-section {
    max-width: 1000px;
    margin: 0 auto;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.category-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.category-card .count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* === 页脚 === */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 30px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-blue);
}

.footer-icp {
    margin-top: 10px;
}

.footer-icp a {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
}

.footer-icp a:hover {
    color: var(--accent-blue);
}

.beian-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
    display: inline-block;
}

/* === 响应式设计 === */
@media (max-width: 768px) {
    .hero {
        padding: 50px 16px 40px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 26, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-links.open {
        display: flex;
    }

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

    .article-detail {
        padding: 10px 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.6rem;
    }

    .card-inner {
        padding: 18px;
    }

    .card-title {
        font-size: 1.1rem;
    }

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

    .main-content {
        padding: 20px 12px 40px;
    }
}

/* === 3D 翻转动画 === */
@keyframes cardFlipIn {
    from {
        opacity: 0;
        transform: perspective(600px) rotateY(15deg) translateY(20px);
    }
    to {
        opacity: 1;
        transform: perspective(600px) rotateY(0) translateY(0);
    }
}

.card {
    animation: cardFlipIn 0.6s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }
