/* ═══════════════════════════════════════════
   Tumanydays — 暖纸墨蓝 · 共享样式（新体系）
   全量暖版：字体(按《字体系统说明书》重建) + 暖纸 token
   + 全局基/a11y + 组件类暖化 + 跨页 a11y 工具 + 移动端
   当前覆盖：扉页、音乐。其余页面待各自迁移后接入。
   ═══════════════════════════════════════════ */

/* ── 字体块 ──
   旧 style.css 字体不全：缺整套 LXGW 霞鹜文楷、缺 4 个字体 CSS 变量、
   缺中文系统字体 fallback 栈。此处按《字体系统说明书》补全。
   子集在前、完整版兜底（subset 损坏时自动回退完整 woff2）。 */
@font-face {
    font-family: 'Noto Serif SC';
    font-style: normal; font-weight: 300; font-display: swap;
    src: url(fonts/NotoSerifSC-300-subset.woff2) format('woff2'),
         url(fonts/NotoSerifSC-300.woff2) format('woff2');
}
@font-face {
    font-family: 'Noto Serif SC';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url(fonts/NotoSerifSC-400-subset.woff2) format('woff2'),
         url(fonts/NotoSerifSC-400.woff2) format('woff2');
}
@font-face {
    font-family: 'Noto Serif SC';
    font-style: normal; font-weight: 500; font-display: swap;
    src: url(fonts/NotoSerifSC-500.woff2) format('woff2');
}
@font-face {
    font-family: 'Noto Serif SC';
    font-style: normal; font-weight: 600; font-display: swap;
    src: url(fonts/NotoSerifSC-600.woff2) format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal; font-weight: 300; font-display: swap;
    src: url(fonts/CormorantGaramond-300.woff2) format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url(fonts/CormorantGaramond-400-subset.woff2) format('woff2'),
         url(fonts/CormorantGaramond-400.woff2) format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic; font-weight: 300; font-display: swap;
    src: url(fonts/CormorantGaramond-300i.woff2) format('woff2');
}
@font-face {
    font-family: 'ZCOOL XiaoWei';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url(fonts/ZCOOLXiaoWei-400-subset.woff2) format('woff2'),
         url(fonts/ZCOOLXiaoWei-400.woff2) format('woff2');
}
@font-face {
    font-family: 'LXGW WenKai';
    font-style: normal; font-weight: 300; font-display: swap;
    src: url(fonts/LXGWWenKai-Light-subset.woff2) format('woff2');
}
@font-face {
    font-family: 'LXGW WenKai';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url(fonts/LXGWWenKai-Regular-subset.woff2) format('woff2');
}

/* ── 暖纸墨蓝 token ──
   与扉页/音乐既有内联 :root 逐值对齐，未来回收其内联块时零漂移。 */
:root {
    --bg: #FEFDFA;                    /* 明亮暖纸（2026.8.12 提亮定稿，原 #FAF6EF）*/
    --bg-soft: #F5F1EB;              /* 浅暖纸（表头/代码底，随主背景同步提亮）*/

    /* 暖黑文字阶（带暖褐调，贴合暖纸）*/
    --text-title: #2B231B;
    --text:     rgba(43, 35, 27, 0.86);
    --text-soft: rgba(43, 35, 27, 0.68);
    --text-muted: rgba(43, 35, 27, 0.52);
            --text-dim: rgba(43, 35, 27, 0.55);
            --text-faint: rgba(43, 35, 27, 0.45);

    /* 边框 */
    --border: rgba(43, 35, 27, 0.12);
    --border-light: rgba(43, 35, 27, 0.08);
    --border-soft: rgba(43, 35, 27, 0.14);

    /* 半透明暖卡片（替代冷灰白透）*/
    --card-bg: rgba(43, 35, 27, 0.03);

    /* 强调：墨蓝（信笺钢笔字）+ 朱红印章 */
    --ink: #4a6b80;
    --hover: #5a7685;
    --seal: #AE1300;

    /* 行内代码（墨蓝替代冷灰体系的红 #c7254e，贴合暖纸墨蓝）*/
    --code-bg: rgba(43, 35, 27, 0.06);
    --blockquote-bg: rgba(43, 35, 27, 0.04);
    --code-text: #4a6b80;

    /* 字体变量 + 中文系统字体 fallback 栈（说明书 §5.2）*/
    --font-display: "Cormorant Garamond", "Noto Serif SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", serif;
    --font-serif: "Noto Serif SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, "Segoe UI", serif;
    --font-kai: "LXGW WenKai", "Noto Serif SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", serif;
    --font-hand: "ZCOOL XiaoWei", "Noto Serif SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", serif;
}

