/* TisMF · 全站样式
   配色全部走 CSS 变量（rgb 三元组 + 斜杠透明度），两套：
     默认（无 data-theme）= 黑夜：#121212 底 / #e8e8e8 字 / 低饱和冷蓝点缀
     data-theme="light"  = 白天：暖白纸感底 / 深炭字 / 更深一点的冷蓝
   圆角：卡片 4px，图片容器 0，文字按钮无圆角；不加阴影 */

:root {
    color-scheme: dark;          /* 告诉浏览器本站自带深色配色，尽量减少强制反色 */
    /* 黑夜 */
    --c-bg:        18 18 18;      /* #121212 页面底 */
    --c-surface:   26 26 26;      /* #1a1a1a 卡片面 */
    --c-elev:      34 34 34;      /* #222   再高一层的面 */
    --c-ink:      232 232 232;    /* #e8e8e8 主文字 */
    --c-ink-2:    207 207 207;    /* #cfcfcf 正文 */
    --c-sub:      154 154 154;    /* #9a9a9a 次要文字 */
    --c-mute:     138 138 138;    /* #8a8a8a 弱文字 */
    --c-dim:       90 90 90;      /* #5a5a5a 最弱信息 */
    --c-accent:   107 138 173;    /* #6b8aad 点缀 */
    --c-line:     255 255 255;    /* 描边基色：黑夜里是白线（配透明度用） */
    --c-veil:       0   0   0;    /* 图片遮罩基色：黑夜里压黑 */
    --c-on-accent: 18  18  18;    /* 实心点缀块上的字 */
    --c-hero-lift: 0.55;          /* Hero 图片亮度（夜里压暗） */
}

[data-theme="light"] {
    color-scheme: light;
    /* 白天 */
    --c-bg:       246 245 242;    /* 暖白纸感 */
    --c-surface:  255 255 255;    /* 纯白卡片 */
    --c-elev:     238 237 233;
    --c-ink:       26  26  24;
    --c-ink-2:     51  51  48;
    --c-sub:      110 108 102;
    --c-mute:     132 130 124;
    --c-dim:      166 164 158;
    --c-accent:    74 104 138;    /* 白底上更深的冷蓝，保证对比度 */
    --c-line:      20  20  18;    /* 白天描边反过来用黑线 */
    --c-veil:     255 255 255;    /* 图片遮罩改成压白 */
    --c-on-accent:255 255 255;
    --c-hero-lift: 1;             /* 白天把首屏图提亮 */
}

/* 切换主题时的短过渡（theme.js 会临时挂上、0.38s 后摘掉） */
html.theme-anim,
html.theme-anim body,
html.theme-anim body > header,
html.theme-anim #content-wrap,
html.theme-anim footer,
html.theme-anim .gallery-cell,
html.theme-anim .album-folder,
html.theme-anim .essay-folder,
html.theme-anim .dl-folder,
html.theme-anim .dl-folder-bg {
    transition: background-color 350ms ease, color 350ms ease, border-color 350ms ease;
}

html { scroll-behavior: auto; } /* 首页滚动由 JS 缓动接管 */

html, body { background-color: rgb(var(--c-bg)); }

body {
    background-color: rgb(var(--c-bg));
    color: rgb(var(--c-ink));
    -webkit-font-smoothing: antialiased;
}

img { object-fit: cover; }

/* ====== 导航栏：始终 fixed top-0，样式随状态切换 ======
   边框必须常驻 1px solid transparent，只过渡 border-color；
   backdrop-filter 直接切换，不进 transition（none↔blur 过渡会出边缘伪影）*/
body > header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background-color: transparent;
    border-bottom: 1px solid transparent;
    backdrop-filter: none;
    transform: translateY(-100%);
    transition:
        transform 0.5s ease-out,
        background-color 0.5s ease-out,
        border-color 0.5s ease-out;
}
body.nav-home > header {
    transform: translateY(0);
    background-color: transparent;
    border-bottom-color: transparent;
    backdrop-filter: none;
}
body > header.banner {
    transform: translateY(0);
    background-color: rgb(var(--c-bg) / 0.9);
    border-bottom-color: rgb(var(--c-line) / 0.05);
    backdrop-filter: blur(8px);
}

/* ====== Hero 轮播（仅首页） ====== */
.hero-slides { position: absolute; inset: 0; }
.hero-slides img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 1.4s ease;
}
.hero-slides img.active { opacity: 1; }

