/* =========================================================
   10-pages · 页面模块与彩蛋
   承载范围：原 style.css 第 3151-3820 行
   本节包含：
     - 文章页目录 TOC
     - 页面切换动画
     - 博客卡片封面增强
     - 首页 Hero 过渡层
     - 全局模态提示框
     - 归档页面
     - 分页按钮
     - 分享按钮
     - 前后篇导航
     - 灵动感增强 v2（阅读进度/打字机光标/3D 倾斜/评论表单）
     - 彩蛋：生日横幅与撒落
   ========================================================= */

/* ============= 文章页目录(TOC) ============= */
.toc-sidebar {
    position: fixed;
    top: 160px;
    right: 20px;
    width: 210px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    z-index: 80;
    font-size: 13px;
    line-height: 1.8;
    padding: 14px 16px;
    background: var(--accent-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toc-sidebar.hidden-toc {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

.toc-title {
    font-weight: 700;
    color: var(--pink-600);
    margin-bottom: 8px;
    font-size: 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--accent-soft);
}

.toc-item {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 2px 0 2px 0;
    transition: color 0.2s ease, padding-left 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.toc-item:hover {
    color: var(--pink-500);
    padding-left: 6px;
}

.toc-item.toc-h3 {
    padding-left: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.toc-item.toc-h3:hover {
    padding-left: 20px;
}

.toc-item.active {
    color: var(--pink-600);
    font-weight: 600;
}







@media (max-width: 1200px) {
    .toc-sidebar { display: none; }
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ============= 页面切换增强动画 ============= */
.content-panel {
    display: none;
    animation: panelSlideIn 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-panel.active-panel {
    display: block;
}

/* ============= 博客卡片封面图增强 ============= */
.blog-item {
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
}

.blog-item:hover {
    transform: translateX(6px) scale(1.01);
    border-color: var(--pink-400);
    box-shadow: 0 10px 32px var(--accent-shadow);
}


/* blog-item 封面图 - 仅在文章有 cover 时生效 */
.blog-item .blog-cover {
    flex-shrink: 0;
    width: 80px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.blog-item:hover .blog-cover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px var(--accent-shadow);
}

/* ============= 首页 Hero 过渡层 ============= */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--body-bg);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}


.page-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============= 全局模态提示框 ============= */
.global-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-color);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s ease both;
}


@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.global-modal.hiding {
    animation: modalFadeOut 0.25s ease both;
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.global-modal-card {
    background: var(--pink-100);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 36px 40px 28px;
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px var(--scrim-20);
    animation: modalCardIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}


@keyframes modalCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.global-modal-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.global-modal-msg {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 18px;
    word-break: break-word;
}


.global-modal-timer {
    display: inline;
}

.global-modal-btn {
    display: inline-block;
    padding: 10px 36px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.global-modal-btn.countdown {
    background: var(--disabled-surface);
    color: var(--white);
    cursor: default;
    pointer-events: none;
}


.global-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-shadow-strong);
}



.global-modal.dismissable {
    cursor: pointer;
}

@media (max-width: 768px) {
    .global-modal-card {
        padding: 28px 24px 22px;
    }
    .global-modal-icon { font-size: 32px; }
    .global-modal-msg { font-size: 14px; }
}

/* ============= 归档页面 ============= */
.archive-year {
    font-size: 20px;
    font-weight: 700;
    color: var(--pink-600);
    margin-top: 24px;
    margin-bottom: 16px;
    padding-left: 8px;
    border-left: 4px solid var(--pink-400);
}

.archive-year:first-child {
    margin-top: 0;
}

.archive-months {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px dashed var(--border-light);
}

.archive-month {
    margin-bottom: 16px;
}

.archive-month:last-child {
    margin-bottom: 0;
}

.month-header {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.month-count {
    font-size: 12px;
    color: var(--pink-400);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

.month-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.month-posts li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.month-posts li:last-child {
    border-bottom: none;
}

.month-posts a {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s ease;
}

.month-posts a:hover {
    opacity: 0.7;
}

.post-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-soft);
    border-radius: 8px;
    font-size: 12px;
    color: var(--pink-500);
    font-weight: 600;
    flex-shrink: 0;
}

.post-title {
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}








@media (max-width: 768px) {
    .archive-year {
        font-size: 18px;
    }
    .archive-months {
        margin-left: 8px;
        padding-left: 8px;
    }
    .post-title {
        font-size: 13px;
    }
}

/* ============= 分页按钮 ============= */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--surface-control);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--accent-soft);
    border-color: var(--pink-300);
    color: var(--pink-600);
}

