/* 文章页样式：从 _layouts/blog-post.html 的内联 <style> 抽离而来。
   由 blog-post 布局通过 <link> 引入，便于浏览器缓存与复用。 */

/* 固定标题栏 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--jet);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-title {
    color: var(--white-2);
    font-size: var(--fs-5);
    font-weight: var(--fw-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--border-gradient-onyx);
    color: var(--light-gray);
    border-radius: 8px;
    text-decoration: none;
    font-size: var(--fs-8);
    transition: var(--transition-1);
    position: relative;
    z-index: 1;
}

.header-btn::before {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--bg-gradient-jet);
    border-radius: inherit;
    z-index: -1;
    transition: var(--transition-1);
}

.header-btn:hover {
    background: var(--bg-gradient-yellow-1);
    color: var(--white-2);
}

.header-btn:hover::before {
    background: var(--bg-gradient-yellow-2);
}

/* 主内容区域 */
.blog-container {
    margin-top: 60px;
    background: var(--eerie-black-2);
    border: 1px solid var(--jet);
    border-radius: 20px;
    padding: 15px;
    box-shadow: var(--shadow-1);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 30px;
}

.blog-content {
    padding: 40px;
    background: var(--bg-gradient-jet);
    border-radius: 14px;
}

/* 文章元信息 */
.post-meta {
    background: var(--eerie-black-1);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid var(--jet);
}

.post-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 25px;
    color: var(--light-gray-70);
    font-size: var(--fs-8);
}

.post-meta-item ion-icon {
    font-size: 16px;
    color: var(--vegas-gold);
}

.post-meta-item .series-badge {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    color: #3b82f6;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: var(--fw-500);
}

.post-meta-counter-panel {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: counter-fade-in 0.3s ease;
}

.post-meta-counter-panel.is-visible {
    display: block;
}

.post-meta-counter-panel.is-hidden {
    display: none;
}

.post-meta-counter-item {
    margin-right: 0;
}

.post-meta-counter-item.is-hidden {
    display: none;
}

.post-meta-counter-item .counter-value {
    color: var(--white-2);
    font-weight: var(--fw-600);
}

@keyframes counter-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

/* 文章标题 */
.blog-content h1 {
    font-size: 2.5em;
    color: var(--white-2);
    margin-bottom: 20px;
    line-height: 1.3;
}

/* 正文样式 */
.blog-content h2 {
    font-size: 1.8em;
    color: var(--white-2);
    margin-top: 48px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--orange-yellow-crayola);
    line-height: 1.4;
}

