/* ============================================
   深色科技 + Glassmorphism 设计令牌
   ============================================ */
:root {
    --bg: #000000;
    --bg-2: #000000;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8e8ef;
    --text-2: #a0a0b0;
    --text-3: #6b6b7d;
    --accent: #22d3ee;
    --accent-2: #a78bfa;
    --accent-soft: rgba(34, 211, 238, 0.12);
    --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
    --radius: 16px;
    --radius-sm: 8px;
    --glass-blur: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glow: 0 0 24px rgba(34, 211, 238, 0.15);
}

/* ============================================
   白天（亮色）主题：覆盖变量与硬编码深色
   ============================================ */
html[data-theme="light"] {
    --bg: #ffffff;
    --bg-2: #ffffff;
    --surface: rgba(255, 255, 255, 0.65);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --border: rgba(15, 15, 30, 0.10);
    --border-strong: rgba(15, 15, 30, 0.18);
    --text: #1c1c28;
    --text-2: #4d4d5c;
    --text-3: #8a8a99;
    --accent: #0891b2;
    --accent-2: #7c3aed;
    --accent-soft: rgba(8, 145, 178, 0.10);
    --shadow: 0 8px 32px rgba(15, 15, 30, 0.10);
    --glow: 0 0 24px rgba(8, 145, 178, 0.18);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(15, 15, 30, 0.18);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 15, 30, 0.3);
}

html[data-theme="light"] .wechat-popup {
    background: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .wechat-popup::before {
    border-top-color: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .section-header h2 {
    background: linear-gradient(135deg, #1c1c28 30%, var(--text-3));
    -webkit-background-clip: text;
    background-clip: text;
}

html[data-theme="light"] .hero-btn-primary,
html[data-theme="light"] .project-link {
    color: #ffffff;
}

html[data-theme="light"] .blog-article-content code {
    color: #be185d;
}

/* pre 内的 code 恢复继承，避免整块代码变粉 */
html[data-theme="light"] .blog-article-content pre code {
    color: inherit;
}

html[data-theme="light"] .blog-article-content pre {
    background: #f0f0f6;
    color: #1c1c28;
}

html[data-theme="light"] .code-block-toggle {
    background: rgba(15, 15, 30, 0.06);
}

html[data-theme="light"] .code-block-toggle:hover {
    background: rgba(15, 15, 30, 0.12);
}

html[data-theme="light"] .blog-article-content pre.code-block-collapsed::after {
    background: linear-gradient(to bottom, transparent, #f0f0f6);
}

html[data-theme="light"] .mobile-nav {
    background: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

::selection {
    background: rgba(34, 211, 238, 0.3);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 220px;
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 10vh;
    left: 20px;
    height: 80vh;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: width 0.3s ease, padding 0.3s ease, visibility 0.3s ease, opacity 0.3s ease;
    z-index: 10;
}

.sidebar-toggle {
    position: fixed;
    top: 10vh;
    left: 20px;
    z-index: 1001;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, left 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
}

/* 侧边栏展开时：按钮只显示 ✕，隐藏圆角方块 */
.sidebar-toggle.expanded {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.sidebar-toggle.expanded:hover {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
}

/* 右上角按钮：与左上角对称（面板右边缘对齐），收起面板时隐藏 */
.sidebar-toggle-right {
    left: 208px;
}

.sidebar-toggle-right:not(.expanded) {
    display: none;
}

.sidebar-toggle.hidden {
    left: -40px;
}

/* 移动端顶部导航 - 默认隐藏 */
.mobile-nav {
    display: none;
}

.sidebar.collapsed {
    width: 0;
    padding: 40px 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
}

.sidebar.collapsed + .main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.profile-section {
    text-align: center;
    margin-bottom: 40px;
}

.avatar {
    margin-bottom: 20px;
}

.profile-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    transition: all 0.3s ease;
    border: 2px solid var(--border-strong);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08), var(--glow);
}

.profile-img:hover {
    transform: scale(4.5);
}

.name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.title {
    font-size: 1rem;
    color: var(--text-2);
    margin-bottom: 12px;
    font-weight: 400;
}

.location {
    font-size: 0.875rem;
    color: var(--text-3);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 主题切换按钮（太阳/月亮） */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    transform: scale(1.15);
}

/* 白天显示太阳，晚上显示月亮 */
html[data-theme="light"] .theme-toggle .icon-moon,
html:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;

    transform: scale(1)
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--surface);
    color: var(--text-2);
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    border: 1px solid var(--border);
}

.social-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-1px);
    border-color: var(--accent);
    box-shadow: var(--glow);
}

