/* =========================================================================
   Material 3 for Typecho — 组件与排版层
   色彩/形状 tokens 由 functions.php 注入（#md3-tokens），本文件只消费变量。
   ========================================================================= */

/* ---------- 1. 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
    /* Shape scale */
    --md-shape-xs: 4px;
    --md-shape-sm: 8px;
    --md-shape-md: 12px;
    --md-shape-lg: 16px;
    --md-shape-xl: 28px;
    --md-shape-full: 999px;

    /* Elevation */
    --md-elev-1: 0 1px 2px 0 rgba(0, 0, 0, .30), 0 1px 3px 1px rgba(0, 0, 0, .15);
    --md-elev-2: 0 1px 2px 0 rgba(0, 0, 0, .30), 0 2px 6px 2px rgba(0, 0, 0, .15);
    --md-elev-3: 0 1px 3px 0 rgba(0, 0, 0, .30), 0 4px 8px 3px rgba(0, 0, 0, .15);
    --md-elev-4: 0 2px 3px 0 rgba(0, 0, 0, .30), 0 6px 10px 4px rgba(0, 0, 0, .15);
    --md-elev-5: 0 4px 4px 0 rgba(0, 0, 0, .30), 0 8px 12px 6px rgba(0, 0, 0, .15);

    /* Motion */
    --md-ease: cubic-bezier(.2, 0, 0, 1);
    --md-ease-emph: cubic-bezier(.05, .7, .1, 1);
    --md-ease-accel: cubic-bezier(.3, 0, .8, .15);
    --md-dur-short: 150ms;
    --md-dur-med: 300ms;
    --md-dur-long: 500ms;
    --md-dur-xlong: 720ms;

    /* Type */
    --md-font: "Roboto", "HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
    --md-font-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;

    /* 代码面板固定深色，两种模式都保持高对比 */
    --md-code-bg: color-mix(in srgb, var(--md-surface) 8%, #0B0A0E);
    --md-code-fg: #E8E6EA;
}

:root[data-shape="round"] {
    --md-shape-xs: 6px;
    --md-shape-sm: 12px;
    --md-shape-md: 16px;
    --md-shape-lg: 20px;
    --md-shape-xl: 32px;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    font-family: var(--md-font);
    font-size: 16px;
    line-height: 24px;
    color: var(--md-on-surface);
    background-color: var(--md-surface);
    background-image: radial-gradient(960px 460px at 50% -160px,
        color-mix(in srgb, var(--md-primary) 13%, transparent), transparent 72%);
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; height: auto; border: 0; }
a { color: var(--md-primary); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--md-primary-container); color: var(--md-on-primary-container); }

:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
    border-radius: var(--md-shape-xs);
}

.md3-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* ---------- 2. 布局 ---------- */
.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 8px 24px 72px;
}

.post-layout {
    display: block;
    max-width: 760px;
    margin: 0 auto;
    padding-top: 24px;
}

.post-layout.has-toc {
    max-width: 1040px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 48px;
    align-items: start;
}

/* ---------- 3. 顶栏 ---------- */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 64px;
    padding: 0 16px;
    background: color-mix(in srgb, var(--md-surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    transition: box-shadow var(--md-dur-med) var(--md-ease),
        background var(--md-dur-med) var(--md-ease);
}

.app-bar.is-scrolled {
    background: color-mix(in srgb, var(--md-surface-container) 92%, transparent);
    box-shadow: var(--md-elev-1);
}

.app-bar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    min-width: 0;
    color: var(--md-on-surface);
    font-size: 20px;
    line-height: 28px;
    font-weight: 500;
    letter-spacing: -.01em;
    padding: 6px 8px;
    border-radius: var(--md-shape-sm);
}

.app-bar__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 菜单按钮全尺寸显示：抽屉里有分类树，桌面端也要能打开；
   900px 以下顶栏 nav 隐藏，它就成了唯一的导航入口 */
.app-bar__menu { display: inline-flex; }

.app-bar__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.nav-link {
    position: relative;
    padding: 8px 14px;
    border-radius: var(--md-shape-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
    white-space: nowrap;
}

.nav-link:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--md-on-surface); }
.nav-link.is-active { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

.app-bar__actions { display: flex; align-items: center; gap: 4px; }

.theme-ico { display: none; align-items: center; justify-content: center; }
.theme-toggle[data-theme-state="auto"] .theme-ico[data-ico="auto"],
.theme-toggle[data-theme-state="light"] .theme-ico[data-ico="light"],
.theme-toggle[data-theme-state="dark"] .theme-ico[data-ico="dark"] { display: inline-flex; }
.theme-label { font-weight: 500; }

/* 图标按钮 */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--md-shape-full);
    background: transparent;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.icon-btn:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--md-on-surface); }
.icon-btn:active { background: color-mix(in srgb, var(--md-on-surface) 12%, transparent); }

/* ---------- 4. 阅读进度 ---------- */
.reading-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 60;
    background: color-mix(in srgb, var(--md-primary) 14%, transparent);
    pointer-events: none;
}

.reading-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--md-primary);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 80ms linear;
}

/* ---------- 5. 抽屉 ---------- */
.scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--md-scrim) 32%, transparent);
    opacity: 0;
    transition: opacity var(--md-dur-med) var(--md-ease);
}

.scrim.is-open { opacity: 1; }

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 55;
    width: 300px;
    max-width: 86vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 12px 24px;
    background: var(--md-surface-container);
    border-radius: 0 var(--md-shape-lg) var(--md-shape-lg) 0;
    box-shadow: var(--md-elev-1);
    transform: translateX(-102%);
    transition: transform var(--md-dur-med) var(--md-ease-emph);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.drawer.is-open { transform: translateX(0); box-shadow: var(--md-elev-2); }

.drawer__head { padding: 8px 8px 12px; }
.drawer__brand { display: flex; align-items: center; gap: 12px; }
.drawer__brand strong { display: block; font-size: 16px; font-weight: 500; line-height: 22px; }
.drawer__brand small {
    display: block;
    font-size: 12px;
    line-height: 16px;
    color: var(--md-on-surface-variant);
    margin-top: 2px;
}

.drawer__avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--md-shape-full);
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    font-weight: 500;
    font-size: 18px;
}

/* 有头像图片时沿用同一套盒子：铺满并居中裁切，方形图也不会拉变形 */
img.drawer__avatar,
img.author-card__avatar {
    display: block;
    object-fit: cover;
    background: var(--md-surface-container-high);
}

/* ---------- 抽屉里的分类：分组标题 + 可折叠子分类 ---------- */
.drawer__label {
    padding: 14px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--md-on-surface-variant);
    opacity: .85;
}

.drawer__cat { display: flex; flex-direction: column; gap: 2px; }
.drawer__cat-row { display: flex; align-items: center; gap: 2px; }

/* 每深一层右移 16px（--depth 由 PHP 写成内联变量，1 为顶级） */
.drawer__cat-row .drawer__item {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: calc(16px + (var(--depth, 1) - 1) * 16px);
}

.drawer__item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 有子分类的父项略加重，和下面一排子项拉开层级 */
.drawer__cat.has-children > .drawer__cat-row > .drawer__item { font-weight: 600; }

/* 当前分类的上级：只染主色文字并略加重，不加底色 ——
   主色底与选中项的 secondary-container 太接近，两个胶囊挨在一起会分不清谁是当前页 */
