/* ============================================================
   思念宝 · 组件层
   按钮、面板、卡片、头像、标签、筛选、骨架屏、空状态、文档页
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 13px var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: background var(--transition-fast), border-color var(--transition-fast),
        color var(--transition-fast);
}

.btn svg {
    flex-shrink: 0;
}

/* 主按钮用实墨色而非亮色点缀，是浅底页面上最"高级"的处理 */
.btn-primary,
.android-btn {
    background: var(--ink);
    color: var(--ink-inverse);
}

.btn-primary:hover,
.android-btn:hover {
    background: #322e28;
}

.btn-outline {
    background: transparent;
    border-color: var(--rule-strong);
    color: var(--ink);
}

.btn-outline:hover {
    border-color: var(--ink);
    background: var(--surface);
}

.btn:active {
    transform: translateY(1px);
}

/* ---------- 面板 ---------- */
/* 所有内容面板统一为：纯白表面 + 发丝描边 + 小圆角，不使用阴影和玻璃拟态 */
.moment-list-panel,
.detail-moment-card,
.comment-section,
.seed-album {
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.detail-moment-card,
.comment-section,
.seed-album {
    padding: var(--space-8);
}

.moment-list-panel {
    overflow: hidden;
}

/* ---------- 下载引导条 ---------- */
.app-download-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6);
    border: 1px solid var(--rule);
    border-left: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color var(--transition-fast);
}

.app-download-banner:hover {
    border-color: var(--rule-strong);
    border-left-color: var(--accent);
}

.app-download-banner strong {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-base);
    font-weight: 600;
}

.app-download-banner span {
    display: block;
    font-size: var(--text-sm);
    color: var(--ink-2);
}

.banner-arrow {
    flex-shrink: 0;
}

.banner-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--ink-inverse) !important;
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background var(--transition-fast);
}

.app-download-banner:hover .banner-cta {
    background: #322e28;
}

/* ---------- 筛选标签 ---------- */
/* 用下划线式标签替换原胶囊控件，更接近杂志的栏目切换 */
.filter-tabs {
    display: inline-flex;
    gap: var(--space-6);
}

.filter-tab {
    position: relative;
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    color: var(--ink-3);
    transition: color var(--transition-fast);
}

.filter-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--ink);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.filter-tab:hover {
    color: var(--ink);
}

.filter-tab.active {
    color: var(--ink);
    font-weight: 600;
}

.filter-tab.active::after {
    transform: scaleX(1);
}

/* ---------- 头像 ---------- */
.avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: 600;
}

.avatar.small {
    width: 32px;
    height: 32px;
    font-size: var(--text-2xs);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- 标签 / 关键词 ---------- */
.seed-chip,
.seo-keywords span {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 var(--space-3);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-pill);
    font-size: var(--text-2xs);
    color: var(--accent);
    white-space: nowrap;
}

.seed-chip.muted,
.seo-keywords span {
    border-color: var(--rule);
    color: var(--ink-3);
}

.seo-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.seed-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

/* ---------- 图片网格（小缩略图，点击预览） ---------- */
.web-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.web-image-thumb {
    display: block;
    width: 96px;
    height: 96px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    cursor: zoom-in;
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.web-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.web-image-thumb:hover {
    border-color: var(--accent-line);
    transform: translateY(-1px);
}

/* ---------- 灯箱 ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(18, 16, 13, 0.88);
    animation: lightbox-in 0.2s var(--ease);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-stage {
    max-width: min(92vw, 1100px);
    max-height: 88vh;
}

.lightbox-img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    transition: background var(--transition-fast);
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.24);
}

.lightbox-close {
    top: var(--space-5);
    right: var(--space-5);
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-nav[hidden] {
    display: none;
}

.lightbox-nav.prev {
    left: var(--space-5);
}

.lightbox-nav.next {
    right: var(--space-5);
}

.lightbox-counter {
    position: absolute;
    bottom: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.8);
}

html.lightbox-open {
    overflow: hidden;
}

@keyframes lightbox-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- AI 回应引用块 ---------- */
.reply-preview,
.detail-ai-reply {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-left: 2px solid var(--sage);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--sage-tint);
}

