/* ============================================================================
   SFMblog · 设计系统
   ----------------------------------------------------------------------------
   1. Tokens        2. Base        3. Background    4. Primitives
   5. Navbar        6. Hero        7. Sections      8. Post cards
   9. Archive      10. About      11. Article      12. Auth / Console
  13. Footer       14. Motion     15. Responsive   16. Print
============================================================================ */

/* ---------------------------------------------------------------- 1. Tokens */
:root {
    color-scheme: light;

    /* brand */
    --brand-1: #ec4899;
    --brand-2: #8b5cf6;
    --brand-3: #22d3ee;
    /* 比 --brand-1 深一档：浅色模式下作为正文里的链接/标签色，
       要在浅底上稳稳过 WCAG AA（4.5:1），#db2777 只有 4.34 */
    --brand-ink: #c81e6e;
    --grad-brand: linear-gradient(120deg, #ec4899 0%, #8b5cf6 100%);
    --grad-brand-r: linear-gradient(120deg, #8b5cf6 0%, #ec4899 100%);
    --brand-tint: rgba(236, 72, 153, 0.10);
    --brand-ring: rgba(236, 72, 153, 0.30);

    /* page */
    /*
     * 白天底色从"近白"改成偏粉。
     * 近白的底会把任何线条衬得很跳；底色和线色同属粉系之后，
     * 格子就"长"在底上了，不再突兀。顺带整页也暖一点，不显得那么像张白纸。
     */
    --bg-0: #fdf1f7;
    --bg-1: #f9e4f0;
    /* 背景光晕的强度（浅色 / 深色分开，深色下太强会发灰） */
    --bg-glow-a: 0.16;
    --bg-glow-b: 0.12;
    --ink-1: #14162a;
    --ink-2: #43485e;
    --ink-3: #666d85;
    --ink-4: #8f96ab;
    --line: rgba(20, 22, 42, 0.13);
    --line-strong: rgba(20, 22, 42, 0.16);
    /*
     * 方格本的线，单独一套 token，不动界面的 --line。
     * 浅色下用**靛蓝灰**而不是紫色：底色本身偏粉紫，再用同色系的紫
     * 会显得跳、也容易发闷；方眼纸本来就该是冷灰蓝。
     */
    --paper-line: rgba(196, 112, 154, 0.13);
    --paper-line-strong: rgba(196, 112, 154, 0.22);

    /* glass */
    /* 透明玻璃：填充很淡、模糊很小，让背板"看得清"再靠边缘高光立住质感 */
    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.40), rgba(255, 255, 255, 0.14));
    --glass-bg-2: rgba(255, 255, 255, 0.30);
    --glass-brd: rgba(255, 255, 255, 0.70);
    --glass-blur: 3px;
    --glass-bright: 1.06;
    --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.95);
    /* 玻璃的"厚度"：顶部一道内反光、底部一片内阴影，再加左上冷/右下暖的色散 */
    --glass-edge:
        inset 1px 1px 0 rgba(190, 230, 255, 0.60),
        inset -1px -1px 0 rgba(255, 190, 235, 0.45),
        inset 0 2px 5px -2px rgba(255, 255, 255, 0.75),
        inset 0 -14px 26px -20px rgba(24, 18, 58, 0.42);

    /* elevation */
    --sh-sm: 0 1px 2px rgba(20, 22, 42, 0.05), 0 8px 20px -14px rgba(20, 22, 42, 0.30);
    --sh-md: 0 2px 4px rgba(20, 22, 42, 0.04), 0 20px 44px -26px rgba(20, 22, 42, 0.40);
    --sh-lg: 0 2px 6px rgba(20, 22, 42, 0.05), 0 34px 70px -34px rgba(76, 29, 149, 0.45);
    --sh-brand: 0 18px 40px -20px rgba(236, 72, 153, 0.60);

    /* code */
    --code-bg: #10142a;
    --code-bg-2: #171c38;
    --code-ink: #e6e9f5;

    /* geometry */
    --r-xs: 10px;
    --r-sm: 14px;
    --r-md: 20px;
    --r-lg: 28px;
    --r-pill: 999px;
    --maxw: 1180px;
    --nav-h: 64px;

    /* motion */
    --ease: cubic-bezier(0.22, 0.75, 0.28, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    /*
     * 极光色团的两个开关。
     *
     * --drift-play: running 就恢复漂移，paused 就是静止（当前）。
     *   只要背景在动，玻璃背后的画面就每帧都变，页面上所有 backdrop-filter
     *   都得跟着重算。实测（Chrome 154，本机）：
     *       连续漂移            41.3% GPU
     *       离散步进 steps(30)   21.8%
     *       完全不漂移           17.6%
     *   画面上的动静交给终端雨即可，它只有 18fps，便宜得多。
     *
     * --drift-steps: 想让漂移"几乎看不出来但保留一点"时用它做离散步进。
     */
    --drift-play: paused;
    --drift-steps: steps(30, end);

    /* type */
    --font: "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC",
        Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", "SF Mono", "JetBrains Mono", Menlo, Consolas,
        "Liberation Mono", "Courier New", monospace;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg-0: #070810;
    --bg-1: #0d1022;
    --bg-glow-a: 0.10;
    --bg-glow-b: 0.10;
    --ink-1: #eef0f9;
    --ink-2: #bfc5da;
    --ink-3: #9ba2ba;
    --ink-4: #737a94;
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(255, 255, 255, 0.16);
    --paper-line: rgba(150, 200, 255, 0.14);
    --paper-line-strong: rgba(150, 200, 255, 0.26);

    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.03));
    --glass-bg-2: rgba(255, 255, 255, 0.035);
    --glass-brd: rgba(255, 255, 255, 0.16);
    --glass-blur: 4px;
    --glass-bright: 1.12;
    --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    --glass-edge: inset 1px 1px 0 rgba(150, 220, 255, 0.30),
        inset -1px -1px 0 rgba(255, 150, 220, 0.24),
        inset 0 2px 6px -2px rgba(255, 255, 255, 0.18),
        inset 0 -14px 30px -20px rgba(0, 0, 0, 0.75);

    --brand-ink: #f472b6;
    --brand-tint: rgba(236, 72, 153, 0.16);
    --brand-ring: rgba(236, 72, 153, 0.45);

    --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 20px -14px rgba(0, 0, 0, 0.8);
    --sh-md: 0 2px 4px rgba(0, 0, 0, 0.5), 0 20px 44px -26px rgba(0, 0, 0, 0.9);
    --sh-lg: 0 2px 6px rgba(0, 0, 0, 0.6), 0 34px 70px -34px rgba(0, 0, 0, 1);

    --code-bg: #171c3c;
    --code-bg-2: #1e2449;
}

/* ------------------------------------------------------------------ 2. Base */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    /*
     * ⚠️ 这里千万不要给 html 设 background-color。
     *
     * 原来的机制是：html 没有背景 -> body 的背景**传播到画布**，
     * 于是 .bg（z-index:-2，装着极光和纹理）能露出来。
     * 一旦 html 有了背景，body 就不再传播、改为自己绘制那一层，
     * 而 body 是不透明的 —— 它会直接盖在 .bg 和 .rain 上面，
     * 整个背景装饰层全被遮住：浅色下看不到纹理，深色下只剩一片 #070810。
     * （这个坑我踩过一次，黑色模式变纯黑就是它。）
     */
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-1);
    background: var(--bg-0);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