.drawer__item.is-ancestor {
    color: var(--md-primary);
    font-weight: 600;
}

.drawer__cat-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--md-shape-full);
    background: transparent;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.drawer__cat-toggle:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--md-on-surface); }

.drawer__cat-toggle svg { transition: transform var(--md-dur-med) var(--md-ease-emph); }

/* 折叠：grid-template-rows 0fr ↔ 1fr 做高度动画，老浏览器直接切换 */
.drawer__sub {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows var(--md-dur-med) var(--md-ease);
}

.drawer__sub > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow: hidden;
}

.drawer__sub .drawer__item { font-size: 13px; }

.drawer__cat.is-collapsed > .drawer__sub { grid-template-rows: 0fr; }
.drawer__cat.is-collapsed > .drawer__cat-row .drawer__cat-toggle svg { transform: rotate(-90deg); }

.drawer__nav,
.drawer__foot { display: flex; flex-direction: column; gap: 2px; }

.drawer__foot {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--md-outline-variant);
}

.drawer__item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 0;
    width: 100%;
    text-align: left;
    border-radius: var(--md-shape-full);
    background: transparent;
    color: var(--md-on-surface-variant);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.drawer__item:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--md-on-surface); }
.drawer__item.is-active { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* ---------- 6. 搜索视图 ---------- */
.search-view {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 72px 16px;
}

.search-view__scrim {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--md-scrim) 40%, transparent);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.search-view__panel {
    position: relative;
    width: min(640px, 100%);
    background: var(--md-surface-container-high);
    border-radius: var(--md-shape-xl);
    padding: 8px;
    box-shadow: var(--md-elev-3);
    animation: md3-pop var(--md-dur-med) var(--md-ease-emph);
}

@keyframes md3-pop {
    from { opacity: 0; transform: translateY(-12px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 4px 16px;
    border-radius: var(--md-shape-full);
    background: var(--md-surface-container-highest);
    color: var(--md-on-surface-variant);
}

.search-field--inline {
    max-width: 560px;
    margin: 0 0 28px;
    padding-right: 4px;
    box-shadow: 0 0 0 1px var(--md-outline-variant);
}

.search-field__lead { color: var(--md-on-surface-variant); }

.search-field input[type="search"] {
    flex: 1;
    min-width: 0;
    height: 52px;
    border: 0;
    background: transparent;
    color: var(--md-on-surface);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.search-field input::placeholder { color: var(--md-on-surface-variant); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-view__hint {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px 6px;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}

.kbd {
    font-family: var(--md-font-mono);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--md-on-surface) 10%, transparent);
}

/* ---------- 7. Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--md-shape-xl);
    margin: 24px 0 44px;
    padding: 40px 40px 34px;
    background:
        radial-gradient(125% 135% at 6% -12%,
            color-mix(in srgb, var(--md-primary-container) 66%, transparent), transparent 58%),
        var(--md-surface-container);
    isolation: isolate;
}

.hero__glow {
    position: absolute;
    inset: -40% -6% auto auto;
    width: 560px;
    height: 560px;
    z-index: -1;
    background:
        radial-gradient(closest-side, color-mix(in srgb, var(--md-primary) 34%, transparent), transparent 70%),
        radial-gradient(closest-side at 32% 62%, color-mix(in srgb, var(--md-tertiary) 26%, transparent), transparent 72%);
    filter: blur(46px);
    opacity: .32;
    pointer-events: none;
}

/* 装饰：两层细环 + 一颗色调球，溢出部分被圆角裁切 */
.hero__decor {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.hero__orb {
    position: absolute;
    display: block;
    border-radius: 50%;
}

.hero__orb--a {
    width: 240px;
    height: 240px;
    right: -54px;
    top: -84px;
    border: 1px solid color-mix(in srgb, var(--md-on-surface) 11%, transparent);
}

.hero__orb--b {
    width: 148px;
    height: 148px;
    right: 82px;
    bottom: -74px;
    background: color-mix(in srgb, var(--md-tertiary) 20%, transparent);
}

.hero__orb--c {
    width: 84px;
    height: 84px;
    right: 196px;
    top: 34px;
    border: 1px solid color-mix(in srgb, var(--md-primary) 26%, transparent);
}

.hero__inner { position: relative; z-index: 1; }

.hero__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.hero__id {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.hero__avatar {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: var(--md-elev-1);
}

.hero__avatar--text {
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
    color: var(--md-on-primary-container);
    background: var(--md-primary-container);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-primary) 20%, transparent);
}

.hero__id-text { min-width: 0; }

.hero__rss {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--md-shape-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-secondary-container);
    background: var(--md-secondary-container);
    transition: background var(--md-dur-short) var(--md-ease),
        transform var(--md-dur-short) var(--md-ease);
}

.hero__rss:hover {
    background: color-mix(in srgb, var(--md-secondary-container) 78%, var(--md-on-secondary-container));
    transform: translateY(-1px);
}

.hero__rss .md3-icon { width: 18px; height: 18px; }

.hero__eyebrow {
    margin: 0 0 6px;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--md-primary);
}

.hero__title {
    margin: 0;
    font-size: clamp(26px, 4.2vw, 46px);
    line-height: 1.12;
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--md-on-surface);
    overflow-wrap: anywhere;
}

.hero__desc {
    margin: 20px 0 0;
    max-width: 50ch;
    text-wrap: pretty;
    font-size: 15.5px;
    line-height: 26px;
    color: var(--md-on-surface-variant);
}

.hero__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid color-mix(in srgb, var(--md-outline-variant) 60%, transparent);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 28px;
}

.hero-stat:first-child { padding-left: 0; }
.hero-stat + .hero-stat { border-left: 1px solid color-mix(in srgb, var(--md-outline-variant) 55%, transparent); }

.hero-stat strong {
    font-size: 23px;
    line-height: 30px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--md-primary);
    font-variant-numeric: tabular-nums;
}

.hero-stat span {
    font-size: 12.5px;
    line-height: 18px;
    color: var(--md-on-surface-variant);
}

/* ---------- 7.5 Hero · 自定义头部背景图 ---------- */
.hero--media {
    --hero-min-h: 410px;
    --hero-scrim: .95;
    display: grid;
    align-content: end;
    min-height: var(--hero-min-h);
    margin-top: 8px;
    padding: 40px 40px 38px;
    background: var(--md-surface-container);
    color: #fff;
}

.hero--media[data-height="compact"] { --hero-min-h: 300px; }
.hero--media[data-height="immersive"] { --hero-min-h: 520px; }
.hero--media[data-overlay="light"] { --hero-scrim: .7; }
.hero--media[data-overlay="strong"] { --hero-scrim: 1; }

.hero__media,
.hero__scrim {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
}

.hero__media {
    overflow: hidden;
    background: var(--md-surface-container-high);
}

.hero__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 50%;
    transform-origin: center 40%;
    will-change: transform;
}

.hero--media[data-focus="top"] .hero__media img { object-position: center 18%; }
.hero--media[data-focus="bottom"] .hero__media img { object-position: center 82%; }

