/* ============================================ */
/* Topic (文章专题) Pages                        */
/* ============================================ */

/* === 中心页 === */
.topics-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.topic-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transform: translateY(16px);
    animation: topicCardIn 0.45s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.topic-card:nth-child(3n+2) { animation-delay: 0.06s; }
.topic-card:nth-child(3n+3) { animation-delay: 0.12s; }

@keyframes topicCardIn {
    to { opacity: 1; transform: translateY(0); }
}

.topic-card:hover {
    border-color: rgba(86,156,214,0.45);
    background: rgba(255,255,255,0.04);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

.topic-card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0a0e27 0%, #101630 100%);
    overflow: hidden;
}

.topic-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.topic-card:hover .topic-card-cover img { transform: scale(1.04); }

.topic-card-cover-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(86,156,214,0.5);
}

.topic-card-cover-fallback i,
.topic-card-cover-fallback svg { width: 44px; height: 44px; }

.topic-card-featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(220,220,170,0.14);
    border: 1px solid rgba(220,220,170,0.35);
    color: var(--code-yellow, #dcdcaa);
    backdrop-filter: blur(8px);
}

.topic-card-featured-badge i,
.topic-card-featured-badge svg { width: 12px; height: 12px; }

.topic-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.topic-card-title {
    font-size: 17px;
    font-weight: 600;
    color: #e8e8e8;
    margin-bottom: 6px;
    line-height: 1.45;
}

.topic-card-subtitle {
    font-size: 13px;
    color: var(--code-blue, #569cd6);
    margin-bottom: 8px;
    line-height: 1.5;
}

.topic-card-desc {
    font-size: 13px;
    color: #8a8f98;
    line-height: 1.6;
    margin-bottom: 14px;
    flex: 1;
}

.topic-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #6b7078;
}

.topic-card-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.topic-card-count i,
.topic-card-count svg { width: 13px; height: 13px; }

.topic-card-label {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(86,156,214,0.1);
    border: 1px solid rgba(86,156,214,0.25);
    color: var(--code-blue, #569cd6);
    font-size: 11px;
}

.topics-empty {
    text-align: center;
    padding: 90px 20px;
    color: #6b7078;
}

.topics-empty i,
.topics-empty svg { width: 46px; height: 46px; opacity: 0.45; margin-bottom: 14px; }

.topics-empty p { font-size: 15px; }

/* === 详情页 banner 计数 === */
.topic-banner-count {
    margin: 12px 0 0;
    font-size: 13px;
    color: #7d838d;
}

/* === 海报式大 Banner（有主图时） === */
.topic-posterbanner {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    height: 440px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.topic-posterbanner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topic-posterbanner-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(5,5,10,0.15) 0%, rgba(5,5,10,0.35) 40%, rgba(5,5,10,0.92) 100%);
}

.topic-posterbanner-inner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px 40px;
    z-index: 2;
}

.topic-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 14px;
    color: rgba(255,255,255,0.55);
}

.topic-breadcrumb a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color 0.25s;
}

.topic-breadcrumb a:hover { color: #fff; }

.topic-breadcrumb .breadcrumb-sep { color: rgba(255,255,255,0.35); }
.topic-breadcrumb .breadcrumb-current { color: #569cd6; }

.topic-posterbanner-title {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-shadow: 0 2px 24px rgba(0,0,0,0.6);
    margin: 0 0 10px;
}

.topic-posterbanner-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.85);
    line-height: 1.6;
    max-width: 720px;
    margin: 0 0 16px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.topic-posterbanner-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.topic-posterbanner-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
}

.topic-posterbanner-count i,
.topic-posterbanner-count svg { width: 14px; height: 14px; }

.topic-posterbanner-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.topic-posterbanner-tag {
    font-size: 12px;
    color: #c8d5e8;
    background: rgba(86,156,214,0.22);
    border: 1px solid rgba(86,156,214,0.4);
    padding: 5px 12px;
    border-radius: 999px;
}

@media (max-width: 768px) {
    .topic-posterbanner { height: 340px; }
    .topic-posterbanner-inner { padding: 0 20px 28px; }
    .topic-posterbanner-title { font-size: 25px; }
    .topic-posterbanner-subtitle { font-size: 14px; }
}

/* === 详情页布局 === */
.topic-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 24px 80px;
}

.topic-hero {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 28px;
}

.topic-hero img {
    width: 100%;
    display: block;
    max-height: 420px;
    object-fit: cover;
}