.social-icon {
    width: 20px;
    height: 20px;
}

/* 联系我区块的社交图标 */
.contact-social {
    margin-top: 32px;
}

/* Hero 首屏的社交图标：左对齐 */
.hero-social {
    justify-content: flex-start;
    margin-top: 8px;
}

/* 微信弹窗样式 */
.wechat-container {
    position: relative;
    display: inline-block;
}

.wechat-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    min-width: 160px;
}

.wechat-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(18, 18, 26, 0.85);
}

.wechat-container:hover .wechat-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

.wechat-popup-content {
    text-align: center;
}

.wechat-qrcode {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.wechat-info {
    color: var(--text);
}

.wechat-id {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text);
}

.wechat-tip {
    font-size: 11px;
    color: var(--text-2);
    margin: 0;
}

.nav-section {
    margin-top: auto;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 8px;
}

.nav-link {
    display: block;
    color: var(--text-2);
    text-decoration: none;
    padding: 16px 0;
    border-radius: 0;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link.active {
    color: var(--accent);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--gradient);
    border-radius: 2px;
    box-shadow: var(--glow);
}

/* Main Content Styles */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 80px 80px 80px 32px;
    /* 不要加 overflow-y: auto：高度无约束时它是空操作，还会把 sticky 目录的滚动祖先从视口抢走 */
    background: transparent;
}

.content-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 90px 0 30px;
    scroll-margin-top: 20px;
}

/* Hero 首屏 */
.hero {
    min-height: 72vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
    animation: fade-up 0.5s ease;
}

.hero-greeting {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.hero-name {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero-tagline {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 24px;
}

.hero-desc {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-3);
    max-width: 560px;
    margin-bottom: 40px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-btn-primary {
    background: var(--gradient);
    color: #0a0a0f;
}

.hero-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.hero-btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.hero-btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--glow);
}

/* 博客详情独立视图 */
.page-sections.hidden {
    display: none;
}

.blog-detail-view {
    display: none;
    padding-top: 40px;
}

.blog-detail-view.active {
    display: block;
}

/* 页脚 */
.site-footer {
    max-width: 1000px;
    margin: 60px auto 0;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-3);
    font-size: 0.875rem;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 40px;
    text-align: left;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 30%, var(--text-3));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.section-header p {
    color: var(--text-2);
    font-size: 1.125rem;
    font-weight: 400;
}

/* About Section Tabs */
.about-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 0;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.about-tab {
    padding: 12px 28px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-3);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    user-select: none;
}

.about-tab:hover {
    color: var(--text);
}

.about-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.about-tab-content {
    display: none;
}

.about-tab-content.active {
    display: block;
}

/* About Section */
.about-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-2);
    max-width: 600px;
}

.about-content p {
    margin-bottom: 20px;
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.gallery-image {
    width: 100%;
    /* height: 300px; */
    object-fit: fill;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-image__exercise {
    width: 26%;
    /* height: 300px; */
}

.gallery-image:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow), var(--glow);
}

/* Skills Section */
.skills-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.skill-category h3 {
    color: var(--text);
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tag {
    background: var(--surface);
    color: var(--text-2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.skill-tag:hover {
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-1px);
    border-color: var(--accent);
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.project-card {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow), var(--glow);
}

.project-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.project-info p {
    color: var(--text-2);
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.project-tech span {
    background: var(--surface-strong);
    color: var(--text-2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
}

.project-links {
    display: flex;
    gap: 15px;
    margin-top: auto;
    padding-top: 16px;
}

.project-link {
    display: inline-block;
    background: var(--gradient);
    color: #0a0a0f;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.project-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow);
}

/* Blog Section */
.blog-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.blog-card {
    display: flex;
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    cursor: pointer;
    gap: 24px;
}

.blog-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow), var(--glow);
}

.blog-card-image {
    width: 240px;
    height: 160px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--bg-2);
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
    transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 24px;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-3);
}