/* 双层遮罩：整体压暗 + 底部加深，保证任何底图上文字都可读 */
.hero__scrim {
    background: linear-gradient(178deg,
        rgba(10, 8, 14, .05) 0%,
        rgba(10, 8, 14, .2) 34%,
        rgba(10, 8, 14, .62) 68%,
        rgba(10, 8, 14, .86) 100%);
    opacity: var(--hero-scrim);
    transition: opacity var(--md-dur-med) var(--md-ease);
}

/* 图片模式下的反色文字系统：一律用浅色，不再跟随亮暗主题 */
.hero--media .hero__title {
    color: #fff;
    text-shadow: 0 2px 28px rgba(0, 0, 0, .38);
}

.hero--media .hero__eyebrow {
    color: rgba(255, 255, 255, .8);
    text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
}

.hero--media .hero__desc {
    max-width: 56ch;
    color: rgba(255, 255, 255, .88);
    text-shadow: 0 1px 16px rgba(0, 0, 0, .34);
    text-wrap: pretty;
}

.hero--media .hero__avatar {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .38), var(--md-elev-2);
}

.hero--media .hero__avatar--text {
    color: #fff;
    background: rgba(16, 12, 20, .34);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.hero--media .hero__rss {
    color: #fff;
    background: rgba(16, 12, 20, .36);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.hero--media .hero__rss:hover {
    background: rgba(16, 12, 20, .5);
    transform: translateY(-1px);
}

.hero--media .hero__stats {
    border-top-color: rgba(255, 255, 255, .24);
}

.hero--media .hero-stat + .hero-stat {
    border-left-color: rgba(255, 255, 255, .2);
}

.hero--media .hero-stat strong { color: #fff; }
.hero--media .hero-stat span { color: rgba(255, 255, 255, .76); }

/* 滚动视差：图片随页面滚动缓慢放大，制造深度（滚动驱动动画，不支持则静止） */
@supports (animation-timeline: scroll()) {
    .hero--media .hero__media img {
        animation: md3-hero-drift linear both;
        animation-timeline: scroll(root block);
        animation-range: 0 640px;
    }

    @keyframes md3-hero-drift {
        from { transform: scale(1.02) translateY(0); }
        to { transform: scale(1.1) translateY(2.4%); }
    }
}

/* ---------- 8. 列表 ---------- */
.feed-wrap { padding-bottom: 24px; }

.feed-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 20px;
}

.feed-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 22px;
    line-height: 28px;
    font-weight: 500;
    color: var(--md-on-surface);
}

.feed-head__title::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: var(--md-primary);
}

.feed-head__count { font-size: 12px; color: var(--md-on-surface-variant); }

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 20px;
}

.post-grid--list { grid-template-columns: minmax(0, 1fr); }

/* 文章数量少时不要留 2/3 的空白：1 篇通栏头条，2 篇双列 */
.post-grid--one { grid-template-columns: minmax(0, 1fr); }
.post-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.post-grid--list.post-grid--two { grid-template-columns: minmax(0, 1fr); }

.post-grid:has(> .post-card:only-child) { grid-template-columns: minmax(0, 1fr); }

.post-grid--one .post-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 268px;
}

.post-grid--one .post-card__media { flex: 0 0 46%; aspect-ratio: auto; }

.post-grid--one .post-card__body {
    justify-content: center;
    gap: 12px;
    padding: 34px 40px;
}

.post-grid--one .post-card__title {
    font-size: clamp(22px, 2.3vw, 30px);
    line-height: 1.28;
}

.post-grid--one .post-card__excerpt {
    margin: 2px 0 4px;
    font-size: 15px;
    line-height: 25px;
    -webkit-line-clamp: 3;
}

.post-grid--one .post-card__placeholder .md3-icon { width: 56px; height: 56px; }

.post-grid--two .post-card__body { padding: 22px 24px 24px; }
.post-grid--two .post-card__title { font-size: 20px; line-height: 1.35; }
.post-grid--two .post-card__excerpt { -webkit-line-clamp: 3; }

.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--md-surface-container-high);
    border-radius: var(--md-shape-lg);
    overflow: hidden;
    transition: box-shadow var(--md-dur-med) var(--md-ease),
        transform var(--md-dur-med) var(--md-ease),
        background var(--md-dur-med) var(--md-ease);
}

.post-card:hover {
    box-shadow: var(--md-elev-2);
    transform: translateY(-2px);
    background: var(--md-surface-container-highest);
}

.post-card__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--md-surface-container-highest);
}

.post-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--md-dur-long) var(--md-ease-emph);
}

.post-card:hover .post-card__media img { transform: scale(1.04); }

.post-card__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--md-on-surface-variant);
    background:
        radial-gradient(90% 90% at 82% 8%, color-mix(in srgb, var(--md-primary) 32%, transparent), transparent 58%),
        radial-gradient(80% 80% at 8% 92%, color-mix(in srgb, var(--md-tertiary) 26%, transparent), transparent 60%),
        linear-gradient(145deg, var(--md-surface-container-high), var(--md-surface-container-highest));
}

.post-card__placeholder { overflow: hidden; }

.post-card__placeholder::before,
.post-card__placeholder::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--md-primary) 22%, transparent);
    pointer-events: none;
}

.post-card__placeholder::before {
    width: 190px;
    height: 190px;
    right: -46px;
    top: -58px;
}

.post-card:nth-child(even) .post-card__placeholder::before {
    right: auto;
    left: -46px;
    top: auto;
    bottom: -58px;
}

.post-card:nth-child(even) .post-card__placeholder::after {
    right: auto;
    left: 24px;
    bottom: auto;
    top: -58px;
}

.post-card__placeholder::after {
    width: 120px;
    height: 120px;
    right: 24px;
    bottom: -58px;
    background: color-mix(in srgb, var(--md-tertiary) 14%, transparent);
    border-color: color-mix(in srgb, var(--md-tertiary) 20%, transparent);
}

.post-card__placeholder .md3-icon {
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    opacity: .32;
}

.post-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 20px;
    flex: 1;
}

.post-card__cat {
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
}

.post-card__cat a { color: inherit; }
.post-card__cat a + a::before { content: "·"; margin: 0 4px; opacity: .6; }

.post-card__title {
    margin: 0;
    font-size: 19px;
    line-height: 26px;
    font-weight: 500;
    letter-spacing: -.01em;
}

.post-card__title a {
    color: var(--md-on-surface);
    display: block;
}

.post-card__title a:hover { color: var(--md-primary); }

.post-card__excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 22px;
    color: var(--md-on-surface-variant);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 4px;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
}

.meta-item .md3-icon { width: 15px; height: 15px; }
.meta-item:hover { color: var(--md-primary); }

/* 单列列表形态 */
.post-grid--list .post-card { flex-direction: row; align-items: stretch; }
.post-grid--list .post-card__media { flex: 0 0 240px; aspect-ratio: auto; }
.post-grid--list .post-card__body { padding: 20px 24px; }