.pagination-btn.active {
    background: var(--accent-gradient);
    border-color: var(--pink-500);
    color: var(--text-on-accent);
    cursor: default;
    box-shadow: 0 4px 12px var(--accent-shadow);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .pagination-btn {
        min-width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* ============= 分享按钮 ============= */
.share-section {
    padding: 16px;
    background: var(--accent-soft);
    border-radius: 16px;
    border: 1px solid var(--border-light);
}

.share-buttons {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.share-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--surface-control);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--accent-shadow);
}

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




/* ============= 文章前后篇导航 ============= */
.post-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    max-width: 45%;
}

.post-nav-item:hover {
    background: var(--accent-hover);
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.post-nav-item.prev {
    justify-content: flex-start;
}

.post-nav-item.next {
    justify-content: flex-end;
}

.nav-arrow {
    font-size: 16px;
    color: var(--pink-500);
    transition: transform 0.3s ease;
}

.post-nav-item:hover .nav-arrow {
    transform: translateX(prev === 'prev' ? -4px : 4px);
}

.post-nav-item.prev:hover .nav-arrow {
    transform: translateX(-4px);
}

.post-nav-item.next:hover .nav-arrow {
    transform: translateX(4px);
}

.nav-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}





@media (max-width: 768px) {
    .post-nav-item {
        max-width: 48%;
        padding: 8px 12px;
    }
    .nav-title {
        font-size: 11px;
    }
}

/* ============= 灵动感增强 v2 ============= */

/* 阅读进度条（文章页） */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 999;
    background: var(--accent-soft);
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pink-300), var(--pink-500), var(--pink-400));
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.1s linear;
}


/* 打字机光标 */
.hero-subtitle-cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--white);
    animation: cursorBlink 1s step-end infinite;
    text-shadow: 0 1px 6px var(--accent-shadow-strong);
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 卡片 3D 倾斜 */
.tilt-target {
    will-change: transform;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* 手机端：评论表单纵向堆叠，输入框占满整行；
   控件字号统一到 16px —— 低于 16px 时 iOS Safari 聚焦输入框会自动放大页面 */
@media (max-width: 768px) {
    .comment-form-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .comment-form-row input[type="text"] {
        width: 100%;
        min-width: 0;
    }

    .guestbook-form input,
    .guestbook-form textarea,
    .comment-form-row input[type="text"],
    .contact-form input,
    .contact-form textarea,
    .search-input {
        font-size: 16px;
    }
}

/* 无障碍：跟随系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============= 彩蛋：生日横幅 & 撒落 ============= */
.birthday-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 44px 12px 16px;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 4px var(--accent-shadow-strong);
    box-shadow: 0 4px 16px var(--accent-shadow-strong);
    animation: bannerSlideDown 0.5s ease-out;
}

@keyframes bannerSlideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.birthday-banner-hide {
    transition: transform 0.3s ease-in;
    transform: translateY(-100%);
}

.birthday-emoji {
    font-size: 20px;
}

.birthday-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--glass-35);
    color: var(--white);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.birthday-fall {
    position: fixed;
    top: -50px;
    z-index: 999;
    pointer-events: none;
    animation: birthdayFall linear forwards;
}

@keyframes birthdayFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}
