/* 字体引入 - 仅图标字体 */
@import url('fonts/remixicon.css');

/* 图标通用样式 */
.doc-icon {
    font-size: 1.2em;
    vertical-align: -0.1em;
    margin-right: 0.3em;
    color: var(--primary-color);
}

:root {
    /* Paper Aesthetic Palette */
    --primary-color: #8B4513;
    /* SaddleBrown - Ink friendly leather color */
    --accent-color: #c0392b;
    /* Traditional Red ink */
    --text-color: #2c2525;
    /* Soft Black */
    --text-muted: #5d5555;
    /* Sepia Gray */
    --bg-color: #fdfbf7;
    /* Warm Ivory Paper */
    --bg-secondary: #f4ecd8;
    /* Slightly darker parchment */
    --border-color: #dcd0c0;
    --sidebar-width: 280px;

    /* 系统字体栈 - Windows/Mac/Linux/iOS/Android 通用 */
    --font-serif: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-serif);
    /* Default to Serif for literary feel */
    line-height: 1.8;
    /* More breathing room */
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' opacity='0.5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    display: flex;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-color);
    transition: all 0.2s ease;
}

a:hover {
    color: var(--accent-color);
    border-bottom-style: solid;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(44, 37, 37, 0.05);
}

.sidebar h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 2px double var(--border-color);
    padding-bottom: 0.5rem;
}

.nav-links {
    list-style: none;
    margin-bottom: 2rem;
}

.nav-item {
    margin: 0.5rem 0;
}

.nav-section {
    font-weight: bold;
    margin: 1.5rem 0 0.5rem;
    color: var(--primary-color);
    font-size: 0.95em;
    font-family: var(--font-sans);
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    /* Reset underline for nav */
    border-bottom: none;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: rgba(139, 69, 19, 0.05);
    /* Very light brown */
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(139, 69, 19, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 4rem;
    /* 占满剩余空间 */
    width: calc(100% - var(--sidebar-width));
    /* 内容区内部限宽并居中 */
    display: flex;
    flex-direction: column;
}

/* 内部内容限宽容器 - 通过section实现 */
.main-content>* {
    max-width: 900px;
    width: 100%;
}

/* feature-grid 允许更宽以容纳多列卡片 */
.main-content .feature-grid {
    max-width: 1100px;
}

/* 宽屏时内容区使用居中布局 */
@media (min-width: 1400px) {
    .main-content {
        padding-left: calc((100% - var(--sidebar-width) - 1100px) / 2 + 4rem);
        padding-right: calc((100% - var(--sidebar-width) - 1100px) / 2 + 4rem);
    }

    .main-content>* {
        max-width: 1100px;
    }
}

h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    color: var(--text-color);
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.05);
}

.lead {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-style: italic;
    font-family: var(--font-serif);
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
}

section {
    margin-bottom: 4rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--accent-color);
    margin-top: 0.5rem;
}

h3 {
    font-size: 1.4rem;
    margin: 2rem 0 1rem;
    color: var(--primary-color);
}

p,
ul,
ol {
    margin-bottom: 1.2rem;
}

ul,
ol {
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

code {
    background-color: rgba(0, 0, 0, 0.06);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

/* Utilities & Components */
.note {
    background-color: #fff9e6;
    border: 1px solid #efe3b8;
    border-left: 4px solid #d4c285;
    color: #8a7a4a;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-sans);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.03);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* 中等屏幕：2列 */
@media (min-width: 769px) and (max-width: 1200px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 宽屏：根据卡片数量自适应，最多3列 */
@media (min-width: 1201px) {
    .feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        max-width: 100%;
    }
}

.feature-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 2rem;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--border-color);
}

.feature-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.08);
}

.feature-card:hover::before {
    background: var(--primary-color);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    font-size: 0.8em;
    font-weight: 500;
    font-family: var(--font-sans);
}

.shortcut {
    background: #fff;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--text-color);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: none;
    }

    .sidebar h2 {
        display: inline-block;
        margin-right: 1rem;
        border-bottom: none;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-section {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.2rem;
    }

    .nav-item {
        margin: 0;
    }

    .nav-link {
        display: inline-block;
        background: #fff;
        border: 1px solid var(--border-color);
    }

    .main-content {
        margin-left: 0;
        padding: 2rem 1.5rem;
        width: 100%;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}