/* ---------- 9. Chip / Button / FAB ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--md-shape-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 32px;
    color: var(--md-on-surface-variant);
    white-space: nowrap;
}

.chip .md3-icon { width: 16px; height: 16px; }
.chip--tonal { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.chip--outline { box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.chip--primary { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.chip--sm { height: 24px; line-height: 24px; padding: 0 8px; font-size: 11px; }

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--md-shape-full);
    background: transparent;
    color: var(--md-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 40px;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow var(--md-dur-short) var(--md-ease),
        background var(--md-dur-short) var(--md-ease);
}

.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity var(--md-dur-short) var(--md-ease);
}

.btn:hover::after { opacity: .08; }
.btn:active::after { opacity: .12; }
.btn .md3-icon { width: 18px; height: 18px; }

.btn--filled { background: var(--md-primary); color: var(--md-on-primary); }
.btn--filled:hover { box-shadow: var(--md-elev-1); }
.btn--tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.btn--outlined { box-shadow: inset 0 0 0 1px var(--md-outline); }
.btn--text { padding: 0 12px; }
.btn--sm { height: 36px; line-height: 36px; padding: 0 16px; font-size: 13px; }

.fab-stack {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: var(--md-shape-lg);
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    box-shadow: var(--md-elev-3);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px) scale(.9);
    pointer-events: none;
    transition: opacity var(--md-dur-med) var(--md-ease),
        transform var(--md-dur-med) var(--md-ease-emph),
        box-shadow var(--md-dur-short) var(--md-ease);
}

.fab .md3-icon { width: 24px; height: 24px; }
.fab:hover { box-shadow: var(--md-elev-4); }
.fab.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.fab--tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* 目录按钮在文章页要一直可点：桌面端靠右侧常驻目录，窄屏只能靠这个 FAB。
   .fab 默认是隐藏态（等 JS 加 .is-visible），这里直接放行，避免手机上按钮
   既看不见也点不到 —— 之前手机端打不开目录就是这个原因。 */
#tocFab {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- 10. 文章 ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--md-on-surface-variant);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--md-on-surface-variant); }
.breadcrumb a:hover { color: var(--md-primary); }
.breadcrumb__sep { display: inline-flex; opacity: .5; }
.breadcrumb__sep .md3-icon { width: 14px; height: 14px; }

.article {
    background: var(--md-surface);
    min-width: 0;
}

/* ---------- 关于页自定义模板（page-about.php） ---------- */
.page-about {
    display: flex;
    justify-content: center;
    padding: 40px 24px 72px;
}

.about-card {
    width: 100%;
    max-width: 680px;
    padding: 48px 40px;
    border-radius: var(--md-shape-xl);
    background: var(--md-surface);
    box-shadow: var(--md-elev-1);
    text-align: center;
}

.about-card__avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 20px;
    border-radius: var(--md-shape-full);
    overflow: hidden;
    box-shadow: var(--md-elev-2);
}

.about-card__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-card__title {
    margin: 0 0 8px;
    font-size: clamp(26px, 4vw, 34px);
    line-height: 1.25;
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--md-on-surface);
}

.about-card__subtitle {
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--md-on-surface-variant);
}

.about-card__social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

/* 社交链接胶囊：图标 + 文字，图标可以是 SVG 也可以是 emoji */
.about-link,
.about-card__social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--md-shape-full);
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: transform var(--md-dur-short) var(--md-ease), background var(--md-dur-short) var(--md-ease);
}

.about-link:hover,
.about-card__social-link:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--md-secondary-container) 82%, var(--md-on-secondary-container));
}

.about-link .about-link__ico {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.about-link__emoji {
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1;
}

.about-link__text {
    white-space: nowrap;
}

.about-card__body {
    text-align: left;
}

/* 普通独立页面里的社交链接行（没选「关于页」模板时也照样显示） */
.page-social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
}

.article__head { margin-bottom: 28px; }

.article__title {
    margin: 0 0 18px;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.22;
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--md-on-surface);
}

.article__meta { display: flex; flex-wrap: wrap; gap: 8px; }

.article__tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 40px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--md-outline-variant);
}

.article__tags-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}

.article__tags-label .md3-icon { width: 15px; height: 15px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-row a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border-radius: var(--md-shape-sm);
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
    font-size: 13px;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.tag-row a:hover { background: var(--md-primary-container); color: var(--md-on-primary-container); }

.author-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 32px;
    padding: 16px 18px;
    border-radius: var(--md-shape-lg);
    background: var(--md-surface-container);
}

.author-card__avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--md-shape-full);
    background: var(--md-tertiary-container);
    color: var(--md-on-tertiary-container);
    font-weight: 500;
}

.author-card__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.author-card__info strong { font-size: 14px; font-weight: 500; }
.author-card__info span { font-size: 12px; color: var(--md-on-surface-variant); line-height: 18px; }
.author-card .btn { margin-left: auto; }

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.post-nav__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: var(--md-shape-md);
    background: var(--md-surface-container);
    transition: background var(--md-dur-short) var(--md-ease);
    min-width: 0;
}

.post-nav__item:hover { background: var(--md-surface-container-high); }
.post-nav__item--next { text-align: right; align-items: flex-end; }

.post-nav__label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}

.post-nav__label .md3-icon { width: 14px; height: 14px; }

.post-nav__item a {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-nav__item a:hover { color: var(--md-primary); }
.post-nav__empty { font-size: 13px; color: var(--md-on-surface-variant); }

/* ---------- 11. 正文排版 ---------- */
.prose {
    font-size: 16px;
    line-height: 1.82;
    color: var(--md-on-surface);
    word-wrap: break-word;
}

.prose > *:first-child { margin-top: 0; }
.prose p { margin: 18px 0; }

.prose h2,
.prose h3,
.prose h4 {
    color: var(--md-on-surface);
    letter-spacing: -.01em;
    scroll-margin-top: 88px;
    position: relative;
}

.prose h2 {
    font-size: 24px;
    line-height: 34px;
    font-weight: 600;
    margin: 44px 0 14px;
    padding-left: 12px;
    border-left: 4px solid var(--md-primary);
    border-radius: 2px;
}

.prose h3 {
    font-size: 19px;
    line-height: 28px;
    font-weight: 600;
    margin: 32px 0 10px;
    padding-left: 10px;
    border-left: 3px solid color-mix(in srgb, var(--md-tertiary) 70%, transparent);
    border-radius: 2px;
}

.prose h4 { font-size: 16px; font-weight: 600; margin: 26px 0 8px; }

.prose a {
    color: var(--md-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--md-primary) 45%, transparent);
}

.prose a:hover { text-decoration-color: var(--md-primary); }

.prose strong { font-weight: 600; }

.prose ul,
.prose ol { margin: 16px 0; padding-left: 1.4em; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--md-primary); }

.prose blockquote {
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: var(--md-shape-md);
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    border-left: 4px solid var(--md-primary);
}

.prose blockquote p { margin: 8px 0; }
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 24px auto;
    border-radius: var(--md-shape-md);
    box-shadow: var(--md-elev-1);
    transition: box-shadow var(--md-dur-med) var(--md-ease), transform var(--md-dur-med) var(--md-ease);
}

.prose img:hover {
    box-shadow: var(--md-elev-2);
}

/* 正文里的图（含 Typecho 独立页面直接贴图、无 <p> 包裹的情况）都约束在内容栏内，
   不越界、不挤压两侧文字 */
.prose > img,
.prose p > img {
    width: auto;
    max-width: 100%;
}

.prose figure { margin: 24px 0; }
.prose figcaption,
.prose .img-caption {
    text-align: center;
    font-size: 12px;
    color: var(--md-on-surface-variant);
    margin-top: 8px;
}

.prose hr {
    border: 0;
    height: 1px;
    background: var(--md-outline-variant);
    margin: 36px 0;
}