.blog-card-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.blog-card-tag {
    background: var(--surface-strong);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-2);
    border: 1px solid var(--border);
}

.blog-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.4;
}

.blog-card-excerpt {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    transition: gap 0.2s ease;
}

.blog-card:hover .blog-card-read-more {
    gap: 10px;
}

/* Blog Detail Section */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 30px;
}

.back-button:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.blog-article {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius);
    padding: 58px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 1000px;
    margin: 0 auto;
}

.blog-article-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.blog-article-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.3;
}

.blog-article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-3);
    font-size: 0.875rem;
}

.blog-article-date,
.blog-article-tag {
    display: flex;
    align-items: center;
    gap: 6px;
}

.blog-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.blog-article-tag {
    background: var(--surface-strong);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.blog-article-hero {
    width: 100%;
    height: 320px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
    background: var(--bg-2);
}

.blog-article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
}

.blog-article-content {
    color: var(--text-2);
    font-size: 1.0625rem;
    line-height: 1.8;
    flex: 1;
    min-width: 0;
    /* 长 URL、长英文 token 等超出时自动换行（overflow-wrap 会被继承） */
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 文章主体布局 - 侧边目录 */
.blog-article-body {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.blog-article-sidebar {
    width: 168px;
    flex-shrink: 0;
    position: sticky;
    top: 40px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* 目录样式 */
.toc-header {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 4px;
    margin-bottom: 12px;
    padding: 0 16px 8px 16px;
    border-bottom: 1px solid var(--border);
}

.toc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-2);
    transition: all 0.2s ease;
    padding: 0;
}

.toc-toggle-btn {
    width: auto;
    padding: 0 8px;
    gap: 4px;
}

.toc-toggle-text {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.toc-scroll-top-btn {
    width: 28px;
    flex-shrink: 0;
}

.toc-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.toc-toggle-btn svg {
    transition: transform 0.25s ease;
}

.toc-toggle-btn.collapsed svg {
    transform: rotate(-90deg);
}

.toc-header.toc-collapsed {
    border-bottom-color: transparent;
    margin-bottom: 0;
    padding-bottom: 0;
}

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

.toc-item {
    margin-bottom: 4px;
}

.toc-link {
    display: block;
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.toc-link:hover {
    color: var(--text);
    background: var(--surface-strong);
}

.toc-link.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
}

.toc-level-1 .toc-link {
    font-weight: 500;
}

.toc-level-2 .toc-link {
    padding-left: 16px;
}

.toc-level-3 .toc-link {
    padding-left: 24px;
    font-size: 0.75rem;
}

/* 文章内容中的标题 */
.blog-article-content h1,
.blog-article-content h2,
.blog-article-content h3 {
    color: var(--text);
    margin-top: 32px;
    margin-bottom: 16px;
    font-weight: 600;
}

.blog-article-content h2 {
    font-size: 1.5rem;
}

.blog-article-content h3 {
    font-size: 1.25rem;
}

.blog-article-content p {
    margin-bottom: 16px;
}

.blog-article-content ul,
.blog-article-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.blog-article-content li {
    margin-bottom: 8px;
}

.blog-article-content code {
    background: var(--surface-strong);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.9em;
    color: #f472b6;
    border: 1px solid var(--border);
}

.blog-article-content pre {
    background: #0d0d14;
    color: #e8e8ef;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-x: auto;
    margin-bottom: 20px;
}

.blog-article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* 代码块展开/收起 */
.code-block-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.code-block-wrapper pre {
    margin-bottom: 0;
    transition: max-height 0.4s ease;
}

.code-block-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.5;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.code-block-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.blog-article-content pre.code-block-collapsed {
    max-height: 16em;
    overflow: hidden;
    position: relative;
}

.blog-article-content pre.code-block-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3em;
    background: linear-gradient(to bottom, transparent, #0d0d14);
    pointer-events: none;
}

.blog-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 20px 0;
}

.blog-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9375rem;
}

