/* ================================================================
   首页内嵌滚动 3D 模块（原「关节模组全部件结构拆解」位置）
   ----------------------------------------------------------------
   与独立的 demo-scroll.html 共用同一套模型 / 机位 / 暗调影棚，
   但把 fixed 全屏画布改成了「section 内 sticky 画布」：
   模块本身占 5 屏滚动行程，画布只在模块范围内粘住，
   离开模块后首页其余内容照常接管页面。
   ================================================================ */

.hsd {
    --hsd-bg: #050505;
    position: relative;
    height: 500vh;
    height: 500svh;
    margin: 0;
    padding: 0;
    background: var(--hsd-bg);
}
.hsd *,
.hsd *::before,
.hsd *::after { box-sizing: border-box; }
.hsd p, .hsd h2, .hsd h3, .hsd dl, .hsd dt, .hsd dd { margin: 0; }

.hsd-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    background: var(--hsd-bg);
    isolation: isolate;
}

/* ---- 3D 画布与兜底 ---- */
.hsd-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: var(--hsd-bg);
    z-index: 0;
}
.hsd-fallback {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--hsd-bg);
}
.hsd-fallback[hidden] { display: none; }
.hsd-fallback img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

/* ---- 加载态：定位到当前机位的模型中心 ---- */
.hsd-load {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: block;
    background: rgba(5, 5, 5, 0.28);
    pointer-events: none;
}
.hsd-load[hidden] { display: none; }
.hsd-load-box {
    position: absolute;
    left: var(--hsd-load-x, 50%);
    top: var(--hsd-load-y, 50%);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(360px, 78vw);
    padding: 14px 16px;
    text-align: center;
    background: rgba(5, 5, 5, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.hsd-load-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
}
.hsd-pct {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--fs-16);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}
.hsd-phase {
    max-width: 100%;
    padding: 0 42px;
    font-size: var(--fs-12);
    line-height: 1.5;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    text-align: center;
}
.hsd-load-track {
    height: 2px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.14);
}
.hsd-load-fill {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--accent), var(--accent3));
    transition: transform 0.18s linear;
}

/* ---- 五屏文案：同一块 sticky 画布上切换 ---- */
.hsd-panels {
    position: absolute;
    inset: 0;
    z-index: 3;
}
.hsd-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
}
.hsd-panel.is-active {
    visibility: visible;
    pointer-events: auto;
}
.hsd-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(5, 5, 5, 0.66) 0%,
        rgba(5, 5, 5, 0.12) 32%,
        rgba(5, 5, 5, 0.00) 52%,
        rgba(5, 5, 5, 0.36) 76%,
        rgba(5, 5, 5, 0.82) 100%);
}
.hsd-panel[data-side="right"]::before {
    background: linear-gradient(90deg,
        rgba(5, 5, 5, 0.00) 0%,
        rgba(5, 5, 5, 0.00) 38%,
        rgba(5, 5, 5, 0.34) 64%,
        rgba(5, 5, 5, 0.78) 100%),
        linear-gradient(to bottom,
        rgba(5, 5, 5, 0.52) 0%,
        rgba(5, 5, 5, 0.04) 40%,
        rgba(5, 5, 5, 0.55) 100%);
}
.hsd-panel[data-side="left"]::before {
    background: linear-gradient(270deg,
        rgba(5, 5, 5, 0.00) 0%,
        rgba(5, 5, 5, 0.00) 38%,
        rgba(5, 5, 5, 0.34) 64%,
        rgba(5, 5, 5, 0.78) 100%),
        linear-gradient(to bottom,
        rgba(5, 5, 5, 0.52) 0%,
        rgba(5, 5, 5, 0.04) 40%,
        rgba(5, 5, 5, 0.55) 100%);
}
.hsd-panel[data-panel="0"] { align-items: flex-end; }

/* ---- 文案栏：模型在一侧，文案在另一侧 ---- */
.hsd-copy {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(64px + 7vh) 5% 15vh;
}
.hsd-panel[data-side="right"] .hsd-copy {
    margin-left: 56%;
    margin-right: 5%;
    padding-left: 0;
}
.hsd-panel[data-side="left"] .hsd-copy {
    margin-right: 56%;
    margin-left: 5%;
    padding-right: 0;
}
.hsd-panel[data-panel="0"] .hsd-copy { padding-bottom: 17vh; }