.blog-content h3 {
    font-size: 1.4em;
    color: var(--white-2);
    margin-top: 36px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.blog-content h4 {
    font-size: 1.2em;
    color: var(--white-2);
    margin-top: 28px;
    margin-bottom: 14px;
    line-height: 1.4;
}

.blog-content h5 {
    font-size: 1.1em;
    color: var(--white-2);
    margin-top: 24px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.blog-content h6 {
    font-size: 1em;
    color: var(--light-gray);
    margin-top: 20px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.blog-content p {
    color: var(--light-gray);
    font-size: var(--fs-6);
    line-height: 1.7;
    margin-bottom: 20px;
}

.blog-content code {
    background: rgba(255, 215, 0, 0.1);
    color: var(--orange-yellow-crayola);
    padding: 3px 9px;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.88em;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

/* 代码块外层容器 - 只有这一层有背景和边框 */
.blog-content div.highlight,
.blog-content div.highlighter-rouge {
    background: #272822;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 没有 highlight 包裹的纯 pre 元素 */
.blog-content pre:not(.highlight pre) {
    background: #272822;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 内层 highlight 和 pre 全部透明 */
.blog-content div.highlighter-rouge .highlight,
.blog-content div.highlight pre,
.blog-content .highlighter-rouge pre {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 代码块内的 code 元素 - 完全透明 */
.blog-content pre code,
.blog-content .highlight code,
.blog-content .highlighter-rouge code {
    background: transparent !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    color: #f8f8f2;
    white-space: pre !important;
    display: block;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 代码块样式保障 */
.blog-content pre span,
.blog-content code span,
.blog-content .highlight span {
    display: inline;
}

.blog-content blockquote {
    border-left: 5px solid var(--orange-yellow-crayola);
    padding: 18px 24px;
    margin: 30px 0;
    color: var(--light-gray);
    font-style: normal;
    background: linear-gradient(to right, rgba(255, 215, 0, 0.08), transparent);
    border-radius: 0 10px 10px 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.blog-content blockquote p {
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-content ul,
.blog-content ol {
    padding-left: 0;
    margin-bottom: 24px;
    margin-top: 12px;
}

.blog-content li {
    color: var(--light-gray);
    margin-bottom: 10px;
    line-height: 1.7;
    padding-left: 0;
    position: relative;
}

.blog-content li:last-child {
    margin-bottom: 0;
}

/* 无序列表 */
.blog-content ul {
    list-style: none;
}

/* 无序列表：::before 作为 inline 内容，紧贴文字前显示
   - li 不加额外 padding，文字与段落/标题左对齐
   - li p { display:inline } 使 kramdown 生成的 <p> 内联化，bullet 与文字共行
   - 嵌套 <ul> 是块级，自然另起一行，通过 padding-left 实现缩进层级 */
.blog-content ul>li {
    padding-left: 0;
    display: block;
}

.blog-content ul>li::before {
    content: "•\00a0\00a0";
    /* bullet + 两个不换行空格作间距 */
    color: var(--orange-yellow-crayola);
    font-size: 1.2em;
    font-weight: bold;
    display: inline;
    line-height: inherit;
}

/* 嵌套无序列表：通过 padding-left 缩进，体现层级 */
.blog-content ul ul {
    padding-left: 1.6em;
    margin-top: 8px;
    margin-bottom: 4px;
}

.blog-content ul ul>li::before {
    content: "◦\00a0\00a0";
    font-size: 1.2em;
}

/* 第三层嵌套 */
.blog-content ul ul ul {
    padding-left: 1.4em;
}

.blog-content ul ul ul>li::before {
    content: "▪\00a0\00a0";
    font-size: 1em;
}



/* 有序列表 */
.blog-content ol {
    list-style: none;
    counter-reset: item;
}

.blog-content ol>li {
    padding-left: 40px;
    counter-increment: item;
    position: relative;
}

.blog-content ol>li::before {
    content: counter(item) ".";
    color: var(--orange-yellow-crayola);
    font-weight: var(--fw-600);
    position: absolute;
    left: 0;
    top: 0;
    min-width: 28px;
    text-align: left;
    padding-left: 8px;
}

/* 嵌套有序列表 */
.blog-content ol ol {
    counter-reset: subitem;
    margin-top: 10px;
    margin-bottom: 10px;
}

.blog-content ol ol>li {
    counter-increment: subitem;
    padding-left: 36px;
}

.blog-content ol ol>li::before {
    content: counter(item) "." counter(subitem);
    min-width: 32px;
}


/* 加粗文本 */
.blog-content strong {
    color: var(--white-2);
    font-weight: var(--fw-600);
}

/* 斜体文本 */
.blog-content em {
    color: var(--light-gray);
    font-style: italic;
}

/* 列表项中的加粗文本 */
.blog-content li strong {
    color: var(--white-2);
    font-weight: var(--fw-600);
    display: inline;
}

/* 确保列表项内的段落和块级元素正确显示 */
.blog-content li p {
    margin-bottom: 10px;
    display: inline;
}

.blog-content li p:first-child {
    display: inline;
}

/* 水平分隔线 */
.blog-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--orange-yellow-crayola), transparent);
    margin: 40px 0;
    opacity: 0.5;
}

/* 删除线 */
.blog-content del {
    color: var(--light-gray-70);
    text-decoration: line-through;
    opacity: 0.7;
}

/* 键盘按键样式 */
.blog-content kbd {
    background: var(--jet);
    color: var(--white-2);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin: 28px auto;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    background: var(--eerie-black-1);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.blog-content th,
.blog-content td {
    padding: 14px 16px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.6;
}

.blog-content th {
    background: linear-gradient(to bottom, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
    color: var(--orange-yellow-crayola);
    font-weight: var(--fw-600);
    border-bottom: 2px solid var(--orange-yellow-crayola);
}

.blog-content td {
    color: var(--light-gray);
}

.blog-content tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 正文链接（避免默认刺眼蓝色） */
.post-body a {
    display: inline;
    color: var(--orange-yellow-crayola);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: hsla(45, 100%, 72%, 0.45);
    text-decoration-thickness: 1px;
    border-radius: 4px;
    transition:
        color var(--transition-1),
        text-decoration-color var(--transition-1),
        text-shadow var(--transition-1);
}

.post-body a:visited {
    color: var(--vegas-gold);
}

.post-body a:hover {
    text-decoration-color: var(--orange-yellow-crayola);
    text-shadow: 0 0 10px hsla(45, 100%, 72%, 0.25);
}

.post-body a:focus-visible {
    outline: 2px solid var(--orange-yellow-crayola);
    outline-offset: 2px;
}

/* 标签 */
.post-tags {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--jet);
}

.post-tags-title {
    color: var(--light-gray-70);
    font-size: var(--fs-8);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag {
    display: inline-block;
    background: var(--jet);
    color: var(--light-gray-70);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: var(--fs-8);
    margin-right: 10px;
    margin-bottom: 10px;
    transition: var(--transition-1);
}

.tag:hover {
    background: var(--eerie-black-1);
    color: var(--light-gray);
}

/* 导航链接 */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--jet);
    gap: 20px;
}

.nav-link {
    flex: 1;
    padding: 20px;
    background: var(--border-gradient-onyx);
    border-radius: 12px;
    text-decoration: none;
    transition: var(--transition-1);
    position: relative;
    z-index: 1;
    display: block;
}

.nav-link::before {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--bg-gradient-jet);
    border-radius: inherit;
    z-index: -1;
    transition: var(--transition-1);
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.nav-link:hover::before {
    background: linear-gradient(to bottom right, hsla(240, 1%, 18%, 0.351) 0%, hsla(240, 2%, 11%, 0.1) 100%);
}

.nav-link .nav-label {
    color: var(--light-gray-70);
    font-size: var(--fs-8);
    margin-bottom: 8px;
    display: block;
}

.nav-link .nav-title {
    color: var(--white-2);
    font-size: var(--fs-6);
    font-weight: var(--fw-500);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link.prev .nav-title {
    justify-content: flex-start;
}

.nav-link.next .nav-title {
    justify-content: flex-end;
}

.back-to-list {
    text-align: center;
    margin-top: 30px;
}

/* 响应式 */
@media (max-width: 768px) {
    .fixed-header {
        padding: 0 15px;
    }

    .header-title {
        font-size: var(--fs-8);
        max-width: 50%;
    }

    .blog-content {
        padding: 25px 20px;
    }

    .blog-content h1 {
        font-size: 1.8em;
    }

    .blog-content h2 {
        font-size: 1.4em;
    }

    .post-navigation {
        flex-direction: column;
    }

    .nav-link {
        padding: 15px;
    }
}

/* Mermaid图表样式 */
.mermaid {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid var(--jet);
}

/* MathJax 公式样式 */
/* 行间公式 */
.mjx-chtml {
    color: #f8f8f2 !important;
    outline: none;
    font-family: 'Latin-Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif !important;
}

/* 行间公式的上下间距 */
.blog-content p>.mjx-chtml,
.blog-content>.mjx-chtml {
    display: block;
    margin: 20px 0;
    padding: 15px;
    background: rgba(30, 30, 30, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

/* 确保行间公式居中显示 */
.mjx-chtml[jax="CHTML"][display="true"] {
    display: block !important;
    margin: 25px auto !important;
    text-align: center !important;
    padding: 20px;
    background: rgba(30, 30, 30, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(255, 165, 0, 0.2);
    max-width: 100%;
    overflow-x: auto;
}

/* 行内公式 - 全局规则 */
.mjx-chtml[jax="CHTML"][display="false"] {
    display: inline !important;
    margin: 0 2px !important;
    color: #ffa500 !important;
    font-size: 0.95em;
    vertical-align: middle !important;
}

/* 确保行内公式在任何容器中都正确显示 */
p .mjx-chtml[jax="CHTML"][display="false"],
li .mjx-chtml[jax="CHTML"][display="false"],
span .mjx-chtml[jax="CHTML"][display="false"],
td .mjx-chtml[jax="CHTML"][display="false"],
th .mjx-chtml[jax="CHTML"][display="false"] {
    display: inline !important;
}

/* 列表中的行间公式 */
.blog-content li .mjx-chtml[jax="CHTML"][display="true"],
.blog-content li p .mjx-chtml[jax="CHTML"][display="true"] {
    display: block !important;
    margin: 15px 0 !important;
    padding: 12px;
    background: rgba(30, 30, 30, 0.6);
    border-radius: 8px;
    border-left: 3px solid #ffa500;
}

/* 表格中的公式样式 */
.blog-content table .mjx-chtml {
    color: #f8f8f2 !important;
    font-size: 0.9em;
}

/* 表格中的行间公式 */
.blog-content table td .mjx-chtml[jax="CHTML"][display="true"],
.blog-content table th .mjx-chtml[jax="CHTML"][display="true"] {
    display: block !important;
    margin: 10px 0;
    text-align: center;
    color: #f8f8f2 !important;
}

/* 表格中的行内公式 - 保持 inline，橙色高亮 */
.blog-content table td .mjx-chtml[jax="CHTML"][display="false"],
.blog-content table th .mjx-chtml[jax="CHTML"][display="false"] {
    display: inline !important;
    margin: 0 2px !important;
    color: #ffa500 !important;
    vertical-align: middle !important;
}

/* 确保 MathJax 元素在所有情况下都可见 */
mjx-container {
    color: #f8f8f2 !important;
    font-family: 'Latin-Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif !important;
}

.mjx-mi,
.mjx-mo,
.mjx-mn,
.mjx-mtext,
.mjx-mspace {
    color: #f8f8f2 !important;
    font-family: 'Latin-Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif !important;
}

/* 公式中的特殊符号颜色 */
.mjx-mo {
    color: #ffa500 !important;
}

/* 公式容器样式优化 */
.mjx-container {
    font-size: 1em !important;
    font-family: 'Latin-Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif !important;
}

/* 所有 MathJax 元素的字体设置 */
.mjx-chtml .mjx-math,
.mjx-chtml .mjx-mrow,
.mjx-chtml .mjx-mtext,
.mjx-chtml .mjx-mi,
.mjx-chtml .mjx-mo,
.mjx-chtml .mjx-mn {
    font-family: 'Latin-Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif !important;
}
