/* =============================================
   素描风格博客 - Sketch Style Blog
   v2.0 - 丰富装饰 + 交互动效
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;600;700&family=ZCOOL+XiaoWei&family=Ma+Shan+Zheng&display=swap');

:root {
    --bg: #fafaf7;
    --bg-secondary: #f2f1ed;
    --bg-card: #ffffff;
    --text-primary: #1a1a18;
    --text-secondary: #6b6a66;
    --text-muted: #b5b3ae;
    --border: #d8d6d0;
    --border-light: #e8e7e2;
    --border-dark: #b0ada8;
    --accent: #2c2c2a;
    --accent-light: #8a8884;
    --hover: #f0eee9;
    --code-bg: #f5f4f0;
    --shadow: 0 2px 12px rgba(0,0,0,0.04);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.08);
    --font-body: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-heading: 'Noto Serif SC', 'SimSun', 'STSong', serif;
    --font-logo: 'ZCOOL XiaoWei', 'Ma Shan Zheng', 'Noto Serif SC', serif;
    --font-deco: 'Ma Shan Zheng', 'KaiTi', cursive;
    --radius: 0;
    --paper-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
    --bg: #181817;
    --bg-secondary: #1f1f1d;
    --bg-card: #222220;
    --text-primary: #d6d4ce;
    --text-secondary: #8a8884;
    --text-muted: #555450;
    --border: #353432;
    --border-light: #2a2927;
    --border-dark: #4a4945;
    --accent: #c8c6c0;
    --accent-light: #7a7874;
    --hover: #2a2927;
    --code-bg: #252523;
    --shadow: 0 2px 12px rgba(0,0,0,0.2);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    background-color: var(--bg);
    background-image: 
        var(--paper-noise),
        radial-gradient(circle, var(--border-dark) 1px, transparent 1px);
    background-size: auto, 28px 28px;
    animation: dotsDrift 40s linear infinite;
    color: var(--text-primary);
    line-height: 1.9;
    font-size: 15px;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

@keyframes dotsDrift {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 28px 28px; }
}

/* 素描纸边缘装饰 - 四角括号 */
body::before {
    content: '';
    position: fixed;
    top: 12px; left: 12px;
    width: 30px; height: 30px;
    border-top: 2px solid var(--border);
    border-left: 2px solid var(--border);
    opacity: 0.3;
    pointer-events: none;
    z-index: 999;
}
body::after {
    content: '';
    position: fixed;
    bottom: 12px; right: 12px;
    width: 30px; height: 30px;
    border-bottom: 2px solid var(--border);
    border-right: 2px solid var(--border);
    opacity: 0.3;
    pointer-events: none;
    z-index: 999;
}

/* ===== 素描通用装饰 ===== */

/* 手绘分割线 */
.sketch-divider {
    height: 20px;
    position: relative;
    margin: 24px 0;
    overflow: hidden;
}
.sketch-divider::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 12px,
        transparent 12px, transparent 16px,
        var(--border) 16px, var(--border) 28px,
        transparent 28px, transparent 32px
    );
    transform: translateY(-50%) scaleY(0.6);
}

/* 手绘角落装饰 - 右上 */
.corner-deco {
    position: absolute;
    pointer-events: none;
    opacity: 0.15;
    transition: opacity 0.4s;
}
.corner-deco-tl {
    top: -1px; left: -1px;
    border-top: 2px solid var(--text-primary);
    border-left: 2px solid var(--text-primary);
    width: 20px; height: 20px;
}
.corner-deco-br {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--text-primary);
    border-right: 2px solid var(--text-primary);
    width: 20px; height: 20px;
}
.corner-deco-tr {
    top: -1px; right: -1px;
    border-top: 2px solid var(--text-primary);
    border-right: 2px solid var(--text-primary);
    width: 16px; height: 16px;
}
.corner-deco-bl {
    bottom: -1px; left: -1px;
    border-bottom: 2px solid var(--text-primary);
    border-left: 2px solid var(--text-primary);
    width: 16px; height: 16px;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.25s, opacity 0.25s;
}
a:hover {
    opacity: 0.7;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

::selection {
    background: var(--text-primary);
    color: var(--bg);
}

/* ===== 素描风格滚动条 ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border: 1px solid var(--border-dark);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* ===== 主内容包裹（撑开 footer 到底部） ===== */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ===== 布局 ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
    width: 100%;
}