.ai-reply-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.ai-reply-tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 2px 8px;
    background: rgba(82, 110, 91, 0.12);
    border-radius: var(--radius-pill);
    font-size: var(--text-2xs);
    font-weight: 600;
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--sage);
}

.detail-ai-reply .eyebrow {
    color: var(--sage);
    margin-bottom: var(--space-2);
}

.ai-reply-block p,
.preview-comment,
.detail-ai-reply p {
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--ink-2);
    line-height: var(--leading-body);
}

.preview-comment {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: var(--space-2);
}

.preview-comment strong {
    font-weight: 600;
    color: var(--ink);
    margin-right: var(--space-1);
}

.preview-comment strong::after {
    content: '：';
}

/* ---------- 骨架屏 ---------- */
.skeleton-card {
    padding: var(--space-6);
}

.skeleton-line {
    height: 12px;
    margin: var(--space-3) 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg,
            var(--surface-sunken),
            var(--paper-alt),
            var(--surface-sunken));
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite;
}

.skeleton-line.short {
    width: 38%;
}

/* ---------- 空状态 ---------- */
.empty-state,
.empty-comments,
.noscript-copy {
    padding: var(--space-16) var(--space-8);
    text-align: center;
    color: var(--ink-3);
    font-size: var(--text-sm);
}

.empty-state h1,
.empty-state h2 {
    margin-bottom: var(--space-2);
    font-size: var(--text-xl);
    color: var(--ink);
}

.load-more-wrap {
    padding: var(--space-5) var(--space-6);
    text-align: center;
    border-top: 1px solid var(--rule);
}

.load-more-wrap .btn {
    min-width: 200px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
    color: var(--ink-3);
}

.back-link::before {
    content: '←';
}

.back-link:hover {
    color: var(--ink);
}

/* ---------- 法律 / 说明文档页 ---------- */
/* 去掉原先的卡片外框与阴影，改为单栏窄版式，接近印刷文档 */
.doc-page {
    padding: calc(var(--nav-height) + var(--space-16)) 0 var(--space-20);
}

.doc-container {
    width: 100%;
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.doc-header {
    padding-bottom: var(--space-8);
    margin-bottom: var(--space-10);
    border-bottom: 1px solid var(--rule);
}

.doc-title {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-display);
    margin-bottom: var(--space-3);
}

.doc-meta {
    font-size: var(--text-xs);
    color: var(--ink-3);
}

/* .doc-header 之外单独使用 .doc-meta 时补足间距 */
.doc-title + .doc-meta {
    margin-bottom: var(--space-10);
}

.doc-content h2 {
    margin: var(--space-12) 0 var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--rule);
    font-size: var(--text-xl);
}

/* 紧跟 .doc-header 的首个章节标题不再重复一条分隔线 */
.doc-content h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.doc-content h3 {
    margin: var(--space-8) 0 var(--space-3);
    font-size: var(--text-base);
}

.doc-content p,
.doc-content li {
    color: var(--ink-2);
    line-height: var(--leading-loose);
}

.doc-content p {
    margin-bottom: var(--space-4);
}

.doc-content ul,
.doc-content ol {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-5);
    list-style: disc;
}

.doc-content ol {
    list-style: decimal;
}

.doc-content li {
    margin-bottom: var(--space-2);
}

.doc-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* 文档页多语言显示控制 */
.lang-en {
    display: none;
}

html[lang="en"] .lang-en {
    display: block;
}

html[lang="en"] .lang-zh {
    display: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {

    .app-download-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .banner-cta {
        width: 100%;
    }

    .detail-moment-card,
    .comment-section,
    .seed-album {
        padding: var(--space-5);
    }

    .filter-tabs {
        gap: var(--space-5);
    }


    .empty-state,
    .empty-comments,
    .noscript-copy {
        padding: var(--space-12) var(--space-5);
    }

    .doc-page {
        padding: calc(var(--nav-height) + var(--space-10)) 0 var(--space-16);
    }
}


@media (max-width: 480px) {
    .web-image-thumb {
        width: 80px;
        height: 80px;
    }

    .lightbox-nav.prev { left: var(--space-2); }
    .lightbox-nav.next { right: var(--space-2); }
}
