/* =====================================================
   home.css — 首页专属样式（重构版）
   仅服务 index.html；复用 style.css 的变量体系
   动效原则：只用 transform / opacity / filter
   ===================================================== */

/* -------------------------------------------------
   JS 增强标记
   home.js 启动时给 <html> 加 .hx-js；
   没有 JS 时，所有"待入场"内容保持可见（渐进增强）
   ------------------------------------------------- */

/* -------------------------------------------------
   通用小节眉标
   ------------------------------------------------- */
.section-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--color-text-secondary);
    margin-bottom: 14px;
}

/* =====================================================
   1) Hero · Canvas 极光背景 + 逐字大标题
   ===================================================== */
.hero {
    min-height: 100vh;
    min-height: 100svh;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 底部柔化过渡，让极光融进下一屏 */
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 200px;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(245, 245, 247, 0), var(--color-bg));
}

/* 覆盖 style.css 的整体入场动画：
   视差由 home.js 写内联 transform，动画 fill 会顶掉它 */
.hero .hero-content {
    animation: none;
    z-index: 2;
    max-width: 900px;
    will-change: transform, opacity;
}

.hero .scroll-indicator {
    z-index: 2;
}

/* 眉标 */
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 26px;
    animation: hx-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-eyebrow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pro-gradient);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    animation: hx-dot 2.4s ease-in-out infinite;
}

/* 超大标题 */
.hero .hero-title {
    font-size: clamp(34px, 10.8vw, 128px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.04;
    margin-bottom: 22px;
}

/* 逐字入场：home.js 拆字后加 .is-split，
   每个字符带 --i 序号做错峰延迟 */
.hero-title.is-split .hero-char {
    display: inline-block;
    opacity: 0;
    animation: hx-char-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(0.3s + var(--i, 0) * 0.05s);
    will-change: transform, opacity, filter;
}

/* CTA 组 */
.hero .hero-actions {
    animation: hx-fade-up 0.9s cubic-bezier(0.16, 1, 0.3, 1) 1.15s both;
}

@keyframes hx-fade-up {
    from {
        opacity: 0;
        transform: translate3d(0, 32px, 0);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes hx-char-in {
    from {
        opacity: 0;
        transform: translate3d(0, 0.55em, 0) scale(0.94);
        filter: blur(16px);
    }
    55% {
        filter: blur(7px);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
        filter: blur(0);
    }
}

@keyframes hx-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.45); opacity: 0.55; }
}

/* =====================================================
   2) 宣言区 · sticky 满屏，随滚动逐词点亮
   ===================================================== */
.manifesto {
    position: relative;
    height: 260vh;
    background: var(--color-bg);
}

.manifesto-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 3.4vh, 36px);
    padding: 0 24px;
}

.manifesto-kicker {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--color-text-secondary);
}

.manifesto-line {
    max-width: min(1020px, 92vw);
    text-align: center;
    font-size: clamp(26px, 5.2vw, 58px);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.55;
}

.manifesto-word {
    position: relative;
    display: inline-block;
    margin: 0 0.1em 0.12em;
    color: var(--color-text);
}

/* 渐变副本：用 attr(data-w) 叠在原词上，opacity 渐显 */
.manifesto-word::after {
    content: attr(data-w);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: var(--pro-gradient);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

/* 静态模式（无 JS / 减少动画）：整句直接全亮为渐变字 */
.manifesto:not(.is-tracking) .manifesto-word::after {
    opacity: 1;
}

/* 追踪模式：未点亮的词是浅灰；
   点亮过程只动 ::after 渐变副本的 opacity（不动 color，保证合成器友好） */
.manifesto.is-tracking .manifesto-word {
    color: rgba(29, 29, 31, 0.13);
}

.manifesto.is-tracking .manifesto-word.lit::after {
    opacity: 1;
}

.manifesto-sub {
    font-size: clamp(13px, 1.6vw, 15px);
    color: var(--color-text-secondary);
}

/* =====================================================
   3) 关于我 · Pinned 堆叠卡片
   ===================================================== */

/* style.css 给 .about 设了 overflow:hidden，会废掉 sticky；
   这里恢复为 visible，装饰性 ::before 直接关掉（卡片自带光斑） */
.about {
    overflow: visible;
}

.about::before {
    display: none;
}

.pin-stack {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px;
}

.pin-card {
    position: relative;
    display: flex;
    min-height: clamp(300px, 44vh, 430px);
    padding: 46px 44px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    transform-origin: 50% 0;
    will-change: transform;
    transition: box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}

.pin-card:hover {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.11);
    border-color: rgba(102, 126, 234, 0.25);
}

/* 3D 倾斜层：home.js 在桌面端写入 rotateX/rotateY；
   滚动缩放写在外层 .pin-card 上，两者互不打架 */
.pin-body {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out;
    will-change: transform;
}