svg,
video { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button,
input,
textarea,
select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

ul,
ol { list-style: none; }

::selection {
    background: rgba(236, 72, 153, 0.22);
    color: var(--ink-1);
}

:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 3px;
    border-radius: 4px;
}

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--brand-ring); background-clip: content-box; }

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 999;
    padding: 10px 18px;
    border-radius: var(--r-pill);
    background: var(--ink-1);
    color: var(--bg-0);
    font-size: 0.9rem;
    font-weight: 600;
    transform: translateY(-200%);
    transition: transform 0.25s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ------------------------------------------------------------ 3. Background */
.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(1200px 700px at 12% -8%, rgba(236, 72, 153, var(--bg-glow-a)), transparent 60%),
        radial-gradient(1000px 600px at 92% 4%, rgba(139, 92, 246, var(--bg-glow-b)), transparent 62%),
        linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 55%, var(--bg-0) 100%);
}

.bg-aurora { position: absolute; inset: -20%; }

.bg-aurora i {
    position: absolute;
    display: block;
    border-radius: 50%;
    /*
     * 这里原本是 filter: blur(70px)。实测这是全站最大的一笔 GPU 开销：
     * 对一个 46vw 的元素做 70px 高斯模糊、而且它还在动，
     * 浏览器每帧都得重算一次模糊 —— 单这一项就吃掉十几个百分点。
     * 换成"本身就足够柔和"的径向渐变之后，观感几乎一样，开销归零。
     */
    opacity: 0.55;
    will-change: transform;
    /* 开关见 :root 里的 --drift-play（注意不能只写在这里：
       下面各色团的 animation 简写会把它重置掉） */
}

html[data-theme="dark"] .bg-aurora i { opacity: 0.42; }

.bg-aurora .b1 {
    width: 46vw; height: 46vw; left: -6vw; top: -8vw;
    background: radial-gradient(circle at 50% 50%,
        rgba(236, 72, 153, 0.55) 0%, rgba(236, 72, 153, 0.30) 32%,
        rgba(236, 72, 153, 0.10) 56%, transparent 78%);
    animation: drift-1 26s var(--drift-steps) infinite alternate;
    animation-play-state: var(--drift-play);
}
.bg-aurora .b2 {
    width: 40vw; height: 40vw; right: -8vw; top: 6vh;
    background: radial-gradient(circle at 50% 50%,
        rgba(139, 92, 246, 0.52) 0%, rgba(139, 92, 246, 0.28) 32%,
        rgba(139, 92, 246, 0.09) 56%, transparent 78%);
    animation: drift-2 32s var(--drift-steps) infinite alternate;
    animation-play-state: var(--drift-play);
}
.bg-aurora .b3 {
    width: 44vw; height: 44vw; left: 28vw; bottom: -16vw;
    background: radial-gradient(circle at 50% 50%,
        rgba(34, 211, 238, 0.34) 0%, rgba(34, 211, 238, 0.18) 34%,
        rgba(34, 211, 238, 0.06) 58%, transparent 80%);
    animation: drift-3 38s var(--drift-steps) infinite alternate;
    animation-play-state: var(--drift-play);
}

.bg-grid {
    position: absolute;
    inset: 0;
    /*
     * 背景纹理全部用 CSS 渐变生成，不放任何栅格图 —— 这样永远不存在
     * "不同设备尺寸/DPR 下被拉伸、裁切、模糊"的问题。
     *
     * 纹理不只是装饰：玻璃的折射需要**直的、有细节的东西**当参照，
     * 光滑渐变被位移几十像素也看不出来。
     * 具体用哪一套由 <html data-pattern="..."> 决定，见下面几段。
     */
    mask-image: radial-gradient(150% 120% at 50% 0%, #000 34%, transparent 96%);
    -webkit-mask-image: radial-gradient(150% 120% at 50% 0%, #000 34%, transparent 96%);
    opacity: 1;
}

/*
 * 五套纹理，改 <html data-pattern="..."> 就能换。
 * 全部由 CSS 渐变生成，没有任何栅格图 —— 换设备也不会有缩放问题。
 *
 *   grid     彩色方格本（默认）：22px 小格 + 每 4 格一条略深的主线
 *   iso      等距网格，工程图纸感
 *   dots     点阵，最安静
 *   contour  等高线，曲线更好看
 *   none     不要纹理（玻璃会变成纯透明，折射失去参照物）
 */

/* ---- 彩色方格本（默认）---- */
html[data-pattern="grid"] .bg-grid,
html:not([data-pattern]) .bg-grid {
    background-image:
        linear-gradient(to right, var(--paper-line-strong) 1px, transparent 1px),
        linear-gradient(to bottom, var(--paper-line-strong) 1px, transparent 1px),
        linear-gradient(to right, var(--paper-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--paper-line) 1px, transparent 1px);
    background-size: 72px 72px, 72px 72px, 18px 18px, 18px 18px;
}

/* ---- 点阵 ---- */
html[data-pattern="dots"] .bg-grid {
    background-image:
        radial-gradient(circle, var(--paper-line-strong) 1.7px, transparent 1.8px),
        radial-gradient(circle, var(--paper-line) 1.1px, transparent 1.2px);
    background-size: 104px 104px, 26px 26px;
}

/* ---- 等距网格 ---- */
html[data-pattern="iso"] .bg-grid {
    background-image:
        repeating-linear-gradient(60deg, var(--paper-line) 0 1px, transparent 1px 34px),
        repeating-linear-gradient(-60deg, var(--paper-line) 0 1px, transparent 1px 34px),
        repeating-linear-gradient(0deg, var(--paper-line-strong) 0 1px, transparent 1px 102px);
}

/* ---- 等高线 ---- */
html[data-pattern="contour"] .bg-grid {
    background-image:
        repeating-radial-gradient(circle at 16% 8%, var(--paper-line) 0 1px, transparent 1px 46px),
        repeating-radial-gradient(circle at 88% 78%, var(--paper-line-strong) 0 1px, transparent 1px 64px);
}

/* ---- 不要纹理 ---- */
html[data-pattern="none"] .bg-grid { display: none; }

.bg-noise {
    position: absolute;
    inset: 0;
    /*
     * 原本是 mix-blend-mode: overlay。混合模式会让整屏在合成阶段多一道混合，
     * 而且是固定层、每帧都要算 —— 实测这一项就吃掉十几个百分点。
     * 改成普通叠加 + 更低的不透明度，纹理感还在，混合成本没了。
     */
    opacity: 0.10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift-1 {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(9vw, 7vh, 0) scale(1.14); }
}
@keyframes drift-2 {
    from { transform: translate3d(0, 0, 0) scale(1.06); }
    to   { transform: translate3d(-11vw, 12vh, 0) scale(0.92); }
}
@keyframes drift-3 {
    from { transform: translate3d(0, 0, 0) scale(0.94); }
    to   { transform: translate3d(-7vw, -9vh, 0) scale(1.12); }
}

/* ------------------------------------------------------------ 4. Primitives */
.shell {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.main {
    flex: 1;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(38px, 6vw, 68px) 24px clamp(70px, 9vw, 120px);
}

.glass {
    position: relative;
    background: var(--glass-bg);
    /* 兜底：不支持 backdrop-filter: url() 的浏览器走普通毛玻璃 */
    backdrop-filter: blur(8px) saturate(175%);
    -webkit-backdrop-filter: blur(8px) saturate(175%);
    border: 1px solid var(--glass-brd);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md), var(--glass-edge), var(--glass-inner);
}

/*
 * 真·折射。
 *
 * #sfm-lens 里是一张"透镜位移图"（JS 生成，见 buildLensMap）：
 * 靠近边缘的采样点被推到元素外侧，于是玻璃边缘会把外面的画面吸进来，
 * 中间则完全不位移。折射的是**真实背板** —— 终端雨、极光、网格都会跟着弯。
 */
@supports (backdrop-filter: url(#sfm-lens)) {
    .glass {
        backdrop-filter: url(#sfm-lens);
        -webkit-backdrop-filter: url(#sfm-lens);
    }
}

/* 放滤镜定义的容器，不参与布局 */
.sfm-defs {
    position: fixed;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.card {
    padding: 26px 28px;
    border-radius: var(--r-md);
}

/* 顶部那道渐变高光已经并进 --glass-inner / --glass-edge 的 inset 阴影里，
   ::before 让给上面的折射层 */

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand-ink);
}
.kicker::before {
    content: "";
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad-brand);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-top: 12px;
}

.section-sub {
    margin-top: 10px;
    color: var(--ink-3);
    font-size: 0.98rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 44px;
    padding: 0 22px;
    border-radius: var(--r-pill);
    font-size: 0.94rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease),
        background-color 0.28s var(--ease), border-color 0.28s var(--ease), color 0.2s;
}
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary {
    background: var(--grad-brand);
    color: #fff;
    box-shadow: var(--sh-brand);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 46px -18px rgba(236, 72, 153, 0.72); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: var(--glass-bg);
    border-color: var(--glass-brd);
    color: var(--ink-1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--brand-ring); color: var(--brand-ink); }

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--brand-ink);
}
.link-arrow svg { width: 15px; height: 15px; transition: transform 0.3s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    border-radius: var(--r-pill);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    color: var(--brand-ink);
    background: var(--brand-tint);
    border: 1px solid var(--brand-ring);
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
        border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
a.tag:hover, .tag:hover {
    background: var(--grad-brand);
    border-color: transparent;
    color: #fff;
    transform: translateY(-1px);
}

.tag-row { display: flex; flex-wrap: wrap; gap: 9px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r-pill);
    color: var(--ink-2);
    border: 1px solid transparent;
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
        border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.icon-btn:hover {
    color: var(--brand-ink);
    background: var(--brand-tint);
    border-color: var(--brand-ring);
}
.icon-btn svg { width: 19px; height: 19px; }

/* theme switch: show sun in dark mode, moon in light mode */
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* --------------------------------------------------------------- 5. Navbar */
.nav-wrap {
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 14px 24px 0;
    transition: padding 0.35s var(--ease);
}
.nav-wrap.is-stuck { padding-top: 8px; }

.nav {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    height: var(--nav-h);
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: var(--r-pill);
    transition: box-shadow 0.35s var(--ease), background-color 0.35s var(--ease),
        border-color 0.35s var(--ease);
}
.nav-wrap.is-stuck .nav {
    box-shadow: var(--sh-lg);
    background: var(--glass-bg-2);
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: none;
    padding-right: 6px;
}

.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-size: cover;
    background-position: center 22%;
    background-color: var(--brand-tint);
    border: 1.5px solid var(--glass-brd);
    box-shadow: 0 4px 12px -6px rgba(20, 22, 42, 0.5);
    transition: transform 0.4s var(--ease);
}
.nav-brand:hover .nav-avatar { transform: rotate(-4deg) scale(1.06); }