/* ===== Header ===== */
.header {
    border-bottom: 2px solid var(--border-light);
    background-color: var(--bg);
    background-image: var(--paper-noise);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.4s, border-color 0.4s;
}
.header::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 20px,
        transparent 20px, transparent 30px
    );
    opacity: 0.3;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-logo);
    font-size: 1.6em;
    letter-spacing: 4px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    position: relative;
    padding: 4px 0;
    transition: letter-spacing 0.3s;
}
.logo:hover {
    letter-spacing: 6px;
    opacity: 1;
}
.logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--text-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
.logo:hover::after {
    transform: scaleX(1);
}
.logo-text {
    font-size: inherit;
}
.logo-img {
    height: 38px;
    width: auto;
    display: block;
    transition: opacity 0.3s;
}

/* 导航 */
.nav {
    display: flex;
    list-style: none;
    gap: 2px;
    align-items: center;
}
.nav li a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 2px;
    position: relative;
    transition: color 0.3s;
}
.nav li a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: var(--text-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
.nav li a:hover {
    color: var(--text-primary);
    opacity: 1;
}
.nav li a:hover::after {
    transform: scaleX(1);
}

/* 主题切换按钮 */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    margin-left: 10px;
    flex-shrink: 0;
    background-color: var(--bg);
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: rotate(30deg);
}
.theme-toggle:active {
    transform: rotate(60deg) scale(0.9);
}

/* ===== 主页布局 ===== */
.content-with-sidebar {
    display: flex;
    gap: 45px;
    padding: 40px 0;
    align-items: flex-start;
}
.content-main {
    flex: 1;
    min-width: 0;
}

/* ===== 素描网格装饰线 ===== */
.content-main::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--border-light) 0px, var(--border-light) 40px,
        transparent 40px, transparent 44px
    );
    opacity: 0;
    transition: opacity 0.5s;
}
.content-main {
    position: relative;
}

/* =============================================
   文章卡片 - 撕边宣纸 + 错落堆叠
   ============================================= */

.post-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 4px;
}

/* ---- 错落旋转 + 撕边 ---- */
.post-card {
    background: var(--bg-card);
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 
        0 2px 8px rgba(0,0,0,0.04),
        0 0 0 1px var(--border);
    opacity: 0;
    animation: cardEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transform: rotate(var(--rot, 0deg)) translateY(0);
    transition:
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.5s ease,
        border-color 0.4s ease;
    will-change: transform;
    /* 撕边：用伪类模拟宣纸毛边 */
}

/* 每张卡片轻微错落旋转 */
.post-card:nth-child(1) { --rot: -0.6deg; animation-delay: 0s; }
.post-card:nth-child(2) { --rot: 0.8deg;  animation-delay: 0.08s; }
.post-card:nth-child(3) { --rot: -1deg;   animation-delay: 0.16s; }
.post-card:nth-child(4) { --rot: 0.5deg;  animation-delay: 0.24s; }
.post-card:nth-child(5) { --rot: -0.7deg; animation-delay: 0.32s; }
.post-card:nth-child(6) { --rot: 0.9deg;  animation-delay: 0.40s; }

/* 卡片入场动画 */
@keyframes cardEnter {
    0%   { opacity: 0; transform: rotate(var(--rot, 0deg)) translateY(40px) scale(0.96); }
    100% { opacity: 1; transform: rotate(var(--rot, 0deg)) translateY(0) scale(1); }
}

