/* ==========================================
   Wayson's Blog — 全局暗色主题 & 样式定制
   ========================================== */

/* ------------------------------------------
   1. 暗色 CSS 变量
   ------------------------------------------ */
:root {
    --white: rgba(255, 255, 255, 0.95) !important;
    --font-color: rgba(255, 255, 255, 0.85) !important;
    --light-grey: rgba(255, 255, 255, 0.75) !important;
    --text-highlight-color: #f0f6fc !important;
    --global-bg: #0d1117 !important;
    --card-bg: #161b22 !important;
    --btn-bg: #21262d !important;
    --btn-color: #c9d1d9 !important;
    --hr-border: #30363d !important;
}

/* ------------------------------------------
   2. 全局基础样式
   ------------------------------------------ */
body {
    background: #0d1117 !important;
    color: #c9d1d9 !important;
}

a { color: #58a6ff !important; }
h1, h2, h3, h4, h5, h6 { color: #f0f6fc !important; }
hr { border-color: #30363d !important; }

::selection {
    background: #388bfd !important;
    color: #fff !important;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ------------------------------------------
   3. 布局：三栏 Grid（宽屏）
   左列：#aside-content sticky（Butterfly CSS 原生生效）
   中列：主内容区
   右列：.right-sticky-col（JS 从 window.__BD__ 构建）
   ------------------------------------------ */
@media screen and (min-width: 1200px) {
    #content-inner.layout {
        display: grid !important;
        grid-template-columns: 260px minmax(0, 1fr) 260px !important;
        column-gap: 20px !important;
        max-width: 1400px !important;
        align-items: start !important;
    }

    /* 左列：覆盖 Butterfly 的 width:26%、padding-right:15px */
    #content-inner.layout > #aside-content {
        grid-column: 1 / 2 !important;
        grid-row: 1 !important;
        position: sticky !important;
        top: 65px !important;
        align-self: start !important;
        width: 100% !important;
        padding: 0 !important;
        order: 0 !important;
    }

    /* .sticky_layout 在非 overflow 容器中自然工作，无需额外 sticky */
    #aside-content .sticky_layout {
        position: static !important;
    }

    /* recent-post/archives 由右列展示，左列隐藏 */
    #aside-content .card-recent-post,
    #aside-content .card-archives {
        display: none !important;
    }

    /* 中列：覆盖 Butterfly 的 width:74%、padding:50px 40px */
    #content-inner.layout > div:not(#aside-content):not(.right-sticky-col) {
        grid-column: 2 / 3 !important;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    /* 右列 */
    .right-sticky-col {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
        position: sticky !important;
        top: 65px !important;
        align-self: start !important;
        order: 2 !important;
    }

    .right-sticky-col .card-widget {
        width: 100% !important;
        margin: 0 0 20px 0 !important;
        padding: 20px 24px !important;
        position: relative !important;
        overflow: hidden !important;
        border-radius: 8px !important;
    }

    .right-sticky-col .aside-list > .aside-list-item {
        display: flex !important;
        align-items: center !important;
        padding: 6px 0 !important;
    }
    .right-sticky-col .aside-list > .aside-list-item:first-child { padding-top: 0 !important; }
    .right-sticky-col .aside-list > .aside-list-item:last-child  { padding-bottom: 0 !important; }
    .right-sticky-col .aside-list > .aside-list-item:not(:last-child) {
        border-bottom: 1px dashed rgba(245, 245, 245, 0.15) !important;
    }

    .right-sticky-col .thumbnail {
        width: 4em !important;
        min-width: 4em !important;
        height: 4em !important;
        overflow: hidden !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
        display: block !important;
    }
    .right-sticky-col .thumbnail img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }

    .right-sticky-col .aside-list .content {
        flex: 1 !important;
        padding-left: 10px !important;
        overflow: hidden !important;
        min-width: 0 !important;
    }
    .right-sticky-col .aside-list .content .title {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        color: var(--font-color) !important;
        line-height: 1.5 !important;
        font-size: 0.95em !important;
    }
    .right-sticky-col .aside-list .content time {
        display: block !important;
        color: var(--card-meta, #8b949e) !important;
        font-size: 0.85em !important;
        margin-top: 4px !important;
    }

    .right-sticky-col .card-archive-list {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .right-sticky-col .card-archive-list-link {
        display: flex !important;
        align-items: center !important;
        margin: 2px 0 !important;
        padding: 2px 8px !important;
        color: var(--font-color) !important;
        border-radius: 5px !important;
        transition: all .3s !important;
    }
    .right-sticky-col .card-archive-list-link:hover {
        padding: 2px 12px !important;
        background-color: var(--text-bg-hover) !important;
        color: var(--white) !important;
    }
    .right-sticky-col .card-archive-list-date {
        flex: 1 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }
    .right-sticky-col .card-archive-list-count {
        background: var(--tag-bg, rgba(88,166,255,0.15)) !important;
        border-radius: 4px !important;
        padding: 0 6px !important;
        font-size: 12px !important;
        color: var(--font-color) !important;
    }
}

/* ------------------------------------------
   4. 导航 & 页脚
   ------------------------------------------ */
#nav {
    background: rgba(22, 27, 34, 0.85) !important;
    backdrop-filter: blur(10px);
}

#footer { background: #161b22 !important; }

/* 卡片底色 & 边框 */
#aside-content .card-widget,
.right-sticky-col .card-widget,
.recent-post-item {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

/* ------------------------------------------
   5. 个人信息卡片 & Follow Me
   ------------------------------------------ */
#card-info-btn {
    background: #21262d !important;
    color: #58a6ff !important;
    border: 1px solid #58a6ff !important;
    transition: all 0.3s;
}
#card-info-btn:hover {
    background: #58a6ff !important;
    color: #fff !important;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.4);
}