.prose code {
    font-family: var(--md-font-mono);
    font-size: .875em;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
}

.prose table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    font-size: 14px;
    border-radius: var(--md-shape-md);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--md-outline-variant);
}

.prose thead th {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    font-weight: 500;
    text-align: left;
}

.prose th,
.prose td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--md-outline-variant);
}

.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--md-surface-container); }

/* ---------- 11.1 编辑器能写出来、但容易被漏掉的正文元素 ---------- */
.prose del,
.prose s { color: var(--md-on-surface-variant); text-decoration-thickness: 1px; }

.prose mark {
    background: color-mix(in srgb, var(--md-primary) 22%, transparent);
    color: inherit;
    padding: 1px 4px;
    border-radius: 4px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.prose kbd {
    display: inline-block;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--md-surface-container-high);
    box-shadow: inset 0 -2px 0 var(--md-outline-variant), inset 0 0 0 1px var(--md-outline-variant);
    font-family: var(--md-font-mono);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: var(--md-on-surface);
}

.prose sub,
.prose sup { font-size: .75em; line-height: 0; }
.prose sup a { text-decoration: none; font-weight: 600; }

/* 任务列表：- [ ] / - [x] */
.prose li > input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0 8px 0 0;
    vertical-align: -2px;
    border-radius: 4px;
    border: 1.5px solid var(--md-outline);
    background: transparent;
    cursor: default;
    position: relative;
    flex: none;
}

.prose li > input[type="checkbox"]:checked {
    background: var(--md-primary);
    border-color: var(--md-primary);
}

.prose li > input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 8px;
    border: solid var(--md-on-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(42deg);
}

.prose ul:has(> li > input[type="checkbox"]) {
    list-style: none;
    padding-left: .1em;
}

.prose ul:has(> li > input[type="checkbox"]) > li { display: flex; align-items: flex-start; gap: 2px; }
.prose ul:has(> li > input[type="checkbox"]) > li > input { margin-top: 5px; }

/* 折叠块 <details> */
.prose details {
    margin: 20px 0;
    padding: 0 16px;
    border-radius: var(--md-shape-md);
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

.prose details[open] { padding-bottom: 6px; }
.prose details > *:not(summary) { margin-left: 2px; }

.prose summary {
    cursor: pointer;
    padding: 12px 0;
    font-weight: 500;
    list-style: none;
    color: var(--md-on-surface);
}

.prose summary::-webkit-details-marker { display: none; }

.prose summary::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 10px;
    border-right: 2px solid var(--md-primary);
    border-bottom: 2px solid var(--md-primary);
    transform: rotate(-45deg) translateY(-2px);
    transition: transform var(--md-dur-short) var(--md-ease);
}

.prose details[open] summary::before { transform: rotate(45deg) translateY(-1px); }

/* 定义列表 */
.prose dl { margin: 18px 0; }
.prose dt { font-weight: 600; margin-top: 12px; }
.prose dd { margin: 4px 0 0 16px; color: var(--md-on-surface-variant); }

/* 脚注（Markdown 扩展 / 手工写的） */
.prose .footnotes {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--md-outline-variant);
    font-size: 13px;
    color: var(--md-on-surface-variant);
}

.prose .footnotes ol { padding-left: 1.2em; }

/* 嵌入内容：视频 / 地图 / 幻灯片 */
.prose iframe,
.prose video {
    display: block;
    width: 100%;
    margin: 24px 0;
    border: 0;
    border-radius: var(--md-shape-md);
    box-shadow: var(--md-elev-1);
    background: var(--md-surface-container-high);
}

/* 图片下面单独一段斜体 = 图注 */
.prose p > em:only-child {
    display: block;
    color: var(--md-on-surface-variant);
    font-size: 12px;
    text-align: center;
}

/* 段落紧跟列表时收紧间距，避免视觉断层 */
.prose p + ul,
.prose p + ol { margin-top: -4px; }

.table-scroll {
    overflow-x: auto;
    margin: 24px 0;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table { margin: 0; min-width: 480px; }

/* ---------- 12. 代码块 ---------- */
.code-block {
    position: relative;
    margin: 24px 0;
    border-radius: var(--md-shape-md);
    background: var(--md-code-bg);
    overflow: hidden;
    box-shadow: var(--md-elev-1), inset 0 0 0 1px rgba(255, 255, 255, .07);
}

.code-block pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
    background: transparent;
    font-family: var(--md-font-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--md-code-fg);
    -webkit-overflow-scrolling: touch;
    tab-size: 4;
}

.code-block code {
    font-family: inherit;
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    white-space: pre;
}

.code-block__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 16px;
    background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.code-block__lang {
    font-family: var(--md-font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .62);
}

.code-block__copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--md-shape-sm);
    background: transparent;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.code-block__copy .md3-icon { width: 15px; height: 15px; }
.code-block__copy:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.code-block__copy.is-done { color: #A6E3A1; }

.prose > pre {
    margin: 24px 0;
    padding: 16px 18px;
    border-radius: var(--md-shape-md);
    background: var(--md-code-bg);
    color: var(--md-code-fg);
    overflow-x: auto;
    font-family: var(--md-font-mono);
    font-size: 13px;
    line-height: 1.7;
}

/* 超长代码折叠 */
.code-block.is-folded pre {
    max-height: 460px;
    overflow: hidden;
    position: relative;
}

.code-block.is-folded pre::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 96px;
    background: linear-gradient(to bottom, transparent, var(--md-code-bg) 78%);
    pointer-events: none;
}

.code-block__more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .06);
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .74);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.code-block__more:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.code-block__more .md3-icon { width: 15px; height: 15px; }