.blog-article-content thead {
    background: var(--surface-strong);
}

.blog-article-content th {
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    text-align: left;
    font-weight: 600;
    color: var(--text);
}

.blog-article-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text-2);
}

.blog-article-content tr:hover {
    background: var(--surface);
}

.blog-article-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-2);
    font-style: italic;
}

.blog-article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-article-content a:hover {
    color: var(--accent-2);
}

/* Experience Section */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-strong);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 24px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg);
    box-shadow: var(--glow);
}

.timeline-date {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-content h3 {
    color: var(--text);
    margin-bottom: 4px;
    font-size: 1.125rem;
    font-weight: 600;
}

.company {
    color: var(--text-3);
    font-style: normal;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.timeline-content p {
    color: var(--text-2);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Contact Section */
.contact-content {
    text-align: center;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-2);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* backdrop-filter 不支持时的降级：玻璃面改用实色 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sidebar,
    .project-card,
    .blog-card,
    .blog-article,
    .timeline-item,
    .wechat-popup,
    .mobile-nav,
    .back-button,
    .toc-btn {
        background: var(--bg-2);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* 隐藏侧边栏 */
    .sidebar {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    /* 顶部简约导航 */
    .mobile-nav {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(10, 10, 15, 0.8);
        backdrop-filter: blur(var(--glass-blur));
        -webkit-backdrop-filter: blur(var(--glass-blur));
        border-bottom: 1px solid var(--border);
        padding: 10px 15px;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-nav-title {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text);
    }

    .mobile-nav-menu {
        display: flex;
        gap: 15px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile-nav-link {
        color: var(--text-2);
        text-decoration: none;
        font-size: 0.875rem;
        padding: 5px 8px;
        border-radius: 4px;
        transition: all 0.2s;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link.active {
        color: var(--accent);
        background: var(--accent-soft);
    }

    .main-content {
        margin-left: 0;
        padding: 70px 20px 30px;
    }

    .content-section {
        padding: 50px 0 20px;
        scroll-margin-top: 60px;
    }

    .hero {
        min-height: 60vh;
    }

    .about-tabs {
        overflow-x: auto;
    }

    .about-tab {
        padding: 12px 14px;
        white-space: nowrap;
    }

    .blog-article {
        padding: 28px 20px;
    }

    /* 宽表格在移动端允许横向滚动，避免撑破版面 */
    .blog-article-content table {
        display: block;
        overflow-x: auto;
    }

    /* 文章内联排图片（markdown 内联 flex）移动端换行堆叠 */
    .blog-article-content div[style*="display: flex"],
    .blog-article-content div[style*="display:flex"] {
        flex-wrap: wrap !important;
    }

    /* 联排图片之间的分隔竖线在堆叠后无意义，隐藏 */
    .blog-article-content div[style*="width:1px"] {
        display: none !important;
    }

    /* 覆盖 markdown 内联的固定宽度，图片自适应容器 */
    .blog-article-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    .blog-article-body {
        flex-direction: column;
    }

    /* 列布局下 align-items:flex-start 会让内容区按内容宽度收缩，需显式撑满 */
    .blog-article-content {
        width: 100%;
    }

    .blog-article-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 24px;
    }

    .article-toc {
        display: none; /* 移动端隐藏侧边目录，可根据需要改为折叠形式 */
    }

    .blog-card {
        flex-direction: column;
        gap: 0;
    }

    .blog-card-image {
        width: 100%;
        height: 200px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-item {
        padding-left: 20px;
    }

    .timeline-item::before {
        left: -18px;
    }
}

@media (max-width: 480px) {
    .name {
        font-size: 1.5rem;
    }

    .title {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}
