/* ==========================================================================
   瑞の博客 — 深空冷色调主题
   --------------------------------------------------------------------------
   设计变量集中在 :root。强调色 --accent 取自 Ghost 后台的 Accent color，
   Ghost 会在 <head> 末尾注入 --ghost-accent-color，因此后台改色这里自动跟随。
   ========================================================================== */

/* --------------------------------------------------------------- 1. tokens */
:root {
    /* 冷色深空背景梯度 */
    --bg:            #080B10;
    --surface:       #0F151E;
    --surface-2:     #141C27;
    --line:          #1D2735;
    --line-strong:   #2C3B4E;

    /* 文字 */
    --ink:           #E7EEF7;
    --ink-2:         #A9B8CA;
    --ink-3:         #71829A;

    /* 强调色：后台 Accent color 优先 */
    --accent:        var(--ghost-accent-color, #2F6FEB);
    --accent-ink:    #9DC0FF;
    --glow:          var(--ghost-accent-color, #2F6FEB);

    --wrap:          1180px;
    --read:          740px;
    --head-h:        68px;
    --radius:        18px;
    --radius-sm:     10px;
    --ease:          cubic-bezier(.22, 1, .36, 1);

    /* 字体栈显式包含中文字形，避免浏览器随机回退 */
    --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
                 "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, "Hiragino Sans GB", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo,
                 Consolas, "Liberation Mono", ui-monospace, monospace;
}

/* ------------------------------------------------------------- 2. 基础重置 */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--head-h) + 16px);
}

body {
    margin: 0;
    padding-top: var(--head-h);   /* 固定顶栏占位；Hero / 封面图再用负 margin 顶回去 */
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: 0;
}

p { margin: 0; }

::selection { background: rgba(47, 111, 235, .34); color: #fff; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------- 3. 布局与工具 */
.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: 24px;
}

.main { display: block; }

.skip {
    position: fixed;
    top: 8px; left: 8px;
    z-index: 999;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    transform: translateY(-160%);
    transition: transform .2s var(--ease);
}
.skip:focus { transform: translateY(0); }

.empty { color: var(--ink-3); padding: 40px 0; }

.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); display: inline-block; }

/* 标签胶囊 */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent-ink);
    font-size: 12px;
    line-height: 1.7;
    letter-spacing: .02em;
    white-space: nowrap;
    transition: background .25s var(--ease), border-color .25s var(--ease);
}
.chip--link:hover {
    background: color-mix(in srgb, var(--accent) 24%, transparent);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 550;
    letter-spacing: .02em;
    cursor: pointer;
    transition: transform .3s var(--ease), background .3s var(--ease),
                border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px -12px color-mix(in srgb, var(--accent) 95%, transparent);
}
.btn--ghost {
    border-color: rgba(255, 255, 255, .22);
    color: var(--ink);
    background: rgba(255, 255, 255, .04);
    backdrop-filter: blur(6px);
}
.btn--ghost:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .1);
}

/* --------------------------------------------------------------- 4. 顶栏 */
.head {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: var(--head-h);
    background: rgba(8, 11, 16, .78);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid var(--line);
    transition: background .35s var(--ease), border-color .35s var(--ease);
}

/* 有 Hero / 封面图的页面：顶栏浮在图片之上，滚动后才变成毛玻璃 */
body.head-over-media .head:not(.is-stuck) {
    background: transparent;
    border-bottom-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.head__inner {
    height: var(--head-h);
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: .01em;
    flex-shrink: 0;
}
.brand__logo { max-height: 30px; width: auto; }
.brand__mark {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent),
                0 0 18px color-mix(in srgb, var(--accent) 75%, transparent);
    flex-shrink: 0;
}
.brand__text { white-space: nowrap; }

