/* ===== 文章页扩展功能样式 =====
 * 包含:沉浸式阅读模式、表情点赞、赞赏弹窗、阅读位置恢复按钮 */

/* ========== 沉浸式阅读模式 ========== */
body.focus-mode .sidebar-content,
body.focus-mode .sidebar-scrim,
body.focus-mode .top-app-bar,
body.focus-mode .post-toc-rail,
body.focus-mode .site-footer,
body.focus-mode .footer-divider,
body.focus-mode .back-to-top-fab,
body.focus-mode .music-ball,
body.focus-mode .music-panel {
    display: none !important;
}

body.focus-mode .main {
    margin-left: 0 !important;
}

body.focus-mode .post-container {
    max-width: 860px;
    padding-top: 48px;
}

body.focus-mode .post-card-wide {
    background: var(--s-color-surface-container-low);
}

/* 退出沉浸模式按钮(仅沉浸模式下可见) */
.focus-mode-exit {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--s-color-outline-variant) 60%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--s-color-surface-container-high) 88%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    color: var(--s-color-on-surface);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease;
}

body.focus-mode .focus-mode-exit {
    display: inline-flex;
}

.focus-mode-exit:hover {
    transform: scale(1.06);
    background: var(--s-color-surface-container-highest);
}

.focus-mode-exit material-icon {
    font-size: 22px;
}

/* ========== 文章互动区(点赞 + 赞赏) ========== */
.post-card-actions {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--s-color-outline-variant) 64%, transparent);
    border-radius: 24px;
    background: var(--s-color-surface-container-low);
    padding: 24px 28px;
}

.post-actions-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.post-actions-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.post-actions-block--reward,
.post-actions-block--share {
    align-items: flex-end;
}

.post-actions-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--s-color-on-surface-variant);
}

.post-actions-label material-icon {
    font-size: 1.05rem;
    color: var(--s-color-primary);
}

/* 表情点赞 */
.post-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-reaction {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid color-mix(in srgb, var(--s-color-outline-variant) 60%, transparent);
    border-radius: 999px;
    background: var(--s-color-surface-container);
    color: var(--s-color-on-surface);
    font-family: inherit;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.25s ease,
                border-color 0.25s ease;
}

.post-reaction:hover {
    transform: translateY(-3px) scale(1.04);
    background: var(--s-color-surface-container-high);
}

.post-reaction:active {
    transform: translateY(-1px) scale(0.98);
}

.post-reaction.is-active {
    background: var(--s-color-primary-container);
    border-color: color-mix(in srgb, var(--s-color-primary) 45%, transparent);
    color: var(--s-color-on-primary-container);
}

.post-reaction__emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.post-reaction__count {
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.85;
}

.post-reward-trigger {
    flex: 0 0 auto;
}

@media (max-width: 600px) {
    .post-card-actions {
        padding: 20px;
    }

    .post-actions-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .post-actions-block--reward,
    .post-actions-block--share {
        align-items: flex-start;
    }

    .post-reaction {
        min-height: 38px;
        padding: 5px 12px;
        font-size: 0.82rem;
    }
}

/* ========== 赞赏弹窗 ========== */
.reward-dialog {
    width: min(560px, calc(100vw - 32px));
}

.reward-dialog-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reward-tip {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--s-color-on-surface-variant);
}

.reward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.reward-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.reward-item__media {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 18px;
    background: var(--s-color-surface-container-high);
    color: var(--s-color-on-surface-variant);
}

.reward-item__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.reward-item__media material-icon {
    font-size: 56px;
    opacity: 0.5;
}

.reward-item__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--s-color-on-surface);
}

.reward-item__desc {
    font-size: 0.78rem;
    opacity: 0.7;
    color: var(--s-color-on-surface-variant);
}

/* ========== 阅读位置恢复按钮 ========== */
.reading-resume-btn {
    position: fixed;
    right: 24px;
    bottom: 152px;
    z-index: 8900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid color-mix(in srgb, var(--s-color-outline-variant) 55%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--s-color-surface-container-high) 90%, transparent);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    color: var(--s-color-on-surface);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.94);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: opacity 0.3s ease,
                transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.3s ease,
                background-color 0.3s ease;
}

.reading-resume-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.reading-resume-btn:hover {
    transform: translateY(-2px) scale(1.03);
    background: var(--s-color-surface-container-highest);
}

.reading-resume-btn material-icon {
    font-size: 1.1rem;
    color: var(--s-color-primary);
}