.nav-name {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.nav-name .accent { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--r-pill);
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--ink-2);
    transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.nav-links a:hover { color: var(--ink-1); background: var(--glass-bg); }
.nav-links a.active {
    color: #fff;
    background: var(--grad-brand);
    box-shadow: var(--sh-brand);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
    margin-left: 4px;
    border-left: 1px solid var(--line);
}

.nav-burger { display: none; flex-direction: column; gap: 4px; }
.nav-burger span {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-progress {
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad-brand);
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.1s linear;
    display: none;
}
.nav-progress.is-on { display: block; }

/* ---------------------------------------------------------------- 6. Hero */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: center;
    padding-bottom: clamp(56px, 8vw, 96px);
}

.hero-title {
    margin-top: 18px;
    font-size: clamp(2.6rem, 6.2vw, 4.4rem);
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -0.035em;
}
.hero-title .grad {
    display: block;
    font-size: 0.62em;
    margin-top: 0.22em;
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead {
    margin-top: 22px;
    max-width: 46ch;
    font-size: clamp(1rem, 1.4vw, 1.1rem);
    line-height: 1.85;
    color: var(--ink-2);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-top: 40px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}
.hero-stats .stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.hero-stats .stat span {
    font-size: 0.82rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}

.hero-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-card {
    padding: 26px 28px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-avatar {
    position: relative;
    width: 76px;
    height: 76px;
    flex: none;
    border-radius: 24px;
    background-size: cover;
    background-position: center 20%;
    border: 1px solid var(--glass-brd);
    box-shadow: var(--sh-sm);
}
.profile-avatar::after {
    content: "";
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid var(--bg-0);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.profile-name { font-size: 1.18rem; font-weight: 800; letter-spacing: -0.015em; }
.profile-role {
    margin-top: 4px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--brand-ink);
}
.profile-note { margin-top: 8px; font-size: 0.86rem; color: var(--ink-3); }

.quote-card {
    padding: 22px 26px;
    font-size: 0.98rem;
    line-height: 1.8;
    color: var(--ink-2);
}
.quote-card .mark {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-4);
    letter-spacing: 0.08em;
}

.tags-card { padding: 22px 26px; }

/* ------------------------------------------------------------ 7. Sections */
.section + .section { margin-top: clamp(56px, 8vw, 96px); }

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
    margin: clamp(48px, 7vw, 84px) 0;
    border: 0;
}

/* ---------------------------------------------------------- 8. Post cards */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.post-card {
    position: relative;
    border-radius: var(--r-md);
    padding: 0;
    overflow: hidden;
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
        border-color 0.4s var(--ease);
}
.post-card::after {
    content: none;   /* 顶部渐变线见 .post-card-link::after；::after 留给指针高光 */
}
.post-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--sh-lg);
    border-color: var(--brand-ring);
}

.post-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px 26px 22px;
}

.post-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 14px;
    margin-bottom: 16px;
}
.post-card-top .tag-row { flex: 1 1 auto; min-width: 0; }
.post-card-top .tag { height: 24px; font-size: 0.74rem; padding: 0 10px; }

.post-date {
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    flex: none;
}

.post-card-title {
    font-size: 1.2rem;
    font-weight: 750;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--ink-1);
    transition: color 0.25s var(--ease);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card:hover .post-card-title { color: var(--brand-ink); }

.post-card-summary {
    margin-top: 12px;
    font-size: 0.94rem;
    line-height: 1.78;
    color: var(--ink-3);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
}

.post-read {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-3);
}

.empty-state {
    padding: 54px 28px;
    text-align: center;
    color: var(--ink-3);
    border-radius: var(--r-md);
    border: 1px dashed var(--line-strong);
}
.empty-state strong { display: block; color: var(--ink-2); margin-bottom: 6px; font-size: 1.05rem; }