/* ---- 文字层级 ---- */
.hsd-eyebrow {
    margin-bottom: 20px;
    font-size: var(--fs-12);
    line-height: 1.5;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.hsd-display {
    max-width: 15em;
    margin-bottom: 26px;
    color: var(--text-primary);
    font-size: var(--fs-display);
    font-weight: 600;
    line-height: 1.06;
    letter-spacing: -0.015em;
}
.hsd-line { display: block; }
.hsd-lede {
    max-width: 34em;
    color: var(--text-secondary);
    font-size: var(--fs-lede);
    line-height: 1.75;
}
.hsd-tag {
    margin-bottom: 18px;
    color: var(--accent);
    font-size: var(--fs-12);
    line-height: 1.5;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}
.hsd-title {
    max-width: 20em;
    margin-bottom: 34px;
    color: var(--text-primary);
    font-size: var(--fs-title);
    font-weight: 600;
    line-height: 1.14;
    letter-spacing: -0.01em;
}
.hsd-cue {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 38px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--fs-12);
    line-height: 1.5;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
}
.hsd-cue i {
    display: block;
    width: 1px;
    height: 34px;
    background: linear-gradient(to bottom, transparent, var(--text-muted));
    animation: hsd-cue 2.2s ease-in-out infinite;
}
@keyframes hsd-cue {
    0%, 100% { transform: translateY(-6px); opacity: 0.35; }
    50%      { transform: translateY(0);    opacity: 1; }
}

/* ---- 结构条 / 输出端三步 ---- */
.hsd-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 56px;
    max-width: 1000px;
    margin-top: 6px;
}
.hsd-facts > div {
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}
.hsd-facts dt {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: var(--fs-15);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.hsd-facts dd {
    color: var(--text-secondary);
    font-size: var(--fs-14);
    line-height: 1.7;
}
.hsd-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    max-width: 1180px;
}
.hsd-steps article {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}
.hsd-step-num {
    display: block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: var(--fs-12);
    letter-spacing: 0.18em;
}
.hsd-steps h3 {
    margin-bottom: 9px;
    color: var(--text-primary);
    font-size: var(--fs-18);
    font-weight: 600;
}
.hsd-steps p {
    color: var(--text-secondary);
    font-size: var(--fs-14);
    line-height: 1.72;
}

/* ---- 侧边章节导航 ---- */
.hsd-toc {
    position: absolute;
    top: 50%;
    right: 22px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    transform: translateY(-50%);
    pointer-events: none;
}
.hsd-toc button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 18px;
    padding: 7px 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--fs-11);
    line-height: 1;
    letter-spacing: 0.14em;
    text-align: right;
    text-transform: uppercase;
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.3s ease;
}
.hsd-toc button:hover,
.hsd-toc button.is-active { color: var(--text-primary); }
.hsd-toc button i {
    display: block;
    width: 2px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.72);
    transition: width 0.25s ease, background 0.25s ease;
}
.hsd-toc button.is-active i {
    width: 18px;
    background: var(--accent);
}
.hsd-toc button span {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    opacity: 0;
    white-space: nowrap;
    transform: translateY(-50%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.hsd-toc button:hover span,
.hsd-toc button.is-active span { opacity: 1; }

/* ---- 响应式 ---- */
@media (max-width: 1100px) {
    .hsd-facts { gap: 20px 36px; }
    .hsd-steps { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 900px) {
    .hsd-toc { display: none; }
}
@media (max-width: 768px) {
    .hsd-copy,
    .hsd-panel[data-side="right"] .hsd-copy,
    .hsd-panel[data-side="left"] .hsd-copy {
        margin-left: auto;
        margin-right: auto;
        padding: calc(64px + 5vh) 6% 12vh;
    }
    .hsd-panel { align-items: center; }
    .hsd-panel[data-panel="0"] { align-items: flex-end; }
    .hsd-panel[data-panel="0"] .hsd-copy { padding-bottom: 15vh; }
    .hsd-panel::before,
    .hsd-panel[data-side="right"]::before,
    .hsd-panel[data-side="left"]::before {
        background: linear-gradient(to bottom,
            rgba(5, 5, 5, 0.78) 0%,
            rgba(5, 5, 5, 0.24) 32%,
            rgba(5, 5, 5, 0.18) 55%,
            rgba(5, 5, 5, 0.66) 82%,
            rgba(5, 5, 5, 0.9) 100%);
    }
    .hsd-display { font-size: var(--fs-display-sm); line-height: 1.12; }
    .hsd-title { font-size: var(--fs-title-sm); margin-bottom: 24px; }
    .hsd-lede { font-size: var(--fs-15); line-height: 1.72; }
    .hsd-facts { grid-template-columns: 1fr; gap: 16px; }
    .hsd-steps { grid-template-columns: 1fr; gap: 17px; }
    .hsd-cue { margin-top: 26px; }
}
@media (max-width: 768px) {
    .hsd-load-box {
        width: min(200px, 60vw);
        gap: 8px;
        padding: 10px 12px;
    }
    .hsd-load-head { min-height: 18px; }
    .hsd-phase {
        padding: 0 16px;
        font-size: 11px;
        letter-spacing: 0.03em;
    }
    .hsd-pct { font-size: var(--fs-12); }
}
@media (prefers-reduced-motion: reduce) {
    .hsd-panel { transition: none; }
    .hsd-cue i { animation: none; }
}
