/* ============================================================
   主题色板 —— 全部走 CSS 变量
   日间为默认值；夜间由 body.dark 覆盖
   ============================================================ */
:root {
    /* 背景 */
    --bg-base: #ffffff;                 /* 主内容区 */
    --bg-bubble: #f7f7f8;              /* 灰底气泡（卡片/列表） */
    --bg-bubble-hover: #eaeaea;
    --bg-glass: rgba(255, 255, 255, 0.72);   /* 毛玻璃导航 / 图注 */
    --glass-border: rgba(255, 255, 255, 0.85);

    /* 文字 */
    --text-strong: rgba(0, 0, 0, 0.87);       /* 标题 / 强文本 */
    --text-primary: #2b2b2b;                   /* 正文主色 */
    --text-secondary: #b2b2b2;                 /* 次要 / 元信息灰 */
    --text-muted: rgba(0, 0, 0, 0.5);         /* 描述类 */

    /* 主题色 */
    --color-link: #576b95;              /* 微信蓝：链接 / 作者名 */
    --color-accent: #07c160;            /* 微信绿 */
    --color-accent-soft: rgba(7, 193, 96, 0.12);
    --color-online: #10b981;            /* 友链在线 */
    --color-online-deep: #059669;
    --color-online-bg: rgba(16, 185, 129, 0.08);

    /* 线条 / 点 */
    --border-hairline: rgb(249 250 251);   /* 列表项极淡分隔 */
    --border-divider: rgba(0, 0, 0, 0.045);
    --dot-gray: #c4c4c9;
    --dot-offline: #9ca3af;

    /* 阴影 */
    --shadow-sm: rgba(0, 0, 0, 0.06);
    --shadow-md: rgba(0, 0, 0, 0.1);

    /* 标签 / 杂项 */
    --tag-color: rgb(148 200 216);
    --tag-bg: rgb(148 200 216 / 10%);
    --color-quote-bg: rgb(247 247 247);
    --color-wuxing: #333;
    --status-bg: rgba(0, 0, 0, 0.03);
}

/* ===================== 夜间模式 ===================== */
body.dark {
    --bg-base: #161618;
    --bg-bubble: #2a2a2c;
    --bg-bubble-hover: #343437;
    --bg-glass: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.12);

    --text-strong: rgba(255, 255, 255, 0.92);
    --text-primary: #d4d4d6;
    --text-secondary: #8a8a8e;
    --text-muted: rgba(255, 255, 255, 0.55);

    --color-link: #7e9bc9;
    --color-accent: #2aae67;
    --color-accent-soft: rgba(42, 174, 103, 0.18);
    --color-online: #34d399;
    --color-online-deep: #10b981;
    --color-online-bg: rgba(16, 185, 129, 0.16);

    --border-hairline: rgb(42 42 46);
    --border-divider: rgba(255, 255, 255, 0.07);
    --dot-gray: #6b6b72;
    --dot-offline: #6b7280;

    --shadow-sm: rgba(0, 0, 0, 0.4);
    --shadow-md: rgba(0, 0, 0, 0.5);

    --tag-color: rgb(148 200 216);
    --tag-bg: rgb(148 200 216 / 14%);
    --color-quote-bg: rgb(38 38 42);
    --color-wuxing: #c8c8c8;
    --status-bg: rgba(255, 255, 255, 0.06);
}