/* skeleton */
.skeleton {
    border-radius: var(--r-md);
    height: 200px;
    border: 1px solid var(--line);
    background: linear-gradient(100deg, var(--glass-bg) 30%, var(--glass-bg-2) 50%, var(--glass-bg) 70%);
    background-size: 220% 100%;
    animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer {
    from { background-position: 150% 0; }
    to { background-position: -50% 0; }
}

/* ------------------------------------------------------------ 9. Archive */
.archive-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.stat-card {
    padding: 20px 22px;
    border-radius: var(--r-md);
}
.stat-card strong {
    display: block;
    font-size: 1.7rem;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-card span { font-size: 0.82rem; color: var(--ink-3); letter-spacing: 0.02em; }
.stat-card .stat-word {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.25rem;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--ink-1);
}

.timeline { position: relative; padding-left: 26px; }
.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brand-ring), rgba(139, 92, 246, 0.35), transparent);
}

.year-group { position: relative; }
.year-group + .year-group { margin-top: 34px; }

.year-label {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    z-index: 5;
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 16px -20px;
    padding: 6px 18px 6px 14px;
    border-radius: var(--r-pill);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-brd);
    font-size: 1.28rem;
    font-weight: 850;
    letter-spacing: -0.02em;
    box-shadow: var(--sh-sm);
}
.year-label em {
    font-style: normal;
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--ink-3);
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px 22px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
        transform 0.3s var(--ease);
}
.timeline-item + .timeline-item { margin-top: 4px; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--bg-0);
    border: 2.5px solid var(--brand-1);
    box-shadow: 0 0 0 3px var(--brand-tint);
    transition: transform 0.3s var(--ease), background-color 0.3s var(--ease);
}
.timeline-item:hover {
    background: var(--glass-bg);
    border-color: var(--glass-brd);
    transform: translateX(6px);
}
.timeline-item:hover::before { transform: scale(1.35); background: var(--brand-1); }

.timeline-date {
    flex: none;
    width: 52px;
    font-family: var(--mono);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--brand-ink);
}
.timeline-title {
    flex: 1;
    font-size: 1.02rem;
    font-weight: 620;
    line-height: 1.5;
    color: var(--ink-2);
    transition: color 0.25s var(--ease);
}
.timeline-item:hover .timeline-title { color: var(--ink-1); }

/* -------------------------------------------------------------- 10. About */
.about-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}
.about-col { display: flex; flex-direction: column; gap: 22px; }

.panel { padding: 30px 32px; border-radius: var(--r-lg); }

.panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.16rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}
.panel-title::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 3px;
    background: var(--grad-brand);
}

.prose-lite { color: var(--ink-2); font-size: 1rem; line-height: 1.9; }
.prose-lite p + p { margin-top: 14px; }
.prose-lite strong { color: var(--ink-1); font-weight: 700; }

.fact-list { display: grid; gap: 12px; }
.fact-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.97rem;
    color: var(--ink-2);
    line-height: 1.7;
}
.fact-list .ico {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--brand-tint);
    border: 1px solid var(--brand-ring);
    font-size: 0.9rem;
}

.about-quote {
    margin-top: 22px;
    padding: 16px 20px;
    border-radius: var(--r-sm);
    border-left: 3px solid;
    border-image: var(--grad-brand) 1;
    background: var(--brand-tint);
    font-size: 0.98rem;
    color: var(--ink-2);
    font-style: italic;
}

.skill-group + .skill-group { margin-top: 20px; }
.skill-title {
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 11px;
}

.contact-list { display: grid; gap: 4px; }

/* 素材署名之类的小字 */
.credit {
    margin-top: 14px;
    font-size: 0.82rem;
    line-height: 1.8;
    color: var(--ink-3);
}
.credit strong { color: var(--ink-2); font-weight: 650; }
.credit a {
    color: var(--brand-ink);
    border-bottom: 1px solid var(--brand-ring);
    transition: color 0.2s, border-color 0.2s;
}
.credit a:hover { color: var(--brand-2); border-color: var(--brand-2); }
.contact-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    margin: 0 -13px;
    border-radius: var(--r-sm);
    font-size: 0.95rem;
    color: var(--ink-2);
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.contact-link:hover { background: var(--brand-tint); color: var(--brand-ink); }
.contact-link .ico { display: grid; place-items: center; width: 20px; font-size: 1rem; }
.contact-link b { font-weight: 600; }

.gallery { display: grid; gap: 18px; }
.gallery figure {
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--glass-brd);
    background: var(--glass-bg);
    box-shadow: var(--sh-sm);
}
.gallery img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; transition: transform 0.6s var(--ease); }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--ink-3);
    border-top: 1px solid var(--line);
}
.gallery figcaption b { color: var(--ink-1); font-weight: 700; }

/* 兴趣 / 收藏：Markdown 渲染出来的图文 */
.interest { color: var(--ink-2); font-size: 1rem; line-height: 1.9; }
.interest h2 { font-size: 1.05rem; font-weight: 700; color: var(--ink-1); margin: 0 0 4px; }
.interest p { margin: 0 0 10px; }
.interest p:last-child { margin-bottom: 0; }
.interest strong { color: var(--ink-1); font-weight: 700; }
.interest img {
    display: block;
    width: auto;
    max-width: min(100%, 340px);
    max-height: 420px;
    height: auto;
    margin: 6px auto 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--glass-brd);
    box-shadow: var(--sh-md);
    object-fit: cover;
}
.media-fallback {
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 26px 20px;
    margin: 6px 0 14px;
    border-radius: var(--r-md);
    border: 1px dashed var(--line-strong);
    color: var(--ink-3);
    font-size: 0.88rem;
    text-align: center;
}
.media-fallback b { color: var(--ink-2); font-weight: 700; }

/* ------------------------------------------------------------ 11. Article */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 216px;
    gap: 30px;
    align-items: start;
}

.article {
    padding: clamp(28px, 4.4vw, 56px);
    border-radius: var(--r-lg);
}

.article-head { padding-bottom: 26px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }

.article-title {
    font-size: clamp(1.6rem, 3.6vw, 2.3rem);
    font-weight: 850;
    line-height: 1.32;
    letter-spacing: -0.025em;
    margin: 14px 0 18px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    font-family: var(--mono);
    font-size: 0.79rem;
    color: var(--ink-3);
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }

.edit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 13px;
    border-radius: var(--r-pill);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--brand-ink);
    background: var(--brand-tint);
    border: 1px solid var(--brand-ring);
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.edit-chip:hover { background: var(--grad-brand); color: #fff; border-color: transparent; }

.toc {
    position: sticky;
    top: calc(var(--nav-h) + 28px);
    padding: 20px 20px 22px;
    border-radius: var(--r-md);
    font-size: 0.86rem;
    max-height: calc(100vh - var(--nav-h) - 60px);
    overflow: auto;
}
.toc-title {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 12px;
}
.toc a {
    display: block;
    padding: 6px 10px;
    margin-left: -10px;
    border-radius: 8px;
    color: var(--ink-3);
    line-height: 1.5;
    border-left: 2px solid transparent;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.toc a.lv3 { padding-left: 22px; font-size: 0.82rem; }
.toc a:hover { color: var(--ink-1); background: var(--glass-bg); }
.toc a.is-active { color: var(--brand-ink); border-left-color: var(--brand-1); background: var(--brand-tint); }

/* --- prose ------------------------------------------------------------- */
.prose { font-size: 1.045rem; line-height: 1.9; color: var(--ink-2); }
.prose > :first-child { margin-top: 0 !important; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: var(--ink-1);
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: -0.015em;
    scroll-margin-top: calc(var(--nav-h) + 28px);
}

.prose h1 { font-size: 1.75rem; margin: 2em 0 0.8em; }
.prose h2 {
    position: relative;
    font-size: 1.5rem;
    margin: 2.5em 0 1em;
    padding-left: 0.9rem;
}
.prose h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 4px;
    border-radius: 3px;
    background: var(--grad-brand);
}
.prose h3 { font-size: 1.2rem; margin: 2.1em 0 0.8em; }
.prose h4 { font-size: 1.1rem; margin: 1.9em 0 0.7em; }

.prose p { margin-bottom: 1.15em; text-align: justify; word-break: break-word; }
.prose strong { color: var(--ink-1); font-weight: 700; }
.prose em { color: var(--ink-2); }
.prose del { color: var(--ink-4); }

.prose a {
    color: var(--brand-ink);
    font-weight: 550;
    text-decoration: none;
    border-bottom: 1px solid var(--brand-ring);
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.prose a:hover { color: var(--brand-2); border-color: var(--brand-2); background: var(--brand-tint); }

.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.35em; }
.prose ul { list-style: none; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.5em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
    content: "";
    position: absolute;
    left: -1.15em;
    top: 0.72em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--grad-brand);
    transform: rotate(45deg);
}
.prose ol > li::marker { color: var(--brand-ink); font-weight: 700; }

