/*
Theme Name: Vintage Notebook
Theme URI: 
Author: Marvis
Author URI: 
Description: 复古牛皮纸笔记本风格 WordPress 主题。泛黄纸张质感、金属螺旋装订、手写书卷风格。
Version: 1.0
License: MIT
Text Domain: vintage-notebook
*/

/* ============================================
   Google Fonts 由 functions.php 中 wp_enqueue_style 加载
   ============================================ */

@font-face {
    font-family: 'SansNums';
    src: local('Microsoft YaHei'), local('PingFang SC'), local('Segoe UI'), local('Arial');
    unicode-range: U+0030-0039, U+002E, U+002D, U+0025, U+00B7, U+002B;
}

/* ============================================
   Custom Fonts — 清松手写体
   ============================================ */
@font-face {
    font-family: '清松手写体-圆润';
    src: url('fonts/JasonHandwriting1-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '清松手写体-呆萌';
    src: url('fonts/JasonHandwriting3-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '得意黑';
    src: url('fonts/SmileySans-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '清松手写体-Q萌';
    src: url('fonts/JasonHandwriting6-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: '清松手写体-随性';
    src: url('fonts/JasonHandwriting8-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --paper-bg: #f4e4c1;
    --paper-dark: #e8d5a3;
    --line-color: #c4b998;
    --ink-color: #3a2f28;
    --ink-light: #6b5d4f;
    --accent: #8b6914;
    --metal-light: #c0c0c0;
    --metal-dark: #7a7a7a;
    --metal-mid: #a0a0a0;
    --clip-color: #b8b8b8;
    --shadow-soft: rgba(58, 47, 40, 0.12);
    --shadow-deep: rgba(0, 0, 0, 0.25);
    --font-body: 'SansNums', 'Noto Serif SC', 'Georgia', 'SimSun', serif;
    --font-title: 'Noto Serif SC', 'Georgia', 'SimSun', serif;
    --left-width: 30%;
    --right-width: 70%;
    --line-height-main: 32px;
    --content-padding: 48px;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--ink-color);
    line-height: 1.8;
    /* 泛黄牛皮纸底色 + 做旧纹理 + 边缘暗角 */
    background-color: #e8d9b5;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 105, 20, 0.03) 2px,
            rgba(139, 105, 20, 0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1px,
            rgba(139, 105, 20, 0.015) 1px,
            rgba(139, 105, 20, 0.015) 2px
        ),
        radial-gradient(
            ellipse at 50% 50%,
            #f7ebc6 0%,
            #f0ddb0 40%,
            #e5cea0 70%,
            #d9bf8a 100%
        );
    background-attachment: fixed;
    min-height: 100vh;
}

/* 整体容器 */
.site-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.site-header {
    width: 100%;
    padding: 36px 0 20px;
    position: relative;
    margin-bottom: 0;
}

.site-branding {
    flex-shrink: 0;
}

.site-title {
    font-family: var(--font-title);
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--ink-color);
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.site-title a {
    text-decoration: none;
    color: inherit;
}

.site-description-area {
    text-align: right;
    max-width: 380px;
}

.site-description-line1,
.site-description-line2 {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.6;
    font-style: italic;
}

/* ============================================
   Navigation
   ============================================ */
.site-nav {
    width: 100%;
    padding: 10px 0 0;
    margin-top: 16px;
}

.site-nav .menu {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.site-nav .menu li {
    display: inline;
}

.site-nav .menu li a {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--ink-color);
    text-decoration: none;
    padding: 6px 12px;
    letter-spacing: 0.03em;
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
}

.site-nav .menu li a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.site-nav .menu li.current-menu-item a {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 700;
}

.site-nav .menu li + li::before {
    content: ' · ';
    color: var(--ink-light);
    font-size: 0.9rem;
}

/* ============================================
   Divider Line
   ============================================ */
.header-divider {
    width: 100%;
    height: 0;
    border: none;
    border-top: 2px solid var(--ink-color);
    margin: 4px 0 20px;
    opacity: 0.7;
}

/* ============================================
   Main Content Area - Flexbox 双栏布局
   ============================================ */
.site-main {
    display: flex !important;
    flex-direction: row !important;
    flex: 1;
    width: 100%;
    position: relative;
    margin-top: 4px;
}

/* 左栏 — 30% 宽，不可压缩 */
.sidebar-left {
    width: 30% !important;
    min-width: 280px !important;
    flex-shrink: 0 !important;
    padding: 30px 20px 30px 10px;
    position: relative;
    display: block !important;
}

/* 右栏 — 70% 宽，填充剩余空间 */
.content-right {
    width: 70% !important;
    flex-grow: 1;
    flex-shrink: 0 !important;
    padding: 0;
    position: relative;
    display: block !important;
    /* 温暖浅棕木纹底色 */
    background-color: #c4a27a;
    background-image:
        /* 细竖纹 — 模拟木材纤维纹理 */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1px,
            rgba(139, 90, 43, 0.04) 1px,
            rgba(139, 90, 43, 0.04) 2px
        ),
        /* 宽竖纹渐变 — 模拟木材年轮/山峰纹 */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 38px,
            rgba(160, 110, 60, 0.06) 38px,
            rgba(160, 110, 60, 0.06) 40px
        ),
        /* 斜向纹理 — 增加自然木材渐变感 */
        linear-gradient(
            175deg,
            rgba(180, 130, 85, 0.15) 0%,
            transparent 30%,
            transparent 70%,
            rgba(140, 95, 55, 0.12) 100%
        );
    background-position: 0 0;
    min-height: 600px;
    /* 轻微圆角模拟木板倒角 */
    border-radius: 3px;
    /* 外侧柔和投影 + 贴近边缘细微阴影，模拟木板厚度浮于桌面 */
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 6px 20px rgba(0, 0, 0, 0.12),
        inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.content-right-inner {
    padding: 60px var(--content-padding) 80px;
    position: relative;
    z-index: 1;
    min-height: 600px;
    background-color: #f8f1e3;
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(255,252,240,0) 55%, rgba(200,175,130,0.15) 100%),
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 33px,
            rgba(185, 65, 45, 0.60) 33px,
            rgba(185, 65, 45, 0.60) 34px
        );
    background-size: 100% 100%, 100% 36px;
    /* 撕裂/不规则边缘 — 模拟手工撕纸的毛边感 */
    clip-path: polygon(
        0% 0.2%, 7% -0.12%, 15% 0.25%, 25% -0.1%, 35% 0.3%, 45% -0.15%, 55% 0.22%, 65% -0.18%, 75% 0.28%, 85% -0.08%, 93% 0.15%, 100% 0.2%,
        99.85% 20%, 100.18% 45%, 99.82% 70%, 100.12% 90%, 99.9% 100%,
        88% 99.85%, 72% 100.2%, 55% 99.8%, 38% 100.18%, 20% 99.88%, 0% 99.92%,
        0.15% 80%, -0.1% 55%, 0.2% 30%, -0.08% 10%, 0% 0.2%
    );
    /* 信纸在木板上投下阴影 */
    box-shadow: 2px 3px 10px rgba(0,0,0,0.18);
}

/* ============================================
   Spiral Binding (左右栏之间的竖线 + 金属螺旋线圈)
   ============================================ */
.sidebar-left::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ink-color);
    z-index: 5;
    opacity: 0.5;
}