/* ============================================================
   以下为布局 / 组件样式，颜色全部引用上面的变量
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
::-webkit-scrollbar {
    height: 0 !important;
    width: 0 !important;
}
html { scroll-behavior: smooth; }
html.is-changing .transition-fade { opacity: 0.1; filter: blur(4px); }
html.is-changing .transition-fade:not(.no-transition) { transition: all .25s ease; }
body{
    background: var(--bg-base);
}
body.dark img{
    filter: brightness(0.8);
}
.main-content {
    max-width: 680px;
    margin: 1rem auto;
    background: var(--bg-base);
    border-radius: 1rem;
    overflow-y: auto;
    height: calc(100vh - 2rem);
    box-shadow: 0 2px 8px var(--shadow-sm);
}
a {
    color: inherit;
    border: none;
    text-decoration: none;
}

a:focus {
    outline: 0
}

img {
    width: 100%;
}
.profile-header {
    position: relative;
}
.profile-cover {
    height: 340px;
}
.profile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-avatar-wrapper {
    width: 64px;
    height: 64px;
}
.profile-avatar-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}
.profile-info {
    position: absolute;
    right: 1rem;
    bottom: calc(340px - 430px);
    display: flex;
    flex-direction: column;
    align-content: flex-end;
    text-align: end;
    align-items: flex-end;
}
.profile-bio {
    font-size: 12px;
    padding-block: 1rem;
    color: var(--text-secondary);
}
.article-list {
    padding-block: 2rem;
    padding-inline: 2rem;
    padding-block-start: 6rem;
}
.post-item-avatar {
    width: 46px;
    height: 46px;
}
.post-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.post-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-block: 1rem;
    border-bottom: thin var(--border-hairline) solid;
}
.post-item-body {
    flex: 1 1 0%;
}
.post-item-author {
    color: var(--color-link);
    font-size: 16px;
    font-weight: 600;
}
.post-item-card {
    margin-block-start: .5rem;
    max-width: 280px;
    background-color: var(--bg-bubble);
    border-radius: 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: .3s;
}
.post-item-card:hover {
    background-color: var(--bg-bubble-hover);
}
.post-item-thumb {
    width: 80px;
    height: 80px;
}
.post-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-item-content {
    flex: 1 1 0%;
    padding: .5rem;
}
.post-item-title {
    font-size: 15px;
    color: var(--text-strong);
    transition: .3s;
}
.post-item-title:hover {
    color: var(--color-link);
}
.post-item-desc {
    font-size: 13px;
    color: var(--text-muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
}
.post-item-meta {
    color: var(--text-secondary);
    font-size: 13px;
    margin-block-start: .5rem;
}
.moment-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-break: break-word;
    letter-spacing: .2px;
    overflow: hidden;
}
.moment-text > *{
    margin-block-end: 2rem;
    line-height: 1.8;
}
.moment-text {
    margin-block-start: .5rem;
    transition: .3s;
}
/* 图片九宫格：默认三列；单图放大，2/4 图两列 */
.moment-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 8px;
    max-width: 320px;
}

.moment-images .moment-image {
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-bubble);
}

.moment-images .moment-image-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 1 / 1;
}

/* 单图：不裁成方块，给个更舒展的比例 */
.moment-images.count-1 {
    grid-template-columns: minmax(0, 200px);
    max-width: 200px;
}

.moment-images.count-1 .moment-image-img {
    aspect-ratio: 4 / 3;
    max-height: 240px;
}

/* 2 / 4 图：两列 */
.moment-images.count-2,
.moment-images.count-4 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 216px;
}
.moment-text.is-collapsed {
    max-height: 1.5em;               /* 约 1 行 */
    position: relative;
}
/* 全文 / 收起 按钮：默认隐藏，JS 检测溢出后才显示 */
.moment-toggle {
    display: none;
    margin-top: 4px;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-link);
    font-size: 14px;
    cursor: pointer;
    line-height: 1.6;
}

.moment-toggle.is-visible {
    display: inline-block;
}

.moment-toggle:hover {
    opacity: .8;
}
.footer-inner {
    font-size: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
}
.wuxinghongqi {
    color: var(--color-wuxing);
}
.ios-nav.ios-nav {
    gap: 0;
}
.ios-nav {
    position: sticky;
    bottom: 1rem;
    z-index: 9;
    display: flex;
    gap: .2rem;
    margin: 0 2rem;
    padding: .2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 8px var(--shadow-sm);
    width: fit-content;
    border-radius: 2rem;
}
.ios-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    color: var(--text-strong);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: none;
    line-height: 0;
    margin: 0 .1rem;
    transition:
        width      .4s  cubic-bezier(.4, 0, .2, 1),
        margin     .4s  cubic-bezier(.4, 0, .2, 1),
        opacity    .3s  ease,
        transform  .2s  ease,
        background .2s  ease,
        box-shadow .25s ease;
}
.ios-nav:not(.expanded) > *:not(.ios-nav-toggle):nth-child(n+4) {
    width: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}
.ios-nav-btn:hover {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: var(--glass-border);
    box-shadow: 0 4px 14px var(--shadow-md);
}
.ios-nav-btn:active {
    transform: scale(0.92);
}

