/* ============================================================
   LLog — 主题样式
   深蓝渐变 + #FF7F00 强调色 + 毛玻璃
   ============================================================ */

:root {
    --accent: #FF7F00;
    --accent-soft: #FF9F40;
    --bg-base: rgba(60, 91, 147, 0.6);
    --glass: rgba(21, 23, 34, 0.38);
    --glass-strong: rgba(21, 23, 34, 0.62);
    --line: rgba(255, 255, 255, 0.14);
    --line-solid: rgba(255, 255, 255, 0.25);
    --text: #FFFFFF;
    --text-soft: rgba(255, 255, 255, 0.88);
    --text-dim: #b3b3b3;
    --radius: 14px;
    --radius-sm: 8px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono",
                 Menlo, "Courier New", monospace;
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; }

html, body, ul, ol, li, a, h1, h2, h3, h4, p, figure, blockquote {
    margin: 0;
    padding: 0;
}

a { text-decoration: none; }
hr { border: none; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    background-color: var(--bg-base);
    background-image: linear-gradient(140deg, rgba(61, 66, 96, 0.6) 20%, rgba(21, 23, 34, 0.8));
    background-attachment: fixed;
    font-family: var(--font-sans);
    color: var(--text);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#particles-js {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== 页面容器 ===== */
.page-wrap {
    position: relative;
    z-index: 10;
    max-width: 760px;
    margin: 0 auto;
    padding: 34px 20px 40px;
}

/* 文章页更宽，容纳左侧目录 */
.page-wrap.wrap-wide { max-width: 1120px; }

/* ===== 页头：头像 + 站名，左上角 ===== */
.page-header {
    margin-bottom: 30px;
    animation: fade-down .5s ease both;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.brand-avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: #1c1f2e;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
    transition: border-color .35s ease, transform .55s ease;
}

.brand:hover .brand-avatar {
    border-color: var(--accent);
    transform: rotate(360deg);
}

.brand-name {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 3px;
    transition: color .3s ease;
}

.brand:hover .brand-name { color: var(--accent); }

/* ===== 首页搜索 ===== */
.hero {
    margin-bottom: 24px;
    animation: fade-down .5s .06s ease both;
}

.search-box {
    width: 100%;
    max-width: 340px;
    padding: 9px 17px;
    border: 1px solid var(--line-solid);
    border-radius: 20px;
    background: var(--glass);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all .3s ease;
    -webkit-appearance: none;
}

.search-box::placeholder { color: rgba(255, 255, 255, 0.4); }

.search-box:focus {
    border-color: var(--accent);
    background: var(--glass-strong);
    box-shadow: 0 0 0 3px rgba(255, 127, 0, 0.15);
}

/* ===== 文章卡片列表 ===== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    position: relative;
    border: 1px solid var(--line-solid);
    border-radius: var(--radius);
    background: var(--glass);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
    transition: transform .3s ease, border-color .3s ease, background .3s ease, box-shadow .3s ease;
    animation: fade-up .45s ease both;
}

.post-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    transform: translateX(-3px);
    transition: transform .3s ease;
}

.post-card:hover {
    border-color: rgba(255, 127, 0, 0.55);
    background: var(--glass-strong);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.post-card:hover::before { transform: translateX(0); }

.post-card-link {
    display: block;
    color: inherit;
    padding: 20px 26px;
}

.post-title {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: .5px;
    line-height: 1.5;
    color: #FFF;
    transition: color .3s ease;
}

.post-card:hover .post-title { color: var(--accent-soft); }

.post-meta {
    font-size: 12.5px;
    color: var(--text-dim);
    margin-top: 7px;
    font-family: var(--font-mono);
    letter-spacing: .5px;
}

.post-excerpt {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 9px;
    line-height: 1.8;
}

.empty, .no-result {
    color: var(--text-dim);
    font-size: 14px;
    padding: 36px 0;
}

/* ===== 文章页两栏布局 ===== */
.article-layout.has-toc {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

/* ===== 左侧层次目录 ===== */
.toc-sidebar {
    position: sticky;
    top: 26px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    animation: fade-up .45s ease both;
}

.toc-title {
    font-size: 11.5px;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

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

/* 嵌套层级：缩进 + 左引导线，体现层次 */
.toc ul ul {
    margin: 3px 0 3px 8px;
    padding-left: 11px;
    border-left: 1px solid var(--line);
}

.toc li { margin: 2px 0; }

.toc a {
    display: block;
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.62);
    border-left: 2px solid transparent;
    padding-left: 8px;
    margin-left: -10px;
    transition: color .25s ease, border-color .25s ease;
}

/* 层级越深字号越小一档 */
.toc ul ul a { font-size: 12.5px; }
.toc ul ul ul a { font-size: 12px; }

.toc a:hover { color: #FFF; }

.toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
}

.toc-sidebar::-webkit-scrollbar { width: 4px; }
.toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 3px;
}

/* ===== 文章正文 ===== */
.article {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: rgba(21, 23, 34, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 34px 38px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    animation: fade-up .45s ease both;
    min-width: 0;
}

.article-head {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.article-head h1 {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.article-body {
    font-size: 15.5px;
    color: var(--text-soft);
    overflow-wrap: break-word;
    min-width: 0;
}

.article-body > *:first-child { margin-top: 18px; }

.article-body p { margin: 16px 0; }

.article-body h2,
.article-body h3,
.article-body h4 {
    color: #FFF;
    font-weight: 600;
    line-height: 1.5;
    scroll-margin-top: 20px;
}

.article-body h2 {
    font-size: 20.5px;
    margin: 32px 0 14px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.article-body h3 {
    font-size: 17.5px;
    margin: 26px 0 12px;
    color: var(--accent-soft);
}

.article-body h4 { font-size: 15.5px; margin: 20px 0 10px; }

.header-anchor {
    margin-left: 8px;
    color: var(--accent);
    opacity: 0;
    font-weight: 400;
    transition: opacity .25s ease;
}

h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor { opacity: .75; }

.article-body a {
    color: var(--accent-soft);
    border-bottom: 1px solid rgba(255, 159, 64, 0.35);
    transition: all .25s ease;
}

.article-body a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

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

.article-body li { margin: 7px 0; }
.article-body li::marker { color: var(--accent); }
.article-body strong { color: #FFF; font-weight: 600; }
.article-body em { color: var(--accent-soft); font-style: italic; }

.article-body hr {
    height: 1px;
    background: var(--line);
    margin: 30px 0;
}

.article-body blockquote {
    margin: 20px 0;
    padding: 12px 20px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: rgba(255, 127, 0, 0.07);
    color: rgba(255, 255, 255, 0.78);
}

.article-body blockquote p { margin: 6px 0; }

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

/* 行内代码 */
.article-body :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 13.5px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--accent-soft);
    word-break: break-word;
}

/* 表格 */
.table-wrap {
    margin: 22px 0;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-solid);
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-wrap th,
.table-wrap td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.table-wrap th {
    background: rgba(255, 255, 255, 0.07);
    color: #FFF;
    font-weight: 600;
    white-space: nowrap;
}

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tbody tr { transition: background .25s ease; }
.table-wrap tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

/* ===== 代码块 ===== */
.code-block {
    margin: 22px 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #16181f;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

.code-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-lang {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.code-copy {
    padding: 3px 11px;
    border: 1px solid var(--line-solid);
    border-radius: 12px;
    background: transparent;
    color: var(--text-dim);
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all .25s ease;
}

.code-copy:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFF;
}

.code-copy.copied {
    background: #2ea043;
    border-color: #2ea043;
    color: #FFF;
}

.code-block pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
    background: transparent;
    max-width: 100%;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    color: #e6e6e6;
    background: none;
    border: none;
    padding: 0;
    white-space: pre;
    tab-size: 4;
}

.code-block pre::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar { height: 7px; }

.code-block pre::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
}

.code-block pre::-webkit-scrollbar-thumb:hover { background: rgba(255, 127, 0, 0.5); }

/* ===== 语法高亮配色 ===== */
.hljs-comment,
.hljs-quote { color: #6b7280; font-style: italic; }

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-doctag,
.hljs-name,
.hljs-type { color: #ff9f40; }

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string { color: #98c379; }

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo { color: #d19a66; }

.hljs-title,
.hljs-title.function_,
.hljs-title.class_,
.hljs-built_in { color: #61afef; }

.hljs-variable,
.hljs-template-variable,
.hljs-selector-id,
.hljs-selector-class,
.hljs-attr { color: #e5c07b; }

.hljs-params { color: #dcdcdc; }

.hljs-operator,
.hljs-punctuation { color: #56b6c2; }

.hljs-deletion { color: #e06c75; }
.hljs-meta { color: #7f848e; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ===== 返回 / 页脚 ===== */
.back-link {
    display: inline-block;
    margin-top: 26px;
    padding: 7px 17px;
    border: 1px solid var(--line-solid);
    border-radius: 18px;
    color: var(--text-dim);
    font-size: 13.5px;
    transition: all .3s ease;
}

.back-link:hover {
    color: #FFF;
    background: var(--accent);
    border-color: var(--accent);
}

.page-footer {
    font-size: 12.5px;
    color: var(--text-dim);
    margin-top: 50px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

/* ===== 回到顶部 ===== */
.to-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line-solid);
    background: var(--glass-strong);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #FFF;
    font-size: 17px;
    cursor: pointer;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all .3s ease;
}

.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--accent); border-color: var(--accent); }

/* ===== 动画 ===== */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-down {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.post-card:nth-child(1) { animation-delay: .04s; }
.post-card:nth-child(2) { animation-delay: .08s; }
.post-card:nth-child(3) { animation-delay: .12s; }
.post-card:nth-child(4) { animation-delay: .16s; }
.post-card:nth-child(5) { animation-delay: .2s; }
.post-card:nth-child(n+6) { animation-delay: .24s; }

/* ===== 响应式 ===== */

/* 窄到放不下侧栏时，目录移到正文上方 */
@media (max-width: 900px) {
    .article-layout.has-toc {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .toc-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.04);
        padding: 14px 18px;
    }
}

@media (max-width: 640px) {
    .page-wrap { padding: 26px 15px 30px; }
    .article { padding: 24px 20px; }
    .article-head h1 { font-size: 21.5px; }
    .article-body { font-size: 15px; }
    .post-card-link { padding: 17px 20px; }
    .post-title { font-size: 17.5px; }
    .brand-avatar { width: 38px; height: 38px; }
    .brand-name { font-size: 18px; }
    .search-box { max-width: 100%; }
    .code-block code { font-size: 12.5px; }
    .to-top { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    html { scroll-behavior: auto; }
}

@media print {
    body { background: #fff; color: #000; }
    #particles-js, .to-top, .code-copy, .back-link, .hero, .toc-sidebar { display: none !important; }
    .article-layout.has-toc { display: block; }
    .article { border: none; box-shadow: none; background: none; padding: 0; }
    .article-body, .article-head h1, .article-body h2, .article-body h3 { color: #000; }
    .code-block { border: 1px solid #ccc; background: #f6f6f6; }
    .code-block code { color: #000; }
}
