/* =============================================
   Picnote Demo - 完整样式（Phase 1~9）
   ============================================= */

/* ---------- 变量 ---------- */
:root {
    --grid-gap: 18px;
    --card-radius: 8px;
    --card-shadow: 0 2px 12px rgba(0,0,0,.07);
    --card-shadow-hover: 0 10px 28px rgba(0,0,0,.13);
    --bg: #f4f5f7;
    --card-bg: #fff;
    --text-1: #1c1c1e;
    --text-2: #6b6b70;
    --transition: .3s ease;
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* html 也要上底色，否则页面底部/橡皮筋回弹区域会露白 */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }

html, body.snapic-body { min-height: 100%; }

body.snapic-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
                 Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.snapic-main { flex: 1 0 auto; width: 100%; }

/* ---------- noscript ---------- */
.noscript-notice {
    padding: 12px 20px;
    background: #fff3cd;
    color: #664d03;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid #ffe69c;
}
html[data-theme="dark"] .noscript-notice {
    background: #3d3119; color: #ffd970; border-bottom-color: #6e5524;
}

/* =============================================
   顶栏
   ============================================= */
.snapic-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(0,0,0,.05);
}
.snapic-topbar .site-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--text-1);
}
/* 顶栏图标按钮（放大镜搜索 / 分类菜单） */
.snapic-topbar .topbar-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border: none; border-radius: 50%;
    background: rgba(0,0,0,.05);
    color: var(--text-1);
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.snapic-topbar .topbar-icon-btn:hover { background: rgba(0,0,0,.1); transform: translateY(-1px); }
.snapic-topbar .topbar-icon-btn[aria-expanded="true"] { background: #1c1c1e; color: #fff; }

/* 下拉面板：分类二级菜单 / 搜索框 */
.snapic-topbar { position: sticky; }
.snapic-topbar .topbar-panel {
    position: absolute; top: calc(100% + 8px); right: 16px;
    z-index: 60;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.04);
    padding: 10px;
    min-width: 180px; max-width: calc(100vw - 24px);
    opacity: 0; transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}
.snapic-topbar .topbar-panel.open {
    opacity: 1; transform: translateY(0);
    pointer-events: auto;
}
.snapic-topbar .nav-panel { display: flex; flex-direction: column; gap: 2px; }
.snapic-topbar .nav-panel .site-nav-item {
    display: block; width: 100%; box-sizing: border-box;
    padding: 9px 14px; border-radius: 9px;
    font-size: 14px; font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.snapic-topbar .nav-panel .site-nav-item:hover { background: rgba(0,0,0,.06); }
.snapic-topbar .nav-panel .site-nav-item.active { background: #1c1c1e; color: #fff; }
.snapic-topbar .nav-panel .site-nav-item.active:hover { background: #333; }
.snapic-topbar .search-panel { padding: 12px; }
.snapic-topbar .search-panel .site-search { display: flex; gap: 8px; width: 280px; max-width: 100%; }
.snapic-topbar .search-panel .site-search input { flex: 1 1 auto; width: auto; }
.snapic-topbar .search-panel .site-search button { flex: 0 0 auto; }

.snapic-topbar .topbar-right { display: flex; align-items: center; gap: 10px; }
.site-search { display: flex; gap: 6px; }
.site-search input {
    padding: 6px 12px;
    border: 1px solid #e2e2e6;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
    background: #fff;
    color: var(--text-1);
    width: 180px;
}
.site-search input:focus { border-color: #999; }
.site-search button {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: #1c1c1e;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s;
}
.site-search button:hover { background: #333; }

.theme-toggle {
    position: relative;
    width: 36px; height: 36px;
    padding: 0; border: none; border-radius: 50%;
    background: rgba(0,0,0,.05);
    color: var(--text-1);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease, transform .25s ease;
    overflow: hidden;
}
.theme-toggle:hover { background: rgba(0,0,0,.1); transform: rotate(15deg); }
.theme-toggle svg { position: absolute; transition: opacity .25s ease, transform .35s ease; }
.theme-toggle .icon-sun  { opacity: 1; transform: rotate(0deg); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg); }
html[data-theme="dark"] .theme-toggle { background: rgba(255,255,255,.08); }
html[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,.15); }
html[data-theme="dark"] .theme-toggle .icon-sun  { opacity: 0; transform: rotate(90deg); }
html[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg); }

/* =============================================
   瀑布流
   ============================================= */
.grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 0;
    column-count: 4;
    column-gap: var(--grid-gap);
}
.grid-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    margin-bottom: var(--grid-gap);
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition);
}
.grid-item:hover { box-shadow: var(--card-shadow-hover); }

/* ---------- 横向瀑布流（JS 接管布局：从左到右、自上而下） ----------
   .js-masonry 由 masonry-init.js 添加。加了它才切到绝对定位，
   没加时仍是上面的 column-count 多列布局（无 JS 时的降级）。
   html.snapic-js 表示"JS 可用"：先藏起来等脚本排好版再显示，
   避免先闪一下竖排再跳成横向；masonry-fallback 是脚本没跑起来时的兜底显示。 */
html.snapic-js .grid#snapic-grid:not(.js-masonry) { visibility: hidden; }
html.snapic-js.masonry-fallback .grid#snapic-grid:not(.js-masonry) { visibility: visible; }

.grid.js-masonry {
    column-count: auto;
    position: relative;
}
.grid.js-masonry > .grid-item {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
}
.post-link,
.post-cover-link,
.post-title-link { display: block; color: inherit; }

/* 不写死比例：真实宽高由 <img> 的 width/height 属性预留（见 index.php），
   取不到宽高的图跟随自然比例，避免宽图被 3:4 兜底拉成长卡片 */