.scroll-progress-bg {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2.5;
}
.scroll-progress-bar {
    fill: none;
    stroke: var(--color-link);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 87.96;
    stroke-dashoffset: 87.96;
    transition: stroke-dashoffset 0.15s;
}
.scroll-progress-text {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-strong);
    position: absolute;
    z-index: 1;
    line-height: 1;
}

.article-header {
    padding-block: 2rem;
    padding-inline: 2rem;
    padding-block-end: 0;
}
.article-title {
    font-size: 28px;
    color: var(--text-primary);
}
.article-meta {
    font-size: 13px;
    display: flex;
    gap: .3rem;
    margin-block-start: .3rem;
    color: var(--text-secondary);
}
.article-meta a {
    color: var(--color-link);
}
.article-body {
    padding: 2rem;
    padding-block-start: 0;
    color: var(--text-primary);
}
.article-body > * {
    margin: 2rem 0;
    line-height: 1.8;
}
.article-body .post__image {
    position: relative;
    cursor: zoom-in;
    border-radius: 8px;
}
.article-body .post__image img {
    border-radius: 8px;
}
.article-body figcaption.image-caption {
    padding: .2rem .5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 8px var(--shadow-sm);
    width: fit-content;
    border-radius: 2rem;
    position: absolute;
    bottom: 1rem;
    font-size: 13px;
    transform: translateX(50%);
    right: 50%;
}
.article-body a {
    color: var(--color-link);
    text-decoration: none;
}
.article-body a:hover {
    text-decoration: underline;
}
.article-body blockquote {
    border-left: 3px solid var(--color-link);
    color: var(--text-secondary);
    background: var(--color-quote-bg);
    border-radius: 0 4px 4px 0;
    margin: .8em 0;
    padding: .4em 1em;
    font-style: italic;
}
.article-body h2 {
    position: relative;
    font-size: 1rem;
    text-align: center;
}
.article-body h2::before {
    content: "[";
    color: var(--color-link);
    font-size: 1.2rem;
    margin-right: .2rem;
}
.article-body h2::after {
    content: "]";
    color: var(--color-link);
    font-size: 1.2rem;
    margin-left: .2rem;
}

/* 无序列表 */
.article-body ul {
    margin: 0;
    padding: 8px 12px;
    list-style: none;
    background: var(--bg-bubble);
    border-radius: 8px;
}
.article-body ul li {
    position: relative;
    padding: 7px 0 7px 22px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-break: break-word;
    letter-spacing: .2px;
}
.article-body ul li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot-gray);
    opacity: .55;
}
.article-body ul li + li {
    border-top: 1px solid var(--border-divider);
}

/* 有序列表 */
.article-body ol {
    list-style: none;
    counter-reset: m;
    margin: 0;
    padding: 8px 12px;
    background: var(--bg-bubble);
    border-radius: 8px;
}
.article-body ol li {
    position: relative;
    padding: 7px 0 7px 30px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-break: break-word;
    letter-spacing: .2px;
    counter-increment: m;
}
.article-body ol li::before {
    content: counter(m);
    position: absolute;
    left: 0;
    top: 10px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    font-size: 11px;
    color: var(--color-accent);
    background: var(--color-accent-soft);
    font-variant-numeric: tabular-nums;
}
.article-body ol li + li {
    border-top: 1px solid var(--border-divider);
}

.page_next {
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-block-end: 2rem;
}
.page_next a:hover {
    color: var(--color-link);
}
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .5rem;
    padding: 0 2rem;
}
.link-card {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 1rem 0;
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    transition: all .25s;
    overflow: hidden;
    position: relative;
}
.link-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    overflow: hidden;
    position: relative;
}
.link-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
    display: block;
}
.link-info {
    flex: 1;
    min-width: 0;
    position: relative;
}
.link-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .15s;
    line-height: 1.4;
}
.link-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}
.link-status.online {
    color: var(--color-online-deep);
    background: var(--color-online-bg);
}
.link-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 50px;
    vertical-align: middle;
    margin-left: 2px;
    transition: all .3s;
    background: var(--status-bg);
    color: var(--text-secondary);
}
.link-status.online::before {
    background: var(--color-online);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.35);
}
.link-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot-offline);
    flex-shrink: 0;
    transition: background .3s;
}
.tag-list span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--tag-color);
    background: var(--tag-bg);
    padding: 2px 8px;
    border-radius: 2rem;
    font-weight: 500;
}
.tag-list {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 5px;
}
.footer-beian {
    display: flex;
    align-items: center;
    margin-block: .5rem;
    justify-content: center;
    flex-direction: column;
}
.footer-meta__item {
    display: flex;
    gap: .3rem;
    align-items: center;
    margin-block: .1rem;
    justify-content: center;
}
.footer-meta__item img {
    width: 20px;
    height: 20px;
}
.ios-nav-btn {
    margin: 0 .1rem;                       /* 相邻两按钮合计 .2rem 间距 */
    transition:
        width      .4s  cubic-bezier(.4, 0, .2, 1),
        margin     .4s  cubic-bezier(.4, 0, .2, 1),
        opacity    .3s  ease,
        transform  .2s  ease,
        background .2s  ease,
        box-shadow .25s ease;
}