.spiral-binding {
    position: absolute;
    left: -12px;
    top: 0;
    width: 28px;
    z-index: 15;
    pointer-events: none;
    /* JS 动态生成线圈 */
}

.spiral-coil {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 18px;
    border: 2.5px solid #5a5a5a;
    border-radius: 38%;
    background: linear-gradient(
        180deg,
        #d8d8d8 0%,
        #e8e8e8 20%,
        #b0b0b0 45%,
        #909090 50%,
        #b0b0b0 55%,
        #e8e8e8 80%,
        #d8d8d8 100%
    );
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.7),
        inset 0 -2px 3px rgba(0, 0, 0, 0.25),
        2px 1px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Sidebar - Article List
   ============================================ */
.sidebar-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border: 1px solid var(--ink-light);
    border-radius: 2px;
    margin-bottom: 20px;
}

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

.article-list li {
    margin-bottom: 2px;
}

.article-list li a {
    display: block;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink-color);
    text-decoration: none;
    padding: 8px 10px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-list li a:hover {
    background: rgba(139, 105, 20, 0.08);
    border-left-color: var(--accent);
    color: var(--accent);
}

.article-list li a.active {
    background: rgba(139, 105, 20, 0.12);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}

/* Loading indicator for right panel */
.content-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    font-family: var(--font-body);
    font-style: italic;
    color: var(--ink-light);
    font-size: 0.95rem;
}

.content-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    font-family: var(--font-body);
    color: var(--ink-light);
    font-size: 1rem;
}

/* ============================================
   Metal Clip (向下夹的金属夹子)
   ============================================ */
.metal-clip {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    min-width: 240px;
    z-index: 30;
    pointer-events: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.metal-clip-top {
    width: 100%;
    height: 36px;
    background: linear-gradient(
        180deg,
        #e8e8e8 0%,
        #c8c8c8 18%,
        #9e9e9e 40%,
        #b8b8b8 52%,
        #8a8a8a 75%,
        #a0a0a0 100%
    );
    border-radius: 8px 8px 4px 4px;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.35),
        0 2px 0 rgba(255, 255, 255, 0.25) inset,
        0 -1px 3px rgba(0, 0, 0, 0.15) inset;
    position: relative;
}

.metal-clip-top::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 12px;
    right: 12px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
}

.metal-clip-label {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: #2a1f18;
    letter-spacing: 0.06em;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    z-index: 2;
}

.metal-clip-wings {
    display: flex;
    justify-content: space-between;
    padding: 0 12%;
    margin-top: -1px;
}