/* 指针跟随光斑（--mx/--my 由 home.js 写在 .pin-card 上，继承进来） */
.pin-body::after {
    content: "";
    position: absolute;
    inset: -24px;
    border-radius: var(--radius-lg);
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%),
            rgba(102, 126, 234, 0.16) 0%, rgba(240, 147, 251, 0.08) 42%, transparent 64%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.pin-card:hover .pin-body::after {
    opacity: 1;
}

.pin-card + .pin-card {
    margin-top: 26px;
}

/* 每张卡右上角一团淡淡的色晕 */
.pin-card::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -80px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--pin-accent, rgba(102, 126, 234, 0.18)) 0%, transparent 65%);
    pointer-events: none;
}

.pin-card:nth-child(1) { --pin-accent: rgba(102, 126, 234, 0.20); }
.pin-card:nth-child(2) { --pin-accent: rgba(240, 147, 251, 0.20); }
.pin-card:nth-child(3) { --pin-accent: rgba(79, 172, 254, 0.22); }

/* 描边大序号：浮在最上层（translateZ），带一点呼吸浮动 */
.pin-index {
    position: absolute;
    top: -20px;
    right: -10px;
    font-size: clamp(52px, 7vw, 88px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(29, 29, 31, 0.14);
    pointer-events: none;
    transform: translateZ(28px);
    animation: hx-float-y 6s ease-in-out infinite;
}

@keyframes hx-float-y {
    0%, 100% { transform: translateZ(28px) translate3d(0, 0, 0); }
    50% { transform: translateZ(28px) translate3d(0, -8px, 0); }
}

.pin-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 16px;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    transform: translateZ(22px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 悬停时图标凑近一点、歪头打个招呼 */
.pin-card:hover .pin-icon {
    transform: translateZ(22px) scale(1.1) rotate(-5deg);
}

.pin-card:nth-child(2) .pin-icon {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.25);
}

.pin-card:nth-child(3) .pin-icon {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 8px 20px rgba(79, 172, 254, 0.28);
}

.pin-title {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    letter-spacing: -0.015em;
    transform: translateZ(14px);
}

.pin-text {
    max-width: 520px;
    font-size: clamp(15px, 1.8vw, 17px);
    line-height: 1.7;
    color: var(--color-text-secondary);
    transform: translateZ(6px);
}

.pin-tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    transform: translateZ(6px);
}

/* 桌面 + 非减少动画时，由 home.js 加 .is-pinned 启用吸顶堆叠 */
.pin-stack.is-pinned {
    padding-bottom: 8vh;
}

.pin-stack.is-pinned .pin-card {
    position: sticky;
}

.pin-stack.is-pinned .pin-card:nth-child(1) {
    top: calc(var(--nav-height) + 26px);
    z-index: 1;
}

.pin-stack.is-pinned .pin-card:nth-child(2) {
    top: calc(var(--nav-height) + 50px);
    z-index: 2;
    margin-top: 14vh;
}

.pin-stack.is-pinned .pin-card:nth-child(3) {
    top: calc(var(--nav-height) + 74px);
    z-index: 3;
    margin-top: 14vh;
}

/* =====================================================
   4) 回忆横滚区 · 垂直滚动驱动横向位移（暗色舞台）
   ===================================================== */
.hscroll {
    position: relative;
    padding: 88px 0;
    background: #0c0c0e;
    color: #f5f5f7;
}

.hscroll-sticky {
    position: static;
}

/* 默认（无 JS / 移动端 / 减少动画）：原生横向滑动 */
.hscroll-track {
    display: flex;
    align-items: center;
    gap: clamp(18px, 2.4vw, 34px);
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hscroll-track::-webkit-scrollbar {
    display: none;
}

/* home.js 加 .is-driven 后：300vh 滚动行程 + sticky 视口 */
.hscroll.is-driven {
    height: 300vh;
    padding: 0;
}

.hscroll.is-driven .hscroll-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hscroll.is-driven .hscroll-track {
    width: max-content;
    overflow: visible;
    scroll-snap-type: none;
    will-change: transform;
}

/* 开头介绍块 */
.hscroll-head {
    flex: none;
    width: min(400px, 78vw);
    padding-right: clamp(16px, 3vw, 48px);
}

.hscroll-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: rgba(245, 245, 247, 0.5);
    margin-bottom: 18px;
}