/* 收起：第 4 个及之后的功能按钮 宽/间距/透明 一起收为 0
   （.ios-nav-toggle 用 :not() 排除，永远保留在末尾、点得到） */
.ios-nav:not(.expanded) > *:not(.ios-nav-toggle):nth-child(n+4) {
    width: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 展开按钮图标：展开时翻转方向（换个方向，表示可再点收起） */
.ios-nav-toggle svg {
    transition: transform .3s ease;
}
.ios-nav.expanded .ios-nav-toggle svg {
    transform: rotate(180deg);
}

.expanded .ios-nav-toggle{
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: var(--glass-border);
    box-shadow: 0 4px 14px var(--shadow-md);
}
.ios-nav.expanded {
    max-width: calc(100% - 2rem);
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;   /* iOS 惯性滚动 */
    scroll-snap-type: x proximity;        /* 滑动有轻微“刻度感” */
    scrollbar-width: none;                /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;             /* 旧 Edge 隐藏滚动条 */
}
.ios-nav.expanded::-webkit-scrollbar {
    display: none;                        /* WebKit / Chrome / Safari 隐藏滚动条 */
}

/* 展开态：按钮不收缩、保持 44px，过长时触发横向滚动而非被挤压变形 */
.ios-nav.expanded .ios-nav-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* 多列瀑布流：卡片高度由封面比例决定，自然错落 */
.album-grid{
    column-count: 2;
    column-gap: 16px;
    margin-top: 20px;
}

/* 卡片：玻璃质感 + 悬浮上浮（多列布局下用 block + break-inside）*/
.album-card{
    display: block;
    width: 100%;
    margin-bottom: 16px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    background: var(--bg-base);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 2px 8px var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease;
}
.album-card:hover{
    transform: translateY(-4px);
}

.album-cover{
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg-bubble, #f2f2f7);
}
.album-card:nth-child(4n + 1) .album-cover{ aspect-ratio: 4 / 3; }
.album-card:nth-child(4n + 2) .album-cover{ aspect-ratio: 3 / 4; }
.album-card:nth-child(4n + 3) .album-cover{ aspect-ratio: 1 / 1; }
.album-card:nth-child(4n + 4) .album-cover{ aspect-ratio: 16 / 10; }

.album-cover img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.album-card:hover .album-cover img{
    transform: scale(1.06);
}

/* 无封面占位 */
.album-cover-empty{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 40px;
}

/* 数量徽标：右下角毛玻璃药丸 */
.album-count{
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1;
    color: #fff;
    background: rgba(0,0,0,.45);
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 标题与元信息 */
.album-info{
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.album-title{
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-meta{
    font-size: 12px;
    color: var(--text-muted);
}

/* 空状态 */
.links-empty{
    text-align: center;
    color: var(--text-muted);
    padding: 60px 16px;
    font-size: 14px;
}
.album-grid{
    padding: 2rem;
}

@media (max-width: 560px){
    .album-grid{ column-count: 1; column-gap: 12px; }
    .album-card{ margin-bottom: 12px; }
}


@media (max-width: 769px) {
    .main-content {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    .article-list,.article-header{
        padding: 2rem 1rem;
    }
    .article-body,.album-grid{
        padding: 0rem 1rem;
    }
    .ios-nav{
        margin: 0 1rem;
    }
    .ios-nav{
        position: fixed;
    }
    .site-footer {
        margin-block-end: 3rem;
    }
}
