/* ============================================================
   blog.css — 熊记博客统一外壳（导航栏 / 主题 / 移动端）
   供 index.html（内联版）风格对齐，并被工具页复用。
   ============================================================ */

:root {
    /* 亮色（博客纸感）主题 —— 默认 */
    --bg: #f6f5f1;
    --bg-elev: #ffffff;
    --bg-subtle: #efece5;
    --text: #26231f;
    --text-soft: #5e584f;
    --text-mute: #908979;
    --border: #e6e1d7;
    --border-strong: #d6cfc2;
    --accent: #c2683f;
    --accent-soft: #f4e6db;
    --accent-strong: #a9522c;
    --shadow: 0 1px 2px rgba(40, 30, 20, 0.05), 0 10px 30px rgba(40, 30, 20, 0.07);
    --radius: 14px;
    --nav-h: 60px;
    --serif: 'Noto Serif SC', 'Songti SC', Georgia, 'Times New Roman', serif;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #17191e;
    --bg-elev: #1f232a;
    --bg-subtle: #23272f;
    --text: #e7e3db;
    --text-soft: #a9a399;
    --text-mute: #726c63;
    --border: #2c313a;
    --border-strong: #383e48;
    --accent: #e3916a;
    --accent-soft: #34271d;
    --accent-strong: #f1a784;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 32px rgba(0, 0, 0, 0.45);
}

/* ==================== 导航栏 ==================== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-left)) 0;
    padding-right: max(20px, env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition);
}
.navbar.scrolled {
    box-shadow: var(--shadow);
    background: color-mix(in srgb, var(--bg) 93%, transparent);
}
/* 工具页：导航栏随文档流，不固定吸顶 */
.navbar--static {
    position: relative;
    top: auto; left: auto; right: auto;
    height: auto;
    min-height: var(--nav-h);
    box-shadow: none;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.2em;
    letter-spacing: -0.3px;
}
.nav-brand .logo-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25em;
    flex-shrink: 0;
}
.nav-brand .blog-tag {
    font-family: var(--sans);
    font-size: 0.5em;
    font-weight: 500;
    color: var(--text-mute);
    border: 1px solid var(--border-strong);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.nav-brand .version-tag {
    font-family: var(--sans);
    font-size: 0.5em;
    font-weight: 500;
    color: var(--text-mute);
    background: var(--bg-subtle);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0; padding: 0;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-soft);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    touch-action: manipulation;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    background: var(--accent-soft);
}
.nav-actions {
    display: flex;
    align-items: center;
}
.theme-toggle {
    margin-left: 10px;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 1.05em;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(-15deg);
}
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5em;
    cursor: pointer;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    margin-left: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 阅读进度条 / 回到顶部（主页用，工具页无则自动隐藏） */
#progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    z-index: 1002;
    transition: width 0.1s linear;
}
#toTop {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1001;
}
#toTop.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
#toTop:hover { background: var(--accent-strong); transform: translateY(-2px); }

/* 博客风按钮（工具页内部按钮不受影响，互不复用类名） */
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu-btn { display: flex; }
    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: calc(var(--nav-h) + env(safe-area-inset-top));
        left: 0; right: 0;
        background: var(--bg-elev);
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        gap: 4px;
        box-shadow: var(--shadow);
        align-items: stretch;
    }
    .nav-links.mobile-open a { padding: 12px 14px; font-size: 0.95em; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