/* ── 全局基础 + a11y ── */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
a, button { outline: none; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--hover); }
button { font-family: inherit; cursor: pointer; }
/* 焦点可见性：修复旧 css outline:none 导致的键盘 Tab 不可见 */
a:focus-visible, button:focus-visible,
.controls button:focus-visible, .lyric-line:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}
body {
    font-family: var(--font-serif);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

/* ── 通用容器（文章页面后备）── */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 64px 24px 80px;
}

/* ── 文章页基础排版（滚动/分页通用，2026.8.12 回收自文章页内联）── */
h1 { font-size: 1.8rem; font-weight: 400; letter-spacing: 2px; line-height: 1.5; margin-bottom: 16px; color: var(--text-title); }
.meta { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 48px; }
.meta span { margin-right: 16px; }
h2 { font-size: 1.25rem; font-weight: 500; margin-top: 56px; margin-bottom: 20px; color: var(--text-title); letter-spacing: 1px; }
h3 { font-size: 1.05rem; font-weight: 500; margin-top: 36px; margin-bottom: 14px; color: var(--text); }
h4 { font-size: 0.95rem; font-weight: 600; margin-top: 24px; margin-bottom: 10px; color: var(--text-title); }
p { font-size: 0.95rem; margin-bottom: 16px; color: var(--text); }

/* ── 引用块 ── */
blockquote {
    margin: 24px 0;
    padding: 16px 20px;
    background: var(--blockquote-bg);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-soft);
    border-left: 3px solid var(--border-soft);
}
blockquote p { margin-bottom: 0; color: var(--text-soft); }

/* ── meta 行链接 ── */
.meta a { color: var(--text-faint); text-decoration: none; }
.meta a:hover { color: var(--hover); }

/* ── 引言 ── */
.intro { margin-bottom: 48px; padding-left: 16px; border-left: 2px solid var(--text-faint); }
.intro p { font-size: 0.88rem; color: var(--text-faint); line-height: 1.8; margin-top: 8px; }

/* ── 加粗 ── */
strong { color: var(--text-title); font-weight: 600; }

/* ── 表格 ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0 28px;
    font-size: 0.85rem;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.6;
}
th {
    background: var(--bg-soft);
    font-weight: 500;
    color: var(--text-soft);
    font-size: 0.8rem;
    letter-spacing: 1px;
}
tr:hover td { background: var(--blockquote-bg); }

/* ── 分割线 ── */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 48px 0;
}

/* ── 小圆点分隔符 ── */
.dot {
    display: block;
    width: 6px; height: 6px;
    background: var(--border);
    border-radius: 50%;
    margin: 40px auto;
}

/* ── 行内代码 ── */
code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    color: var(--code-text);
}

/* ── 返回链接（顶部 back + 底部 nav-bottom）── */
/* 2026.8.16：返回链接常驻墨蓝 --ink（原 --text-dim 暖灰），与全站链接色统一；hover 仍 --hover */
.back {
    font-size: 0.85rem;
    color: var(--ink);
    text-decoration: none;
    margin-bottom: 48px;
    display: inline-block;
}
.back:hover { color: var(--hover); }

.nav-bottom {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.nav-bottom a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
}
.nav-bottom a:hover { color: var(--hover); }
.nav-bottom .nav-sep { margin: 0 8px; color: var(--text-faint); }

/* ── 底部注记 ── */
.footer-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 48px;
}

/* 署名内链接：继承色 + hover 墨蓝（克制）*/
.footer-note .sign-link { color: inherit; text-decoration: none; transition: color 0.3s; }
.footer-note .sign-link:hover { color: var(--ink); }

/* 文章页脚印章点（通用规格，2026.8.12 起全站文章页统一）*/
.footer-note.seal-mark::before {
    content: '';
    display: inline-block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--seal);
    margin-right: 8px;
    vertical-align: 1px;
}

/* ── 系列导航（上下篇链接）── */
.series-nav {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
}
.series-nav a {
    color: var(--text-dim);
    text-decoration: none;
}
.series-nav a:hover { color: var(--hover); }
.series-nav .prev { float: left; }
.series-nav .next { float: right; }

/* ── 杂志分页组件（文章页长文专用，.mag- 前缀结构隔离）
   配合 js/paginate.js 使用：桌面端 ≥601px 由引擎生成 DOM
   安全边距：.mag-col padding-bottom 20px 防内容探入导航区（规格）── */