.nav { margin-left: auto; }
.nav ul {
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.nav a {
    position: relative;
    font-size: 14.5px;
    color: var(--ink-2);
    transition: color .25s var(--ease);
}
.nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -6px;
    height: 1.5px;
    background: var(--accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }
.nav .nav-current a { color: var(--ink); }
.nav .nav-current a::after { transform: scaleX(1); }

.head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 顶栏右侧：登录 / 注册 / 账户（会员功能关闭时整块不渲染） */
.head__members {
    display: flex;
    align-items: center;
    gap: 6px;
}
.head__member {
    max-width: 13ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 550;
    color: var(--ink-2);
    transition: color .25s var(--ease), background .25s var(--ease);
}
.head__member:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, .06);
}
.head__signup {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 550;
    letter-spacing: .02em;
    box-shadow: 0 8px 24px -14px color-mix(in srgb, var(--accent) 90%, transparent);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.head__signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--accent) 95%, transparent);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, .03);
    color: var(--ink-2);
    cursor: pointer;
    transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.icon-btn:hover {
    color: var(--ink);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, .07);
}

.burger {
    display: none;
    position: relative;
    width: 38px; height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
}
.burger span {
    position: absolute;
    left: 11px;
    width: 16px; height: 1.5px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; }
body.nav-open .burger span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
body.nav-open .burger span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

/* ------------------------------------------------------------ 5. Hero */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: calc(-1 * var(--head-h));   /* 顶到视口最上缘，顶栏浮在其上 */
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
}
.hero--tall    { min-height: 78vh; min-height: 78svh; }
.hero--compact { min-height: 56vh; min-height: 56svh; }

.hero__media {
    position: absolute;
    inset: -12% 0;      /* 上下留出余量，供视差与缓慢漂移动画使用 */
    z-index: -2;
    will-change: transform;
}
.hero__img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 渐隐到页面背景，Hero 与下方内容无缝衔接 */
.hero__veil {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(120% 78% at 50% 8%, rgba(8, 11, 16, .18) 0%, rgba(8, 11, 16, .55) 62%, rgba(8, 11, 16, .92) 100%),
        linear-gradient(180deg,
            rgba(8, 11, 16, .78) 0%,
            rgba(8, 11, 16, .30) 30%,
            rgba(8, 11, 16, .72) 74%,
            var(--bg) 100%);
}

.hero__inner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 96px 24px 120px;
    max-width: 940px;
}

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    padding: 6px 16px 6px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .22em;
    color: var(--ink-2);
    text-transform: uppercase;
}
.hero__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    animation: pulse 2.4s ease-in-out infinite;
}

.hero__title {
    font-size: clamp(2.4rem, 6.4vw, 4.9rem);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: 0;
    background: linear-gradient(175deg, #FFFFFF 0%, #FFFFFF 42%, #B9CEEA 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 24px;
    text-wrap: balance;
}

.hero__sub {
    max-width: 660px;
    margin-inline: auto;
    color: var(--ink-2);
    font-size: clamp(15px, 1.5vw, 17.5px);
    line-height: 1.85;
}

.hero__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 40px;
}

.hero__hint {
    position: absolute;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--ink-3);
}
.hero__hint-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .3em;
    transition: color .3s var(--ease);
}
.hero__hint-line {
    position: relative;
    width: 1px; height: 46px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .28), transparent);
    overflow: hidden;
}
.hero__hint-line::after {
    content: "";
    position: absolute;
    top: 0; left: -1px;
    width: 3px; height: 12px;
    border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    animation: hintLine 2.2s cubic-bezier(.6, 0, .4, 1) infinite;
}
.hero__hint:hover .hero__hint-label { color: var(--ink-2); }

@keyframes hintLine {
    0%   { transform: translateY(-14px); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateY(46px); opacity: 0; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .45; transform: scale(.8); }
}

/* ------------------------------------------------------ 6. 区块标题 */
.section { padding: 84px 24px 110px; }

.section__head {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 44px;
}
.section__title {
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 650;
    white-space: nowrap;
}
.section__title::before {
    content: "";
    display: inline-block;
    width: 4px; height: .82em;
    margin-right: 12px;
    border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
    vertical-align: -2px;
}
.section__rule,
.foot__rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line) 0%, transparent 92%);
}

/* -------------------------------------------------------- 7. 卡片网格 */
.feed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
}

.card { position: relative; min-width: 0; }

