﻿/**
 * 博客公共外壳样式：设计基座、页眉、页脚、三主题（亮色/暗色/彩色）
 * 共用页面：default.html、column.html、content.html、search.html
 *
 * 视觉基调（2026-11-13 首页改版，暖米底 + 藏青字 + 琥珀金强调）：
 *   1) 页面底是暖米色，卡片是白底细描边，层级靠留白与字重，不靠重阴影；
 *   2) 金色只出现在 CTA 按钮、标题下的装饰笔触、序号与徽标上；
 *   3) 链接与导航当前态走藏青，保证在米底上够对比度（金色只做大面积填充）；
 *   4) 三主题共用同一套结构样式，只换变量。
 * 页面自身的样式在本文件之后引入，便于覆盖（如 .container 宽度）
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 标题用微软雅黑（2026-11-16 由楷/宋体系改来：衬线大字在暖米底上显得旧、不够利落）。
       中英同栈，标题里混排的英文与数字不会和中文出现两种字形；
       非 Windows 依次回退 PingFang SC / 系统无衬线，与 --font-body 同源。
       正文 --font-body 本来就是这套无衬线，标题靠字重、字号与区块标题下的金色短线拉开层级。 */
    --font-display: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB",
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

    --primary: #17233d;
    --secondary: #243456;
    /* --accent：文字型强调（链接、导航当前态、图标），需在 --bg 上达 AA */
    --accent: #1a4fa0;
    --accent-hover: #143c7a;
    /* --gold / --gold-strong：大面积填充（CTA 按钮、装饰笔触、徽标） */
    --gold: #eda13a;
    --gold-strong: #d9891c;
    /* 金色底上的文字色：深棕而非白，白字在金底只有 2:1 左右 */
    --on-gold: #2b1c05;

    --text: #17233d;
    --text-light: #5f6879;
    --bg: #fbf7f0;
    --bg-soft: #f5efe3;
    --bg-light: #f5efe3;
    --card: #ffffff;
    --border: #eae2d3;
    /* --rule：报头双线、标题下重线等结构性粗线，随主题走 */
    --rule: #17233d;
    --underline: #b9b1a2;
    --shadow: 0 6px 22px rgba(45, 34, 14, 0.07);
    --radius: 14px;
    --radius-sm: 8px;
    /* 正文最大行宽（约 40 个汉字） */
    --measure: 40em;
    /* 站点版心：报头、栏目导航、页脚、栏目内容共用同一条左右边界 */
    --page-width: 1160px;
}

/* ===== 三主题（亮色 / 暗色 / 彩色） ===== */
/* 亮色主题：设计稿的暖米底 */
body.light-theme {
    --bg: #fbf7f0;
    --bg-soft: #f5efe3;
    --bg-light: #f5efe3;
    --card: #ffffff;
    --text: #17233d;
    --text-light: #5f6879;
    --border: #eae2d3;
    --accent: #1a4fa0;
    --accent-hover: #143c7a;
    --gold: #eda13a;
    --gold-strong: #d9891c;
    --on-gold: #2b1c05;
    --primary: #17233d;
    --secondary: #243456;
    --rule: #17233d;
    --underline: #b9b1a2;
    --shadow: 0 6px 22px rgba(45, 34, 14, 0.07);
}

/* 暗色主题 */
body.dark-theme {
    --bg: #14161d;
    --bg-soft: #1b1e28;
    --bg-light: #1b1e28;
    --card: #1c202b;
    --text: #ece7dd;
    --text-light: #a2a6b2;
    --border: #2c313f;
    --accent: #8fb8f0;
    --accent-hover: #b0cdf7;
    --gold: #f0b45c;
    --gold-strong: #f7c87c;
    --on-gold: #2a1a02;
    --primary: #1c202b;
    --secondary: #262b3a;
    --rule: #d9d2c5;
    --underline: #4a4f5e;
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}