.metal-clip-wing {
    width: 36px;
    height: 20px;
    background: linear-gradient(180deg, #b0b0b0, #787878);
    clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

/* ============================================
   Article Content Styles
   ============================================ */
.article-header {
    margin-bottom: 24px;
}

.article-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--ink-color);
    line-height: var(--line-height-main);
    margin: 0 0 8px;
}

.article-meta {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink-light);
    font-style: italic;
    line-height: var(--line-height-main);
}

/* ============================================
   Article Thumbnail (特色图片)
   ============================================ */
.article-thumbnail {
    margin: 16px 0 20px;
    text-align: center;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 2px 3px 8px var(--shadow-soft);
}

.article-thumbnail img {
    display: block;
    max-width: 288px;
    height: auto;
    margin: 0 auto;
}

.article-content {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink-color);
    line-height: var(--line-height-main);
}

.article-content p {
    margin: 0;
    line-height: var(--line-height-main);
    min-height: var(--line-height-main);
    text-indent: 2em;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--ink-color);
    line-height: var(--line-height-main);
    margin: calc(var(--line-height-main) * 0.5) 0 0;
}

.article-content h2 { font-size: 1.5rem; }
.article-content h3 { font-size: 1.25rem; }
.article-content h4 { font-size: 1.1rem; }

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin: 8px 0;
    color: var(--ink-light);
    font-style: italic;
}

.article-content ul,
.article-content ol {
    padding-left: 24px;
    line-height: var(--line-height-main);
}

.article-content li {
    line-height: var(--line-height-main);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
    box-shadow: 2px 2px 8px var(--shadow-soft);
}

.article-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(139, 105, 20, 0.08);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.9em;
}

.article-content pre {
    background: rgba(58, 47, 40, 0.04);
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    line-height: 1.5;
    border: 1px solid var(--line-color);
}

/* ============================================
   Vintage Pen (右下角 CSS 钢笔)
   ============================================ */
.vintage-pen {
    position: absolute;
    bottom: 40px;
    right: 50px;
    width: 240px;
    height: 48px;
    z-index: 5;
    pointer-events: none;
    opacity: 0.9 !important;
    transform: rotate(-25deg);
    filter: drop-shadow(4px 4px 6px rgba(0, 0, 0, 0.35));
    display: block !important;
    visibility: visible !important;
}

.vintage-pen-body {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 18px;
    background: linear-gradient(
        180deg,
        #0d0600 0%,
        #2a1508 15%,
        #4a2512 30%,
        #3d1e0e 50%,
        #2a1508 75%,
        #0d0600 100%
    );
    border-radius: 5px;
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.06),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.vintage-pen-body::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 20px;
    right: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

.vintage-pen-nib {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 14px;
    background: linear-gradient(180deg, #f0d860, #c8a420, #8a6c00);
    clip-path: polygon(0 15%, 60% 0, 100% 20%, 100% 80%, 60% 100%, 0 85%);
    border-radius: 1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.vintage-pen-clip {
    position: absolute;
    left: 14px;
    top: -14px;
    width: 34px;
    height: 9px;
    background: linear-gradient(180deg, #e0c870, #b09830);
    border-radius: 2px 2px 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 30px 0 20px;
    border-top: 1px solid var(--line-color);
    margin-top: 40px;
}

.site-footer p {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--ink-light);
    letter-spacing: 0.04em;
}

/* ============================================
   Single Article / Page (带横线底纹)
   ============================================ */
.single-article,
.page-article {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 48px 60px;
    background-color: var(--paper-bg);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(var(--line-height-main) - 1px),
        var(--line-color) calc(var(--line-height-main) - 1px),
        var(--line-color) var(--line-height-main)
    );
    box-shadow:
        2px 2px 12px var(--shadow-soft),
        0 0 40px rgba(139, 105, 20, 0.06);
    border-radius: 2px;
    position: relative;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    :root {
        --content-padding: 24px;
    }

    .site-main {
        flex-direction: column;
    }

    .sidebar-left {
        flex: none;
        width: 100%;
        padding: 20px 10px;
    }

    .sidebar-left::after {
        display: none;
    }

    .spiral-binding {
        display: none;
    }

    .content-right {
        flex: none;
        width: 100%;
    }

    .metal-clip {
        width: 80%;
        min-width: 180px;
    }

    .site-header {
        padding: 20px 10px;
    }
    .header-utility {
        position: static;
        margin-top: 10px;
    }

    .vintage-pen {
        right: 16px;
        bottom: 16px;
        width: 120px;
        height: 24px;
    }
}

/* 所有文章归档页 */
.archive-cat-tag {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--ink-light);
    background: rgba(139, 105, 20, 0.1);
    border: 1px solid rgba(139, 105, 20, 0.25);
    padding: 1px 6px;
    margin-right: 6px;
    border-radius: 2px;
    font-family: var(--font-body);
    vertical-align: middle;
}
/* 所有文章归档页 - 列表 */
.all-posts-list li:hover a {
    color: #8b6914 !important;
}
@media (max-width: 600px) {
    .all-posts-list li span[style*="float:right"] {
        float: none !important;
        display: inline-block;
        margin-left: 6px;
        font-size: 0.75rem !important;
    }
}
