/* ==========================================================================
   1. 核心变量与基础重置
   ========================================================================== */
   :root {
    --primary: #ffffff;
    --accent: #00f2ff;
    --bg: #050505;
    --font-mono: 'Space Mono', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; cursor: none; }

body {
    background: var(--bg);
    color: var(--primary);
    font-family: "PingFang SC", "Lantinghei SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ==========================================================================
   2. UI 框架 (Loader / HUD / Canvas)
   ========================================================================== */
#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 1s cubic-bezier(1, 0, 0, 1);
}

.loader-content { width: 200px; text-align: center; }
.loading-text { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; }
.progress-bar { height: 1px; background: rgba(255,255,255,0.1); margin-top: 10px; overflow: hidden; }
.progress { height: 100%; background: var(--accent); width: 0%; transition: 0.5s; }

#canvas-webgl { position: fixed; top: 0; left: 0; z-index: 0; pointer-events: none; }

.hud-top, .hud-bottom-left {
    position: fixed;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    z-index: 10;
}
.hud-top { top: 40px; left: 40px; }
.hud-bottom-left { bottom: 40px; left: 40px; transform: rotate(-90deg); transform-origin: left bottom; }

/* ==========================================================================
   3. 主体布局与文案区
   ========================================================================== */
main { position: relative; z-index: 10; }

.container { 
    padding: 40px; 
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    /* 核心修改：让容器本身不拦截触摸 */
    pointer-events: none; 
}
/* 重新开启 header、title 和 nav 的点击权，否则按钮点不动 */
header, .title-wrap, .main-nav, .nav-more-wrapper {
    pointer-events: auto;
}

/* 针对手机端的特殊处理：让画布层级提前 */
@media (max-width: 768px) {
    #canvas-webgl {
        z-index: 1; /* 提升画布层级 */
        pointer-events: auto; /* 手机端让画布直接接收触摸 */
    }
    main {
        z-index: 5; /* 文字层级略高于画布，但因为 pointer-events: none 依然可以穿透 */
    }
}

header { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 900; letter-spacing: -1px; font-size: 1.2rem; }
.status-dot { font-size: 10px; display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.5); }
.status-dot span { width: 6px; height: 6px; background: #00ff62; border-radius: 50%; box-shadow: 0 0 10px #00ff62; }

.title-wrap { max-width: 800px; }

.main-title {
    font-size: clamp(3.5rem, 12vw, 9rem);
    font-weight: 900; 
    letter-spacing: -4px;
    line-height: 0.8;
}

.sub-slogan { margin-top: 15px; }

.highlight-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.desc-text {
    font-size: 1rem;
    font-weight: 300;
    line-height: 2;
    color: rgba(255,255,255,0.7);
    max-width: 550px;
    border-left: 2px solid var(--accent);
    padding-left: 20px;
}

/* ==========================================================================
   4. 3D 翻转导航 (核心交互)
   ========================================================================== */
.main-nav {
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: flex-end;
}

.nav-link {
    text-decoration: none;
    height: 60px;
    width: 450px;
    position: relative;
    pointer-events: auto;
    transition: transform 0.4s ease;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.nav-link:hover .card-inner {
    transform: rotateX(-90deg) translateY(-50%);
}

.card-front, .card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.card-front {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.card-front span { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); margin-right: 15px; }
.card-front small { font-size: 0.7rem; font-weight: 300; text-transform: uppercase; margin-left: 10px; letter-spacing: 2px; }

.card-back {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    background: rgba(0, 242, 255, 0.05);
    border-right: 4px solid var(--accent);
    padding-right: 20px;
    transform: rotateX(90deg) translateZ(30px);
}

.nav-link:hover .card-front { opacity: 1; }

/* ==========================================================================
   5. 简历详情按钮
   ========================================================================== */
.nav-more-wrapper {
    margin-top: 50px;
    display: flex;
    justify-content: flex-end;
}

.nav-item-more {
    text-decoration: none;
    color: var(--accent);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 3px;
    position: relative;
    padding-bottom: 8px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-item-more::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 1px;
    background-color: var(--accent);
    transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-item-more .arrow { animation: arrowSide 1.5s infinite; }

@keyframes arrowSide {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(8px); opacity: 0.5; }
}

body.hovering .nav-item-more:hover { color: #fff; }
body.hovering .nav-item-more:hover::after { width: 100%; background-color: #fff; }

/* ==========================================================================
   6. 赛博光标 (Cursor)
   ========================================================================== */
#cursor { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; mix-blend-mode: difference; }

.cursor-dot {
    position: absolute;
    width: 4px; height: 4px;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1.5s infinite;
}

.cursor-ring-inner {
    position: absolute;
    width: 30px; height: 30px;
    border: 1px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

.cursor-ring-outer {
    position: absolute;
    width: 46px; height: 46px;
    border: 1px dashed rgba(0, 242, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rotate-reverse 4s linear infinite;
}

body.hovering .cursor-ring-inner { width: 40px; height: 40px; border: 2px solid var(--accent); background: rgba(0, 242, 255, 0.1); }
body.hovering .cursor-ring-outer { width: 20px; height: 20px; border-color: #fff; animation: rotate-fast 0.5s linear infinite; }

@keyframes pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.5; } }
@keyframes rotate-reverse { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes rotate-fast { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ==========================================================================
   7. 入场动画
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px) skewY(2deg); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0) skewY(0); filter: blur(0); }
}

.main-title, .sub-slogan, .nav-link, .nav-item-more { opacity: 0; }

body.loaded .main-title { animation: fadeInUp 1s ease forwards 0.2s; }
body.loaded .sub-slogan { animation: fadeInUp 1s ease forwards 0.4s; }
body.loaded .nav-link:nth-child(1) { animation: fadeInUp 1s ease forwards 0.6s; }
body.loaded .nav-link:nth-child(2) { animation: fadeInUp 1s ease forwards 0.7s; }
body.loaded .nav-link:nth-child(3) { animation: fadeInUp 1s ease forwards 0.8s; }
body.loaded .nav-item-more { animation: fadeInUp 1s ease forwards 1.0s; }

/* ==========================================================================
   8. 移动端适配
   ========================================================================== */
/* --- 移动端导航深度优化 --- */
@media (max-width: 768px) {
    /* 1. 允许手指穿过文字划到球，但按钮本身可点 */
    .container { pointer-events: none; }
    header, .main-nav, .nav-more-wrapper { pointer-events: auto; }

    /* 2. 标题动画：增加一个持续的呼吸效果，不让画面静止 */
    .main-title {
        font-size: 3.2rem;
        animation: titleFloat 4s ease-in-out infinite;
    }
    @keyframes titleFloat {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-10px); }
    }

    /* 3. 导航项：取消悬浮，改为“压感交互” */
    .nav-link {
        width: 100%;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px); /* 增加毛玻璃感，显得高级 */
        border: 1px solid rgba(0, 242, 255, 0.2);
        padding: 20px;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
        flex-direction: column;
        height: auto;
    }

    /* 关键：手机点击瞬间的反馈 */
    .nav-link:active {
        transform: scale(0.95) translateX(10px); /* 向内凹陷并轻微右移 */
        background: rgba(0, 242, 255, 0.15);
        border-color: var(--accent);
    }

    .card-inner { transform: none !important; display: block !important; }

    /* 让文字始终保持高亮，不需要翻转 */
    .card-front {
        position: relative;
        font-size: 1.3rem;
        opacity: 1;
        color: #fff;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 把原来的英文副标题变成一个精致的小标签 */
    .card-back {
        position: relative;
        display: inline-block !important;
        transform: none !important;
        font-size: 0.7rem;
        margin-top: 8px;
        color: var(--accent);
        letter-spacing: 1px;
        background: rgba(0, 242, 255, 0.1);
        padding: 4px 8px;
        border-radius: 2px;
        width: fit-content;
    }
}

/* ==========================================================================
   高级转场：科技感窗帘
   ========================================================================== */
   #transition-curtain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    pointer-events: none; /* 初始状态不干扰点击 */
}