/* Syntax tokens */
.tok-com { color: #6E7391; font-style: italic; }
.tok-str { color: #C3E88D; }
.tok-num { color: #F78C6C; }
.tok-kw  { color: #C792EA; }
.tok-fn  { color: #82AAFF; }
.tok-var { color: #FFCB6B; }
.tok-tag { color: #F07178; }
.tok-attr { color: #FFCB6B; }
.tok-op  { color: #89DDFF; }
.tok-type { color: #FFCB6B; }
.tok-meta { color: #F78C6C; }
.tok-ins  { color: #C3E88D; background: rgba(195, 232, 141, .1); }
.tok-del  { color: #F07178; background: rgba(240, 113, 120, .12); }

/* ---------- 13. TOC ---------- */
.toc-rail {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-bottom: 8px;
}

.toc-card {
    padding: 16px 8px 12px;
    border-radius: var(--md-shape-lg);
    background: var(--md-surface-container);
}

.toc-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
}

.toc-card__head .md3-icon { width: 16px; height: 16px; }

.toc { display: flex; flex-direction: column; gap: 2px; }

.toc a {
    display: block;
    padding: 7px 12px;
    border-radius: var(--md-shape-sm);
    font-size: 12.5px;
    line-height: 17px;
    color: var(--md-on-surface-variant);
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.toc a:hover { background: color-mix(in srgb, var(--md-on-surface) 7%, transparent); color: var(--md-on-surface); }

.toc a.is-active {
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    font-weight: 500;
}

.toc a.toc-lv3 { padding-left: 26px; font-size: 12.5px; }
.toc a.toc-lv4 { padding-left: 38px; font-size: 12px; }
.toc__empty { padding: 8px 12px; font-size: 12px; color: var(--md-on-surface-variant); }

/* 窄屏目录：锚在目录按钮正上方的小浮层，宽度不超过屏幕三分之一 */
.toc-sheet { position: fixed; inset: 0; z-index: 72; }

/* 只负责「点外面关闭」，不压暗页面 */
.toc-sheet__scrim { position: absolute; inset: 0; background: transparent; }

.toc-sheet__panel {
    position: fixed;
    right: var(--md3-sheet-right, 12px);
    bottom: var(--md3-sheet-bottom, 148px);
    width: 33vw;
    min-width: 104px;
    max-width: 220px;
    max-height: 46vh;
    box-sizing: border-box;
    padding: 6px;
    background: var(--md-surface-container-high);
    border-radius: var(--md-shape-lg);
    box-shadow: var(--md-elev-3);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: md3-toc-pop var(--md-dur-med) var(--md-ease-emph);
}

@keyframes md3-toc-pop {
    from { transform: translateY(8px) scale(.96); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* 浮层里不需要拖拽条 */
.toc-sheet__handle { display: none; }

.toc-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 2px 2px 4px 6px;
}

.toc-sheet__head strong {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--md-on-surface-variant);
    white-space: nowrap;
}

.toc-sheet__head .icon-btn { width: 24px; height: 24px; }
.toc-sheet__head .icon-btn .md3-icon { width: 14px; height: 14px; }

/* 三分之一屏宽下条目更紧凑，两行截断 */
.toc-sheet .toc { gap: 1px; }
.toc-sheet .toc a {
    padding: 5px 6px;
    font-size: 11.5px;
    line-height: 15px;
    border-radius: 6px;
    -webkit-line-clamp: 2;
}
.toc-sheet .toc a.toc-lv3 { padding-left: 14px; font-size: 11px; }
.toc-sheet .toc a.toc-lv4 { padding-left: 20px; font-size: 10.5px; }
.toc-sheet .toc__marker { width: 2px; }

/* ---------- 14. 归档页头 / 空状态 / 404 ---------- */
.page-head { padding: 40px 0 28px; }

.page-head__icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: var(--md-shape-md);
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

.page-head__icon .md3-icon { width: 24px; height: 24px; }

.page-head__eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--md-primary);
}

.page-head__title {
    margin: 0;
    font-size: clamp(26px, 3.6vw, 38px);
    line-height: 1.2;
    font-weight: 500;
    letter-spacing: -.02em;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 64px 24px;
    text-align: center;
    border-radius: var(--md-shape-lg);
    background: var(--md-surface-container);
}

.empty-state__icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: var(--md-shape-full);
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
}

.empty-state h2 { margin: 0; font-size: 18px; font-weight: 500; }
.empty-state p { margin: 0; font-size: 14px; color: var(--md-on-surface-variant); }
.empty-state .btn { margin-top: 12px; }

.not-found {
    display: grid;
    place-items: center;
    min-height: 56vh;
    padding: 48px 0;
}

.not-found__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 520px;
    padding: 48px 32px;
    text-align: center;
    border-radius: var(--md-shape-xl);
    background: var(--md-surface-container);
}

.not-found__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: var(--md-shape-full);
    background: var(--md-error-container);
    color: var(--md-on-error-container);
}

.not-found__icon .md3-icon { width: 32px; height: 32px; }
.not-found__code { margin: 8px 0 0; font-size: 13px; letter-spacing: .18em; color: var(--md-primary); }
.not-found__title { margin: 0; font-size: 28px; font-weight: 500; }
.not-found__desc { margin: 0; font-size: 14px; color: var(--md-on-surface-variant); }
.not-found__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* ---------- 15. 评论 ---------- */
.comments-wrap {
    margin-top: 56px;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.comments {
    max-width: 100%;
    padding: 28px 24px 32px;
    border-radius: var(--md-shape-lg);
    background: var(--md-surface-container);
}

.comments__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.comments__title { margin: 0; font-size: 18px; font-weight: 500; }
.comments__count { height: 26px; line-height: 26px; font-size: 12px; }
.comments__empty { font-size: 14px; color: var(--md-on-surface-variant); padding: 12px 0; }

.comment-list,
.comment-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list { display: flex; flex-direction: column; gap: 12px; }

/* Typecho 递归输出子评论时复用 .comment-list，这里做层级缩进 */
.comment-item .comment-list,
.comment-children {
    margin: 12px 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--md-shape-md);
    background: var(--md-surface-container-high);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-outline-variant) 45%, transparent);
}

.comment-item.is-author { box-shadow: inset 0 0 0 1px var(--md-primary-container); }

.comment-item__avatar { flex: 0 0 auto; }

.comment-item__avatar img {
    width: 44px;
    height: 44px;
    border-radius: var(--md-shape-full);
    object-fit: cover;
    background: var(--md-surface-container-high);
}

/* Gravatar 连不上时（国内常见）：留一个同尺寸的圆底，不留破图 */
.comment-item__avatar--blank {
    width: 44px;
    height: 44px;
    border-radius: var(--md-shape-full);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--md-primary) 26%, transparent),
            color-mix(in srgb, var(--md-tertiary) 26%, transparent)),
        var(--md-surface-container-high);
    box-shadow: inset 0 0 0 1px var(--md-outline-variant);
}

.comment-item__body { min-width: 0; flex: 1; }

.comment-item__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-item__name { font-size: 14px; font-weight: 500; font-style: normal; color: var(--md-on-surface); }

.comment-item__time {
    font-size: 12px;
    color: var(--md-on-surface-variant);
    margin-left: auto;
}

.comment-item__content { font-size: 14px; line-height: 24px; color: var(--md-on-surface); }
.comment-item__content p { margin: 8px 0; }
.comment-item__content p:first-child { margin-top: 0; }
.comment-item__content p:last-child { margin-bottom: 0; }
.comment-item__content code {
    font-family: var(--md-font-mono);
    font-size: .9em;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--md-surface-container-high);
}

.comment-item__actions { margin-top: 8px; }

.comment-item__actions a {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--md-shape-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.comment-item__actions a:hover { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

.comment-awaiting-moderation {
    font-size: 12px;
    color: var(--md-error);
    font-style: normal;
}

/* 评论表单 */
.respond {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--md-outline-variant);
    --field-bg: var(--md-surface-container);
}

.respond__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.respond__title { margin: 0; font-size: 16px; font-weight: 500; }
.respond__cancel a { font-size: 13px; }

.comment-form { display: flex; flex-direction: column; gap: 12px; }

.comment-form__row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.comment-form__login { margin: 0 0 4px; font-size: 13px; color: var(--md-on-surface-variant); }

.field { position: relative; }

.field input,
.field textarea {
    width: 100%;
    padding: 18px 14px 8px;
    border: 1px solid var(--md-outline);
    border-radius: var(--md-shape-sm);
    background: transparent;
    color: var(--md-on-surface);
    font: inherit;
    font-size: 14px;
    line-height: 22px;
    transition: border-color var(--md-dur-short) var(--md-ease),
        box-shadow var(--md-dur-short) var(--md-ease);
    -webkit-appearance: none;
}

.field textarea { min-height: 132px; resize: vertical; line-height: 24px; }

.field input:hover,
.field textarea:hover { border-color: var(--md-on-surface); }

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: inset 0 0 0 1px var(--md-primary);
}

.field label {
    position: absolute;
    left: 11px;
    top: 14px;
    padding: 0 4px;
    font-size: 14px;
    color: var(--md-on-surface-variant);
    background: var(--field-bg, var(--md-surface));
    pointer-events: none;
    transform-origin: left top;
    transition: transform var(--md-dur-short) var(--md-ease),
        color var(--md-dur-short) var(--md-ease);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
    transform: translateY(-23px) scale(.78);
    color: var(--md-primary);
}

.comment-form__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.comment-form__tip { font-size: 12px; color: var(--md-on-surface-variant); }

/* ---------- 16. 分页 ---------- */
.pagination-wrap {
    display: flex;
    justify-content: center;
    margin: 36px 0 8px;
}

.page-navigator {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.page-navigator li { display: inline-flex; }

.page-navigator a,
.page-navigator span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--md-shape-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    background: transparent;
    transition: background var(--md-dur-short) var(--md-ease), color var(--md-dur-short) var(--md-ease);
}

.page-navigator a:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); color: var(--md-on-surface); }
.page-navigator .current a,
.page-navigator .current span {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.page-navigator .prev a,
.page-navigator .next a { padding: 0 16px; }

/* ---------- 17. 页脚 ---------- */
.site-footer {
    margin-top: 48px;
    background: var(--md-surface-container);
    border-top: 1px solid var(--md-outline-variant);
}

.site-footer__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 24px 40px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.site-footer__name { font-size: 15px; font-weight: 500; }
.site-footer__desc {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 20px;
    color: var(--md-on-surface-variant);
    max-width: 42ch;
}

.site-footer__meta { font-size: 12px; color: var(--md-on-surface-variant); text-align: right; }
.site-footer__meta p { margin: 0 0 4px; }
.site-footer__meta a { color: var(--md-on-surface-variant); text-decoration: underline; text-underline-offset: 2px; }
.site-footer__meta a:hover { color: var(--md-primary); }

/* ---------- 18. Snackbar ---------- */
.snackbar {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 80;
    min-width: 200px;
    max-width: min(520px, calc(100vw - 32px));
    padding: 14px 20px;
    border-radius: var(--md-shape-xs);
    background: var(--md-inverse-surface);
    color: var(--md-inverse-on-surface);
    font-size: 14px;
    box-shadow: var(--md-elev-3);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity var(--md-dur-med) var(--md-ease),
        transform var(--md-dur-med) var(--md-ease-emph);
}

.snackbar.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 19. 动效系统 ---------- */

/* 入场：上浮淡入，由 JS 按 DOM 顺序错峰触发 */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(16px) scale(.994);
    transition: opacity var(--md-dur-long) var(--md-ease),
        transform var(--md-dur-long) var(--md-ease-emph);
}