/* 彩色主题（暖色渐变风格，与新视觉同源） */
body.colorful-theme {
    --bg: #2a1d2b;
    --bg-soft: rgba(255, 255, 255, 0.06);
    --bg-light: rgba(255, 255, 255, 0.06);
    --card: rgba(255, 255, 255, 0.07);
    --text: #f4ece0;
    --text-light: #c4b6a6;
    --border: rgba(255, 255, 255, 0.16);
    --accent: #ffc98a;
    --accent-hover: #ffe0b8;
    --gold: #f2a93b;
    --gold-strong: #ffbe5c;
    --on-gold: #2a1a02;
    --primary: #3a2740;
    --secondary: #4a2f3d;
    --rule: rgba(255, 255, 255, 0.78);
    --underline: rgba(255, 255, 255, 0.35);
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

body.colorful-theme {
    background: linear-gradient(140deg, #2b1d33 0%, #4a2b32 55%, #6b3d22 100%) !important;
    background-attachment: fixed;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* 键盘焦点可见（无障碍） */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

::selection {
    background: rgba(237, 161, 58, 0.32);
    color: var(--text);
}

img {
    max-width: 100%;
}

.container {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 页眉 ===== */
/* 布局：左侧品牌（Logo + 站名 + 标语），右侧动作（用户 / 搜索 / 管理 / 主题） */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    min-height: 68px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* 品牌块：Logo + 站名 + 标语（服务端渲染与 blog-shell.js 同款结构） */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}

.brand:hover {
    color: var(--text);
}

.brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary);
    border: 2px solid var(--gold);
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.24rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
}

.brand-tagline {
    font-size: 0.76rem;
    color: var(--text-light);
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .user-info,
.topbar .user-info-none {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.topbar .user-avatar {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50%;
    object-fit: cover;
}

.topbar .user-nickname {
    color: var(--text);
    font-weight: 600;
}

.topbar .user-nickname:hover {
    color: var(--accent);
}

.topbar .user-info-none a {
    color: var(--text) !important;
}

.topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* 页眉动作按钮：默认文字式，描边款用于「管理」（呼应设计稿的金框胶囊） */
.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-light);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    white-space: nowrap;
}

a.topbar-btn {
    color: var(--text-light);
}

.topbar-btn:hover {
    color: var(--accent);
    border-color: var(--border);
}

.topbar-btn--outline {
    color: var(--text);
    border-color: var(--gold);
    font-weight: 600;
}

.topbar-btn--outline:hover {
    color: var(--on-gold);
    background: var(--gold);
    border-color: var(--gold);
}

/* 栏目导航：页眉下的分栏条（文字 + 下划线当前态），平面平铺不折叠，整体居中 */
.columns-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 4px;
    padding-top: 8px;
    padding-bottom: 8px;
    border-top: 1px solid var(--border);
}

.columns-nav a {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-light);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}

.columns-nav a:hover {
    color: var(--text);
    border-bottom-color: var(--gold);
}

/* 当前栏目高亮 */
.columns-nav a.active {
    border-bottom-color: var(--rule);
    color: var(--text);
    background: transparent;
    font-weight: 600;
}

/* 主题切换：仅图标按钮 */
.theme-toggle-btn {
    padding: 7px 11px;
    font-size: 1.05rem;
    line-height: 1;
    border-color: var(--border);
}

/* ===== 通用组件：按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-gold {
    background: var(--gold);
    color: var(--on-gold);
    border-color: var(--gold);
}

.btn-gold:hover {
    background: var(--gold-strong);
    border-color: var(--gold-strong);
    color: var(--on-gold);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: transparent;
    padding-left: 8px;
    padding-right: 8px;
}

.btn-ghost:hover {
    color: var(--accent);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--gold);
}

.btn-outline:hover {
    background: var(--gold);
    color: var(--on-gold);
}

/* ===== 通用组件：区块标题（衬线大字 + 标题下金色短笔触） ===== */
.section {
    padding: clamp(40px, 5.5vw, 60px) 0;
}

.section .container {
    max-width: var(--page-width);
}

.section-header {
    display: block;
    margin-bottom: clamp(18px, 2.6vw, 26px);
}

/* 栏目标题：结构与 SSR（BuildHomeSectionsHtml）/ 前端保持一致——
   「查看更多」是 h2 的子元素，靠标题自身的 flex + margin-left:auto 顶到右边 */
.section-title {
    position: relative;
    display: flex;
    width: 100%;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 3vw, 1.85rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    padding-bottom: 14px;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

/* 标题下的金色短笔触（设计稿的下划装饰） */
.section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 3.2rem;
    height: 4px;
    border-radius: 2px;
    background: var(--gold);
}

.section-more {
    margin-left: auto;
    font-family: var(--font-body);
    color: var(--text-light);
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    white-space: nowrap;
    transition: color 0.2s;
}

.section-more:hover {
    color: var(--accent);
}

/* ===== 页脚 ===== */
footer {
    background: var(--primary);
    color: white;
    padding: 44px 0 40px;
    text-align: center;
}

footer p {
    opacity: 0.72;
    font-size: 0.88rem;
    letter-spacing: 0.05em;
    line-height: 1.9;
}

footer a {
    color: white;
    opacity: 0.9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    padding-bottom: 1px;
    transition: opacity 0.2s, border-color 0.2s;
}

footer a:hover {
    opacity: 1;
    border-bottom-color: white;
    color: white;
}

/* 栏目导航在窄屏下保持可读字号，允许换行（不折叠） */
@media (max-width: 720px) {
    .columns-nav a {
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .topbar-inner {
        min-height: 56px;
        gap: 8px;
    }

    .brand-logo {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .brand-name {
        font-size: 1.1rem;
    }

    .brand-tagline {
        font-size: 0.7rem;
    }
}