.card__link {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    isolation: isolate;
    transition: transform .5s var(--ease), border-color .5s var(--ease),
                box-shadow .5s var(--ease), background .5s var(--ease);
}
.card__link:hover {
    transform: translateY(-5px);
    border-color: var(--line-strong);
    background: var(--surface-2);
    box-shadow: 0 26px 60px -30px rgba(0, 0, 0, .95);
}

/* 媒体区 */
.card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #0A0E14;
    flex-shrink: 0;
}
.card__media--empty {
    background:
        radial-gradient(120% 90% at 30% 0%, rgba(47, 111, 235, .16), transparent 62%),
        linear-gradient(160deg, #101722 0%, #0A0E14 100%);
}
.card__img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: saturate(.92) contrast(1.03);
    transition: transform 1.1s var(--ease), filter .6s var(--ease);
}
.card__link:hover .card__img {
    transform: scale(1.055);
    filter: saturate(1.12) contrast(1.05);
}

/* 没有封面图的文章：按顺序配一张深空图 */
.card__ph {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: saturate(.78) brightness(.82) contrast(1.05);
    transition: transform 1.1s var(--ease), filter .6s var(--ease);
}
.card__link:hover .card__ph { transform: scale(1.055); filter: saturate(1) brightness(.95) contrast(1.05); }
.card__ph::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(8, 11, 16, .55) 100%);
}

.feed > .card:nth-child(6n+1) .card__ph { background-image: url("../images/field-1.jpg"); }
.feed > .card:nth-child(6n+2) .card__ph { background-image: url("../images/field-2.jpg"); }
.feed > .card:nth-child(6n+3) .card__ph { background-image: url("../images/field-3.jpg"); }
.feed > .card:nth-child(6n+4) .card__ph { background-image: url("../images/field-4.jpg"); }
.feed > .card:nth-child(6n+5) .card__ph { background-image: url("../images/field-5.jpg"); }
.feed > .card:nth-child(6n)   .card__ph { background-image: url("../images/field-6.jpg"); }

/* 卡片正文 */
.card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
    padding: 22px 24px 24px;
    min-width: 0;
}

.card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .04em;
    color: var(--ink-3);
}
.card__date { white-space: nowrap; }

.card__title {
    font-size: 19px;
    font-weight: 650;
    line-height: 1.42;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .3s var(--ease);
}
.card__link:hover .card__title { color: var(--accent-ink); }

.card__excerpt {
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
    font-size: 13.5px;
    color: var(--accent-ink);
}
.card__more svg { transition: transform .35s var(--ease); }
.card__link:hover .card__more svg { transform: translateX(5px); }

/* 聚光跟随（鼠标移动时由 JS 写入 --mx / --my） */
.card__spot {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity .45s var(--ease);
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
                color-mix(in srgb, var(--glow) 17%, transparent), transparent 62%);
}
.card__glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    padding: 1px;
    border-radius: inherit;
    opacity: 0;
    transition: opacity .45s var(--ease);
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
                color-mix(in srgb, var(--glow) 80%, transparent), transparent 68%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
}
.has-spotlight .card__link:hover .card__spot,
.has-spotlight .card__link:hover .card__glow { opacity: 1; }

/* 特色卡（第一张）：整行，横向排版 */
.card--featured { grid-column: 1 / -1; }
.card--featured .card__media { aspect-ratio: 16 / 9; }
.card--featured .card__title { font-size: clamp(1.3rem, 2.6vw, 1.85rem); -webkit-line-clamp: 3; }
.card--featured .card__excerpt { font-size: 15px; -webkit-line-clamp: 3; }

/* ------------------------------------------------------- 8. 归档页头 */
.archive {
    position: relative;
    padding: 76px 0 52px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(90% 130% at 12% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%),
        var(--bg);
}
.archive__inner { max-width: 760px; }
.archive__avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 18px;
    border: 1px solid var(--line-strong);
}
.archive__label {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-bottom: 12px;
}
.archive__title {
    font-size: clamp(1.9rem, 4.6vw, 2.9rem);
    font-weight: 700;
    margin-bottom: 14px;
}
.archive__desc {
    color: var(--ink-2);
    font-size: 15.5px;
    line-height: 1.85;
    margin-bottom: 14px;
}
.archive__count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-3);
}