.prose code {
    font-family: var(--mono);
    font-size: 0.87em;
    padding: 0.16em 0.42em;
    border-radius: 6px;
    color: var(--brand-ink);
    background: var(--brand-tint);
    border: 1px solid var(--brand-ring);
    word-break: break-word;
}

.prose pre {
    position: relative;
    margin: 0 0 1.5em;
    padding: 20px 22px;
    border-radius: var(--r-md);
    background: var(--code-bg);
    border: 1px solid rgba(255, 255, 255, 0.11);
    box-shadow: var(--sh-md);
    overflow: hidden;
}
.prose pre::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}
.prose pre code {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: var(--code-ink);
    font-size: 0.86rem;
    line-height: 1.75;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}

.code-lang {
    position: absolute;
    top: 12px;
    left: 16px;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
    pointer-events: none;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 0.74rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(6px);
    transition: background-color 0.2s, color 0.2s, opacity 0.2s;
    opacity: 0;
}
.prose pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.copy-btn.is-done { color: #34d399; border-color: rgba(52, 211, 153, 0.5); opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

.prose blockquote {
    margin: 0 0 1.5em;
    padding: 16px 22px;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    border-left: 3px solid;
    border-image: var(--grad-brand) 1;
    background: var(--brand-tint);
    color: var(--ink-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 1.8em auto;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    box-shadow: var(--sh-md);
    background: var(--glass-bg);
}

.prose hr {
    height: 1px;
    border: 0;
    margin: 2.6em 0;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.prose table {
    width: 100%;
    margin: 0 0 1.6em;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
    display: block;
    overflow-x: auto;
}
.prose th, .prose td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.prose thead th { background: var(--brand-tint); color: var(--ink-1); font-weight: 700; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--glass-bg); }

.prose kbd {
    font-family: var(--mono);
    font-size: 0.8em;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    background: var(--glass-bg);
}

.prose .h-anchor {
    margin-left: 0.4em;
    font-size: 0.7em;
    color: var(--brand-ink);
    opacity: 0;
    border: 0;
    transition: opacity 0.2s;
}
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor { opacity: 0.8; }

/* prev / next */
.post-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 30px;
}
.post-nav a {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 20px 24px;
    border-radius: var(--r-md);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.post-nav a:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: var(--brand-ring); }
.post-nav .lbl {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.post-nav .ttl { font-weight: 700; line-height: 1.5; color: var(--ink-1); }
.post-nav .next { text-align: right; align-items: flex-end; }

/* back to top */
.to-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 150;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink-2);
    opacity: 0;
    transform: translateY(14px) scale(0.9);
    pointer-events: none;
    transition: all 0.35s var(--ease);
}
.to-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--brand-ink); border-color: var(--brand-ring); }

/* reading progress */
.reading-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    height: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--grad-brand);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
}

/* ------------------------------------------------------- 12. Auth/Console */
.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 408px;
    padding: 40px 38px 36px;
    border-radius: var(--r-lg);
    text-align: center;
    animation: rise 0.6s var(--ease-out) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

.auth-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 20px;
    background-size: cover;
    background-position: center 20%;
    border: 1px solid var(--glass-brd);
    box-shadow: var(--sh-sm);
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.auth-sub {
    margin-top: 8px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-4);
    letter-spacing: 0.04em;
}

.field { position: relative; margin-top: 26px; }
.field input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 18px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--glass-bg);
    color: var(--ink-1);
    font-size: 1rem;
    letter-spacing: 0.06em;
    outline: none;
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.field input::placeholder { color: var(--ink-3); letter-spacing: 0; }
.field input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px var(--brand-tint); }

.field .eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--ink-3);
    transition: color 0.2s, background-color 0.2s;
}
.field .eye:hover { color: var(--brand-ink); background: var(--brand-tint); }
.field .eye svg { width: 18px; height: 18px; }

.auth-btn { width: 100%; margin-top: 18px; height: 48px; }

.auth-msg {
    margin-top: 16px;
    min-height: 20px;
    font-size: 0.86rem;
    color: var(--ink-3);
}
.auth-msg.is-error { color: #e11d48; }
.auth-msg.is-ok { color: #10b981; }

.auth-foot {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
    color: var(--ink-3);
}
.auth-foot a { color: var(--brand-ink); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* --- console ----------------------------------------------------------- */
.console-body {
    height: 100vh;
    overflow: hidden;
    background: var(--code-bg);
    color: var(--code-ink);
}

.console-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--code-bg-2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.console-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--mono);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-right: 6px;
    color: #fff;
}
.console-logo i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.console-top input[type="text"],
.console-top input[type="date"] {
    height: 38px;
    padding: 0 13px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: var(--code-ink);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}
.console-top input:focus { border-color: var(--brand-1); background: rgba(255, 255, 255, 0.08); }
.console-top input::placeholder { color: rgba(255, 255, 255, 0.35); }
.fld-title { flex: 2 1 220px; }
.fld-date { flex: 0 0 150px; }
.fld-tag { flex: 1 1 140px; }

.cbtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}
.cbtn:hover { color: #fff; background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.3); }
.cbtn svg { width: 15px; height: 15px; }
.cbtn-primary {
    color: #fff;
    border-color: transparent;
    background: var(--grad-brand);
    box-shadow: 0 12px 26px -14px rgba(236, 72, 153, 0.9);
}
.cbtn-primary:hover { background: var(--grad-brand); filter: brightness(1.08); }
.cbtn[disabled] { opacity: 0.55; pointer-events: none; }

.console-spacer { flex: 1; }

.console-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    overflow-x: auto;
}
.tool {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: var(--mono);
    color: rgba(255, 255, 255, 0.66);
    transition: background-color 0.18s, color 0.18s;
}
.tool:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tool-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.12); margin: 0 6px; flex: none; }

.console-stats {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.56);
    white-space: nowrap;
    padding-left: 14px;
}

.console-main { display: flex; flex: 1; min-height: 0; }

.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-editor { flex: 1 1 50%; border-right: 1px solid rgba(255, 255, 255, 0.07); }
.pane-preview { flex: 1 1 50%; background: rgba(0, 0, 0, 0.18); }

.pane-head {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex: none;
}