@media (max-width: 600px) {
    .reading-resume-btn {
        right: 16px;
        bottom: 136px;
        padding: 9px 14px;
        font-size: 0.8rem;
    }

    .focus-mode-exit {
        top: 14px;
        right: 14px;
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reading-resume-btn,
    .post-reaction,
    .focus-mode-exit {
        transition: none !important;
    }
}

/* ========== 评论数徽章(文章卡片 / 归档 / 热门页) ========== */
.post-card__comments,
.archives-post-comments,
.hot-comments {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--s-color-on-surface-variant);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transition: color 0.3s ease;
}

.post-card__comments material-icon,
.archives-post-comments material-icon,
.hot-comments material-icon {
    font-size: 0.95rem;
    opacity: 0.85;
}

/* 未取到数据前用占位符,取到后淡入 */
.post-card__comments span[data-comment-count],
.archives-post-comments span[data-comment-count],
.hot-comments span[data-comment-count] {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.post-card__comments.is-loaded span[data-comment-count],
.archives-post-comments.is-loaded span[data-comment-count],
.hot-comments.is-loaded span[data-comment-count] {
    opacity: 1;
}

/* 卡片悬停时高亮 */
.post-card:hover .post-card__comments,
.hot-item:hover .hot-comments,
.archives-post-item:hover .archives-post-comments {
    color: var(--s-color-primary);
}
/* ========== 文章加密(锁定占位 + MD3E 弹窗) ========== */

/* 锁定占位(解锁前显示在正文区域) */
.post-encrypt-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 56px 24px 64px;
    text-align: center;
}

.post-encrypt-placeholder__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 28px;
    background: linear-gradient(135deg,
        var(--s-color-primary-container),
        var(--s-color-secondary-container));
    color: var(--s-color-on-primary-container);
    margin-bottom: 6px;
}

.post-encrypt-placeholder__icon material-icon {
    font-size: 40px;
}

.post-encrypt-placeholder__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--s-color-on-surface);
}

.post-encrypt-placeholder__hint {
    margin: 0;
    max-width: 42ch;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--s-color-on-surface-variant);
    opacity: 0.85;
}

.post-encrypt-placeholder s-button {
    margin-top: 8px;
}

/* 解密后的正文淡入 */
.post-encrypted-content {
    display: none;
}

.post-encrypted-content.is-revealed {
    display: block;
    animation: post-encrypt-reveal 0.5s cubic-bezier(0.05, 0.7, 0.1, 1);
}

@keyframes post-encrypt-reveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 密码弹窗(MD3E) ===== */
.encrypt-dialog {
    width: min(420px, calc(100vw - 32px));
}

.encrypt-dialog-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.encrypt-dialog__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: linear-gradient(135deg,
        var(--s-color-primary-container),
        var(--s-color-secondary-container));
    color: var(--s-color-on-primary-container);
}

.encrypt-dialog__icon material-icon {
    font-size: 30px;
}

.encrypt-dialog__hint {
    margin: 0;
    max-width: 40ch;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--s-color-on-surface-variant);
    opacity: 0.88;
}

.encrypt-dialog__form {
    width: 100%;
    margin-top: 4px;
}

.encrypt-dialog__field {
    position: relative;
    width: 100%;
}

.encrypt-dialog__field input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 18px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--s-color-outline-variant) 62%, transparent);
    border-radius: 999px;
    background: var(--s-color-surface-container-high);
    color: var(--s-color-on-surface);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.encrypt-dialog__field input:focus {
    border-color: var(--s-color-primary);
    background: var(--s-color-surface-container-highest);
}

.encrypt-dialog__field input::placeholder {
    color: var(--s-color-on-surface-variant);
    opacity: 0.7;
}

.encrypt-dialog__toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--s-color-on-surface-variant);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.encrypt-dialog__toggle:hover {
    background: color-mix(in srgb, var(--s-color-primary) 12%, transparent);
    color: var(--s-color-primary);
}

.encrypt-dialog__toggle material-icon {
    font-size: 19px;
}

.encrypt-dialog__error {
    min-height: 1.2em;
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: var(--s-color-error);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.encrypt-dialog__error.is-visible {
    opacity: 1;
}

@media (max-width: 480px) {
    .post-encrypt-placeholder {
        padding: 40px 16px 48px;
    }

    .post-encrypt-placeholder__icon {
        width: 68px;
        height: 68px;
        border-radius: 24px;
    }

    .post-encrypt-placeholder__icon material-icon {
        font-size: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-encrypted-content.is-revealed,
    .encrypt-dialog__field input,
    .encrypt-dialog__toggle {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }

    .encrypt-dialog__toggle {
        transform: translateY(-50%) !important;
    }
}
/* 加密文章卡片上的锁标记 */
.post-card__lock {
    display: inline-flex;
    vertical-align: -2px;
    margin-right: 4px;
    font-size: 0.95rem;
    color: var(--s-color-primary);
}
