/* ==================================================
   Scroll Theme v2 — 横轴画卷 · 沉浸式设计
   Inspired by stone-industrial.com
   ================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
                 -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #fff;
    background: #111;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- 背景层 (全屏沉浸) --- */
#bg-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity;
}

/* 深色遮罩 — 让文字在任何背景上都清晰 */
#bg-layer::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.35) 50%,
        rgba(0, 0, 0, 0.55) 100%
    );
    z-index: 1;
}

/* --- 极简导航 --- */
#navbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 64px;
    z-index: 100;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.4s ease;
}

#navbar.scrolled {
    background: rgba(0, 0, 0, 0.6);
}

.nav-inner {
    width: 100%;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.site-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
}

.site-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

.nav-right a {
    transition: color 0.3s ease;
    position: relative;
}

.nav-right a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #fff;
    transition: width 0.3s ease;
}

.nav-right a:hover {
    color: #fff;
}

.nav-right a:hover::after {
    width: 100%;
}

/* --- 文章计数器 --- */
#article-counter {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

/* --- 滚动容器 (横轴) --- */
#scroll-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* --- 文章卡片 (全屏沉浸) --- */
.scroll-article {
    flex: 0 0 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 80px;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-article.active {
    opacity: 1;
    transform: scale(1);
}

.scroll-article.prev-active {
    opacity: 0.3;
    transform: scale(0.95);
}

/* --- 文章内容 (暗色卡片叠加在背景上) --- */
.article-inner {
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    z-index: 2;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 48px 52px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.article-inner::-webkit-scrollbar {
    width: 4px;
}

.article-inner::-webkit-scrollbar-track {
    background: transparent;
}

.article-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* --- 文章编号 --- */
.article-number {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.article-number span {
    color: rgba(255, 255, 255, 0.7);
}

/* --- 大标题 (stone-industrial 风格) --- */
.article-title {
    font-size: clamp(24px, 3.2vw, 36px);
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.article-title a {
    display: inline;
    background: linear-gradient(to right, #fff, #fff);
    background-size: 0 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.4s ease;
}

.article-title a:hover {
    background-size: 100% 2px;
}

/* --- 元信息 --- */
.article-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.article-meta a {
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.3s ease;
}

.article-meta a:hover {
    color: #fff;
}

.meta-sep {
    color: rgba(255, 255, 255, 0.2);
}

/* --- 文章正文 --- */
.article-content {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.9;
    max-width: 780px;
}

.article-content p {
    margin-bottom: 1em;
}

.article-content a {
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.3s ease;
}

.article-content a:hover {
    border-bottom-color: #fff;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5em 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
    color: #fff;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.article-content h1 { font-size: 1.6em; }
.article-content h2 { font-size: 1.4em; }
.article-content h3 { font-size: 1.2em; }

.article-content blockquote {
    border-left: 3px solid rgba(255, 255, 255, 0.5);
    padding: 12px 24px;
    margin: 1.5em 0;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.article-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.9em;
}

.article-content pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 24px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content ul, .article-content ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.article-content li {
    margin-bottom: 0.4em;
}

/* --- 阅读更多按钮 (truncated content) --- */
.read-more {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.read-more:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* --- 底部导航容器 --- */
#scroll-footer {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* --- 导航箭头 --- */
#scroll-arrows {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 18px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.arrow-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.arrow-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.arrow-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* --- 圆点指示器 --- */
#dot-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.4s ease;
}

.dot.active {
    background: #fff;
    width: 24px;
    border-radius: 3px;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* --- 时间线导航 --- */
#timeline-wrap {
    width: 100%;
    max-width: 80vw;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#timeline-wrap::-webkit-scrollbar {
    display: none;
}

#timeline {
    display: flex;
    gap: 0;
    white-space: nowrap;
    padding: 4px 0;
    min-width: 100%;
    justify-content: center;
}

.timeline-item {
    display: inline-flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.timeline-item:hover {
    opacity: 0.7;
}

.timeline-item.active {
    opacity: 1;
}

.timeline-item .tl-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.timeline-item.active .tl-dot {
    width: 7px;
    height: 7px;
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.timeline-item .tl-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    margin-left: 6px;
    transition: color 0.3s ease;
}

.timeline-item.active .tl-label {
    color: #fff;
}

.timeline-item .tl-line {
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin-left: 6px;
    flex-shrink: 0;
}

.timeline-item:last-child .tl-line {
    display: none;
}

/* --- 键盘提示 --- */
#keyboard-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 2px;
    animation: fadeInOut 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.6; }
}

/* --- 音乐控制 --- */
#music-toggle {
    position: fixed;
    bottom: 48px;
    right: 48px;
    z-index: 50;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

#music-toggle:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

#music-toggle.playing {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* --- 进度条 --- */
#progress-bar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 99;
    background: transparent;
}

#progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.2));
    transition: width 0.15s linear;
}

/* --- 响应式 --- */
@media (max-width: 1024px) {
    .scroll-article {
        padding: 80px 48px;
    }
    .article-title {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .scroll-article {
        padding: 60px 20px;
    }
    .article-inner {
        padding: 28px 24px;
    }
    .nav-inner {
        padding: 0 20px;
    }
    .site-desc {
        display: none;
    }
    .nav-right a:not(.nav-search) {
        display: none;
    }
    .article-title {
        font-size: 20px;
    }
    .article-content {
        font-size: 14px;
    }
    #scroll-footer {
        bottom: 24px;
        gap: 8px;
    }
    #scroll-arrows {
        bottom: auto;
        padding: 8px 14px;
        gap: 14px;
    }
    #timeline-wrap {
        max-width: 90vw;
    }
    .arrow-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    #music-toggle {
        bottom: 24px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    #keyboard-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .scroll-article {
        padding: 40px 12px;
    }
    .article-inner {
        padding: 20px 16px;
        border-radius: 8px;
    }
    .article-title {
        font-size: 22px;
    }
}
