/* ============================================
   字体
   - 全部使用系统字体：零下载、首屏无字体切换抖动
   - 标题用系统衬线（宋体 / Georgia），正文用系统无衬线
   - 元信息用系统等宽字体
   ============================================ */

:root {
    /*
     * 近白冷调 · 浅色
     * 近白纸底 + 墨黑正文 + 砖红单点强调
     * 除链接、当前页与焦点外，不使用彩色块和渐变
     */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', Georgia, 'Times New Roman', serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;

    --bg-color: #FBFBFA;
    --surface-color: #FFFFFF;
    --text-primary: #1A1A18;
    --text-secondary: #5F5F5A;
    --accent-color: #9E4231;        /* 砖红，仅用于强调 */
    --accent-strong: #833426;
    --accent-subtle: #E4E3DF;
    --hover-bg: rgba(158, 66, 49, 0.05);
    --nav-bg: rgba(251, 251, 250, 0.95);

    --tile-bg-1: #FFFFFF;
    --tile-bg-2: #F4F4F2;

    /* 语义色：低饱和，避免抢正文 */
    --color-primary: #5B5560;
    --color-success: #3F6B4C;
    --color-warning: #86672F;
    --color-danger: #9E4231;
    --color-info: #44607A;

    --mark-bg: #F1E3C4;
    --mark-text: #1A1A18;
}

[data-theme="dark"] {
    /*
     * 近白冷调 · 深色
     */
    --bg-color: #121212;
    --surface-color: #1A1A19;
    --text-primary: #ECECEA;
    --text-secondary: #A0A09A;
    --accent-color: #CF8A78;
    --accent-strong: #E0A08F;
    --accent-subtle: #2E2E2C;
    --hover-bg: rgba(207, 138, 120, 0.06);
    --nav-bg: rgba(18, 18, 18, 0.95);

    --tile-bg-1: #1A1A19;
    --tile-bg-2: #222220;

    --color-primary: #B3AAB8;
    --color-success: #8FAE96;
    --color-warning: #C6A76A;
    --color-danger: #D18A7A;
    --color-info: #91A9B8;

    --mark-bg: #574526;
    --mark-text: #ECECEA;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a,
button,
summary,
label[for],
input[type="checkbox"],
input[type="radio"],
select,
[role="button"],
[data-lightbox-action],
[data-lightbox-close] {
    cursor: pointer;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    width: 100vw;
    min-height: 100vh;
    line-height: 1.6;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.012em;
}

/* Global Smooth Theme Transition */
.theme-transition,
.theme-transition * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Selection */
::selection {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-subtle);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

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

.theme-toggle svg {
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
}
