/* 博客通用样式 - 基于 shimo-export 参考项目优化 */

/* Base Styles Override */
html, body {
    height: auto !important;
    overflow-y: visible !important;
}

body {
    background-color: var(--bg-color, #060010);
    color: var(--text-color, #ffffff);
    font-family: 'Figtree', 'Inter', sans-serif;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    --stripes: repeating-linear-gradient(100deg, rgba(102, 126, 234, 0.15), rgba(102, 126, 234, 0.15) 7%, transparent 10%, transparent 12%, rgba(102, 126, 234, 0.15) 16%);
    --rainbow: repeating-linear-gradient(100deg, rgba(96, 165, 250, 0.2) 10%, rgba(232, 121, 249, 0.15) 15%, rgba(96, 165, 250, 0.2) 20%, rgba(94, 234, 212, 0.15) 25%, rgba(96, 165, 250, 0.2) 30%);
    background-image: var(--stripes), var(--rainbow);
    background-size: 300%, 200%;
    background-position: 50% 50%, 50% 50%;
    filter: blur(10px) opacity(60%) saturate(200%);
    mask-image: radial-gradient(ellipse at 50% 0, #000 40%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 0, #000 40%, transparent 70%);
    animation: jumbo 15s linear infinite;
}

@keyframes jumbo {
    0% { background-position: 50% 50%, 50% 50%; }
    100% { background-position: 350% 50%, 350% 50%; }
}

/* Navbar Override for Blog Pages - 固定背景 */
.homepage-nav {
    background: rgba(6, 0, 16, 0.95) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
}

/* Ensure content sits above the aurora background */
.blog-layout,
.blog-index-container {
    position: relative;
    z-index: 1;
}

/* Footer Fixes */
.homepage-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(6, 0, 16, 0.95);
}

/* 整体布局 - 左侧目录、中间正文、右侧CTA */
.blog-layout {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    gap: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 100px;
    min-height: calc(100vh - 60px);
}

/* 平板端适配 */
@media (max-width: 1200px) and (min-width: 769px) {
    .blog-layout {
        grid-template-columns: 200px 1fr;
        gap: 2rem;
    }
    .blog-sidebar-right {
        display: none;
    }
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .blog-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
        padding-top: 80px;
    }
    .blog-sidebar-left,
    .blog-sidebar-right {
        display: none;
    }
    .blog-sidebar-left.mobile-show.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: rgba(6, 0, 16, 0.98);
        z-index: 1001;
        overflow-y: auto;
        padding: 2rem 1rem;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
}

/* 左侧目录导航 */
.blog-sidebar-left {
    position: sticky;
    top: 5rem;
    height: fit-content;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.toc-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.2rem;
}

.toc-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgb(132, 0, 255);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: #ccc;
    text-decoration: none;
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.88rem;
    line-height: 1.4;
    border-left: 2px solid transparent;
}

.toc-list a:hover {
    color: rgb(132, 100, 255);
    background: rgba(132, 0, 255, 0.08);
    border-left-color: rgb(132, 0, 255);
    transform: translateX(2px);
}

.toc-list a.active {
    color: rgb(132, 100, 255);
    background: rgba(132, 0, 255, 0.15);
    font-weight: 500;
    border-left-color: rgb(132, 0, 255);
}

.toc-list li.toc-h3 {
    margin-left: 1rem;
}

/* 移动端目录按钮 */
.mobile-toc-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    width: 50px;
    height: 50px;
    background: rgb(132, 0, 255);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(132, 0, 255, 0.5);
    transition: transform 0.2s;
}

.mobile-toc-toggle:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .mobile-toc-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }
}

/* 中间正文区域 */
.blog-main-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 3rem;
    line-height: 1.8;
}

@media (max-width: 768px) {
    .blog-main-content {
        padding: 1.5rem;
    }
}

/* 文章头部 */
.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.article-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #888;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-meta-icon {
    width: 16px;
    height: 16px;
}

/* 文章内容样式 */
.article-content h2 {
    font-size: 1.6rem;
    color: #fff;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(132, 0, 255, 0.3);
    scroll-margin-top: 5rem;
}

.article-content h3 {
    font-size: 1.3rem;
    color: #ddd;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    scroll-margin-top: 5rem;
}

.article-content p {
    color: #ccc;
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-content strong {
    color: #fff;
}

.article-content ul, .article-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: #ccc;
}

.article-content li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.article-content a {
    color: rgb(132, 100, 255);
    text-decoration: none;
    border-bottom: 1px solid rgba(132, 0, 255, 0.3);
    transition: border-color 0.2s;
}

.article-content a:hover {
    border-bottom-color: rgb(132, 0, 255);
}

/* 图片样式 */
.article-content img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.article-image-caption {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

/* 代码样式 */
.article-content code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #fff;
}

/* 表格样式 */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.article-content th, .article-content td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
}

.article-content th {
    background: rgba(132, 0, 255, 0.15);
    color: #fff;
    font-weight: 600;
}

.article-content tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 768px) {
    .article-content table { font-size: 0.8rem; }
    .article-content th, .article-content td { padding: 0.5rem 0.6rem; }
}

/* 引用样式 */
.article-content blockquote {
    border-left: 4px solid rgb(132, 0, 255);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: #ccc;
    font-style: italic;
}

/* 分割线 */
.article-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 3rem 0 2rem;
}

/* 右侧CTA区域 */
.blog-sidebar-right {
    position: sticky;
    top: 5rem;
    height: fit-content;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.cta-card {
    background: linear-gradient(135deg, rgba(132, 0, 255, 0.8) 0%, rgba(102, 126, 234, 0.8) 100%);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(132, 0, 255, 0.3);
    margin-bottom: 2rem;
}

.cta-icon-img {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: block;
    border-radius: 12px;
}

.cta-card .cta-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.cta-card .cta-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.cta-card .cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    color: rgb(132, 0, 255);
    padding: 0.9rem 1.6rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.cta-card .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    background: #f8f9fa;
}

/* 相关文章推荐 */
.related-posts {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
}

.related-posts-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.related-post-item {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.related-post-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgb(132, 0, 255);
}

.related-post-link {
    color: #ccc;
    text-decoration: none;
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
}

.related-post-link:hover {
    color: rgb(132, 100, 255);
}

/* 文章底部标签 */
.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.article-tag {
    display: inline-block;
    background: rgba(132, 0, 255, 0.15);
    color: rgb(132, 100, 255);
    padding: 0.3rem 0.8rem;
    border-radius: 16px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

.article-tag:hover {
    background: rgba(132, 0, 255, 0.25);
    transform: translateY(-1px);
}

/* 返回顶部按钮 */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: rgb(132, 0, 255);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(132, 0, 255, 0.5);
    transition: all 0.2s;
    font-size: 1.2rem;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(132, 0, 255, 0.6);
}

.back-to-top.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 滚动条样式 */
.blog-sidebar-left::-webkit-scrollbar {
    width: 4px;
}

.blog-sidebar-left::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.blog-sidebar-left::-webkit-scrollbar-thumb {
    background: rgba(132, 0, 255, 0.5);
    border-radius: 2px;
}