/* ---- 撕边毛边效果 ---- */
.post-card::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid var(--border-light);
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.5s ease, inset 0.5s ease;
    /* 毛边锯齿：用渐变更改模拟 */
    background:
        linear-gradient(90deg, transparent 30%, var(--bg-card) 30%, var(--bg-card) 70%, transparent 70%) 0 0 / 6px 100%,
        linear-gradient(0deg,  transparent 30%, var(--bg-card) 30%, var(--bg-card) 70%, transparent 70%) 0 0 / 100% 6px;
    background-repeat: repeat-x, repeat-y;
    background-position: 0 0, 0 0, 100% 0, 0 100%;
}

/* ---- Hover 交互 ---- */
.post-card:hover {
    transform: rotate(0deg) translateY(-10px);
    box-shadow:
        0 16px 48px rgba(0,0,0,0.10),
        0 0 0 1px var(--text-primary),
        0 0 60px -10px rgba(100, 80, 60, 0.08);
    z-index: 2;
}

/* 墨晕扩散动画 */
.post-card:hover::before {
    opacity: 0.7;
    inset: -6px;
    border-color: var(--text-primary);
    animation: inkBleed 3s ease-in-out infinite;
}

@keyframes inkBleed {
    0%, 100% { opacity: 0.5; inset: -6px; }
    50%      { opacity: 0.8; inset: -8px; }
}

/* ---- 朱砂红印章 ---- */
.post-card::after {
    content: '●印';
    position: absolute;
    bottom: 14px;
    right: 14px;
    font-family: var(--font-deco);
    font-size: 10px;
    color: #c43a31;
    letter-spacing: 1px;
    padding: 3px 4px;
    border: 1.5px solid #c43a31;
    opacity: 0;
    transform: rotate(-10deg) scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1;
    z-index: 3;
    background: rgba(196, 58, 49, 0.04);
}
.post-card:hover::after {
    opacity: 0.85;
    transform: rotate(-6deg) scale(1);
}

/* ---- 卡片缩略图 ---- */
.post-card-thumb {
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}
.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}
.post-card:hover .post-card-thumb img {
    transform: scale(1.06);
}
.post-card-thumb .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-logo);
    font-size: 2.8em;
    color: var(--text-muted);
    letter-spacing: 3px;
    background: var(--bg-secondary);
    transition: color 0.3s;
}
.post-card:hover .post-card-thumb .placeholder {
    color: var(--text-secondary);
}

/* 缩略图素描交叉排线 */
.post-card-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg,  transparent 0, transparent 5px, rgba(0,0,0,0.012) 5px, rgba(0,0,0,0.012) 6px),
        repeating-linear-gradient(-45deg, transparent 0, transparent 5px, rgba(0,0,0,0.012) 5px, rgba(0,0,0,0.012) 6px);
    pointer-events: none;
    z-index: 1;
}