#markdown-input {
    flex: 1;
    width: 100%;
    padding: 22px;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--mono);
    font-size: 0.94rem;
    line-height: 1.8;
    tab-size: 4;
}
#markdown-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.preview-empty {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 30px;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.44);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: var(--r-md);
}
.preview-empty b {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 650;
}

.preview-scroll { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.preview-scroll .prose { font-size: 1rem; color: rgba(255, 255, 255, 0.78); }
.preview-scroll .prose h1, .preview-scroll .prose h2,
.preview-scroll .prose h3, .preview-scroll .prose h4,
.preview-scroll .prose strong { color: #fff; }
.preview-scroll .prose blockquote { color: rgba(255, 255, 255, 0.72); }
.preview-scroll .prose code { color: #f9a8d4; background: rgba(236, 72, 153, 0.14); border-color: rgba(236, 72, 153, 0.3); }
.preview-scroll .prose ul > li::before { background: #f472b6; }

/* console drawer */
.drawer {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(340px, 86vw);
    z-index: 400;
    display: flex;
    flex-direction: column;
    background: var(--code-bg-2);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(-102%);
    transition: transform 0.4s var(--ease);
    box-shadow: 30px 0 60px -30px rgba(0, 0, 0, 0.9);
}
.drawer.is-open { transform: none; }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}
.drawer-list { flex: 1; overflow-y: auto; padding: 10px; }
.drawer-tabs { display: flex; gap: 4px; }
.drawer-tab {
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.2s, color 0.2s;
}
.drawer-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.drawer-tab.is-on { color: #fff; background: var(--brand-tint); }
.drawer-empty {
    padding: 18px 14px;
    font-size: 0.88rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.45);
}
.drawer-item .restore {
    flex: none;
    padding: 4px 11px;
    border-radius: 7px;
    font-size: 0.74rem;
    font-weight: 650;
    color: #fff;
    background: var(--grad-brand);
    transition: filter 0.2s;
}
.drawer-item .restore:hover { filter: brightness(1.12); }
.drawer-item .acts { display: flex; gap: 6px; flex: none; }
.drawer-item .purge {
    flex: none;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.16);
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.drawer-item .purge:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
}
.drawer-item .nm { font-size: 0.86rem; }
.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    text-align: left;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.drawer-item:hover { background: rgba(255, 255, 255, 0.08); }
.drawer-item .idx {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--brand-ink);
    flex: none;
}
.drawer-item .nm {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drawer-item .dt { font-family: var(--mono); font-size: 0.7rem; color: rgba(255, 255, 255, 0.48); flex: none; }
.drawer-item.is-current { background: var(--brand-tint); color: #fff; }

/* ---------------------------------------------- 控制台 · 评论管理（抽屉里） */

.drawer-cmt {
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.86rem;
    line-height: 1.75;
}

.drawer-cmt.is-pending {
    border-color: var(--brand-ring);
    background: var(--brand-tint);
}

.drawer-cmt .dc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.drawer-cmt .dc-head b { color: #fff; }

.drawer-cmt .dc-badge {
    padding: 1px 8px;
    border-radius: var(--r-pill);
    background: var(--brand-1);
    color: #fff;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.drawer-cmt.is-spam .dc-badge { background: #ef4444; }

.drawer-cmt .dc-meta {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.74rem;
}

.drawer-cmt .dc-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.drawer-cmt .dc-acts {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.drawer-cmt .dc-acts button {
    padding: 4px 12px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.76rem;
    transition: background-color 0.2s;
}

.drawer-cmt .dc-acts button:hover { background: rgba(255, 255, 255, 0.1); }
.drawer-cmt .dc-acts .ok { border-color: #10b981; color: #10b981; }
.drawer-cmt .dc-acts .del { border-color: rgba(239, 68, 68, 0.7); color: #ef4444; }

.scrim {
    position: fixed;
    inset: 0;
    z-index: 390;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease);
}
.scrim.is-on { opacity: 1; pointer-events: auto; }

/* toast */
.toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-1);
    background: var(--glass-bg);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--glass-brd);
    box-shadow: var(--sh-lg);
    animation: toast-in 0.4s var(--ease-out) both;
}
.toast.is-out { animation: toast-out 0.3s var(--ease) both; }
.toast .bar { width: 3px; height: 18px; border-radius: 2px; background: var(--grad-brand); }
.toast.ok .bar { background: #10b981; }
.toast.err .bar { background: #ef4444; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* -------------------------------------------------------------- 13. Footer */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    background: var(--glass-bg-2);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 24px 34px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 32px;
    align-items: start;
}

.footer-id { display: flex; align-items: center; gap: 16px; }
.footer-img {
    width: 54px;
    height: 54px;
    flex: none;
    border-radius: 16px;
    background-size: cover;
    background-position: center 20%;
    border: 1px solid var(--glass-brd);
    box-shadow: var(--sh-sm);
    transition: transform 0.4s var(--ease);
}
a:hover > .footer-img { transform: rotate(-4deg) scale(1.06); }
.footer-quote { font-size: 0.9rem; line-height: 1.7; color: var(--ink-3); font-style: italic; max-width: 34ch; }

.footer-meta { font-size: 0.84rem; color: var(--ink-3); line-height: 1.9; }
.footer-meta a { color: var(--ink-3); transition: color 0.2s; }
.footer-meta a:hover { color: var(--brand-ink); }

.counter {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 15px;
    border-radius: var(--r-pill);
    background: var(--glass-bg);
    border: 1px solid var(--glass-brd);
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-3);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.counter:hover { border-color: var(--brand-ring); box-shadow: 0 0 0 4px var(--brand-tint); }
.counter b { color: #10b981; font-weight: 700; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.counter .pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* -------------------------------------------------------------- 14. Motion */
/* -------------------------------------------------------- 13b. 看板娘 */

/* 收起看板娘之后留下的"召唤"按钮（只在桌面端出现） */
.pet-btn {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 140;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: var(--r-pill);
    font-size: 18px;
    line-height: 1;
    color: var(--ink-2);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease),
        border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.pet-btn.is-on { opacity: 1; transform: none; pointer-events: auto; }
.pet-btn:hover { border-color: var(--brand-ring); color: var(--brand-ink); }

/* 看板娘本体：压到内容之下一点点，别抢正文 */
#oml2d-stage,
.oml2d-stage {
    z-index: 120 !important;
}

/* 库自带一个左边的小切换柄，我们已经有自己的 🐾 按钮了，把它藏掉免得多一个 */
#waifu-toggle { display: none !important; }

/* 看板娘本体：压在正文之上（不然工具条点不到），但别盖住导航和阅读进度条 */
#waifu { z-index: 120 !important; }

/*
 * 看板娘的显示尺寸。
 * waifu.css 里把 #live2d 写死成 300×300，而那张表是 JS 后加载的 —— 同权重时它赢，
 * 所以这里用两个 id（#waifu #live2d）压过去，改大小只动这一处就行。
 * 顺手把工具条和对话气泡按比例收一收，不然小模型配大按钮会很怪。
 */
#waifu #live2d {
    width: 250px;
    height: 250px;
}

#waifu #waifu-tool {
    top: 58px;
    right: -6px;
    gap: 4px;
}

#waifu #waifu-tool svg {
    height: 22px;
}

#waifu #waifu-tips {
    width: 210px;
    margin: -26px 12px;
    min-height: 62px;
    font-size: 13px;
    line-height: 22px;
}

@media (max-width: 1023px), (hover: none), (pointer: coarse) {
    .pet-btn { display: none; }
}

/*
 * 滚动浮现。
 * 注意：初始的"隐藏"状态挂在 html.has-reveal 上，而这个类是由 JS 加的 ——
 * 万一 JS 挂了，元素就是普通可见状态，不会整页空白。
 */
html.has-reveal [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.75s var(--ease-out),
        transform 0.75s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 70ms);
    /*
     * 这里原本有 will-change: opacity, transform —— 千万别加回来。
     *
     * will-change 会让元素成为 backdrop root：它后代的 backdrop-filter
     * 只能采样到这个元素**内部**的东西。而容器里除了卡片自己没有别的内容，
     * 于是玻璃后面空无一物，折射完全失效（实测差异 0.07%，正常应该是 50%+）。
     * 更坑的是 .post-card 自己就是 [data-reveal]，等于自己把自己的
     * backdrop-filter 废掉，看起来"只是很透明"。
     *
     * 换成干净探针元素后同一个滤镜有 54.97% 的差异 —— 滤镜没问题，是这行的问题。
     */
}
html.has-reveal [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

/* --------------------------------------------------- 13c. 文章评论（自建） */

/*
 * 评论区是自己实现的：数据是服务器上的 comments/<文章 id>.json，
 * 不依赖任何第三方服务，样式也全归我们 —— 用的还是站点这套 token，
 * 所以白天/黑夜自动跟着走，不需要像 iframe 那样把主题"推"进去。
 */

.comments-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.comments-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.comments-tip {
    margin: 10px 0 0;
    color: var(--ink-2);
    font-size: 0.92rem;
    line-height: 1.8;
}

/*
 * 评论区那块 panel。
 * 上面的 .post-nav 自己只留了 30px 的上边距，评论区紧跟着会显得挤 ——
 * 这里单独拉开一档，让"看完这一篇 → 去上一篇/下一篇"和"往下看评论"是两件事。
 */
.comments-panel {
    margin-top: 48px;
}

#sfm-comments {
    margin-top: 18px;
}

/* -------------------------------------------------------- 评论：发表表单 */

.cmt-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cmt-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cmt-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--glass-bg-2);
    color: var(--ink-1);
    font-size: 0.95rem;
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.cmt-input::placeholder {
    color: var(--ink-4);
}

