/* ========== 基础 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #030712;
    --bg-card: #0f172a;
    --primary: #6366f1;
    --primary-glow: #818cf8;
    --cyan: #22d3ee;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --hud-color: #22d3ee;
    --hud-dim: rgba(34, 211, 238, 0.4);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.hidden { display: none !important; }

/* ========== Intro 层 ========== */
.intro-layer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    opacity: 1;
    transition: opacity 1.2s ease;
}

.intro-layer.fade-out {
    opacity: 0;
    pointer-events: none;
}

#intro-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========== HUD ========== */
.intro-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    font-family: 'Courier New', Consolas, monospace;
    color: var(--hud-color);
    text-shadow: 0 0 8px var(--hud-dim);
    overflow: hidden;
}

.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--hud-color);
    border-style: solid;
    opacity: 0.7;
}

.hud-tl { top: 24px; left: 24px; border-width: 2px 0 0 2px; }
.hud-tr { top: 24px; right: 24px; border-width: 2px 2px 0 0; }
.hud-bl { bottom: 24px; left: 24px; border-width: 0 0 2px 2px; }
.hud-br { bottom: 24px; right: 24px; border-width: 0 2px 2px 0; }

.hud-scanline {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

.hud-top {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-label {
    font-size: 11px;
    letter-spacing: 4px;
    opacity: 0.6;
}

.hud-status {
    font-size: 14px;
    letter-spacing: 2px;
    animation: hudBlink 2s ease-in-out infinite;
}

@keyframes hudBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hud-left {
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hud-right {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: right;
}

.hud-readout {
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.85;
}

.hud-bottom {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: min(400px, 80vw);
}

.hud-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    letter-spacing: 1px;
}

.hud-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(34, 211, 238, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

#hud-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--hud-color);
    box-shadow: 0 0 10px var(--hud-color);
    transition: width 0.2s;
}

.hud-center-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    letter-spacing: 6px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s;
    white-space: nowrap;
}

.hud-center-msg.visible {
    opacity: 1;
}

/* Warp 闪白 */
.warp-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #fff 0%, #6366f1 40%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.warp-flash.active {
    animation: warpFlash 1.2s ease-out forwards;
}

@keyframes warpFlash {
    0% { opacity: 0; transform: scale(0.5); }
    30% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(2); }
}

/* ========== 主站占位 ========== */
.main-site {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.main-site.visible {
    opacity: 1;
}

/* AT 主站关键布局（防止 home.css 缓存失效） */
#at-app { position: relative; min-height: 100vh; }
#home-canvas-wrap { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#home-canvas { display: block; width: 100%; height: 100%; }
.at-scroll-track { position: relative; z-index: 1; height: calc(var(--panel-count, 4) * 100vh); }
.at-panel { position: sticky; top: 0; height: 100vh; min-height: 100vh; overflow: hidden; isolation: isolate; }
.at-panel-project { background: #000; }
.at-panel-end { background: #000; }
.at-loader { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.at-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.6s, visibility 0.6s; }

.home-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 48px 24px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(34, 211, 238, 0.06) 0%, transparent 50%),
        var(--bg);
}

.home-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

.home-particles {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.25) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.15) 0%, transparent 100%);
    animation: particleDrift 20s linear infinite;
}

@keyframes particleDrift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

.home-content {
    position: relative;
    text-align: center;
    max-width: 640px;
}

.home-tag {
    font-size: 12px;
    letter-spacing: 6px;
    color: var(--cyan);
    margin-bottom: 16px;
    opacity: 0.8;
}

.home-title {
    font-size: clamp(36px, 8vw, 56px);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--primary-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.home-desc {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 36px;
}

.home-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.home-btn {
    padding: 12px 28px;
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.5);
    color: var(--primary-glow);
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s, box-shadow 0.3s;
}

.home-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.home-projects-placeholder {
    height: 0;
    overflow: hidden;
}

.home-footer {
    position: absolute;
    bottom: 24px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.5;
}

.home-footer a {
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .hud-left, .hud-right { display: none; }
    .hud-corner { width: 24px; height: 24px; }
    .hud-tl, .hud-tr { top: 12px; }
    .hud-bl, .hud-br { bottom: 12px; }
    .hud-tl, .hud-bl { left: 12px; }
    .hud-tr, .hud-br { right: 12px; }
}