/* 指示器 */
.hero-dots {
    position: absolute;
    bottom: 28px; right: 32px;
    display: flex; gap: 8px;
    z-index: 10;
}
.hero-dots button {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgb(var(--c-line) / 0.2);
    border: none; cursor: pointer; padding: 0;
    transition: background 0.3s;
}
.hero-dots button.active { background: rgb(var(--c-line) / 0.6); }

/* 手机端：右下角有主题切换悬浮按钮，把圆点挪到左下角避开 */
@media (max-width: 767px) {
    .hero-dots { left: 24px; right: auto; bottom: 26px; }
}

/* Hero 外层渐入 */
#hero-text {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 1.2s ease-out, transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}
#hero-text.is-visible { opacity: 1; transform: translateY(0); }

/* Hero 文案切换（状态B：淡出 0.5s → 换字 → 淡入 0.5s） */
#hero-copy { transition: opacity 0.5s ease; }
#hero-copy.fade-out { opacity: 0; }
#hero-subtitle { white-space: pre-line; }

/* 「开始探索」按钮 */
#enter-btn {
    transition:
        opacity 0.4s ease,
        background-color 200ms ease-out,
        border-color     200ms ease-out,
        color            200ms ease-out;
}
#enter-btn:hover {
    background-color: rgb(var(--c-line) / 0.12);
    border-color:     rgb(var(--c-line) / 0.7);
    color:            rgb(var(--c-line) / 0.95);
}
#enter-btn.fade-out { opacity: 0; pointer-events: none; }
#enter-btn.gone { display: none; }


/* 图片水印已改为后端烧进图片像素（tisf/image_utils.py 的平铺水印），
   这里不再用 CSS 叠加，避免出现"两层水印"且 CSS 层可被右键保存绕过。 */


/* ====== 内页通用 ====== */
/* 内页顶部要给 fixed 导航让位 */
.page-wrap {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 7rem 1.5rem 5rem;
}

/* 文章正文排版：克制、行距偏松 */
.prose-ink {
    font-size: 0.95rem;
    line-height: 2;
    color: rgb(var(--c-ink-2));
}
.prose-ink p { margin: 0 0 1.4em; }
.prose-ink h2, .prose-ink h3 {
    color: rgb(var(--c-ink));
    font-weight: 400;
    letter-spacing: 0.03em;
    margin: 2em 0 0.8em;
}
.prose-ink img { width: 100%; margin: 1.6em 0; }
.prose-ink blockquote {
    border-left: 2px solid rgb(var(--c-accent));
    padding-left: 1em;
    color: rgb(var(--c-sub));
    margin: 1.6em 0;
}

/* 图库大图查看 */
.gallery-cell {
    display: block;
    overflow: hidden;
    background: rgb(var(--c-surface));
}
.gallery-cell img { width: 100%; height: 100%; object-fit: cover; }

/* 多行省略（gallery.html 里用 line-clamp-2，Tailwind 3.3+ 才有，兜底） */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ====== 灯箱（左图右文 + 3D rotateY 转动切换） ====== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox.hidden { display: none; }

/* 遮罩 */
.lightbox-overlay {
    position: absolute; inset: 0;
    background: rgb(var(--c-veil) / 0.92);
    opacity: 0;
    transition: opacity 300ms ease-out;
}
.lightbox.is-open .lightbox-overlay { opacity: 1; }
.lightbox.is-closing .lightbox-overlay { opacity: 0; transition: opacity 250ms ease-in; }

/* 内部容器：左图右文（桌面）；窄屏上下堆叠 */
.lightbox-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    gap: 2.5rem;
    max-width: min(1100px, 92vw);
    max-height: 82vh;
    align-items: center;
}
@media (max-width: 720px) {
    .lightbox-inner {
        flex-direction: column;
        gap: 1.25rem;
        max-height: 90vh;
        max-width: 94vw;
    }
}