/* --------------------------------------------------------- 9. 文章页 */
.post-head {
    position: relative;
    display: flex;
    align-items: flex-end;
    margin-top: calc(-1 * var(--head-h));
    padding: 150px 0 44px;
    min-height: 58svh;
    isolation: isolate;
    overflow: hidden;
}
.post-head--plain {
    min-height: 0;
    margin-top: calc(-1 * var(--head-h));
    padding: 132px 0 28px;
    background: radial-gradient(80% 120% at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%);
}
.post-head__media {
    position: absolute;
    inset: 0;
    z-index: -2;
}
.post-head__img { width: 100%; height: 100%; object-fit: cover; }
.post-head__veil {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(110% 80% at 50% 100%, rgba(8, 11, 16, .55) 0%, transparent 60%),
        linear-gradient(180deg,
            rgba(8, 11, 16, .80) 0%,
            rgba(8, 11, 16, .42) 34%,
            rgba(8, 11, 16, .88) 82%,
            var(--bg) 100%);
}

.post-head__inner { max-width: var(--read); margin-inline: auto; width: 100%; }

.post-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-2);
}
.post-head__title {
    font-size: clamp(1.85rem, 4.6vw, 3.05rem);
    font-weight: 700;
    line-height: 1.24;
    margin-bottom: 20px;
    text-wrap: balance;
}
.post-head__excerpt {
    color: var(--ink-2);
    font-size: 16.5px;
    line-height: 1.85;
    padding-left: 16px;
    border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
}

.byline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    font-size: 13.5px;
    color: var(--ink-2);
    transition: color .25s var(--ease);
}
.byline:hover { color: var(--ink); }
.byline__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); }

.post-body { max-width: var(--read); margin-inline: auto; padding: 56px 24px 24px; }
/* 标题带图时正文顶部留白收紧，避免署名到正文之间空一大块 */
.post-head + .post-body { padding-top: 34px; }

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

/* 评论区：用 Ghost 原生评论，后台可审核、可关闭 */
.post-comments {
    max-width: var(--read);
    margin: 64px auto 0;
    padding-inline: 24px;
    scroll-margin-top: calc(var(--head-h) + 24px);
}
.post-comments__title {
    margin-bottom: 28px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .01em;
}
/* 评论组件是 Ghost 注入的深色配色由 {{comments mode="dark"}} 自带。
   千万不要在这里写 color-scheme: dark —— 它会让评论 iframe 的画布
   变成不透明白色，在深色站点上就是一大块白板。 */
#ghost-comments-root {
    --ghost-accent-color: var(--accent);
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    max-width: var(--read);
    margin: 24px auto 100px;
    padding-inline: 24px;
}
.post-nav__item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 84px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .35s var(--ease), background .35s var(--ease), transform .35s var(--ease);
}
.post-nav__item:hover { border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-3px); }
/* 「上一篇」缺席时右边那张仍留在右半格，位置和两篇都在时完全一致，
   不会因为自动填充而跑回左边、或拉成一整条空条 */
.post-nav__item--next { grid-column: 2; }
/* 卡片里只剩这一个标签，左右两张都居中 —— 方向只由箭头表达 */
.post-nav__label {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--ink-2);
    transition: color .35s var(--ease);
}
.post-nav__item:hover .post-nav__label { color: var(--accent-ink); }

/* -------------------------------------------- 10. 正文排版 (.gh-content) */
.gh-content {
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--ink);
    letter-spacing: .012em;
    overflow-wrap: break-word;
}
.gh-content > * + * { margin-top: 1.35em; }
/* Ghost 正文开头常有空 <p>，其后的标题 margin 会塌出去顶出大段空白 */
.gh-content > *:first-child,
.gh-content > p:empty + * { margin-top: 0; }