/* ---- 卡片内容区 ---- */
.post-card-body {
    padding: 22px 24px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.post-card-body .post-category {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 3px;
    margin-bottom: 6px;
    display: inline-block;
    padding: 2px 0;
    border-bottom: 1px solid var(--border-light);
    align-self: flex-start;
    transition: border-color 0.3s, color 0.3s;
}
.post-card:hover .post-category {
    border-color: var(--text-primary);
    color: var(--text-secondary);
}

.post-card .post-title {
    font-family: var(--font-heading);
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 8px;
}
.post-card .post-title a {
    color: var(--text-primary);
    transition: color 0.3s;
}
.post-card .post-title a:hover {
    opacity: 1;
    color: var(--text-primary);
}
.post-card .post-title a::after {
    content: '';
    display: block;
    width: 0;
    height: 1px;
    background: var(--text-primary);
    transition: width 0.35s ease;
}
.post-card .post-title a:hover::after {
    width: 100%;
}

.post-card .post-meta {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.post-card .post-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    flex: 1;
}

/* ---- 阅读更多 ---- */
.read-more {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 2px;
    padding-bottom: 2px;
    align-self: flex-start;
    position: relative;
    transition: color 0.3s, letter-spacing 0.3s;
}
.read-more::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--text-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}
.read-more:hover {
    color: var(--text-primary);
    letter-spacing: 3px;
    opacity: 1;
}
.read-more:hover::after {
    transform: scaleX(1);
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 84px;
}
.sidebar-widget {
    margin-bottom: 32px;
    border: 1px solid var(--border-light);
    padding: 20px 20px 18px;
    background: var(--bg-card);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s;
    position: relative;
}
.sidebar-widget:hover {
    box-shadow: var(--shadow-hover);
}
.sidebar-widget h3 {
    font-family: var(--font-deco);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 3px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    text-align: center;
}
.sidebar-widget h3::after {
    content: '~';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
}
.sidebar-widget ul {
    list-style: none;
}
.sidebar-widget li {
    margin-bottom: 1px;
}
.sidebar-widget li a {
    display: block;
    padding: 7px 4px;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.25s;
    position: relative;
    padding-left: 12px;
}
.sidebar-widget li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 4px;
    background: var(--border);
    border-radius: 50%;
    transform: translateY(-50%);
    transition: background 0.3s, width 0.3s;
}
.sidebar-widget li a:hover {
    color: var(--text-primary);
    padding-left: 16px;
    border-color: var(--border);
}
.sidebar-widget li a:hover::before {
    background: var(--text-primary);
    width: 6px;
    height: 6px;
}
.sidebar-widget li:last-child a {
    border-bottom: none;
}

/* 一言小部件 */
.quote-text {
    font-family: var(--font-heading);
    font-size: 14px;
    line-height: 2;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-style: italic;
    position: relative;
    padding: 0 4px;
}
.quote-text::before {
    content: '\201C';
    font-family: var(--font-heading);
    font-size: 3em;
    position: absolute;
    top: -12px;
    left: -6px;
    color: var(--border);
    line-height: 1;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}
.quote-author {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    letter-spacing: 1px;
    padding-top: 6px;
    border-top: 1px solid var(--border-light);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 35px 0;
    border-top: 1px solid var(--border-light);
    position: relative;
}
.pagination::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 30%;
    right: 30%;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 8px,
        transparent 8px, transparent 12px
    );
}
.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    background: var(--bg-card);
}
.pagination a:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.pagination a.current {
    border-color: var(--text-primary);
    color: var(--text-primary);
    font-weight: 500;
    background: var(--text-primary);
    color: var(--bg);
}
.pagination a.current:hover {
    transform: none;
    box-shadow: none;
}

/* ===== 文章详情页 ===== */
.article {
    padding: 40px 0;
    max-width: 780px;
    position: relative;
}
.article-header {
    margin-bottom: 35px;
    position: relative;
}
.article-header::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--text-primary);
    margin-top: 20px;
    opacity: 0.3;
}
.article-header .post-category {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 3px;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.article-header .post-title {
    font-family: var(--font-heading);
    font-size: 2.1em;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 14px;
    letter-spacing: 1px;
}
.article-header .post-meta {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    display: flex;
    gap: 18px;
}

.article-content {
    font-size: 15.5px;
    line-height: 2.1;
    color: var(--text-primary);
}
.article-content p {
    margin-bottom: 1.3em;
}
.article-content img {
    max-width: 100%;
    margin: 28px 0;
    cursor: zoom-in;
    border: 1px solid var(--border-light);
    padding: 4px;
    background: var(--bg-card);
    transition: all 0.4s ease;
    box-shadow: var(--shadow);
}
.article-content img:hover {
    box-shadow: var(--shadow-hover);
    transform: scale(1.01);
}
.article-content img:active {
    transform: scale(1.02);
}

/* 文章内部链接 */
.article-content a {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: border-color 0.3s;
}
.article-content a:hover {
    border-color: var(--text-primary);
    opacity: 1;
}

/* 下载区 */
.download-area {
    margin-top: 35px;
    padding: 24px 0 10px;
    border-top: 2px solid var(--border-light);
    position: relative;
}
.download-area::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    width: 40px;
    height: 4px;
    background: var(--text-primary);
    opacity: 0.15;
}
.download-area h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 14px;
    color: var(--text-secondary);
    letter-spacing: 3px;
}
.download-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    transition: border-color 0.3s, background 0.3s;
}
.download-item:hover {
    border-color: var(--border);
    background: var(--bg-secondary);
}
.download-link {
    font-size: 14px;
    color: var(--text-primary);
    padding-bottom: 1px;
    position: relative;
}
.download-link::after {
    content: '↓';
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.download-link:hover::after {
    opacity: 1;
}
.file-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 10px;
}