/* 图片舞台：建 3D 空间，perspective 让 rotateY 有透视感 */
.lightbox-stage {
    position: relative;
    perspective: 900px;
    perspective-origin: center center;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
@media (max-width: 720px) {
    .lightbox-stage { width: 100%; }
}

.lightbox-img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 0;
    backface-visibility: hidden;
    opacity: 0;
    /* 初始：根据切换方向决定 rotateY 起始值（由 JS 用内联 style 控制）
       这里给一个默认起始，打开时会被 is-open 覆盖到 rotateY(0) */
    transform: rotateY(45deg);
    transition:
        opacity 500ms ease-out,
        transform 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@media (max-width: 720px) {
    .lightbox-img { max-height: 55vh; }
}

/* 打开 */
.lightbox.is-open .lightbox-img {
    opacity: 1;
    transform: rotateY(0);
}
/* 关闭（原地淡出，不做翻转反向） */
.lightbox.is-closing .lightbox-img {
    opacity: 0;
    transform: rotateY(0);
    transition: opacity 250ms ease-in, transform 250ms ease-in;
}

/* 右侧说明（现在改 aside，单独一列） */
.lightbox-caption {
    flex: 0 0 240px;
    text-align: left;
    color: rgb(var(--c-ink));
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}
@media (max-width: 720px) {
    .lightbox-caption {
        flex: none;
        width: 100%;
        text-align: center;
        gap: 0.25rem;
    }
}
.lightbox-group {
    color: rgb(var(--c-accent));
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.lightbox-title {
    color: rgb(var(--c-ink));
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    font-weight: 400;
}
.lightbox-desc {
    color: rgb(var(--c-mute));
    font-size: 0.75rem;
    line-height: 1.8;
    margin-top: 0.5rem;
    max-height: 18rem;
    overflow-y: auto;
}
.lightbox-counter {
    margin-top: 1rem;
    color: rgb(var(--c-dim));
    font-size: 0.65rem;
    letter-spacing: 0.1em;
}

/* 关闭按钮：右上角细线 X */
.lightbox-close {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    z-index: 3;
    width: 2.25rem; height: 2.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
}
.lightbox-close span {
    position: absolute;
    width: 1.25rem; height: 1px;
    background: rgb(var(--c-line) / 0.6);
    transition: background 200ms;
}
.lightbox-close span:first-child { transform: rotate(45deg); }
.lightbox-close span:last-child  { transform: rotate(-45deg); }
.lightbox-close:hover span { background: rgb(var(--c-line)); }

/* 左右箭头（比之前更靠边） */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 2.75rem; height: 2.75rem;
    background: transparent;
    border: none;
    color: rgb(var(--c-line) / 0.5);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: color 200ms;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
@media (max-width: 720px) {
    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }
}
.lightbox-prev:hover,
.lightbox-next:hover { color: rgb(var(--c-line)); }


/* ====== 图库：文件夹卡 ====== */
.album-folder {
    position: relative;
    aspect-ratio: 4 / 3;
    width: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    background: rgb(var(--c-surface));
    border-radius: 0;
    text-align: left;
    transition: opacity 200ms ease-out;
    touch-action: manipulation;
}
.album-folder:hover { opacity: 0.92; }        /* 唯一允许的 hover 效果 */
.album-folder.is-open { opacity: 1; outline: none; }
a.album-folder { display: block; text-decoration: none; color: inherit; }

.album-folder-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity 300ms;
    pointer-events: none;
}
.album-folder-empty {
    position: absolute; inset: 0;
    background: rgb(var(--c-elev));
    pointer-events: none;
}

/* 渐变遮罩（让底部文字可读） */
.album-folder-mask {
    position: absolute; inset: 0;
    background: linear-gradient(
        to top,
        rgb(var(--c-veil) / 0.85) 0%,
        rgb(var(--c-veil) / 0.25) 50%,
        rgb(var(--c-veil) / 0) 100%
    );
    pointer-events: none;
}

.album-folder-body {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 2;
    pointer-events: none;
}