.post-cover { position: relative; overflow: hidden; background: #ececef; }
.post-cover img {
    width: 100%; height: auto; display: block;
    transition: transform .5s ease;
    -webkit-user-drag: none; user-select: none;
}
.grid-item:hover .post-cover img { transform: scale(1.04); }

/* ---------- 卡片底部文字（仅摘要，无头像/作者行） ---------- */
.post-body { padding: 10px 14px 12px; }
.post-excerpt {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-2);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-cover {
    aspect-ratio: 4 / 3;
    display: flex; align-items: center; justify-content: center;
    color: #b6b6bd;
    font-size: 13px;
    background: linear-gradient(135deg, #ececef 0%, #e2e2e6 100%);
}

.img-count {
    position: absolute;
    top: 10px; left: 10px;
    padding: 3px 9px;
    font-size: 12px;
    color: #fff;
    background: rgba(0,0,0,.55);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    letter-spacing: .2px;
}

.post-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    padding: 12px 14px 4px;
    color: var(--text-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s;
}
.post-title-link:hover .post-title { color: #0066cc; }
.post-body .post-excerpt:last-child { padding-bottom: 0; }

/* =============================================
   分页
   ============================================= */
.pagination {
    max-width: 1400px; margin: 32px auto 56px; padding: 0 24px;
    display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}
/* Typecho pageNav 输出 <ol class="page-navigator"><li>…，重置列表默认样式，横向排列 */
.pagination ol,
.pagination ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.pagination li { margin: 0; padding: 0; list-style: none; }
.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    background: #fff;
    color: var(--text-1);
    font-size: 13px;
    box-shadow: var(--card-shadow);
    transition: all .2s;
}
.pagination a:hover { background: #1c1c1e; color: #fff; }

/* =============================================
   页脚
   ============================================= */
.snapic-footer {
    flex-shrink: 0;
    padding: 36px 24px 48px;
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
}
.snapic-footer .theme-info { margin-top: 6px; font-size: 12px; color: #a0a0a8; }
.snapic-footer .footer-extra {
    margin-top: 8px; font-size: 12px; color: #a0a0a8; line-height: 1.8;
}
.snapic-footer .footer-extra a {
    color: inherit;
    border-bottom: 1px solid transparent;
    transition: color .2s, border-color .2s;
}
.snapic-footer .footer-extra a:hover {
    color: var(--text-1); border-bottom-color: currentColor;
}
html[data-theme="dark"] .snapic-footer .footer-extra { color: #6b6b72; }
html[data-theme="dark"] .snapic-footer .footer-extra a:hover { color: #f0f0f3; }

/* =============================================
   回到顶部
   ============================================= */
.back-to-top {
    position: fixed;
    right: 24px; bottom: 24px;
    z-index: 40;
    width: 42px; height: 42px;
    padding: 0; border: none; border-radius: 50%;
    background: #1c1c1e; color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    opacity: 0;
    transform: translateY(16px) scale(.9);
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease, background .2s;
}
.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.back-to-top:hover { background: #333; transform: translateY(-2px) scale(1.05); }
html[data-theme="dark"] .back-to-top {
    background: #f0f0f3; color: #1c1c1e;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
html[data-theme="dark"] .back-to-top:hover { background: #fff; }

/* =============================================
   文章页（博客模式）
   ============================================= */
.snapic-post {
    width: 100%;
    max-width: 960px;
    margin: 40px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.04);
    overflow: hidden;
    padding: 0;
}

/* 文章页入场动画：和首页瀑布流卡片一样的"渐入上浮"，避免瞬间硬切 */
@keyframes snapicRise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.snapic-post,
.post-nav {
    animation: snapicRise .5s cubic-bezier(.22,.68,.3,1) both;
}
.post-nav { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
    .snapic-post,
    .post-nav { animation: none; }
}
.snapic-post .post-hero { width: 100%; aspect-ratio: 16 / 9; background: #f0f0f3; overflow: hidden; }
.snapic-post .post-hero img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    -webkit-user-drag: none; user-select: none;
}
.snapic-post .post-inner { padding: 40px 32px; }
.snapic-post.has-hero .post-inner { padding-top: 32px; }
.snapic-post .post-header {
    margin-bottom: 32px;
    text-align: center;
    border-bottom: 1px solid #f0f0f3;
    padding-bottom: 24px;
}
.snapic-post .post-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700; line-height: 1.35;
    color: var(--text-1);
    margin-bottom: 16px; padding: 0;
    display: block; -webkit-line-clamp: unset;
}
.snapic-post .post-meta {
    display: flex; justify-content: center;
    gap: 16px;
    font-size: 13px; color: var(--text-2);
    flex-wrap: wrap; padding: 0;
}
.snapic-post .post-meta span,
.snapic-post .post-meta time {
    display: inline-flex; align-items: center; gap: 4px;
}
.snapic-post .post-content { font-size: 16px; line-height: 1.85; color: #2c2c30; }
.snapic-post .post-content p { margin: 0 0 20px; }
.snapic-post .post-content h2,
.snapic-post .post-content h3 {
    margin: 32px 0 16px; font-weight: 600; line-height: 1.4;
}
.snapic-post .post-content h2 { font-size: 1.35rem; }
.snapic-post .post-content h3 { font-size: 1.15rem; }
.snapic-post .post-content a {
    color: #0066cc;
    border-bottom: 1px solid rgba(0,102,204,.3);
    transition: border-color .2s;
}
.snapic-post .post-content a:hover { border-bottom-color: #0066cc; }
/* 正文图片：宽度受"图片大小"字段控制，高度一律限制在屏幕 80% 以内，避免长图占满整屏 */
.snapic-post .post-content img {
    max-width: 100%; height: auto;
    max-height: 80vh; width: auto;
    object-fit: contain;
    border-radius: 10px; margin: 16px auto;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    cursor: zoom-in;
}
.snapic-post.img-size-l .post-content img { max-width: 85%; }
.snapic-post.img-size-m .post-content img { max-width: 65%; }
.snapic-post.img-size-s .post-content img { max-width: 45%; }
.snapic-post .post-content a.content-image-link {
    display: block; text-align: center; border-bottom: 0;
}
    -webkit-user-drag: none; user-select: none;
}
.snapic-post .post-content blockquote {
    border-left: 3px solid #ddd;
    padding: 8px 16px; margin: 20px 0;
    color: var(--text-2);
    background: #fafafa;
    border-radius: 0 8px 8px 0;
}
.snapic-post .post-content pre {
    background: #f6f8fa;
    padding: 16px; border-radius: 10px;
    overflow-x: auto; margin: 20px 0;
    font-size: 14px; line-height: 1.6;
}
.snapic-post .post-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    background: #f0f0f4; padding: 2px 6px;
    border-radius: 4px; font-size: .9em;
}
.snapic-post .post-content pre code { background: none; padding: 0; }
.snapic-post .post-content ul,
.snapic-post .post-content ol { padding-left: 24px; margin: 0 0 20px; }
.snapic-post .post-content li { margin: 4px 0; }

/* =============================================
   文章底部导航
   ============================================= */
.post-nav {
    width: 100%;
    max-width: 960px;
    margin: 0 auto 40px;
    padding: 0 24px;
    display: flex; align-items: center; justify-content: center; gap: 14px;
}
.post-nav-prev,
.post-nav-next { flex: 1 1 0; min-width: 0; }
.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; }
.post-nav-home { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }

.post-nav-prev a,
.post-nav-next a,
.post-nav .nav-empty {
    display: inline-block; vertical-align: middle;
    max-width: 100%;
    height: 46px; line-height: 46px;
    box-sizing: border-box;
    padding: 0 18px;
    font-size: 13px; font-weight: 500;
    border-radius: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.post-nav-prev a,
.post-nav-next a {
    position: relative;
    background: #fff; color: var(--text-1);
    box-shadow: var(--card-shadow);
    border: 1px solid transparent;
}
.post-nav-prev a { padding-left: 42px; }
.post-nav-prev a::before {
    content: "←"; position: absolute;
    left: 16px; top: 50%; transform: translateY(-50%);
    font-size: 15px; font-weight: 600;
    color: var(--text-2);
    transition: color .2s, transform .25s ease;
}
.post-nav-next a { padding-right: 42px; }
.post-nav-next a::after {
    content: "→"; position: absolute;
    right: 16px; top: 50%; transform: translateY(-50%);
    font-size: 15px; font-weight: 600;
    color: var(--text-2);
    transition: color .2s, transform .25s ease;
}
.post-nav-prev a:hover,
.post-nav-next a:hover {
    background: #1c1c1e; color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}
.post-nav-prev a:hover::before,
.post-nav-next a:hover::after { color: #fff; }
.post-nav-prev a:hover::before { transform: translateY(-50%) translateX(-3px); }
.post-nav-next a:hover::after  { transform: translateY(-50%) translateX(3px); }

.post-nav .nav-empty {
    color: #b6b6bd; background: transparent;
    border: 1px dashed #d6d6dc; cursor: default;
}
.post-nav-home a {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 50%;
    background: #1c1c1e; color: #fff;
    box-shadow: var(--card-shadow);
    box-sizing: border-box;
    transition: background .2s, transform .25s ease, box-shadow .2s;
}
.post-nav-home a:hover {
    background: #333;
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--card-shadow-hover);
}
.post-nav-home a svg { display: block; }

/* =============================================
   归档页头部
   ============================================= */
.archive-header {
    max-width: 1400px; margin: 0 auto 8px;
    padding: 40px 24px 20px; text-align: center;
}
.archive-type {
    display: inline-block; padding: 3px 12px;
    font-size: 12px; color: #6b6b70;
    background: rgba(0,0,0,.05);
    border-radius: 20px; letter-spacing: 1px;
    margin-bottom: 12px;
}
.archive-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700; line-height: 1.3;
    color: var(--text-1);
    margin-bottom: 10px; letter-spacing: -.5px;
}
.archive-count { font-size: 13px; color: var(--text-2); }
.empty-state {
    max-width: 400px; margin: 60px auto; padding: 0 24px;
    text-align: center; color: var(--text-2);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }

/* =============================================
   404
   ============================================= */
.error-page {
    max-width: 520px; margin: 80px auto 120px;
    padding: 0 24px; text-align: center;
}
.error-code {
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 900; line-height: 1; letter-spacing: -4px;
    background: linear-gradient(135deg, #1c1c1e 0%, #6b6b70 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.error-title { font-size: 1.4rem; font-weight: 600; color: var(--text-1); margin-bottom: 12px; }
.error-desc { font-size: 14px; color: var(--text-2); line-height: 1.7; margin-bottom: 28px; }
.error-actions { display: flex; justify-content: center; gap: 12px; }
.btn-primary {
    display: inline-block; padding: 11px 28px;
    background: #1c1c1e; color: #fff;
    border-radius: 10px; font-size: 14px; font-weight: 500;
    transition: background .2s, transform .2s;
}
.btn-primary:hover { background: #333; transform: translateY(-1px); }

/* =============================================
   广告位
   ============================================= */
.grid-item.ad-block {
    display: flex; align-items: center; justify-content: center;
    min-height: 200px;
    background: #f4f5f7;
    border: 1px dashed #d6d6dc;
    border-radius: var(--card-radius);
    color: var(--text-2); font-size: 13px;
    text-align: center; padding: 24px;
}
.grid-item.ad-block * { max-width: 100%; }

/* =============================================
   置顶卡片角标
   ============================================= */
.sticky-mark {
    position: absolute;
    top: 10px; left: 10px;
    padding: 3px 9px;
    background: #ff3b30; color: #fff;
    font-size: 12px; font-weight: 600;
    border-radius: 20px;
    letter-spacing: 1px;
    z-index: 2;
}
.is-sticky .img-count { top: 38px; }  /* 角标和图片数同时存在时错开 */

/* =============================================
   相册弹层（图片放大浏览）
   ============================================= */
.gallery-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    /* 浅色模式：朦胧白（不是黑） */
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    opacity: 0;
    transition: opacity .28s ease;
    user-select: none; -webkit-user-select: none;
}
.gallery-overlay.is-open { opacity: 1; }
/* 暗色模式：半透明黑 */
html[data-theme="dark"] .gallery-overlay {
    background: rgba(0, 0, 0, .88);
}

/* 面板：整体参与缩放淡入（poptrox 风格 300ms） */
.gallery-overlay .gallery-panel {
    display: flex; align-items: center; justify-content: center;
    max-width: 90vw; max-height: 90vh;
    transition: transform .3s cubic-bezier(.2, .8, .25, 1), opacity .3s ease;
    will-change: transform, opacity;
}
/* 图片卡片：圆角 + 深色底 + 大阴影（参考站 poptrox popup） */
.gallery-overlay .gallery-stage {
    position: relative;
    max-width: 90vw; max-height: 85vh;
    display: flex; align-items: center; justify-content: center;
    background: rgba(31, 34, 36, .92);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1em 3em .5em rgba(0, 0, 0, .25);
}
.gallery-overlay .gallery-stage img {
    max-width: 90vw; max-height: 85vh;
    object-fit: contain;
    -webkit-user-drag: none; user-select: none;
}
/* 文章信息叠印在图片左下角（参考 Snapic 官方灯箱） */
.gallery-overlay .gallery-caption {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 64px 22px 18px;
    background-image: linear-gradient(to top, rgba(16, 16, 16, .55) 20%, rgba(16, 16, 16, 0) 100%);
    pointer-events: none;
    display: flex; flex-direction: column; gap: 6px;
    text-align: left;
}
.gallery-overlay .gallery-caption-title {
    font-size: 16px; font-weight: 700; margin: 0 0 4px; line-height: 1.4;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,.45);
}
.gallery-overlay .gallery-caption-title a { color: #fff; }
.gallery-overlay .gallery-caption-title a:hover { color: rgba(255,255,255,.82); }
.gallery-overlay .gallery-caption-text {
    font-size: 13px; line-height: 1.6; margin: 0 0 8px;
    color: rgba(255,255,255,.88);
    white-space: pre-wrap; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 5px rgba(0,0,0,.4);
}
/* 灯箱里的日期 / 分类标签（参考站 poptrox caption） */
.gallery-caption-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gc-date { font-size: 12px; color: rgba(255,255,255,.9); letter-spacing: .4px; }
.gc-cat {
    padding: 3px 12px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 20px; font-size: 11px; color: #fff;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    line-height: 1.4;
}

/* ---------- 无限滚动（无分页） ---------- */
html.js-infinite .pagination { display: none; }
.infinite-sentinel {
    padding: 28px 0 40px;
    text-align: center;
    font-size: 13px;
    color: #b6b6bd;
}
.infinite-sentinel.is-end { color: #c7c7cc; }
/* 加载更多：可点击兜底（Observer 失效时用户手动加载） */
.infinite-sentinel.is-clickable { cursor: pointer; text-decoration: underline; }
.infinite-sentinel.is-clickable:hover { color: var(--accent, #007aff); }
.infinite-sentinel.is-error { color: #e0616c; cursor: pointer; }
.infinite-sentinel.is-error:hover { text-decoration: underline; }
.infinite-sentinel.is-loading::after {
    content: ""; display: inline-block;
    width: 14px; height: 14px; margin-left: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(0,0,0,.15);
    border-top-color: #888;
    border-radius: 50%;
    animation: sentinelSpin .8s linear infinite;
}
@keyframes sentinelSpin { to { transform: rotate(360deg); } }
/* 由小到大 / 由大到小：JS 设置 panel 的 transform / opacity，过渡在 .gallery-panel 上 */

.gallery-overlay .gallery-counter {
    position: absolute; top: 24px; left: 50%;
    transform: translateX(-50%);
    padding: 5px 14px;
    font-size: 13px; letter-spacing: .5px;
    background: rgba(0, 0, 0, .06);
    color: var(--text-1);
    border-radius: 20px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.gallery-overlay .gallery-counter .cur { font-weight: 700; }
.gallery-overlay .gallery-close,
.gallery-overlay .gallery-prev,
.gallery-overlay .gallery-next {
    border: none;
    background: rgba(0, 0, 0, .06);
    color: var(--text-1);
    cursor: pointer;
    transition: background .2s, transform .2s;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1;
}
.gallery-overlay .gallery-close {
    position: absolute; top: 20px; right: 24px;
    width: 42px; height: 42px; border-radius: 50%; font-size: 24px;
}
.gallery-overlay .gallery-prev,
.gallery-overlay .gallery-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 54px; height: 54px; border-radius: 50%; font-size: 34px;
}
.gallery-overlay .gallery-prev { left: 24px; }
.gallery-overlay .gallery-next { right: 24px; }
.gallery-overlay .gallery-close:hover,
.gallery-overlay .gallery-prev:hover,
.gallery-overlay .gallery-next:hover { background: rgba(0, 0, 0, .14); }

/* 暗色模式下的弹层控件 */
html[data-theme="dark"] .gallery-overlay .gallery-counter { background: rgba(255,255,255,.12); color: #fff; }
html[data-theme="dark"] .gallery-overlay .gallery-close,
html[data-theme="dark"] .gallery-overlay .gallery-prev,
html[data-theme="dark"] .gallery-overlay .gallery-next { background: rgba(255,255,255,.12); color: #fff; }
html[data-theme="dark"] .gallery-overlay .gallery-close:hover,
html[data-theme="dark"] .gallery-overlay .gallery-prev:hover,
html[data-theme="dark"] .gallery-overlay .gallery-next:hover { background: rgba(255,255,255,.28); }

/* 打开弹层时：隐藏顶栏 / 回顶按钮，锁定滚动（沉浸感）
   用 !important 压过相册模式等更具体的顶栏配色规则 */
html.lb-open .snapic-topbar {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity .2s ease;
}
html.lb-open .back-to-top { opacity: 0 !important; pointer-events: none !important; }
html.lb-open, html.lb-open body.snapic-body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .gallery-overlay,
    .gallery-overlay.is-zooming .gallery-stage img { transition-duration: .01ms !important; }
}

/* =============================================
   PJAX 进度条
   ============================================= */
.pjax-progress {
    position: fixed; top: 0; left: 0;
    height: 3px; width: 0;
    background: linear-gradient(90deg, #0066cc, #a855f7);
    z-index: 10000; opacity: 0; pointer-events: none;
    transition: width .35s ease, opacity .25s ease;
    box-shadow: 0 0 8px rgba(168, 85, 247, .6);
}
.pjax-progress.is-loading { opacity: 1; }
.pjax-progress.is-done {
    width: 100% !important;
    transition: width 0s, opacity .35s ease .12s;
}

/* =============================================
   目录 TOC
   ============================================= */
.snapic-toc {
    margin: 0 0 28px;
    padding: 16px 20px;
    background: #fafafb;
    border: 1px solid #ececef;
    border-radius: 12px;
    font-size: 14px;
}
.snapic-toc .toc-title {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; font-weight: 600;
    color: var(--text-2); letter-spacing: 1px;
    cursor: pointer;
    user-select: none; -webkit-user-select: none;
    padding: 0 0 8px;
}
.snapic-toc .toc-title span { display: inline-flex; align-items: center; gap: 6px; }
.snapic-toc .toc-arrow { transition: transform .25s ease; color: #b6b6bd; }
.snapic-toc.is-collapsed .toc-arrow { transform: rotate(-90deg); }
.snapic-toc .toc-list {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px 16px;
    transition: max-height .3s ease, opacity .25s ease;
    overflow: hidden;
}
.snapic-toc.is-collapsed .toc-list { max-height: 0; opacity: 0; }
.snapic-toc .toc-item { line-height: 1.7; }
.snapic-toc .toc-item a {
    display: block; color: var(--text-1);
    padding: 2px 0; border: none; text-decoration: none;
    transition: color .2s ease;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snapic-toc .toc-item a::before { content: "·"; color: #b6b6bd; margin-right: 6px; }
.snapic-toc .toc-item.toc-h3 a {
    padding-left: 16px; font-size: 13px; color: var(--text-2);
}
.snapic-toc .toc-item a:hover { color: #0066cc; }
.snapic-toc .toc-item a:hover::before { color: #0066cc; }

/* =============================================
   Poptrox 灯箱（直接采用 TimePlus / HTML5UP 成熟方案）
   遮罩分主题：白天朦胧白 / 暗黑半透明黑
   ============================================= */
.poptrox-overlay {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(240, 240, 243, .72); /* 白天：朦胧白 */
}
body[data-theme="dark"] .poptrox-overlay {
  background: rgba(8, 8, 10, .85); /* 暗黑：半透明黑 */
}

.poptrox-popup {
  background: rgba(31, 34, 36, 0.925);
  box-shadow: 0 1em 3em 0.5em rgba(0, 0, 0, 0.25);
  cursor: default;
  border-radius: 12px;
  overflow: hidden;
}
.poptrox-popup:before {
  -moz-transition: opacity 0.2s ease-in-out;
  -webkit-transition: opacity 0.2s ease-in-out;
  -ms-transition: opacity 0.2s ease-in-out;
  transition: opacity 0.2s ease-in-out;
  background-image: -moz-linear-gradient(to left, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0)), -moz-linear-gradient(to right, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0));
  background-image: -webkit-linear-gradient(to left, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0)), -webkit-linear-gradient(to right, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0));
  background-image: linear-gradient(to left, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0)), linear-gradient(to right, rgba(31, 34, 36, 0.35), rgba(31, 34, 36, 0) 10em, rgba(31, 34, 36, 0));
  content: '';
  display: block;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 1;
  opacity: 0;
}
.poptrox-popup:hover:before { opacity: 1; }

.poptrox-popup .closer {
  -moz-transition: opacity 0.2s ease-in-out;
  -webkit-transition: opacity 0.2s ease-in-out;
  -ms-transition: opacity 0.2s ease-in-out;
  transition: opacity 0.2s ease-in-out;
  background-image: url("images/close.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 3em;
  height: 5em;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 5em;
  z-index: 2;
}
.poptrox-popup .nav-previous,
.poptrox-popup .nav-next {
  -moz-transition: opacity 0.2s ease-in-out;
  -webkit-transition: opacity 0.2s ease-in-out;
  -ms-transition: opacity 0.2s ease-in-out;
  transition: opacity 0.2s ease-in-out;
  background-image: url("images/arrow.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 5em;
  cursor: pointer;
  height: 8em;
  margin-top: -4em;
  opacity: 0;
  position: absolute;
  top: 50%;
  width: 6em;
  z-index: 2;
}
.poptrox-popup .nav-previous { -moz-transform: scaleX(-1); -webkit-transform: scaleX(-1); -ms-transform: scaleX(-1); transform: scaleX(-1); left: 0; }
.poptrox-popup .nav-next { right: 0; }

.poptrox-popup .caption {
  padding: 2em 2em 0.1em 2em;
  background-image: -moz-linear-gradient(to top, rgba(16, 16, 16, 0.45) 25%, rgba(16, 16, 16, 0) 100%);
  background-image: -webkit-linear-gradient(to top, rgba(16, 16, 16, 0.45) 25%, rgba(16, 16, 16, 0) 100%);
  background-image: linear-gradient(to top, rgba(16, 16, 16, 0.45) 25%, rgba(16, 16, 16, 0) 100%);
  bottom: 0;
  cursor: default;
  left: 0;
  position: absolute;
  text-align: left;
  width: 100%;
  z-index: 2;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poptrox-popup .caption h2,
.poptrox-popup .caption h3,
.poptrox-popup .caption h4,
.poptrox-popup .caption h5,
.poptrox-popup .caption h6 { margin: 0; font-weight: bold; color: #fff; }
.poptrox-popup .caption p { color: #ffffff; font-size: 15px; }
.poptrox-popup .caption .popup-caption-title {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.poptrox-popup .caption .popup-caption-meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.poptrox-popup .caption .popup-caption-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.poptrox-popup .loader {
  -moz-animation: snapic-spin 1s infinite linear !important;
  -webkit-animation: snapic-spin 1s infinite linear !important;
  -ms-animation: snapic-spin 1s infinite linear !important;
  animation: snapic-spin 1s infinite linear !important;
  background-image: url("images/spinner.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  font-size: 2em;
  height: 2em;
  left: 50%;
  line-height: 2em;
  margin: -1em 0 0 -1em;
  opacity: 0.25;
  position: absolute;
  text-align: center;
  top: 50%;
  width: 2em;
}
@keyframes snapic-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.poptrox-popup:hover .closer,
.poptrox-popup:hover .nav-previous,
.poptrox-popup:hover .nav-next { opacity: 0.5; }
.poptrox-popup:hover .closer:hover,
.poptrox-popup:hover .nav-previous:hover,
.poptrox-popup:hover .nav-next:hover { opacity: 1.0; }
.poptrox-popup.loading:before { opacity: 0; }
body.touch .poptrox-popup .closer,
body.touch .poptrox-popup .nav-previous,
body.touch .poptrox-popup .nav-next { opacity: 1.0 !important; }

/* 多图导航点：仅在灯箱内显示 */
.breadcrumb-nav { display: none; }
.poptrox-popup .breadcrumb-nav { display: flex; gap: 10px; justify-content: center; order: 999; margin-top: 10px; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.5); cursor: pointer; transition: all 0.3s ease; }
.nav-dot:hover { background-color: rgba(255, 255, 255, 0.8); transform: scale(1.2); }
.nav-dot.active { background-color: #fff; transform: scale(1.2); }

.poptrox-popup .pic img { transition: opacity 0.3s ease-in-out; }

@media screen and (max-width: 736px) {
  .poptrox-popup { border-radius: 0; margin-bottom: 0; }
  .poptrox-popup .pic { width: 100%; max-width: 100vw; }
  /* 首图（未被包进滑动轨道前）不能用 width:100%——弹窗开图时先缩到 150px 再量尺寸，
     width:100% 会量出错误尺寸导致"点开先小、翻页才大"。改 auto 按图片真实尺寸量。 */
  .poptrox-popup .pic > img { width: auto; max-width: 100%; }
  .poptrox-popup .pic-swipe-slide img { width: 100%; max-width: 100vw; max-height: 100vh; object-fit: contain; }
  .poptrox-popup .pic-swipe-wrapper,
  .poptrox-popup .pic-swipe-track,
  .poptrox-popup .pic-swipe-slide { width: 100%; }
  .poptrox-popup .pic-swipe-wrapper { touch-action: none; }
  .poptrox-popup:before { display: none; }

  /* 移动端：文字回左下角，无遮罩背景，字体缩小，不挡图 */
  .poptrox-popup .caption {
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    text-align: left;
    align-items: flex-start;
    padding: 28px 14px 12px;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    gap: 3px;
  }
  .poptrox-popup .caption .popup-caption-title {
    font-size: 13px;
    line-height: 1.35;
  }
  .poptrox-popup .caption .popup-caption-meta {
    font-size: 10px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.66);
  }
  .poptrox-popup .caption .popup-caption-text {
    font-size: 11px;
    line-height: 1.45;
    -webkit-line-clamp: 1;
  }

  /* 移动端：关闭 / 翻页图标缩小，便于触屏查看 */
  .poptrox-popup .closer {
    width: 2.6em; height: 2.6em;
    background-size: 1.7em;
    top: 8px; right: 8px;
  }
  .poptrox-popup .nav-previous,
  .poptrox-popup .nav-next {
    width: 3em; height: 4em;
    margin-top: -2em;
    background-size: 2.4em;
  }
}

html.js-fade-enabled .gallery-overlay .gallery-stage img {
    opacity: 0; transition: opacity .22s ease;
}
html.js-fade-enabled .gallery-overlay .gallery-stage img.is-loaded { opacity: 1; }

/* 入场淡入：默认可见；仅当 JS 成功执行（加 .reveal-armed）后才隐藏，
   并有 2.5s 兜底强制显示，避免 JS 失效导致卡片永久空白（吸取 v7/v9 教训） */
.grid-item.reveal-armed {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .25, 1);
    will-change: opacity, transform;
}
.grid-item.reveal-armed.is-in { opacity: 1; transform: none; }

/* =============================================
   暗色模式
   ============================================= */
html[data-theme="dark"] {
    --bg: #16161a;
    --card-bg: #1f1f24;
    --text-1: #f0f0f3;
    --text-2: #9a9aa2;
    --card-shadow: 0 2px 12px rgba(0,0,0,.45);
    --card-shadow-hover: 0 10px 28px rgba(0,0,0,.6);
}
html[data-theme="dark"] body.snapic-body { background: var(--bg); color: var(--text-1); }
html[data-theme="dark"] .snapic-topbar {
    background: rgba(22, 22, 26, .82);
    border-bottom-color: rgba(255,255,255,.06);
}
html[data-theme="dark"] .snapic-topbar .topbar-panel {
    background: #26262c;
    box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
}
html[data-theme="dark"] .snapic-topbar .topbar-icon-btn { background: rgba(255,255,255,.08); color: #fff; }
html[data-theme="dark"] .snapic-topbar .topbar-icon-btn:hover { background: rgba(255,255,255,.15); }
html[data-theme="dark"] .snapic-topbar .topbar-icon-btn[aria-expanded="true"] { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .snapic-topbar .nav-panel .site-nav-item { color: #e6e6ec; }
html[data-theme="dark"] .snapic-topbar .nav-panel .site-nav-item:hover { background: rgba(255,255,255,.1); }
html[data-theme="dark"] .snapic-topbar .nav-panel .site-nav-item.active { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .snapic-topbar .site-nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
html[data-theme="dark"] .snapic-topbar .site-nav-item.active { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .snapic-topbar .site-nav-item.active:hover { background: #fff; color: #1c1c1e; }
html[data-theme="dark"] .site-search input {
    background: #26262c; border-color: #35353c; color: var(--text-1);
}
html[data-theme="dark"] .site-search input::placeholder { color: #6b6b72; }
html[data-theme="dark"] .site-search input:focus { border-color: #555; }
html[data-theme="dark"] .site-search button { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .site-search button:hover { background: #fff; }
html[data-theme="dark"] .grid-item { background: var(--card-bg); }
html[data-theme="dark"] .post-cover { background: #26262c; }
html[data-theme="dark"] .no-cover {
    background: linear-gradient(135deg, #26262c 0%, #1f1f24 100%);
    color: #6b6b72;
}
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination span {
    background: var(--card-bg); color: var(--text-1);
}
html[data-theme="dark"] .pagination a:hover { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .snapic-footer { color: var(--text-2); }
html[data-theme="dark"] .snapic-footer .theme-info { color: #6b6b72; }
html[data-theme="dark"] .snapic-post {
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
html[data-theme="dark"] .snapic-post .post-hero { background: #26262c; }
html[data-theme="dark"] .snapic-post .post-header { border-bottom-color: rgba(255,255,255,.07); }
html[data-theme="dark"] .snapic-post .post-content { color: #d6d6dc; }
html[data-theme="dark"] .snapic-post .post-content a {
    color: #6db3ff; border-bottom-color: rgba(109,179,255,.3);
}
html[data-theme="dark"] .snapic-post .post-content a:hover { border-bottom-color: #6db3ff; }
html[data-theme="dark"] .snapic-post .post-content blockquote {
    background: #26262c; border-left-color: #45454d; color: #b6b6bd;
}
html[data-theme="dark"] .snapic-post .post-content pre { background: #26262c; color: #d6d6dc; }
html[data-theme="dark"] .snapic-post .post-content code { background: #2a2a30; color: #e6e6ec; }
html[data-theme="dark"] .snapic-post .post-content pre code { background: none; }
html[data-theme="dark"] .post-nav-prev a,
html[data-theme="dark"] .post-nav-next a {
    background: var(--card-bg); color: var(--text-1);
}
html[data-theme="dark"] .post-nav-prev a:hover,
html[data-theme="dark"] .post-nav-next a:hover {
    background: #f0f0f3; color: #1c1c1e;
}
html[data-theme="dark"] .post-nav-prev a:hover::before,
html[data-theme="dark"] .post-nav-next a:hover::after { color: #1c1c1e; }
html[data-theme="dark"] .post-nav .nav-empty {
    background: transparent; border-color: #35353c; color: #6b6b72;
}
html[data-theme="dark"] .post-nav-home a { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .post-nav-home a:hover { background: #fff; }
html[data-theme="dark"] .archive-type { background: rgba(255,255,255,.08); color: #b6b6bd; }
html[data-theme="dark"] .empty-state { color: var(--text-2); }
html[data-theme="dark"] .btn-primary { background: #f0f0f3; color: #1c1c1e; }
html[data-theme="dark"] .btn-primary:hover { background: #fff; }
html[data-theme="dark"] .error-code {
    background: linear-gradient(135deg, #f0f0f3 0%, #6b6b70 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
html[data-theme="dark"] .grid-item.ad-block {
    background: #1f1f24; border-color: #35353c; color: var(--text-2);
}
html[data-theme="dark"] .snapic-toc { background: #1f1f24; border-color: #2b2b31; }
html[data-theme="dark"] .snapic-toc .toc-item a { color: var(--text-1); }
html[data-theme="dark"] .snapic-toc .toc-item.toc-h3 a { color: var(--text-2); }
html[data-theme="dark"] .snapic-toc .toc-item a:hover { color: #6db3ff; }
html[data-theme="dark"] .snapic-toc .toc-item a:hover::before { color: #6db3ff; }

/* =============================================
   响应式
   ============================================= */
@media (max-width: 1200px) {
    .grid { column-count: 3; }
}
@media (max-width: 820px) {
    .grid { column-count: 2; column-gap: 10px; padding: 16px 12px 0; }
    .grid-item { margin-bottom: 10px; border-radius: var(--card-radius); }
    .snapic-topbar { padding: 12px 16px; }
    .site-search input { width: 140px; }
}
@media (max-width: 640px) {
    .snapic-topbar { padding: 10px 12px; }
    .snapic-topbar .site-title {
        font-size: 16px; max-width: 40vw;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .snapic-topbar .topbar-right { gap: 6px; }
    .snapic-topbar .topbar-icon-btn { width: 32px; height: 32px; }
    .snapic-topbar .topbar-panel { right: 12px; left: 12px; min-width: 0; }
    .snapic-topbar .search-panel .site-search { width: 100%; }
    .site-search input {
        width: 100px; padding: 5px 10px;
        font-size: 12px; border-radius: 20px;
    }
    .site-search button {
        padding: 5px 10px; font-size: 12px; border-radius: 20px;
    }
    .theme-toggle { width: 32px; height: 32px; }

    .grid { column-count: 2; column-gap: 10px; padding: 12px 10px 0; }
    /* 移动端与桌面同款排版：白底卡片 + 微圆角 + 底部摘要 */
    .grid-item {
        margin-bottom: 10px;
        background: var(--card-bg);
        border-radius: var(--card-radius);
        overflow: hidden;
        box-shadow: 0 1px 6px rgba(0,0,0,.06);
    }
    .grid-item:hover { box-shadow: 0 1px 6px rgba(0,0,0,.06); }
    .post-cover { overflow: hidden; background: #ececef; }
    .grid-item:hover .post-cover img { transform: none; }
    .post-body { padding: 8px 10px 10px; }
    .post-excerpt {
        font-size: 12px; line-height: 1.55;
        -webkit-line-clamp: 3;
    }
    .img-count { top: 6px; left: 6px; padding: 2px 7px; font-size: 10px; border-radius: 12px; }
    .grid-item.ad-block { min-height: 140px; padding: 16px; font-size: 12px; border-radius: 8px; }

    .archive-header { padding: 24px 16px 12px; }
    .archive-title { font-size: 1.3rem; }
    .error-page { margin: 48px auto 80px; }
    .snapic-post { padding: 0; margin: 12px auto; border-radius: 12px; }
    .snapic-post .post-inner { padding: 24px 18px; }
    .snapic-post .post-hero { aspect-ratio: 4 / 3; }
    .snapic-post .post-title { font-size: 20px; }

    .post-nav { padding: 0 12px; gap: 8px; margin-bottom: 24px; }
    .post-nav-prev a,
    .post-nav-next a,
    .post-nav .nav-empty { height: 40px; line-height: 40px; font-size: 12px; }
    .post-nav-prev a { padding-left: 34px; }
    .post-nav-prev a::before { left: 12px; font-size: 13px; }
    .post-nav-next a { padding-right: 34px; }
    .post-nav-next a::after { right: 12px; font-size: 13px; }
    .post-nav-home a { width: 40px; height: 40px; }
    .post-nav-home a svg { width: 16px; height: 16px; }

    .back-to-top { right: 12px; bottom: 12px; width: 36px; height: 36px; }

    .gallery-overlay .gallery-prev,
    .gallery-overlay .gallery-next { width: 42px; height: 42px; font-size: 26px; }
    .gallery-overlay .gallery-prev { left: 8px; }
    .gallery-overlay .gallery-next { right: 8px; }
    .gallery-overlay .gallery-close {
        top: 12px; right: 12px; width: 36px; height: 36px; font-size: 20px;
    }
    .gallery-overlay .gallery-counter { top: 16px; font-size: 12px; }

    .snapic-toc { padding: 12px 14px; margin-bottom: 20px; }
    .snapic-toc .toc-list { grid-template-columns: 1fr; }
    .snapic-toc .toc-item.toc-h3 a { padding-left: 12px; }
}
@media (max-width: 360px) {
    .site-search input { width: 60px; padding: 4px 8px; font-size: 11px; }
    .site-search button { padding: 4px 8px; font-size: 11px; }
    .snapic-topbar .site-title { font-size: 14px; max-width: 34vw; }
    .grid { column-gap: 6px; padding: 10px 6px 0; }
    .grid-item { margin-bottom: 6px; }
}

/* =============================================
   Phase 8: 相册风格文章页（独立访问 URL）
   ============================================= */
body.has-photo-post .snapic-topbar {
    background: rgba(10, 10, 10, .65);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom-color: rgba(255,255,255,.06);
}
body.has-photo-post .snapic-topbar .site-title { color: #fff; }
body.has-photo-post .snapic-topbar .topbar-icon-btn { background: rgba(255,255,255,.12); color: #fff; }
body.has-photo-post .snapic-topbar .topbar-icon-btn:hover { background: rgba(255,255,255,.2); }
body.has-photo-post .snapic-topbar .topbar-icon-btn[aria-expanded="true"] { background: rgba(255,255,255,.92); color: #1c1c1e; }
body.has-photo-post .snapic-topbar .topbar-panel { background: rgba(20,20,24,.92); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
body.has-photo-post .snapic-topbar .nav-panel .site-nav-item { color: rgba(255,255,255,.85); }
body.has-photo-post .snapic-topbar .nav-panel .site-nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
body.has-photo-post .snapic-topbar .nav-panel .site-nav-item.active { background: rgba(255,255,255,.92); color: #1c1c1e; }
body.has-photo-post .site-search input {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.15);
    color: #fff;
}
body.has-photo-post .site-search input::placeholder { color: rgba(255,255,255,.5); }
body.has-photo-post .site-search input:focus { border-color: rgba(255,255,255,.3); }
body.has-photo-post .site-search button {
    background: rgba(255,255,255,.92);
    color: #1c1c1e;
}
body.has-photo-post .theme-toggle {
    background: rgba(255,255,255,.1);
    color: #fff;
}
body.has-photo-post .theme-toggle:hover { background: rgba(255,255,255,.2); }

.photo-post { background: #0a0a0a; color: #fff; }
/* 相册模式整页保持深色，避免任何白色露出 */
body.has-photo-post,
body.has-photo-post .snapic-main { background: #0a0a0a; }

.photo-slide {
    position: relative;
    width: 100%;
    height: calc(100vh - 60px);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    box-sizing: border-box;
    background: #0a0a0a;
    overflow: hidden;
}

.photo-slide-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
    max-width: 100%;
    max-height: 100%;
}

.photo-slide-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 124px);
    object-fit: contain;
    cursor: zoom-in;
    -webkit-user-drag: none;
    user-select: none;
    transition: opacity .6s ease;
}
html.js-fade-enabled .photo-slide-img { opacity: 0; }
html.js-fade-enabled .photo-slide-img.is-loaded { opacity: 1; }

.photo-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 80px 40px 32px;
    background: linear-gradient(180deg,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,.4) 35%,
        rgba(0,0,0,.85) 100%);
    color: #fff;
    z-index: 2;
    line-height: 1.6;
    text-align: left;
    pointer-events: none;
}
.photo-info > * { pointer-events: auto; }

.photo-title {
    font-size: 1.45rem; font-weight: 600; line-height: 1.4;
    margin: 0 0 10px; padding: 0; color: #fff; letter-spacing: .3px;
    text-shadow: 0 2px 10px rgba(0,0,0,.5);
    display: block; -webkit-line-clamp: unset;
}
.photo-desc {
    font-size: 13.5px; line-height: 1.7;
    color: rgba(255,255,255,.88);
    margin: 0 0 14px; max-width: 640px;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.photo-meta {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; color: rgba(255,255,255,.78);
    flex-wrap: wrap;
}
.photo-date { letter-spacing: .5px; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.photo-cat {
    display: inline-block; padding: 3px 12px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 20px; font-size: 11px; color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    letter-spacing: .3px; line-height: 1.4;
}

.photo-text { background: #0a0a0a; padding: 40px 20px 60px; color: #fff; }
.photo-text-inner {
    max-width: 720px; margin: 0 auto;
    font-size: 15px; line-height: 1.85; color: rgba(255,255,255,.85);
}
.photo-text .post-content p { margin: 0 0 20px; }
.photo-text .post-content a { color: #6db3ff; border-bottom: 1px solid rgba(109,179,255,.3); }
.photo-text .post-content h2,
.photo-text .post-content h3 { color: #fff; margin: 32px 0 16px; }

/* 相册模式是全黑沉浸式，底部不能再渐变回浅色（否则露出白条） */
.photo-post::after {
    content: ""; display: block; height: 40px;
    background: #0a0a0a;
}
body.has-photo-post .post-nav { background: #0a0a0a; padding-top: 24px; }

@media (min-width: 1024px) {
    .photo-title { font-size: 1.65rem; }
    .photo-info { padding: 100px 48px 38px; }
}
@media (max-width: 640px) {
    .photo-slide { height: calc(100vh - 52px); min-height: 360px; padding: 12px; }
    .photo-slide-wrap { border-radius: 8px; }
    .photo-slide-img { max-height: calc(100vh - 76px); }
    .photo-info { padding: 70px 20px 24px; }
    .photo-title { font-size: 1.15rem; }
    .photo-desc { font-size: 12px; -webkit-line-clamp: 3; }
    .photo-meta { font-size: 11px; }
    .photo-text { padding: 32px 18px 48px; }
}

/* =============================================
   Phase 9: 弹层式文章浏览（深色沉浸 + 图片最大化）
   ============================================= */
.post-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    /* 深色背景 + 强模糊，底层首页只留一点点影子 */
    background: rgba(0, 0, 0, .94);
    backdrop-filter: blur(60px) saturate(180%);
    -webkit-backdrop-filter: blur(60px) saturate(180%);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    animation: overlayFadeIn .35s cubic-bezier(.32, .72, .36, 1);
    will-change: opacity;
}
.post-overlay.is-closing {
    animation: overlayFadeOut .28s cubic-bezier(.32, .72, .36, 1) forwards;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlayFadeOut { from { opacity: 1; } to { opacity: 0; } }

.post-overlay-inner {
    min-height: 100vh;
    animation: overlayContentIn .55s cubic-bezier(.32, .72, .36, 1);
    will-change: transform, opacity;
}
.post-overlay.is-closing .post-overlay-inner {
    animation: overlayContentOut .3s cubic-bezier(.32, .72, .36, 1) forwards;
}
@keyframes overlayContentIn {
    0%   { transform: scale(.9) translateY(40px); opacity: 0; }
    60%  { transform: scale(1.012) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes overlayContentOut {
    from { transform: scale(1) translateY(0); opacity: 1; }
    to   { transform: scale(.96) translateY(12px); opacity: 0; }
}

/* 弹层内相册：全部透明，让深色弹层露出来 */
.post-overlay .photo-post,
.post-overlay .photo-slide,
.post-overlay .photo-text {
    background: transparent !important;
}
.post-overlay .photo-post::after { display: none; }
.post-overlay .post-nav { background: transparent !important; }

/* 每张图占一屏 */
.post-overlay .photo-slide {
    height: 100vh;
    min-height: 100vh;
    padding: 50px 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片包裹层：尺寸精确等于图片 */
.post-overlay .photo-slide-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .75);
    max-width: 100%;
    max-height: 100%;
}

/* 图片：撑满视口 */
.post-overlay .photo-slide-img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 120px);
    max-height: calc(100vh - 100px);
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

/* 文字叠加在图片底部 */
.post-overlay .photo-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 100px 44px 36px;
    background: linear-gradient(180deg,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,.5) 40%,
        rgba(0,0,0,.88) 100%);
    color: #fff;
    z-index: 2;
    pointer-events: none;
}
.post-overlay .photo-info > * { pointer-events: auto; }

/* 弹层内长文本区 */
.post-overlay .photo-text {
    padding: 40px 24px 80px;
    background: rgba(0,0,0,.5) !important;
}
.post-overlay .photo-text-inner {
    max-width: 720px;
    margin: 0 auto;
    color: rgba(255,255,255,.85);
}
.post-overlay .photo-text .post-content h2,
.post-overlay .photo-text .post-content h3 { color: #fff; }

/* 弹层内博客模式（无图文章） */
.post-overlay .snapic-post {
    background: rgba(28, 28, 32, .85);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    max-width: 780px;
    margin: 40px auto;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
    color: #f0f0f3;
}
.post-overlay .snapic-post .post-header { border-bottom-color: rgba(255,255,255,.08); }
.post-overlay .snapic-post .post-title { color: #fff; }
.post-overlay .snapic-post .post-meta { color: rgba(255,255,255,.7); }
.post-overlay .snapic-post .post-content { color: #d6d6dc; }
.post-overlay .snapic-post .post-content a { color: #6db3ff; }
.post-overlay .snapic-post .post-content blockquote {
    background: rgba(255,255,255,.05);
    border-left-color: rgba(255,255,255,.2);
    color: rgba(255,255,255,.75);
}
.post-overlay .snapic-post .post-content pre { background: rgba(255,255,255,.06); color: #e6e6ec; }
.post-overlay .snapic-post .post-content code { background: rgba(255,255,255,.1); color: #fff; }
.post-overlay .snapic-post .post-content pre code { background: none; }

/* 关闭按钮 */
.post-overlay-close {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9010;
    width: 44px; height: 44px;
    padding: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, .2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
    transition: background .25s ease, transform .3s ease;
    animation: closeBtnIn .5s cubic-bezier(.32, .72, .36, 1) .1s both;
}
.post-overlay.is-closing .post-overlay-close { animation: closeBtnOut .2s ease forwards; }
.post-overlay-close:hover {
    background: rgba(255, 255, 255, .28);
    transform: rotate(90deg) scale(1.06);
}
.post-overlay-close:active { transform: rotate(90deg) scale(.94); }
.post-overlay-close svg { display: block; }

@keyframes closeBtnIn {
    from { opacity: 0; transform: scale(.6) rotate(-45deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes closeBtnOut {
    from { opacity: 1; transform: scale(1) rotate(0); }
    to   { opacity: 0; transform: scale(.85) rotate(-45deg); }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    .post-overlay,
    .post-overlay-inner,
    .post-overlay-close,
    .post-overlay.is-closing,
    .post-overlay.is-closing .post-overlay-inner,
    .post-overlay.is-closing .post-overlay-close {
        animation-duration: .01ms !important;
    }
}

/* 移动端 */
@media (max-width: 640px) {
    .post-overlay-close { top: 12px; right: 12px; width: 38px; height: 38px; }
    .post-overlay .photo-slide { padding: 40px 12px; }
    .post-overlay .photo-slide-img {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 80px);
    }
    .post-overlay .photo-slide-wrap { border-radius: 6px; }
    .post-overlay .photo-info { padding: 70px 20px 24px; }
    .post-overlay .snapic-post { margin: 0; border-radius: 0; }
}
/* =============================================
   Phase 9.1: 相册模式去掉底部导航和页脚
   ============================================= */
body.has-photo-post .post-nav,
body.has-photo-post .snapic-footer {
    display: none !important;
}

/* 相册模式下的回到顶部按钮（保留，可滚到顶） */
body.has-photo-post .back-to-top {
    z-index: 60;
}