.topic-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.topic-main {
    flex: 1;
    min-width: 0;
}

.topic-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 96px;
}

/* === 正文 markdown === */
.topic-prose {
    font-size: 15.5px;
    line-height: 1.85;
    color: #cfd3d9;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 30px 34px;
    margin-bottom: 28px;
}

.topic-prose h2 {
    font-size: 21px;
    color: #ececec;
    margin: 26px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--code-blue, #569cd6);
}

.topic-prose h2:first-child { margin-top: 0; }

.topic-prose h3 {
    font-size: 17px;
    color: #e2e2e2;
    margin: 22px 0 10px;
}

.topic-prose p { margin: 0 0 14px; }

.topic-prose ul,
.topic-prose ol { margin: 0 0 14px; padding-left: 24px; }

.topic-prose li { margin-bottom: 6px; }

.topic-prose a { color: var(--code-blue, #569cd6); text-decoration: none; }
.topic-prose a:hover { text-decoration: underline; }

.topic-prose img {
    max-width: 100%;
    border-radius: 10px;
    margin: 10px 0;
}

.topic-prose blockquote {
    border-left: 3px solid var(--code-purple, #c586c0);
    background: rgba(197,134,192,0.06);
    padding: 10px 16px;
    border-radius: 0 10px 10px 0;
    margin: 0 0 14px;
    color: #aeb3bb;
}

.topic-prose code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    background: rgba(255,255,255,0.07);
    padding: 2px 6px;
    border-radius: 5px;
}

.topic-prose pre {
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 16px;
    overflow-x: auto;
    margin: 0 0 14px;
}

.topic-prose pre code { background: none; padding: 0; }

.topic-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 14px;
    font-size: 14px;
}

.topic-prose th,
.topic-prose td {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px;
    text-align: left;
}

.topic-prose th { background: rgba(255,255,255,0.05); }

/* === 子分类筛选 === */
.topic-filter { margin-bottom: 18px; }

.topic-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.topic-filter-tab {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
    color: #9aa0a8;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.02);
    transition: all 0.2s;
}

.topic-filter-tab:hover {
    color: #dfe3e8;
    border-color: rgba(86,156,214,0.5);
}

.topic-filter-tab.active {
    color: #fff;
    background: rgba(86,156,214,0.18);
    border-color: var(--code-blue, #569cd6);
}

/* === 文章列表 === */
.topic-article-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.topic-article-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(12px);
    animation: topicCardIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.topic-article-item:nth-child(2n) { animation-delay: 0.05s; }
.topic-article-item:nth-child(3n) { animation-delay: 0.1s; }

.topic-article-item:hover {
    border-color: rgba(86,156,214,0.45);
    background: rgba(255,255,255,0.045);
    transform: translateX(3px);
}

.topic-article-index {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--code-blue, #569cd6);
    background: rgba(86,156,214,0.1);
    border: 1px solid rgba(86,156,214,0.25);
}

.topic-article-cover {
    flex-shrink: 0;
    width: 96px;
    height: 62px;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #0a0e27 0%, #101630 100%);
}

.topic-article-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.topic-article-cover-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(86,156,214,0.5);
}

.topic-article-cover-fallback i,
.topic-article-cover-fallback svg { width: 22px; height: 22px; }

.topic-article-body {
    flex: 1;
    min-width: 0;
}

.topic-article-title {
    font-size: 15px;
    font-weight: 600;
    color: #e4e6ea;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-article-excerpt {
    font-size: 12.5px;
    color: #82878f;
    line-height: 1.55;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #6b7078;
}

.topic-article-type {
    padding: 1px 8px;
    border-radius: 5px;
    font-size: 11px;
}

.topic-type-news {
    color: var(--code-green, #6a9955);
    background: rgba(106,153,85,0.12);
    border: 1px solid rgba(106,153,85,0.3);
}

.topic-type-tutorial {
    color: var(--code-purple, #c586c0);
    background: rgba(197,134,192,0.1);
    border: 1px solid rgba(197,134,192,0.3);
}

.topic-type-case {
    color: var(--code-orange, #ce9178);
    background: rgba(206,145,120,0.1);
    border: 1px solid rgba(206,145,120,0.3);
}

.topic-article-label {
    padding: 1px 8px;
    border-radius: 5px;
    background: rgba(86,156,214,0.1);
    border: 1px solid rgba(86,156,214,0.25);
    color: var(--code-blue, #569cd6);
}

.topic-article-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #565b63;
    transition: transform 0.2s, color 0.2s;
}

.topic-article-item:hover .topic-article-arrow {
    transform: translateX(3px);
    color: var(--code-blue, #569cd6);
}

/* === 侧栏 === */
.topic-side-card {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.topic-side-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #dfe2e7;
    margin-bottom: 12px;
}

.topic-side-title i,
.topic-side-title svg { width: 16px; height: 16px; color: var(--code-blue, #569cd6); }

.topic-side-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 9px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.topic-side-item:hover { background: rgba(255,255,255,0.05); }

.topic-side-item-title {
    font-size: 13px;
    color: #c6cad1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-side-item:hover .topic-side-item-title { color: var(--code-blue, #569cd6); }

.topic-side-item-sub {
    font-size: 11.5px;
    color: #6b7078;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-side-all {
    margin-top: 6px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    color: #8a9099;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-radius: 0;
    padding-top: 13px;
}

.topic-side-all:hover { color: var(--code-blue, #569cd6); background: none; }
.topic-side-all i, .topic-side-all svg { width: 13px; height: 13px; }

/* === 明亮模式 === */
body.light-mode .topic-card {
    border-color: rgba(0,0,0,0.07);
    background: rgba(255,255,255,0.6);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body.light-mode .topic-card:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(86,156,214,0.55);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

body.light-mode .topic-card-title { color: #22262b; }
body.light-mode .topic-card-desc { color: #5c626b; }
body.light-mode .topic-card-cover { background: linear-gradient(135deg, #e8edf5 0%, #dde5f2 100%); }
body.light-mode .topic-card-cover-fallback { color: rgba(86,156,214,0.6); }

body.light-mode .topic-prose {
    color: #33383f;
    background: rgba(255,255,255,0.65);
    border-color: rgba(0,0,0,0.07);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body.light-mode .topic-prose h2 { color: #1f242a; }
body.light-mode .topic-prose h3 { color: #2a2f36; }
body.light-mode .topic-prose blockquote { color: #5a5f66; background: rgba(197,134,192,0.08); }
body.light-mode .topic-prose pre { background: #f6f8fa; border-color: rgba(0,0,0,0.08); }
body.light-mode .topic-prose pre code { color: #24292f; }
body.light-mode .topic-prose code { background: rgba(0,0,0,0.06); color: #c7254e; }
body.light-mode .topic-prose th,
body.light-mode .topic-prose td { border-color: rgba(0,0,0,0.1); }
body.light-mode .topic-prose th { background: rgba(0,0,0,0.03); }

body.light-mode .topic-filter-tab {
    color: #5c626b;
    border-color: rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.6);
}

body.light-mode .topic-filter-tab:hover { color: #1f242a; border-color: rgba(86,156,214,0.6); }

body.light-mode .topic-filter-tab.active {
    color: #fff;
    background: #4a8bc2;
    border-color: #4a8bc2;
}

body.light-mode .topic-article-item {
    border-color: rgba(0,0,0,0.07);
    background: rgba(255,255,255,0.6);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

body.light-mode .topic-article-item:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(86,156,214,0.55);
}

body.light-mode .topic-article-title { color: #24282e; }
body.light-mode .topic-article-excerpt { color: #5c626b; }
body.light-mode .topic-article-cover { background: linear-gradient(135deg, #e8edf5 0%, #dde5f2 100%); }

body.light-mode .topic-side-card {
    border-color: rgba(0,0,0,0.07);
    background: rgba(255,255,255,0.6);
}

body.light-mode .topic-side-title { color: #24282e; }
body.light-mode .topic-side-item-title { color: #3a4048; }
body.light-mode .topic-side-item:hover { background: rgba(0,0,0,0.04); }
body.light-mode .topic-banner-count { color: #7a8089; }

/* === 响应式 === */
@media (max-width: 1024px) {
    .topics-grid { grid-template-columns: repeat(2, 1fr); }
    .topic-layout { flex-direction: column; }
    .topic-sidebar { width: 100%; position: static; }
}

@media (max-width: 640px) {
    .topics-grid { grid-template-columns: 1fr; }
    .topics-page, .topic-page { padding-left: 14px; padding-right: 14px; }
    .topic-prose { padding: 20px 18px; }
    .topic-article-cover { width: 72px; height: 50px; }
    .topic-article-excerpt { display: none; }
}