.cmt-input:focus {
    outline: none;
    border-color: var(--brand-ring);
    box-shadow: 0 0 0 4px var(--brand-tint);
}

.cmt-textarea {
    resize: vertical;
    min-height: 108px;
    line-height: 1.8;
    font-family: inherit;
}

/*
 * 蜜罐。
 * 故意**不用 display:none** —— 有些脚本会跳过"不可见"的字段，反而躲过这一关；
 * 挪到屏幕外留 1px，机器人照样会当普通输入框填上。
 */
.cmt-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cmt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.cmt-hint {
    min-height: 1.2em;
    color: var(--ink-3);
    font-size: 0.88rem;
}

.cmt-hint.is-ok { color: #10b981; }
.cmt-hint.is-err { color: #ef4444; }

.cmt-submit {
    padding: 11px 24px;
    border-radius: var(--r-pill);
    background: var(--grad-brand);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 24px -12px var(--brand-ring);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.cmt-submit:hover { transform: translateY(-2px); }
.cmt-submit:disabled { opacity: 0.6; cursor: default; transform: none; }

/* 「正在回复 @某某」那条 */
.cmt-reply-to {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--r-sm);
    border: 1px dashed var(--brand-ring);
    background: var(--brand-tint);
    color: var(--ink-2);
    font-size: 0.88rem;
}

.cmt-reply-to b { color: var(--brand-ink); }

/*
 * 注意：`.cmt-reply-to` 自己设了 display:flex，而 [hidden] 的 display:none
 * 来自浏览器默认样式表 —— **作者样式永远赢过默认样式**，
 * 所以不给它补这一条，"正在回复"那条会一直挂在表单上面。
 */
.cmt-reply-to[hidden] { display: none; }

.cmt-reply-to button {
    margin-left: auto;
    color: var(--ink-3);
    font-size: 0.85rem;
    text-decoration: underline;
}

/* ------------------------------------------------------------ 评论：列表 */

.cmt-head {
    margin: 30px 0 16px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 0.88rem;
    letter-spacing: 0.02em;
}

.cmt-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cmt-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

/* 头像：按昵称算出来的渐变色块 —— 不去请求 Gravatar 之类的外部服务 */
.cmt-av {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.cmt-body { min-width: 0; }

.cmt-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.cmt-name {
    color: var(--ink-1);
    font-size: 0.95rem;
    font-weight: 600;
}

.cmt-name a {
    border-bottom: 1px solid var(--brand-ring);
    transition: color 0.25s var(--ease);
}

.cmt-name a:hover { color: var(--brand-ink); }

.cmt-time {
    color: var(--ink-4);
    font-size: 0.8rem;
}

.cmt-reply-btn {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    color: var(--ink-3);
    font-size: 0.82rem;
    transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

.cmt-reply-btn:hover {
    color: var(--brand-ink);
    background: var(--brand-tint);
}

/* 正文：白空格设成 pre-wrap 就能让换行生效，同时不用把文本拼成 HTML */
.cmt-text {
    color: var(--ink-2);
    font-size: 0.96rem;
    line-height: 1.85;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* 一级回复 */
.cmt-children {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    padding-left: 14px;
    border-left: 2px solid var(--line);
    /*
     * `.cmt-item` 是 40px + 1fr 的两列 grid，而回复列表是它的第三个子元素 ——
     * 不写这一行的话它会被塞进**第一列**（40px），于是回复变成一列一个字。
     */
    grid-column: 1 / -1;
}

.cmt-empty {
    color: var(--ink-3);
    font-size: 0.92rem;
}

/* ------------------------------------------------- 14b. 终端雨 + 指针光 */

/* 代码字形雨：铺在极光之上、内容之下，于是玻璃卡片会把它模糊掉 */
.rain {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: block;
    pointer-events: none;
    /*
     * 默认不可见。雨每重绘一帧，玻璃背后的画面就变一次，
     * 所有 backdrop-filter 都要跟着重算 —— 实测这一项占 7.8 个百分点。
     * 现在它是彩蛋：在页面上敲 rain 打开（off -> low -> high -> off）。
     */
    opacity: 0;
    transition: opacity 1.4s var(--ease);
}
html[data-rain="off"] .rain { opacity: 0; }
html[data-rain="low"] .rain { opacity: 0.20; }
html[data-theme="dark"][data-rain="low"] .rain { opacity: 0.24; }
html[data-rain="high"] .rain { opacity: 0.5; }
html[data-theme="dark"][data-rain="high"] .rain { opacity: 0.62; }

/* 跟着指针走的柔光，让玻璃有"被照亮"的感觉 */
.spotlight {
    position: fixed;
    left: 0;
    top: 0;
    width: 380px;
    height: 380px;
    margin: -190px 0 0 -190px;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s var(--ease);
    background: radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.20), rgba(139, 92, 246, 0.13) 45%, transparent 68%);
    filter: blur(20px);
    will-change: transform;
}
html[data-pointer="on"] .spotlight { opacity: 1; }
html[data-theme="dark"] .spotlight {
    background: radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.22), rgba(56, 189, 248, 0.14) 45%, transparent 68%);
}

/* 玻璃卡上的指针高光（--mx/--my 由 JS 写入） */
.glass { --mx: 50%; --my: 0%; }
.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.16), transparent 62%);
}
html[data-theme="dark"] .glass::after {
    background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.10), transparent 62%);
}
html[data-pointer="on"] .glass:hover::after { opacity: 1; }