.curtain-panel {
    width: 50%;
    height: 100%;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px); /* 核心：透过窗帘看球体是模糊的 */
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.8s cubic-bezier(0.85, 0, 0.15, 1);
    position: relative;
}

.curtain-panel.left { 
    transform: translateX(-100%); 
    border-right: 1px solid rgba(0, 242, 255, 0.2); 
}

.curtain-panel.right { 
    transform: translateX(100%); 
    border-left: 1px solid rgba(0, 242, 255, 0.2); 
}

.curtain-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 5px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10000;
    text-shadow: 0 0 10px var(--accent);
}

/* --- 激活状态控制 --- */
body.is-transitioning .curtain-panel.left,
body.is-transitioning .curtain-panel.right {
    transform: translateX(0);
}

body.is-transitioning .curtain-loader {
    opacity: 1;
    animation: curtainBlink 1s infinite;
}

@keyframes curtainBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* 二级页面通用布局 */
.page-secondary {
    min-height: 100vh;
    padding: 60px 40px;
    position: relative;
    z-index: 10;
}

/* 强制提升返回按钮的层级，确保它在窗帘之上 */
.btn-close {
    position: fixed; /* 改为 fixed，确保不随页面滚动消失 */
    top: 40px;
    left: 40px;
    z-index: 10001; /* 必须大于窗帘的 9999 */
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    font-family: var(--font-mono);
    cursor: pointer !important;
    pointer-events: auto !important; /* 强制开启点击权限 */
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px var(--accent);
}

/* 二级页面：手机端 9:16 沉浸式布局 */
.vertical-feed {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory; /* 核心：开启纵向吸附 */
    background: #000;
    -webkit-overflow-scrolling: touch;
}

.feed-item {
    height: 100vh;
    width: 100%;
    scroll-snap-align: start; /* 每一屏自动对齐 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    border-bottom: 1px solid rgba(0, 242, 255, 0.1);
}

.video-wrapper {
    width: 100%;
    max-width: 400px; /* 适配大屏手机 */
    aspect-ratio: 9 / 16;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    position: relative;
}

.lazy-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* 当视频加载并进入视野时显示 */
.video-wrapper.is-playing .lazy-video {
    opacity: 1;
}

.project-info {
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    padding: 0 10px;
}

.project-info h3 { color: var(--accent); font-size: 1.2rem; }
.project-info p { font-size: 0.9rem; opacity: 0.6; margin-top: 5px; }