.hscroll-title {
    font-size: clamp(34px, 4.6vw, 56px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 18px;
    background: linear-gradient(120deg, #ffffff 30%, #a5b4fc 70%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hscroll-text {
    font-size: clamp(14px, 1.6vw, 16px);
    line-height: 1.7;
    color: rgba(245, 245, 247, 0.62);
    margin-bottom: 30px;
}

/* 缩略卡 */
.hscroll-card {
    flex: none;
    width: clamp(215px, 25vw, 320px);
    margin: 0;
    scroll-snap-align: center;
}

.hscroll-frame {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: #17171a;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.hscroll-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hscroll-card:hover .hscroll-frame img {
    transform: scale(1.06);
}

.hscroll-cap {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: rgba(245, 245, 247, 0.55);
}

/* 底部进度细条（仅驱动模式） */
.hscroll-bar {
    display: none;
}

.hscroll.is-driven .hscroll-bar {
    display: block;
    position: absolute;
    left: max(24px, calc((100vw - 1180px) / 2));
    right: max(24px, calc((100vw - 1180px) / 2));
    bottom: 34px;
    height: 2px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.hscroll-bar-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #667eea, #f093fb, #4facfe);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

/* =====================================================
   5) Marquee 跑马灯
   ===================================================== */
.marquee {
    position: relative;
    z-index: 2;
    overflow: hidden;
    padding: 24px 0;
    background: var(--color-text);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: hx-marquee 26s linear infinite;
    will-change: transform;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

.marquee-group {
    flex: none;
    padding-right: 56px;
    white-space: nowrap;
    font-size: clamp(15px, 1.8vw, 19px);
    font-weight: 600;
    letter-spacing: 0.14em;
    color: rgba(245, 245, 247, 0.85);
}

@keyframes hx-marquee {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-50%, 0, 0); }
}

/* =====================================================
   6) 联系我 · 超大标题
   ===================================================== */
.contact-title-xl {
    font-size: clamp(56px, 14vw, 150px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 20px;
}

.contact-fine {
    margin-top: 44px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* =====================================================
   7) home.js 专属入场 reveal（.hx-reveal → .hx-in）
   与 main.js 的 .reveal 互不干扰
   ===================================================== */
.hx-js .hx-reveal {
    opacity: 0;
    transform: translate3d(0, 34px, 0);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.hx-js .hx-reveal.hx-in {
    opacity: 1;
    transform: none;
}

/* 横滚卡片错峰 */
.hscroll-track > .hx-reveal:nth-child(2) { transition-delay: 0.04s; }
.hscroll-track > .hx-reveal:nth-child(3) { transition-delay: 0.08s; }
.hscroll-track > .hx-reveal:nth-child(4) { transition-delay: 0.12s; }
.hscroll-track > .hx-reveal:nth-child(5) { transition-delay: 0.16s; }
.hscroll-track > .hx-reveal:nth-child(6) { transition-delay: 0.20s; }
.hscroll-track > .hx-reveal:nth-child(7) { transition-delay: 0.24s; }

/* =====================================================
   8) 响应式（<=768px：堆叠与横滚降级为普通布局）
   ===================================================== */
@media (max-width: 768px) {
    .hero .hero-content {
        max-width: 100%;
    }

    .pin-card {
        min-height: 0;
        padding: 34px 26px;
    }

    .pin-index {
        top: -16px;
        right: -6px;
    }

    /* 横滚区强制退回原生滑动，禁用滚动劫持 */
    .hscroll.is-driven {
        height: auto;
        padding: 72px 0;
    }

    .hscroll.is-driven .hscroll-sticky {
        position: static;
        height: auto;
        display: block;
        overflow: visible;
    }

    .hscroll.is-driven .hscroll-track {
        width: auto;
        overflow-x: auto;
        transform: none !important;
    }

    .hscroll-bar {
        display: none !important;
    }

    .hscroll-head {
        padding-right: 8px;
    }

    .contact-fine {
        margin-top: 32px;
    }
}

/* =====================================================
   9) prefers-reduced-motion：一切重动效静止/降级
   （home.js 也会同步摘掉驱动类，这里是 CSS 双保险）
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .hero-eyebrow,
    .hero-eyebrow-dot,
    .hero .hero-actions {
        animation: none !important;
    }

    .hero-title.is-split .hero-char {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .manifesto-word::after {
        transition: none !important;
    }

    /* 宣言直接全亮（渐变字） */
    .manifesto-word::after {
        opacity: 1 !important;
    }

    .manifesto.is-tracking .manifesto-word {
        color: var(--color-text);
    }

    /* pinned 退化为普通流 */
    .pin-stack.is-pinned .pin-card {
        position: relative;
        top: auto;
    }

    .pin-stack.is-pinned .pin-card + .pin-card {
        margin-top: 26px;
    }

    .pin-card {
        transform: none !important;
        filter: none !important;
    }

    /* 卡片 3D 倾斜 / 光斑 / 浮动序号全部静止 */
    .pin-body {
        transform: none !important;
        transition: none !important;
    }

    .pin-body::after {
        opacity: 0 !important;
        transition: none !important;
    }

    .pin-index {
        animation: none !important;
        transform: none !important;
    }

    .pin-icon,
    .pin-card:hover .pin-icon {
        transform: none !important;
        transition: none !important;
    }

    .pin-title,
    .pin-text,
    .pin-tag {
        transform: none !important;
    }

    /* 横滚退化为静态原生滑动 */
    .hscroll.is-driven {
        height: auto;
        padding: 88px 0;
    }

    .hscroll.is-driven .hscroll-sticky {
        position: static;
        height: auto;
        display: block;
        overflow: visible;
    }

    .hscroll.is-driven .hscroll-track {
        width: auto;
        overflow-x: auto;
        transform: none !important;
    }

    .hscroll-frame img {
        transition: none;
    }

    .marquee-track {
        animation: none !important;
    }

    .hx-js .hx-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