.gh-content p { line-height: 1.95; }

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    margin-top: 2.4em;
    margin-bottom: .7em;
    line-height: 1.4;
    scroll-margin-top: calc(var(--head-h) + 20px);
}
.gh-content h2 {
    font-size: 1.5em;
    padding-bottom: .4em;
}
.gh-content h2::after {
    content: "";
    display: block;
    width: 38px; height: 3px;
    margin-top: .5em;
    border-radius: 3px;
    background: var(--accent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}
.gh-content h3 { font-size: 1.26em; }
.gh-content h4 { font-size: 1.1em; color: var(--ink-2); }

.gh-content a {
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color .25s var(--ease), color .25s var(--ease);
}
.gh-content a:hover { color: #C6DAFF; text-decoration-color: currentColor; }

.gh-content strong { font-weight: 650; color: #F2F7FF; }
.gh-content em { color: var(--ink-2); }

.gh-content ul,
.gh-content ol { padding-left: 1.35em; }
.gh-content li { margin-top: .55em; line-height: 1.9; }
.gh-content li::marker { color: var(--accent); }

.gh-content hr {
    height: 1px;
    margin: 3em 0;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.gh-content blockquote {
    margin: 2em 0;
    padding: 4px 0 4px 22px;
    border-left: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
    color: var(--ink-2);
}
.gh-content blockquote p { margin: 0; }
.gh-content blockquote cite {
    display: block;
    margin-top: .8em;
    font-size: .85em;
    font-style: normal;
    color: var(--ink-3);
}

.gh-content img { border-radius: var(--radius-sm); }
.gh-content figure { margin: 2em 0; }
.gh-content figcaption,
.gh-content .kg-image-card figcaption {
    margin-top: .85em;
    text-align: center;
    font-size: 13px;
    color: var(--ink-3);
}

/* 行内代码 */
.gh-content code {
    font-family: var(--font-mono);
    font-size: .875em;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #141C27;
    color: #A8C7FF;
    word-break: break-word;
}

/* 代码块 */
.gh-content pre {
    margin: 1.8em 0;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0B111A;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.78;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}
.gh-content pre code {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: #C5D4E8;
    font-size: inherit;
    white-space: pre;
}

/* Ghost 代码卡片 */
.gh-content .kg-code-card { margin: 1.8em 0; }
.gh-content .kg-code-card pre { margin: 0; }

/* 表格 */
.gh-content table {
    width: 100%;
    margin: 2em 0;
    border-collapse: collapse;
    font-size: 14.5px;
}
.gh-content th,
.gh-content td {
    padding: 11px 14px;
    border: 1px solid var(--line);
    text-align: left;
}
.gh-content th { background: var(--surface-2); font-weight: 600; }
.gh-content tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }

/* Ghost 卡片组件 */
.gh-content .kg-card { margin: 2em 0; }
.gh-content .kg-callout-card {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.gh-content .kg-callout-card + .kg-callout-card { margin-top: 1em; }
.gh-content .kg-toggle-card {
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.gh-content .kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-decoration: none;
}
.gh-content .kg-bookmark-thumbnail img { border-radius: 8px; }
.gh-content .kg-embed-card iframe { border-radius: var(--radius-sm); }

/* 让 Ghost 的宽图 / 全宽图突破正文栏宽 */
.gh-content > .kg-width-wide {
    width: min(1100px, calc(100vw - 48px));
    margin-left: 50%;
    transform: translateX(-50%);
}
.gh-content > .kg-width-full {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

/* --------------------------------------------------------- 11. 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 72px;
    font-family: var(--font-mono);
    font-size: 13.5px;
}
.pagination a,
.pagination .page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.pagination a:hover {
    color: var(--ink);
    border-color: var(--line-strong);
    background: var(--surface);
}
.pagination .page-number.current {
    color: #fff;
    border-color: transparent;
    background: var(--accent);
}
.pagination .older-posts,
.pagination .newer-posts { gap: 6px; }

/* --------------------------------------------------------- 12. 页脚 */
.foot {
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg) 0%, #060910 100%);
    padding: 58px 0;
    margin-top: 40px;
}
.foot__inner { display: block; }
.foot__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.foot__name { font-size: 17px; font-weight: 650; white-space: nowrap; }
.foot__desc {
    max-width: 640px;
    margin-top: 16px;
    color: var(--ink-3);
    font-size: 13.5px;
    line-height: 1.8;
}
.foot__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-3);
}
.foot__meta a { transition: color .25s var(--ease); }
.foot__meta a:hover { color: var(--accent-ink); }

/* ------------------------------------------------ 13. 进度条 / 回顶 */
.progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 2px;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.progress.is-on { opacity: 1; }
.progress__bar {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent));
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 80%, transparent);
}