@media (min-width: 601px) {
    .mag-page {
        position: relative;
        height: 100vh;
        max-width: 1040px;
        margin: 0 auto;
        padding: 48px 48px 0;
        box-sizing: border-box;
        animation: magFade 0.3s ease;
    }
    .mag-cols {
        height: calc(100vh - 88px);
        display: flex;
        gap: 56px;
        overflow: hidden;
    }
    .mag-col { flex: 1 1 0; min-width: 0; overflow: hidden; padding-bottom: 20px; }
    .mag-col p {
        font-size: 0.95rem;
        font-weight: 300;
        line-height: 1.9;
        letter-spacing: 0.5px;
        color: var(--text);
        margin-bottom: 12px;
    }
    .mag-col .intro p {
        font-size: 0.9rem;
        line-height: 1.9;
        letter-spacing: 0.5px;
        color: var(--text-faint);
    }
    .mag-col .back {
        display: inline-block;
        font-size: 0.72rem;
        letter-spacing: 3px;
        color: var(--text-dim);
        margin-bottom: 24px;
    }
    .mag-col .back:hover { color: var(--ink); }
    .mag-col .back-sep {
        margin: 0 6px;
        color: var(--text-faint);
        font-size: 0.72rem;
    }
    .mag-col h1 { font-size: 1.6rem; margin-bottom: 12px; }
    .mag-col .meta { margin-bottom: 24px; }
    .mag-col .intro { margin-bottom: 24px; }
    .mag-col h2 { margin-top: 28px; margin-bottom: 14px; }
    .mag-col h3 { margin-top: 20px; margin-bottom: 10px; }
    .mag-col h4 { margin-top: 16px; margin-bottom: 8px; }
    .mag-col hr { margin: 24px 0; }
    .mag-col .footer-note { margin-top: 24px; }
    .mag-col .nav-bottom { display: none; }
    .mag-nav {
        position: absolute;
        left: 48px;
        right: 48px;
        bottom: 0;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 0.8rem;
        color: var(--text-dim);
        border-top: 1px solid var(--border-light);
    }
    .mag-prev, .mag-next, .mag-home { cursor: pointer; user-select: none; transition: color 0.3s; }
    .mag-prev:hover, .mag-next:hover, .mag-home:hover { color: var(--ink); }
    .mag-home { color: var(--text-dim); text-decoration: none; }
    .mag-pages { position: relative; cursor: pointer; user-select: none; }
    .mag-num { letter-spacing: 1px; transition: opacity 0.3s ease; }
    .mag-list {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        gap: 4px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.6s ease;
    }
    .mag-pages:hover .mag-num { opacity: 0; }
    .mag-pages:hover .mag-list,
    .mag-list:hover {
        opacity: 1;
        pointer-events: auto;
    }
    .mag-goto {
        border: none;
        background: none;
        padding: 2px 5px;
        font-family: inherit;
        font-size: 0.8rem;
        color: var(--text-dim);
        cursor: pointer;
        transition: color 0.3s, transform 0.15s cubic-bezier(0.22, 0.3, 0.32, 1.4);
    }
    .mag-goto:hover {
        color: var(--ink);
        transform: scale(1.75);
    }
    .mag-goto.mag-current { color: var(--ink); }
    .mag-disabled { opacity: 0.35; pointer-events: none; }
}
@keyframes magFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mag-page { animation: none; } }

/* ── 阅读进度条（长文专用）── */
#progress-bar {
    position: fixed; top: 0; left: 0;
    height: 2px; width: 0%;
    background: var(--ink);
    z-index: 999;
}

/* ── 跨页 a11y 工具 ── */
/* 暖纸渐隐遮罩（固化扉页修复：原 #fafafa 冷灰 → 暖纸）*/
#page-fade { background: var(--bg); }

/* 全站滚动条：淡墨蓝细条（2026.8.24 全站推广）
   html:: = 页面滚动条；*:: = 元素滚动条（textarea 等）
   Firefox 的 scrollbar-width/color 为继承属性，写 html 上自动传导 */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 107, 128, 0.3) transparent;
}
html::-webkit-scrollbar, *::-webkit-scrollbar { width: 6px; }
html::-webkit-scrollbar-track, *::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb, *::-webkit-scrollbar-thumb {
    background: rgba(74, 107, 128, 0.3);
    border-radius: 3px;
}

/* 尊重「减少动态」偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── 移动端：防溢出 + 表格自适应 ── */
@media (max-width: 600px) {
    html, body {
        width: 100%;
        overflow-x: hidden;
    }
    body .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    table {
        table-layout: fixed;
        width: 100%;
    }
    th, td {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-all;
    }
}