.article-footer {
    margin-top: 45px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}
.article-footer a {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    padding: 8px 0;
    display: inline-block;
    transition: color 0.3s, padding-left 0.3s;
}
.article-footer a:hover {
    color: var(--text-primary);
    padding-left: 4px;
    opacity: 1;
}

/* ===== 代码块 ===== */
.article-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 20px 22px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 13.5px;
    line-height: 1.7;
    position: relative;
    box-shadow: inset 0 0 0 1px var(--border-light);
}
.article-content pre code {
    background: none;
    padding: 0;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', 'Noto Sans Mono', monospace;
    font-size: 13.5px;
    color: var(--text-primary);
}
.article-content pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: var(--font-body);
    font-weight: 500;
}
.article-content code {
    background: var(--code-bg);
    padding: 2px 8px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    border-radius: 0;
}

/* 代码块素描装饰 */
.article-content pre::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 12px;
    width: 10px;
    height: 10px;
    border: 1px solid var(--border);
    border-radius: 50%;
    opacity: 0.3;
}

/* ===== 友情链接 ===== */
.friend-links {
    border-top: 1px solid var(--border);
    padding: 35px 0 30px;
    text-align: center;
    position: relative;
    margin-top: auto;
}
.friend-links::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 8px,
        transparent 8px, transparent 12px
    );
}
.friend-links h3 {
    font-family: var(--font-deco);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 6px;
    margin-bottom: 22px;
}
.friend-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}
.friend-link-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
}
.friend-link-item::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
.friend-link-item:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    opacity: 1;
}
.friend-link-item:hover::before {
    border-color: var(--text-primary);
    top: 2px; left: 2px; right: 2px; bottom: 2px;
}
.link-icon {
    font-size: 16px;
}

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--border-light);
    padding: 28px 0;
    margin-top: auto;
    background: var(--bg-secondary);
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}
.footer-links {
    display: flex;
    gap: 18px;
}
.footer-links a {
    color: var(--text-muted);
    position: relative;
    transition: color 0.3s;
}
.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--text-primary);
    transform: scaleX(0);
    transition: transform 0.3s;
}
.footer-links a:hover {
    color: var(--text-primary);
}
.footer-links a:hover::after {
    transform: scaleX(1);
}

/* ===== 回到顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 35px;
    right: 35px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.33, 1, 0.68, 1);
    z-index: 999;
    box-shadow: var(--shadow);
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:not(.visible) {
    transform: translateY(20px);
}
.back-to-top:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.back-to-top:active {
    transform: translateY(0) scale(0.95);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    border: 1px solid var(--border-light);
    position: relative;
}
.empty-icon {
    font-family: var(--font-deco);
    font-size: 3.5em;
    color: var(--text-muted);
    margin-bottom: 12px;
    opacity: 0.4;
}
.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 2px;
}

/* ===== 归档页 ===== */
.archive-title {
    font-family: var(--font-heading);
    font-size: 2em;
    font-weight: 600;
    letter-spacing: 4px;
    margin-bottom: 30px;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}
.archive-title::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    margin-top: 6px;
    opacity: 0.15;
}
.archive-month {
    font-family: var(--font-heading);
    font-size: 1.2em;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 18px;
    letter-spacing: 3px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}