.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 120;
    width: 44px; height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(15, 21, 30, .9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--ink-2);
    cursor: pointer;
    transition: color .3s var(--ease), border-color .3s var(--ease),
                transform .3s var(--ease), opacity .3s var(--ease);
}
.to-top:hover {
    color: var(--ink);
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* --------------------------------------------------- 14. 404 / 错误页 */
.err {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100svh - var(--head-h));
    text-align: center;
}
.err__inner { max-width: 560px; }
.err__code {
    font-family: var(--font-mono);
    font-size: clamp(4rem, 14vw, 8rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.04em;
    background: linear-gradient(180deg, #FFFFFF 0%, #2F6FEB 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 18px;
}
.err__title { font-size: clamp(1.3rem, 3.4vw, 1.9rem); margin-bottom: 14px; }
.err__desc { color: var(--ink-2); margin-bottom: 34px; }

/* ------------------------------------------------------ 15. 动效 */
/* 入场：由 IntersectionObserver 加 .is-in */
.js .reveal {
    opacity: 0;
    transform: translateY(22px);
}
.js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity .8s var(--ease), transform .8s var(--ease);
    transition-delay: var(--d, 0ms);
}

/* Hero 缓慢漂移 */
.js .hero__img { animation: heroDrift 30s ease-in-out infinite alternate; }
@keyframes heroDrift {
    from { transform: scale(1.045); }
    to   { transform: scale(1.115) translate3d(0, -1.1%, 0); }
}

/* ------------------------------------------------------ 16. 响应式 */
@media (min-width: 700px) {
    .feed { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .card--featured .card__link { flex-direction: row; }
    .card--featured .card__media { aspect-ratio: auto; width: 56%; min-height: 340px; }
    .card--featured .card__body { width: 44%; padding: 40px 38px; justify-content: center; gap: 16px; }
}

@media (min-width: 1100px) {
    .feed { grid-template-columns: repeat(3, 1fr); gap: 28px; }
}

@media (max-width: 860px) {
    .nav {
        position: fixed;
        inset: var(--head-h) 0 auto 0;
        margin: 0;
        padding: 20px 24px 32px;
        background: rgba(8, 11, 16, .97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--line);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
    }
    body.nav-open .nav { opacity: 1; transform: none; visibility: visible; }
    .nav ul { flex-direction: column; align-items: stretch; gap: 4px; }
    .nav a {
        display: block;
        padding: 13px 0;
        font-size: 16px;
        border-bottom: 1px solid var(--line);
    }
    .nav a::after { display: none; }
    .nav li:last-child a { border-bottom: 0; }
    .burger { display: inline-block; }
}

@media (max-width: 620px) {
    .wrap, .post-body, .post-nav, .post-comments { padding-inline: 20px; }
    /* 小屏顶栏塞不下「登录」，注册弹窗里本身就能切到登录 */
    .head__member--signin { display: none; }
    .head__signup { padding: 8px 14px; font-size: 13.5px; }
    .section { padding: 60px 20px 80px; }
    .hero__inner { padding: 84px 20px 110px; }
    .hero__cta .btn { padding: 11px 20px; font-size: 14px; }
    .card__body { padding: 20px; }
    .card__title { font-size: 17.5px; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav__item--next { grid-column: auto; }
    .foot__rule { display: none; }
    .foot__desc { margin-top: 14px; }
    .to-top { right: 16px; bottom: 16px; }
    .gh-content { font-size: 16px; }
}

/* ------------------------------------------------- 17. 无障碍 / 减少动效 */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .js .reveal { opacity: 1; transform: none; }
    .js .hero__img { animation: none; }
}

/* 打印 */
@media print {
    .head, .foot, .to-top, .progress, .hero__hint, .post-nav, .card__spot, .card__glow { display: none !important; }
    body { background: #fff; color: #111; }
}
