/* 霞鹭文楷 Web 字体 - 按照 GitHub 官方示例配置 */
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.1.0/style.css');

/* Noto Serif SC 字体 - 常用权重 */
@font-face {
  font-family: 'Noto Serif SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Noto Serif SC'), local('NotoSerifSC-Regular'),
       url('https://fonts.gstatic.com/s/notoserifsc/v23/H4c7BXWPl9DZ0Xe7gG9cyOj7mm23dOEbBEb_4MKl9w.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Serif SC';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Noto Serif SC Medium'), local('NotoSerifSC-Medium'),
       url('https://fonts.gstatic.com/s/notoserifsc/v23/H4c7BXWPl9DZ0Xe7gG9cyOj7mm23dOEbBEb_4MKl9w.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Serif SC';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('Noto Serif SC SemiBold'), local('NotoSerifSC-SemiBold'),
       url('https://fonts.gstatic.com/s/notoserifsc/v23/H4c7BXWPl9DZ0Xe7gG9cyOj7mm23dOsbBEb_4MKl9w.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Serif SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Noto Serif SC Bold'), local('NotoSerifSC-Bold'),
       url('https://fonts.gstatic.com/s/notoserifsc/v23/H4c7BXWPl9DZ0Xe7gG9cyOj7mm23dO8bBEb_4MKl9w.woff2') format('woff2');
}

/* Noto Sans SC 字体 - 常用权重 */
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: local('Noto Sans SC Light'), local('NotoSansSC-Light'),
       url('https://fonts.gstatic.com/s/notosanssc/v36/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYxBNbOjZKFRk.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Noto Sans SC'), local('NotoSansSC-Regular'),
       url('https://fonts.gstatic.com/s/notosanssc/v36/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYxBNbOjZKJR.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Noto Sans SC Medium'), local('NotoSansSC-Medium'),
       url('https://fonts.gstatic.com/s/notosanssc/v36/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYxBNbOjZKFR.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Noto Sans SC Bold'), local('NotoSansSC-Bold'),
       url('https://fonts.gstatic.com/s/notosanssc/v36/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYxBNbOjZKFR.woff2') format('woff2');
}

/* 极简字体栈 - Web字体 → 本地霞鹭文楷 → 系统默认 */

:root {
    --primary-color: #4a5568;
    --secondary-color: #718096;
    --accent-color: #48bb78;
    --background-color: #ffffff;
    --text-color: #2d3748;
    --card-background: #f7fafc;
    --border-color: #e2e8f0;
}

[data-theme="dark"] {
    --primary-color: #a0aec0;
    --secondary-color: #cbd5e0;
    --accent-color: #68d391;
    --background-color: #1a202c;
    --text-color: #ffffff;
    --card-background: #2d3748;
    --border-color: #4a5568;
}

[data-theme="dark"] .dark-title,
[data-theme="dark"] p {
    color: var(--text-color);
}

body {
    font-family: 'LXGW WenKai', '霞鹜文楷', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.prose {
    font-family: 'LXGW WenKai', '霞鹜文楷', serif;
    text-align: justify;
    line-height: 1.7;
}


.card {
    position: relative;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow, opacity;
    opacity: 0;
    transform: translateY(20px);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
}

.theme-toggle {
    color: var(--secondary-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.date-label {
    color: var(--accent-color);
    font-weight: 500;
    text-align: left;
    line-height: 1.7;
}

.dark-title {
    text-align: left;
    line-height: 1.7;
}

@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: var(--animation-delay, 0s);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 搜索框样式 */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.2);
    border-color: var(--accent-color);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.highlight-red {
    color: #ff0000; 
}

.search-highlight {
    background-color: var(--accent-color);
    color: white;
    padding: 0 2px;
    border-radius: 2px;
}

/* 打印样式优化 */
@media print {
    /* 重置根样式变量，确保打印使用浅色主题 */
    :root {
        --primary-color: #000000 !important;
        --secondary-color: #333333 !important;
        --accent-color: #48bb78 !important;
        --background-color: #ffffff !important;
        --text-color: #000000 !important;
        --card-background: #ffffff !important;
        --border-color: #cccccc !important;
    }

    /* 重置页面背景和文字颜色 */
    body {
        background: white !important;
        color: black !important;
    }

    /* 隐藏不需要打印的元素 */
    .theme-toggle,
    .search-container {
        display: none !important;
    }

    /* 移除卡片动画和特效 */
    .card {
        transform: none !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
        background: white !important;
        color: black !important;
        margin-bottom: 20px !important;
        opacity: 1 !important;
        position: static !important;
    }

    /* 确保内容可见性 */
    .card * {
        opacity: 1 !important;
        visibility: visible !important;
        color: black !important;
    }

    /* 移除动画效果 */
    .fade-in {
        opacity: 1 !important;
        animation: none !important;
        transform: none !important;
    }

    /* 确保图片和文本正确显示 */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    p, h1, h2, h3, h4, h5, h6 {
        color: black !important;
        page-break-inside: avoid;
    }

    /* 优化字体显示 */
    .prose {
        color: black !important;
    }

    /* 确保链接文本可读 */
    a {
        color: black !important;
        text-decoration: underline !important;
    }
}

/* 导航栏样式 */
.navigation-bar {
    margin-bottom: 1.5rem;
}

.nav-link {
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1);
}

.nav-link:active {
    transform: translateY(0);
}

@media print {
    .navigation-bar {
        display: none !important;
    }
}

/* 列表样式优化 */
.prose ol {
    counter-reset: list-counter;
}

.prose ol li {
    counter-increment: list-counter;
    text-align: justify;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.prose ol.list-inside li {
    padding-left: 0;
    text-indent: 0;
}

.prose ol.list-decimal.list-inside li::marker {
    content: counter(list-counter) ". ";
    font-weight: 500;
    color: var(--text-color);
}

/* 确保列表项内容对齐 */
.prose ol li p {
    margin: 0;
    display: inline;
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    background: var(--accent-color);
    filter: brightness(1.1);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(0) scale(0.95);
}

/* 移动端隐藏返回顶部按钮 - 原生支持双击顶部任务栏返回顶部 */
@media (max-width: 1024px) {
    .back-to-top {
        display: none !important;
    }
}

/* 打印时隐藏 */
@media print {
    .back-to-top {
        display: none !important;
    }
}