.archive-month::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--text-primary);
    opacity: 0.2;
}
.archive-item {
    padding: 18px 22px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    background: var(--bg-card);
}
.archive-item:hover {
    border-color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

/* ===== 搜索页 ===== */
.search-form {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 35px;
    position: relative;
}
.search-form::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 12px,
        transparent 12px, transparent 16px
    );
    opacity: 0.3;
}
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1.1em;
    color: var(--text-primary);
    outline: none;
    font-weight: 300;
    letter-spacing: 1px;
}
.search-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}
.search-btn {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 18px;
    letter-spacing: 2px;
    transition: all 0.3s;
}
.search-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* ===== 墨水涟漪点击效果 ===== */
.ink-ripple {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    border: 1px solid var(--border);
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    z-index: 9999;
    animation: rippleOut 0.8s ease-out forwards;
}
@keyframes rippleOut {
    0% {
        transform: scale(0.5);
        opacity: 0.6;
    }
    100% {
        transform: scale(6);
        opacity: 0;
    }
}

/* ===== 光标跟随墨点 ===== */
.ink-dot {
    position: fixed;
    pointer-events: none;
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0.08;
    z-index: 9998;
    transition: transform 0.15s ease, opacity 0.3s ease;
    transform: translate(-50%, -50%);
}

/* ===== 图片放大淡入 ===== */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ===== 过渡动画 ===== */
body, .header, .post-card, .friend-link-item, .pagination a,
.back-to-top, .article-content pre, .archive-item,
.sidebar-widget, .download-item, .theme-toggle {
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 960px) {
    .post-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0;
    }
    .post-card {
        --rot: 0deg !important;
    }
    .content-with-sidebar {
        flex-direction: column;
        gap: 0;
    }
    .sidebar {
        width: 100%;
        margin-top: 30px;
        padding-top: 24px;
        border-top: 1px solid var(--border-light);
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        position: static;
    }
    .sidebar-widget {
        margin-bottom: 0;
    }
}

@media (max-width: 700px) {
    .container, .header-inner, .footer-inner {
        padding-left: 16px;
        padding-right: 16px;
    }
    .content-with-sidebar {
        padding: 20px 0;
    }
    .sidebar {
        grid-template-columns: 1fr;
    }
    .post-card-body {
        padding: 16px 18px;
    }
    .post-card-thumb {
        height: 160px;
    }
    .post-grid {
        gap: 18px;
    }
    .post-card::after {
        display: none;
    }
    .post-card::before {
        display: none;
    }
    .nav {
        gap: 0;
    }
    .nav li a {
        padding: 6px 10px;
        font-size: 13px;
    }
    .logo {
        font-size: 1.2em;
        letter-spacing: 3px;
    }
    .header-inner {
        height: 56px;
    }
    .article-header .post-title {
        font-size: 1.5em;
    }
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 38px;
        height: 38px;
    }
    .content-with-sidebar {
        gap: 0;
    }
}

/* =============================================
   素描装饰元素增强 v2.0
   ============================================= */

/* 主容器装饰：两侧手绘虚线 */
.container::before {
    content: '';
    position: absolute;
    top: 40px;
    bottom: 40px;
    left: 12px;
    width: 1px;
    background: repeating-linear-gradient(
        0deg,
        var(--border) 0px, var(--border) 4px,
        transparent 4px, transparent 8px
    );
    opacity: 0.2;
    pointer-events: none;
}
.container::after {
    content: '';
    position: absolute;
    top: 40px;
    bottom: 40px;
    right: 12px;
    width: 1px;
    background: repeating-linear-gradient(
        0deg,
        var(--border) 0px, var(--border) 4px,
        transparent 4px, transparent 8px
    );
    opacity: 0.2;
    pointer-events: none;
}
.container {
    position: relative;
}

/* 页面大标题素描装饰 */
.archive-title,
.article-header .post-title {
    position: relative;
    display: inline-block;
}
.archive-title::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -12px;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--border);
    border-left: 2px solid var(--border);
    opacity: 0.25;
}
.archive-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -8px;
    width: 30px;
    height: 2px;
    background: var(--text-primary);
    opacity: 0.12;
}