/* ------------------------------------------
   6. 侧边栏：webinfo / TOC
   ------------------------------------------ */
.card-webinfo .item-name {
    color: rgba(255, 255, 255, 0.85) !important;
}
.card-webinfo .item-count {
    color: #f0f6fc !important;
    font-weight: bold;
}

.toc-link { color: rgba(255, 255, 255, 0.7) !important; }
.toc-link.active {
    background: #1f6feb !important;
    color: #fff !important;
    border-radius: 4px;
}

/* ------------------------------------------
   7. 代码块
   ------------------------------------------ */
code {
    background: #21262d !important;
    color: #c9d1d9 !important;
}

figure.highlight {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 6px;
}
figure.highlight .highlight-tools {
    background: #21262d !important;
    color: #c9d1d9 !important;
}
figure.highlight pre,
figure.highlight .code pre,
figure.highlight table {
    background: #161b22 !important;
    color: #c9d1d9 !important;
}
figure.highlight .gutter pre {
    background: #0d1117 !important;
    color: #484f58 !important;
}

/* ------------------------------------------
   8. 归档 / 标签 / 分类 列表页
   ------------------------------------------ */
#archive .article-sort-title,
#tag .article-sort-title,
#category .article-sort-title,
#body-wrap.type-tags #page .page-title,
#body-wrap.type-categories #page .page-title {
    text-align: center !important;
    margin-left: 0 !important;
    border-bottom: 1px solid #30363d !important;
    padding-bottom: 16px !important;
}

.article-sort-title {
    color: #f0f6fc !important;
    border: none !important;
    margin-bottom: 20px !important;
}

.article-sort {
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
}

.article-sort-item.year {
    font-size: 1.1em !important;
    font-weight: 700 !important;
    color: #f0f6fc !important;
    margin: 24px 0 12px 0 !important;
    padding-bottom: 6px !important;
    border-bottom: 1px solid #30363d !important;
}

.article-sort-item {
    margin: 0 0 4px 0 !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4) !important;
}

.article-sort-item:not(.year) {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

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

.article-sort-item.year:before,
.article-sort-item:before,
.article-sort-title:before,
.article-sort-title:after {
    display: none !important;
}

.article-sort-item-time {
    color: #8b949e !important;
    font-size: 0.85em !important;
    white-space: nowrap !important;
    min-width: 85px !important;
}

.article-sort-item-title {
    color: #c9d1d9 !important;
    font-size: 1em !important;
}
.article-sort-item-title:hover {
    color: #58a6ff !important;
    transform: none !important;
}

.article-sort-item-img {
    width: 4em !important;
    min-width: 4em !important;
    height: 4em !important;
    overflow: hidden !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
}
.article-sort-item-img img,
.article-sort-item-img div {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.post-meta-date, .post-meta-label { color: #8b949e !important; }

/* 分类页按钮样式 */
.category-lists .category-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.category-lists .category-list-item {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    background: var(--btn-bg, #21262d) !important;
    border: 1px solid #30363d !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    transition: border-color 0.2s !important;
}
.category-lists .category-list-item:hover { border-color: #58a6ff !important; }
.category-lists .category-list-item::before { display: none !important; }
.category-lists .category-list-link {
    display: block !important;
    padding: 6px 10px 6px 14px !important;
    color: var(--font-color, #c9d1d9) !important;
    font-size: 0.95em !important;
    text-decoration: none !important;
}
.category-lists .category-list-item:hover .category-list-link { color: #58a6ff !important; }
.category-lists .category-list-count {
    display: inline-flex !important;
    align-items: center !important;
    background: transparent !important;
    color: #8b949e !important;
    padding: 0 10px 0 4px !important;
    font-size: 0.85em !important;
}
.category-lists .category-list-child {
    padding-left: 12px !important;
    flex-basis: 100% !important;
}

/* 侧边栏分类卡片（Butterfly v5：card-category-list-*） */
.card-category-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.card-category-list-item {
    margin: 0 !important;
    border-bottom: 1px solid rgba(48, 54, 61, 0.3) !important;
}
.card-category-list-item::before { display: none !important; content: none !important; }
.card-category-list-link {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px !important;
    color: #c9d1d9 !important;
    text-decoration: none !important;
    transition: background 0.2s;
}
.card-category-list-link:hover {
    background: rgba(88, 166, 255, 0.08) !important;
    color: #58a6ff !important;
}
.card-category-list-name {
    flex: 1;
    color: #c9d1d9 !important;
    font-size: 1.05em;
}
.card-category-list-count {
    color: #8b949e !important;
    font-size: 0.9em;
    margin-left: 8px;
}

/* 标签云 */
.card-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
}
.card-tag-cloud a {
    display: inline-block;
    color: #8b949e !important;
    font-size: 0.9em;
    transition: color 0.2s, transform 0.2s;
}
.card-tag-cloud a:hover {
    color: #58a6ff !important;
    transform: translateY(-2px);
}

/* ------------------------------------------
   9. 页面过渡动画
   ------------------------------------------ */
#content-inner { animation: quickFade 0.15s ease-out; }

@keyframes quickFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ------------------------------------------
   10. 隐藏不需要的 UI
   ------------------------------------------ */
#rightside-config,
.theme-switch,
.menu-separator,
.card-info-social-icons { display: none !important; }

.site-data a {
    pointer-events: none !important;
    cursor: default !important;
}

#body-wrap.type-tags #post-comment,
#body-wrap.type-categories #post-comment { display: none !important; }