.album-folder-name {
    color: rgb(var(--c-ink));
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    font-weight: 400;
}
.album-folder-desc {
    color: rgb(var(--c-sub));
    font-size: 0.7rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.album-folder-count {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    padding: 0.15rem 0.45rem;
    background: rgb(var(--c-bg) / 0.85);
    border: 1px solid rgb(var(--c-line) / 0.15);
    border-radius: 4px;                     /* 内容卡片统一 4px 圆角 */
    color: rgb(var(--c-line) / 0.7);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
}


/* ====== album-block 折叠过渡 ====== */
.album-block {
    max-height: 0;
    overflow: hidden;
    transition: max-height 360ms cubic-bezier(0.25, 0.1, 0.25, 1),
                padding 360ms cubic-bezier(0.25, 0.1, 0.25, 1),
                margin 360ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.album-block[data-collapsed="false"] {
    /* max-height 由 JS 内联 style 设置（scrollHeight 动态值），这里只负责 overflow 放开 */
    overflow: visible;
    margin: 1.5rem 0 3rem;
}


/* ====== 随笔：文件夹卡 ====== */
.essay-folder {
    position: relative;
    aspect-ratio: 4 / 3;
    width: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    background: rgb(var(--c-surface));
    border-radius: 0;
    text-align: left;
    transition: opacity 200ms ease-out;
}
.essay-folder:hover { opacity: 0.92; }
.essay-folder.is-open { opacity: 1; outline: none; }
a.essay-folder { display: block; text-decoration: none; color: inherit; }

.essay-folder-cover {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.85;
    pointer-events: none;
}
.essay-folder-empty {
    position: absolute; inset: 0;
    background: rgb(var(--c-elev));
    pointer-events: none;
}
.essay-folder-mask {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgb(var(--c-veil) / 0.85) 0%, rgb(var(--c-veil) / 0.25) 50%, rgb(var(--c-veil) / 0) 100%);
    pointer-events: none;
}
.essay-folder-body {
    position: absolute;
    left: 1rem; right: 1rem; bottom: 0.85rem;
    z-index: 2;
    pointer-events: none;
}
.essay-folder-name {
    color: rgb(var(--c-ink));
    font-size: 0.85rem;
    letter-spacing: 0.12em;
}
.essay-folder-desc {
    margin-top: 0.15rem;
    color: rgb(var(--c-sub));
    font-size: 0.7rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.essay-folder-count {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    z-index: 3;
    padding: 0.15rem 0.45rem;
    background: rgb(var(--c-bg) / 0.85);
    border: 1px solid rgb(var(--c-line) / 0.15);
    border-radius: 4px;
    color: rgb(var(--c-line) / 0.7);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
}

/* 没有封面的分类卡：不再保留 4:3 的空白图片区，改成紧凑文字卡 */
.essay-folder-plain {
    aspect-ratio: auto;
    min-height: 92px;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line) / 0.07);
}
.essay-folder-plain:hover {
    opacity: 1;
    border-color: rgb(var(--c-line) / 0.18);
}
.essay-folder-plain .essay-folder-body {
    position: static;
    padding: 1.15rem 1rem 1rem;
}


/* ====== essay-block 折叠过渡 ====== */
.essay-block {
    max-height: 0;
    overflow: hidden;
    transition: max-height 360ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.essay-block[data-collapsed="false"] {
    overflow: visible;
    margin: 1.5rem 0 3rem;
}


/* ====== zig-zag 交替文章行（左文右图 / 左图右文） ====== */
.essay-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgb(var(--c-line) / 0.06);
    text-decoration: none;
    color: inherit;
    transition: opacity 200ms;
}
.essay-row:hover { opacity: 0.85; }     /* 唯一允许的 hover 效果 */