/* 文章标题素描下划线 */
.article-header .post-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--text-primary);
    margin-top: 10px;
    opacity: 0.1;
}

/* 侧边栏装饰：顶部花纹 */
.sidebar-widget h3 {
    position: relative;
    text-align: center;
    overflow: hidden;
}
.sidebar-widget h3::before,
.sidebar-widget h3::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 1px;
    background: var(--border);
}
.sidebar-widget h3::before {
    left: 0;
}
.sidebar-widget h3::after {
    right: 0;
}

/* 侧边栏装饰：顶部花纹 */
.sketch-divider {
    position: relative;
    height: 30px;
    margin: 30px 0;
}
.sketch-divider::before {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: var(--border);
    opacity: 0.3;
}
.sketch-divider::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 8px,
        transparent 8px, transparent 12px,
        var(--border) 12px, var(--border) 18px,
        transparent 18px, transparent 22px
    );
    opacity: 0.25;
}

/* ===== 装饰性手绘元素（纯 CSS） ===== */

/* 装饰点阵 - 页面随机装饰点 */
.deco-dots {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
}
.deco-dots-1 {
    top: 20%;
    left: 3%;
    font-size: 20px;
    color: var(--text-primary);
}
.deco-dots-2 {
    top: 60%;
    right: 3%;
    font-size: 14px;
    color: var(--text-primary);
}
.deco-dots-3 {
    bottom: 30%;
    left: 5%;
    font-size: 10px;
    color: var(--text-primary);
}

/* 页脚装饰 */
.footer {
    position: relative;
}
.footer::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    max-width: 300px;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--border) 0px, var(--border) 6px,
        transparent 6px, transparent 10px,
        var(--border) 10px, var(--border) 16px,
        transparent 16px, transparent 20px,
        var(--border) 20px, var(--border) 24px
    );
    opacity: 0.2;
}

/* 分页数字装饰 */
.pagination a {
    position: relative;
}
.pagination a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 6px;
    right: 6px;
    height: 1px;
    background: var(--border);
    opacity: 0;
    transition: opacity 0.3s;
}
.pagination a:hover::after {
    opacity: 1;
}
.pagination a.current::after {
    display: none;
}

/* 友情链接装饰 */
.friend-links {
    position: relative;
}
.friend-links::after {
    content: '~ ❀ ~';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 6px;
    opacity: 0.2;
}

/* 文章内容段落首字母装饰 */
.article-content > p:first-child::first-letter {
    font-family: var(--font-deco);
    font-size: 2.8em;
    float: left;
    line-height: 1;
    margin-right: 8px;
    margin-top: 4px;
    color: var(--text-secondary);
    opacity: 0.4;
}

/* 下载区域装饰 */
.download-area {
    position: relative;
}
.download-area::after {
    content: '↓';
    position: absolute;
    top: -8px;
    left: 20px;
    font-size: 14px;
    color: var(--border);
    opacity: 0.3;
}

/* 空状态装饰 */
.empty-state {
    position: relative;
}
.empty-state::before {
    content: '';
    position: absolute;
    top: -6px; left: -6px; right: -6px; bottom: -6px;
    border: 1px solid var(--border-light);
    pointer-events: none;
    opacity: 0.3;
}

/* 代码块装饰增强 */
.article-content pre {
    position: relative;
}
.article-content pre code {
    position: relative;
    z-index: 1;
}
.article-content pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: var(--font-body);
    font-weight: 500;
    opacity: 0.5;
}

/* 标签装饰 */
.post-meta span {
    position: relative;
    padding-left: 0;
}
.post-meta span::before {
    content: '·';
    margin-right: 2px;
    color: var(--text-muted);
}
.post-meta span:first-child::before {
    display: none;
}

/* ===== 黑暗模式高亮适配 ===== */
[data-theme="dark"] .hljs {
    background: var(--code-bg) !important;
}