.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* Hero 内部三块内容开屏依次浮现 */
.js .hero__inner > * {
    animation: md3-hero-rise 640ms var(--md-ease-emph) both;
}

.js .hero__inner > *:nth-child(1) { animation-delay: 60ms; }
.js .hero__inner > *:nth-child(2) { animation-delay: 140ms; }
.js .hero__inner > *:nth-child(3) { animation-delay: 220ms; }

@keyframes md3-hero-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

/* 顶栏：向下滚动收起，向上滚动回弹（MD3 Top App Bar scroll behavior） */
.app-bar {
    transition: box-shadow var(--md-dur-med) var(--md-ease),
        background var(--md-dur-med) var(--md-ease),
        transform var(--md-dur-med) var(--md-ease-emph);
    will-change: transform;
}

.app-bar.is-hidden { transform: translateY(-104%); }
.app-bar:focus-within { transform: none; }

/* 页面切换：View Transitions 实现的 MD3 fade-through（Z 轴前后推移） */
@view-transition {
    navigation: auto;
}

.app-bar { view-transition-name: app-bar; }

::view-transition-old(root) {
    animation: md3-page-out var(--md-dur-short) var(--md-ease-accel) both;
}

::view-transition-new(root) {
    animation: md3-page-in 400ms var(--md-ease-emph) both;
}

::view-transition-group(app-bar) {
    animation-duration: var(--md-dur-med);
}

@keyframes md3-page-out {
    to { opacity: 0; transform: scale(1.012); }
}

@keyframes md3-page-in {
    from { opacity: 0; transform: scale(.988); }
}

/* TOC 活动项滑动指示条 */
.toc { position: relative; }

.toc__marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 0;
    border-radius: 2px;
    background: var(--md-primary);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--md-dur-med) var(--md-ease-emph),
        height var(--md-dur-med) var(--md-ease-emph),
        opacity var(--md-dur-short) var(--md-ease);
}

.toc.has-active .toc__marker { opacity: 1; }

/* 卡片封面：hover 时缓慢推近 */
.post-card__media img {
    transition: transform var(--md-dur-xlong) var(--md-ease-emph);
}

.post-card:hover .post-card__media img { transform: scale(1.045); }

/* 涟漪 */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: currentColor;
    opacity: .28;
    pointer-events: none;
    animation: md3-ripple 520ms var(--md-ease) forwards;
}

@keyframes md3-ripple {
    to { transform: scale(2.6); opacity: 0; }
}

/* ---------- 19.4 图片灯箱 ---------- */
.prose img.md3-zoomable {
    cursor: zoom-in;
    transition: box-shadow var(--md-dur-med) var(--md-ease);
}

.prose img.md3-zoomable:hover {
    box-shadow: var(--md-elev-2);
    filter: brightness(1.03);
}

.prose img.md3-zoomable:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 4px;
}

html.md3-lock,
body.md3-lock { overflow: hidden; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: center;
    padding: 68px 16px 72px;
    opacity: 0;
    transition: opacity 200ms var(--md-ease);
}

.lightbox.is-open { opacity: 1; }

.lightbox__scrim {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--md-scrim) 91%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.lightbox__bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
}