/* 默认：左文右图（第一、三、五...） */
.essay-row-text {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.essay-row-img {
    flex: 1 1 50%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 0;
    background: rgb(var(--c-surface));
}
.essay-row-img img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.essay-row-img-empty {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(var(--c-dim));
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}

/* 交替：左图右文（第二、四、六...）—— 把 img 挪到左边 */
.essay-row.essay-row-alt { flex-direction: row-reverse; }

.essay-row-meta {
    color: rgb(var(--c-accent));
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}
.essay-row-title {
    color: rgb(var(--c-ink));
    font-size: 1.05rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.essay-row-summary {
    color: rgb(var(--c-mute));
    font-size: 0.8rem;
    line-height: 1.75;
    max-height: 5rem;
    overflow: hidden;
}
.essay-row-link {
    margin-top: 0.5rem;
    color: rgb(var(--c-line) / 0.35);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    align-self: flex-start;
}

/* 窄屏：堆叠成上图下文，不做 zig-zag */
@media (max-width: 640px) {
    .essay-row,
    .essay-row.essay-row-alt {
        flex-direction: column;
        gap: 1rem;
    }
    .essay-row-text,
    .essay-row-img { flex: none; width: 100%; }
}


/* ====== 下载：文件夹卡（不用封面图，用纯符号图标） ====== */
.dl-folder {
    position: relative;
    aspect-ratio: 4 / 3;
    width: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    background: rgb(var(--c-surface));
    border-radius: 0;
    text-align: left;
    transition: opacity 200ms ease-out;
}
.dl-folder:hover { opacity: 0.92; }
a.dl-folder { display: block; text-decoration: none; color: inherit; }

.dl-folder-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgb(var(--c-elev)) 0%, rgb(var(--c-surface)) 100%);
    pointer-events: none;
}
.dl-folder-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -60%);
    font-size: 3.2rem;
    color: rgb(var(--c-accent) / 0.35);
    font-weight: 300;
    pointer-events: none;
}
.dl-folder-count {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    padding: 0.15rem 0.45rem;
    background: rgb(var(--c-bg) / 0.85);
    border: 1px solid rgb(var(--c-line) / 0.15);
    border-radius: 4px;
    color: rgb(var(--c-line) / 0.7);
    font-size: 0.62rem;
    pointer-events: none;
    letter-spacing: 0.08em;
    z-index: 3;
}
.dl-folder-body {
    position: absolute;
    left: 1rem; right: 1rem; bottom: 0.85rem;
    z-index: 2;
    pointer-events: none;
}
.dl-folder-name {
    color: rgb(var(--c-ink));
    font-size: 0.85rem;
    letter-spacing: 0.12em;
}
.dl-folder-desc {
    margin-top: 0.15rem;
    color: rgb(var(--c-sub));
    font-size: 0.7rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* dl-block 折叠过渡（和 gallery/essay 同逻辑） */
.dl-block {
    max-height: 0;
    overflow: hidden;
    transition: max-height 360ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.dl-block[data-collapsed="false"] {
    overflow: visible;
    margin: 1.5rem 0 3rem;
}


/* ====== 下载项：点击标题行展开标注 ====== */
.dl-item {
    border-top: 1px solid rgb(var(--c-line) / 0.06);
    padding: 0.25rem 0;
}

.dl-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    padding: 1rem 0;
    cursor: pointer;
    color: inherit;
    text-align: left;
}
.dl-item-head:hover { opacity: 0.85; }

.dl-item-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}
.dl-item-name {
    color: rgb(var(--c-ink));
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}
.dl-item-platform {
    color: rgb(var(--c-accent));
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    padding: 0.1rem 0.4rem;
    border: 1px solid rgb(var(--c-accent) / 0.3);
    border-radius: 4px;
}
.dl-item-version {
    color: rgb(var(--c-dim));
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

/* 右侧小三角（展开/收起方向） */
.dl-item-caret {
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgb(var(--c-line) / 0.35);
    transition: transform 200ms ease-out;
    flex-shrink: 0;
    margin-left: 0.75rem;
}
.dl-item-head[aria-expanded="true"] .dl-item-caret {
    transform: rotate(180deg);
}

/* 展开内容：标注 + 按钮（默认 max-height:0 不可见） */
.dl-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 320ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.dl-item-body-inner {
    max-height: 1200px;   /* 足够容纳描述 + 按钮，JS 展开时会临时移除 */
}
.dl-item-desc {
    color: rgb(var(--c-mute));
    font-size: 0.78rem;
    line-height: 1.8;
    padding-bottom: 0.75rem;
}

.dl-item-btns {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

.dl-btn {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-decoration: none;
    border-radius: 4px;
    transition: opacity 200ms;
}
.dl-btn:hover { opacity: 0.85; }
.dl-btn-primary {
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
}
.dl-btn-ghost {
    background: transparent;
    color: rgb(var(--c-line) / 0.65);
    border: 1px solid rgb(var(--c-line) / 0.2);
}

@media (max-width: 640px) {
    .dl-item-btns { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .dl-btn { text-align: center; }
}


/* ====== 白天 / 黑夜：按钮图标 ======
   黑夜显示太阳（点一下变白天），白天显示月亮（点一下回黑夜） */
.theme-icon-sun  { display: block; }
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun  { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* 首屏大图：模板里用内联 style 写了后台设置的 brightness(默认 0.3)，
   白天必须提亮，否则深色照片压在白色遮罩上会糊成一团灰；用 !important 覆盖内联值 */
[data-theme="light"] .hero-slides img {
    filter: grayscale(1) brightness(var(--c-hero-lift)) contrast(1.02) !important;
}

/* 白天模式的首屏遮罩：照片本身是暗调，字一变深就看不见了，
   所以整屏压一层暖白雾（上薄下厚），让深色字能读、照片还留一点层次 */
[data-theme="light"] .hero-mask {
    background-image: linear-gradient(
        to bottom,
        rgb(var(--c-bg) / 0.74) 0%,
        rgb(var(--c-bg) / 0.82) 45%,
        rgb(var(--c-bg) / 0.94) 100%
    ) !important;
}

/* 手机端展开菜单时，首页透明导航要临时给一层底色，否则文字压在图上读不清。
   底色跟随当前主题（之前写死成深色，白天模式会整条发黑）。 */
header.menu-open {
    background-color: rgb(var(--c-bg) / 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color .25s ease;
}

/* ====== 进入动效（全站通用）======
   元素加 .rv 类即可；延迟用 style="--d:.12s"
   由 main.js 统一用 IntersectionObserver 触发，只播一次 */
@media (prefers-reduced-motion: no-preference) {

    .rv {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity .95s cubic-bezier(.22, .61, .36, 1) var(--d, 0s),
                    transform .95s cubic-bezier(.22, .61, .36, 1) var(--d, 0s);
    }
    .rv.in { opacity: 1; transform: none; }

    .rv-line {
        transform: scaleX(0);
        transform-origin: left center;
        transition: transform 1.1s cubic-bezier(.22, .61, .36, 1) var(--d, 0s);
    }
    .rv-line.in { transform: scaleX(1); }

    .rv-name {
        opacity: 0;
        letter-spacing: .52em;
        transition: opacity 1s ease var(--d, 0s),
                    letter-spacing 1.7s cubic-bezier(.16, .84, .44, 1) var(--d, 0s);
    }
    .rv-name.in { opacity: 1; letter-spacing: .3em; }

    .rv-portrait {
        opacity: 0;
        transform: scale(.955);
        transition: opacity 1.15s cubic-bezier(.22, .61, .36, 1) var(--d, 0s),
                    transform 1.35s cubic-bezier(.22, .61, .36, 1) var(--d, 0s);
    }
    .rv-portrait.in { opacity: 1; transform: none; }

    .rv-img {
        opacity: 0;
        transform: scale(1.015);
        transition: opacity 1s cubic-bezier(.22, .61, .36, 1) var(--d, 0s),
                    transform 1.4s cubic-bezier(.22, .61, .36, 1) var(--d, 0s);
    }
    .rv-img.in { opacity: 1; transform: none; }
}

/* 尊重系统减少动效设置：直接可见 */
@media (prefers-reduced-motion: reduce) {
    .rv, .rv-line, .rv-name, .rv-portrait, .rv-img {
        opacity: 1 !important;
        transform: none !important;
        letter-spacing: .3em !important;
    }
}

/* ================================================================
   手机端全屏导航（目录式）
   桌面端 >=768px 不渲染这些 DOM —— base.html 里 .md:hidden 已经隐藏了汉堡按钮
   所以下面所有规则都被 @media (max-width: 767px) 包裹
   ================================================================ */

/* 页脚隐形后台入口：外观保持普通署名，不显示手型光标 */
.admin-entry {
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}
.admin-entry:active { opacity: .72; }

/* 桌面端绝不显示手机菜单：即使 Tailwind 未加载也不能漏出来 */
@media (min-width: 768px) {
    .mobile-nav { display: none !important; }
}

/* —— 打开时锁 body 滚动（iOS Safari 需要 position:fixed）—— */
body.menu-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

/* —— 汉堡按钮 focus-visible —— */
#menu-toggle:focus-visible {
    outline: 2px solid rgb(var(--c-accent) / 0.9);
    outline-offset: 4px;
}

@media (max-width: 767px) {

/* 全屏层本体：visibility / opacity / pointer-events 三重控制 */
.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 70;
    width: 100vw;
    height: 100dvh;

    background-color: rgb(var(--c-bg));

    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: visibility 0s linear 320ms, opacity 280ms ease;
}
.mobile-nav.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: visibility 0s linear 0s, opacity 320ms ease;
}

/* 为 safe-area 预留顶部（刘海）、底部（手势条） */
.mobile-nav-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: calc(56px + env(safe-area-inset-top));
    padding-right: 20px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    padding-left: 24px;
    box-sizing: border-box;
}

/* 顶栏：品牌 + 关闭按钮 */
.mobile-nav-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
}
.mobile-nav-brand {
    font-size: 0.85rem;
    letter-spacing: 0.38em;
    color: rgb(var(--c-mute));
    font-weight: 400;
}
.mobile-nav-close {
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    color: rgb(var(--c-ink));
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-nav-close:focus-visible {
    outline: 2px solid rgb(var(--c-accent) / 0.9);
    outline-offset: 2px;
}

/* 菜单列表 */
.mobile-nav-list {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    padding: 16px 0;
    overflow-y: auto;
    width: 100%;
}

/* 单个菜单项 */
.mobile-nav-item {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    align-items: baseline;
    gap: 16px;
    padding: 16px 0;
    min-height: 56px;
    text-decoration: none;
    color: rgb(var(--c-mute));
    position: relative;
    border-bottom: 1px solid rgb(var(--c-line) / 0.08);
    flex-shrink: 0;

    /* 入场：从下方 8px 上来；每项递增 45ms 延迟 */
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 340ms cubic-bezier(.22, .61, .36, 1) 45ms,
                transform 340ms cubic-bezier(.22, .61, .36, 1) 45ms,
                color 220ms ease;
}
/* 五错峰延迟覆盖：01 = 0ms, 02 = 45ms, 03 = 90ms, 04 = 135ms, 05 = 180ms */
.mobile-nav-item:nth-child(1) { transition-delay: 0ms, 0ms, 45ms; }
.mobile-nav-item:nth-child(2) { transition-delay: 45ms, 45ms, 45ms; }
.mobile-nav-item:nth-child(3) { transition-delay: 90ms, 90ms, 45ms; }
.mobile-nav-item:nth-child(4) { transition-delay: 135ms, 135ms, 45ms; }
.mobile-nav-item:nth-child(5) { transition-delay: 180ms, 180ms, 45ms; }

/* 打开时去掉隐藏和位移，错峰显现 */
.mobile-nav.is-open .mobile-nav-item {
    opacity: 1;
    transform: none;
}

.mobile-nav-item:focus-visible {
    outline: 2px solid rgb(var(--c-accent) / 0.9);
    outline-offset: -4px;
}

/* 左侧序号 01–05 */
.mobile-nav-idx {
    font-size: 10px;
    letter-spacing: 0.28em;
    color: rgb(var(--c-mute));
    flex: 0 0 auto;
    padding-top: 8px;
}

/* 主文字 */
.mobile-nav-label {
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: 0.04em;
    color: rgb(var(--c-ink));
    position: relative;
}

/* 当前页高亮：冷蓝文字 + 左侧细竖线 */
.mobile-nav-item.is-current .mobile-nav-label {
    color: rgb(var(--c-accent));
}
.mobile-nav-item.is-current .mobile-nav-label::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 1px;
    background-color: rgb(var(--c-accent));
}

/* 底部区 */
.mobile-nav-foot {
    flex: 0 0 auto;
    padding-top: 20px;
}
.mobile-nav-divider {
    height: 1px;
    background-color: rgb(var(--c-line) / 0.08);
    margin-bottom: 20px;
}
.mobile-nav-foot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mobile-nav-foot-label {
    font-size: 10px;
    letter-spacing: 0.28em;
    color: rgb(var(--c-mute));
}
.mobile-nav-theme {
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: rgb(var(--c-mute));
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.mobile-nav-theme-sep {
    color: rgb(var(--c-line) / 0.5);
    margin: 0 4px;
}
/* 当前主题文字用 accent 色高亮 */
/* 默认黑夜（无 data-theme 或 data-theme != light）：第二个 span "黑夜" 高亮 */
.mobile-nav-theme .mobile-nav-theme-text:last-child {
    color: rgb(var(--c-accent));
}
/* 白天：第一个 span "白天" 高亮；同时把黑夜那个压回 mute */
[data-theme="light"] .mobile-nav-theme .mobile-nav-theme-text:first-child {
    color: rgb(var(--c-accent));
}
[data-theme="light"] .mobile-nav-theme .mobile-nav-theme-text:last-child {
    color: rgb(var(--c-mute));
}
.mobile-nav-copy {
    margin: 24px 0 0;
    font-size: 10px;
    letter-spacing: 0.22em;
    color: rgb(var(--c-mute));
    text-align: left;
}

} /* @media max-width: 767px */

/* reduced motion：取消 overlay 和菜单项的过渡动画 */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav,
    .mobile-nav .mobile-nav-item {
        transition: none !important;
    }
}