/* 卡片顶部的渐变线：原来挂在 .post-card::after 上，会和上面的指针高光打架，
   挪到内层链接上 */
.post-card-link { position: relative; }
.post-card::after { content: none; }
.post-card-link::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--grad-brand);
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.45s var(--ease);
}
.post-card:hover .post-card-link::after { transform: scaleX(1); }

/* 打字机光标 */
.type-caret::after {
    content: "▌";
    margin-left: 2px;
    color: var(--brand-ink);
    animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* 主按钮外圈转光 */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
    content: "";
    position: absolute;
    inset: -40% -10%;
    background: conic-gradient(from 0deg, transparent 0 62%, rgba(255, 255, 255, 0.55) 76%, transparent 86%);
    animation: spin 4.5s linear infinite;
    opacity: 0.5;
    pointer-events: none;
}
.btn-primary > * { position: relative; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------------------------------------------------------------------------
   主题切换：从按钮位置向外扩张的圆形擦除
   浏览器原生的 View Transitions：把切换前后的画面各截一张，
   让"新画面"用一个从点击位置扩散的圆把它擦出来。
   最外层套 @supports，不支持的浏览器自动退回普通切换。
--------------------------------------------------------------------------- */
@supports (view-transition-name: none) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        /* 关掉默认的交叉淡入，否则会和圆形擦除叠在一起发灰 */
        animation: none;
        mix-blend-mode: normal;
    }

    /* 白天 → 黑夜：新画面（深色）从按钮扩散出来盖满整屏 */
    html.theme-wipe-in::view-transition-old(root) { z-index: 1; }
    html.theme-wipe-in::view-transition-new(root) {
        z-index: 2;
        animation: circle-reveal 820ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* 黑夜 → 白天：反过来 —— 旧画面（深色）往按钮里缩回去，
       露出底下已经切好的新画面，看着像整页被吸进按钮 */
    html.theme-wipe-out::view-transition-new(root) { z-index: 1; }
    html.theme-wipe-out::view-transition-old(root) {
        z-index: 2;
        /*
         * forwards 很关键：动画播完到伪元素树真正销毁之间还会渲染若干帧，
         * 如果这时丢了 clip-path，旧快照就会以整屏原样画出来 —— 用户看到的就是
         * "闪一下"（而且闪的是旧主题的颜色）。实测录屏抓到过这一帧。
         * 末尾再叠一个 opacity:0 兜底，因为 clip-path 依赖 CSS 变量，
         * 变量一旦被清掉，圆的半径会回退到默认值、重新盖满整屏。
         */
        animation: circle-collapse 760ms cubic-bezier(0.55, 0, 0.35, 1) forwards;
    }
}

/*
 * 主题切换期间，把所有 CSS 过渡关掉。
 *
 * 原因：View Transitions 会在主题改完之后立刻截一张"新画面"。
 * 如果此时元素还在做颜色/背景过渡，那一刻截到的还是旧颜色 ——
 * 于是动画结束时真画面才补上来，看到的就是"闪一下"。
 * 实测页面上有 35 个元素带着这类过渡（标签、导航、按钮、卡片…），
 * 关掉之后新画面才是最终态。
 *
 * 注意：这里只关 transition，不碰 animation ——
 * 圆形擦除走的是 ::view-transition-* 上的 animation，不受影响。
 */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: none !important;
}

@keyframes circle-reveal {
    from { clip-path: circle(0px at var(--wipe-x, 50%) var(--wipe-y, 0%)); }
    to { clip-path: circle(var(--wipe-r, 160vmax) at var(--wipe-x, 50%) var(--wipe-y, 0%)); }
}
@keyframes circle-collapse {
    from {
        clip-path: circle(var(--wipe-r, 160vmax) at var(--wipe-x, 50%) var(--wipe-y, 0%));
        opacity: 1;
    }
    to {
        clip-path: circle(0px at var(--wipe-x, 50%) var(--wipe-y, 0%));
        opacity: 0;
    }
}

/* 悬浮时扫过卡片的一道细光 */
.post-card-link::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    left: -60%;
    pointer-events: none;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42), transparent);
    transform: skewX(-14deg);
    opacity: 0;
}
.post-card:hover .post-card-link::before {
    animation: sweep 0.9s var(--ease-out);
}
@keyframes sweep {
    from { left: -60%; opacity: 0.9; }
    to { left: 130%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html.has-reveal [data-reveal] { opacity: 1; transform: none; }
    .rain, .spotlight { display: none; }
    .btn-primary::before { animation: none; opacity: 0.25; }
    .post-card:hover .post-card-link::before { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    html.has-reveal [data-reveal] { opacity: 1; transform: none; }
    .bg-aurora i { animation: none !important; }
}

/* ---------------------------------------------------------- 15. Responsive */
@media (max-width: 1080px) {
    .article-layout { grid-template-columns: minmax(0, 1fr); }
    .article-aside { display: none; }
}

@media (max-width: 960px) {
    .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; }
    .hero-lead { max-width: none; }
    .about-layout { grid-template-columns: minmax(0, 1fr); }
    .footer-inner { grid-template-columns: minmax(0, 1fr) auto; }
    .footer-meta { grid-column: 1 / -1; }
    .nav-burger { display: inline-flex; }
    .nav-links {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px;
        border-radius: var(--r-md);
        background: var(--glass-bg);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border: 1px solid var(--glass-brd);
        box-shadow: var(--sh-lg);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
    }
    .nav-links.is-open { opacity: 1; visibility: visible; transform: none; }
    .nav-links a { height: 44px; justify-content: center; }
    .nav { position: relative; }
}

@media (max-width: 720px) {
    .main { padding-left: 18px; padding-right: 18px; }
    .shell { padding-left: 18px; padding-right: 18px; }
    .nav-wrap { padding-left: 14px; padding-right: 14px; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 14px; }
    .post-grid { grid-template-columns: minmax(0, 1fr); }
    .timeline { padding-left: 18px; }
    .timeline-item { padding: 13px 16px; gap: 12px; }
    .timeline-item::before { left: -17px; }
    .timeline-date { width: 46px; font-size: 0.78rem; }
    .timeline-item .tag { display: none; }
    .year-label { margin-left: -18px; font-size: 1.1rem; }
    .footer-inner { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .profile-card { flex-direction: column; text-align: center; }
    .hero-stats { gap: 20px; }
    .article { padding: 24px 20px 30px; border-radius: var(--r-md); }
    .panel { padding: 24px 20px; border-radius: var(--r-md); }
    .post-nav .next { text-align: left; align-items: flex-start; }
    /* 窄屏上 48px 太空，收一档但仍旧比 .post-nav 的 30px 显眼 */
    .comments-panel { margin-top: 36px; }
    /* 昵称 / 网站两个输入框在窄屏上竖着排，别挤成一条 */
    .cmt-row { grid-template-columns: minmax(0, 1fr); }
    .cmt-submit { width: 100%; }
    .to-top { right: 14px; bottom: 14px; }
    .pane-preview { display: none; }
    .fld-date { flex: 0 0 130px; }
}

/* --------------------------------------------------------------- 16. Print */
@media print {
    .bg, .nav-wrap, .site-footer, .to-top, .reading-bar, .article-aside, .post-nav { display: none !important; }
    body { background: #fff; }
    .article { box-shadow: none; border: 0; padding: 0; }
    .prose a { color: #000; border: 0; }
}