.lightbox__count {
    padding: 6px 14px;
    border-radius: var(--md-shape-full);
    background: color-mix(in srgb, var(--md-surface-container-highest) 88%, transparent);
    color: var(--md-on-surface);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.lightbox__close {
    width: 44px;
    height: 44px;
    background: color-mix(in srgb, var(--md-surface-container-highest) 88%, transparent);
    color: var(--md-on-surface);
    margin-left: auto;
}

.lightbox__close:hover { background: var(--md-surface-container-highest); }

.lightbox__stage {
    position: relative;
    margin: 0;
    max-width: min(1200px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transform: scale(.94);
    opacity: 0;
    transition: transform 240ms var(--md-ease), opacity 200ms var(--md-ease);
}

.lightbox.is-open .lightbox__stage {
    transform: none;
    opacity: 1;
}

.lightbox__img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(1200px, 92vw);
    max-height: calc(100vh - 172px);
    border-radius: var(--md-shape-lg);
    background: var(--md-surface-container-high);
    box-shadow: var(--md-elev-5);
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    transition: transform 220ms var(--md-ease);
}

.lightbox.is-zoomed .lightbox__img { cursor: grab; }
.lightbox.is-dragging .lightbox__img { cursor: grabbing; transition: none; }

.lightbox__caption {
    max-width: min(1200px, 92vw);
    padding: 6px 16px;
    border-radius: var(--md-shape-full);
    background: color-mix(in srgb, var(--md-surface-container-highest) 86%, transparent);
    color: var(--md-on-surface-variant);
    font-size: 12.5px;
    line-height: 18px;
    text-align: center;
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: color-mix(in srgb, var(--md-surface-container-highest) 90%, transparent);
    color: var(--md-on-surface);
    box-shadow: var(--md-elev-2);
    transform: translateY(-50%);
    transition: background var(--md-dur-short) var(--md-ease),
        transform var(--md-dur-short) var(--md-ease);
}

.lightbox__nav:hover {
    background: var(--md-surface-container-highest);
    transform: translateY(-50%) scale(1.06);
}

.lightbox__nav .md3-icon { width: 26px; height: 26px; }
.lightbox__nav--prev { left: clamp(10px, calc((100vw - min(1200px, 92vw)) / 2 - 64px), 40px); }
.lightbox__nav--next { right: clamp(10px, calc((100vw - min(1200px, 92vw)) / 2 - 64px), 40px); }

@media (max-width: 620px) {
    .lightbox { padding: 60px 12px 128px; }
    .lightbox__nav {
        width: 44px;
        height: 44px;
        top: auto;
        bottom: 22px;
        transform: none;
    }
    .lightbox__nav:hover { transform: none; }
    .lightbox__nav--prev { left: calc(50% - 64px); right: auto; }
    .lightbox__nav--next { right: calc(50% - 64px); left: auto; }
    .lightbox__img { max-height: calc(100vh - 260px); border-radius: var(--md-shape-md); }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox,
    .lightbox__stage,
    .lightbox__img { transition: none; }
    .lightbox__stage { transform: none; }
}

/* ---------- 19.5 紧凑密度 ---------- */
:root[data-density="compact"] .post-grid { gap: 14px; }
:root[data-density="compact"] .post-card__media { aspect-ratio: 21 / 9; }
:root[data-density="compact"] .post-card__body { padding: 14px 16px 16px; gap: 8px; }
:root[data-density="compact"] .post-card__title { font-size: 17px; line-height: 24px; }
:root[data-density="compact"] .post-card__excerpt { -webkit-line-clamp: 2; }
:root[data-density="compact"] .hero { padding: 40px 32px 32px; }
:root[data-density="compact"] .prose { line-height: 1.72; }
:root[data-density="compact"] .prose p { margin: 14px 0; }

/* ---------- 20. 响应式 ---------- */
@media (max-width: 1100px) {
    .post-layout.has-toc {
        grid-template-columns: minmax(0, 1fr);
        max-width: 760px;
    }
    .toc-rail { display: none; }
}

@media (min-width: 1101px) {
    #tocFab { display: none !important; }
}

@media (max-width: 900px) {
    .app-bar__menu { display: inline-flex; }
    .app-bar__nav { display: none; }
    .page { padding: 8px 16px 88px; }
    .hero { padding: 32px 24px 28px; margin: 16px 0 32px; }
    .hero__decor { display: none; }
    .hero__head { flex-direction: row; align-items: center; gap: 12px; }
    .hero__id { gap: 14px; }
    .hero__avatar { width: 56px; height: 56px; border-radius: 18px; font-size: 22px; }
    .hero__rss { width: 40px; height: 40px; padding: 0; justify-content: center; }
    .hero__rss span { display: none; }
    .hero__title { font-size: clamp(23px, 6.2vw, 32px); line-height: 1.2; }
    .hero__eyebrow { font-size: 11px; letter-spacing: .08em; }
    .hero__stats { margin-top: 24px; padding-top: 18px; }
    .hero-stat { padding: 0 18px; }
    .hero-stat strong { font-size: 20px; line-height: 26px; }
    .post-grid { grid-template-columns: minmax(0, 1fr); }
    .post-grid--list .post-card { flex-direction: column; }
    .post-grid--list .post-card__media { flex: none; aspect-ratio: 16 / 9; }
    .post-grid--one .post-card { flex-direction: column; min-height: 0; }
    .post-grid--one .post-card__media { flex: none; aspect-ratio: 16 / 9; }
    .post-grid--one .post-card__body { padding: 20px 20px 24px; }
    .comments { padding: 20px 16px 24px; }
    .comment-form__row { grid-template-columns: minmax(0, 1fr); }
    .post-nav { grid-template-columns: minmax(0, 1fr); }
    .post-nav__item--next { text-align: left; align-items: flex-start; }
    .fab-stack { right: 16px; bottom: 16px; }
    .site-footer__inner { flex-direction: column; gap: 16px; }
    .site-footer__meta { text-align: left; }
}

@media (max-width: 600px) {
    .article__title { font-size: 26px; }
    .hero__stats .chip { font-size: 12px; }
    .search-view { padding: 56px 12px; }
    .comments-wrap { margin-top: 36px; }
    .comment-children { margin-left: 8px; }
    .author-card { flex-wrap: wrap; }
    .author-card .btn { margin-left: 0; }
    .article__meta .chip { font-size: 12px; }
    .code-block pre { font-size: 12.5px; padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .js [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- 21. 头部背景图 · 响应式 ---------- */
@media (max-width: 900px) {
    .hero--media { padding: 32px 28px 30px; }
    .hero--media[data-height="compact"] { --hero-min-h: 250px; }
    .hero--media[data-height="standard"] { --hero-min-h: 340px; }
    .hero--media[data-height="immersive"] { --hero-min-h: 430px; }
}

@media (max-width: 600px) {
    .hero--media { padding: 24px 20px 26px; border-radius: var(--md-shape-lg); }
    .hero--media[data-height="compact"] { --hero-min-h: 220px; }
    .hero--media[data-height="standard"] { --hero-min-h: 300px; }
    .hero--media[data-height="immersive"] { --hero-min-h: 380px; }
    .hero--media .hero__title { font-size: clamp(24px, 7vw, 32px); }
    .hero--media .hero__desc { margin-top: 14px; font-size: 14.5px; line-height: 23px; }
    .hero--media .hero__stats { margin-top: 20px; padding-top: 16px; }
}

/* 遮罩/抽屉打开时，顶栏必须回到可视区 */
body.is-locked .app-bar,
html.md3-lock .app-bar {
    transform: none;
}

/* 手动切换主题时的过渡更短促，避免整页长时间虚化 */
html.vt-theme::view-transition-old(root),
html.vt-theme::view-transition-new(root) {
    animation-duration: 240ms;
}

html.vt-theme::view-transition-group(app-bar) {
    animation-duration: 240ms;
}

/* ---------- 22. 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
    .app-bar { transition: none; }
    .app-bar.is-hidden { transform: none; }
    .hero--media .hero__media img { animation: none; }
    .js .hero__inner > * { animation: none; }
    .toc__marker { transition: none; }
    ::view-transition-old(root),
    ::view-transition-new(root),
    ::view-transition-group(app-bar) { animation: none; }
}

@media print {
    .app-bar, .drawer, .scrim, .search-view, .fab-stack, .toc-rail,
    .toc-sheet, .reading-progress, .site-footer, .comments, .post-nav { display: none !important; }
    /* 未被滚动触发过的入场元素在打印时也必须完整显示 */
    .js [data-reveal] { opacity: 1 !important; transform: none !important; }
    .hero__scrim { display: none; }
    body { background: #fff; color: #000; }
    .post-layout.has-toc { display: block; }
}
