/* ============================================================
   HOME — 首頁專屬佈局與動畫
   依賴 tokens.css + base.css + components.css
   ============================================================ */

/* ── 導航列 ──────────────────────────────────── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--ds-space-4) 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav:hover {
    background: rgba(102, 252, 241, 0.15);
    /* 主題色微亮 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav.scrolled {
    background: rgba(6, 7, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--ds-border);
    padding: var(--ds-space-3) 0;
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    font-family: var(--ds-font-display);
    font-weight: var(--ds-weight-bold);
    font-size: var(--ds-text-xl);
    color: var(--ds-text-primary);
    text-decoration: none;
}

.nav__logo-icon {
    width: 36px;
    height: 36px;
    background: var(--ds-gradient-accent);
    border-radius: var(--ds-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--ds-text-inverse);
    font-weight: var(--ds-weight-black);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--ds-space-1);
}

.nav__link {
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-weight-medium);
    padding: var(--ds-space-2) var(--ds-space-4);
    border-radius: var(--ds-radius-md);
    transition: all var(--ds-transition-fast);
}

.nav__link:hover {
    color: var(--ds-text-primary);
    background: var(--ds-bg-hover);
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
}

/* ── Hero 區 ─────────────────────────────────── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: var(--ds-gradient-hero);
}

.hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding-top: var(--ds-space-20);
}

.hero__badge {
    margin-bottom: var(--ds-space-6);
}

.hero__title {
    font-size: var(--ds-text-hero);
    font-weight: var(--ds-weight-black);
    line-height: 1.1;
    margin-bottom: var(--ds-space-6);
    letter-spacing: -0.03em;
}

.hero__subtitle {
    font-size: var(--ds-text-xl);
    color: var(--ds-text-secondary);
    max-width: 560px;
    margin: 0 auto var(--ds-space-10);
    line-height: var(--ds-leading-relaxed);
}

.hero__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-4);
    margin-bottom: var(--ds-space-10);
}

.hero__stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-12);
    padding-top: var(--ds-space-10);
    border-top: 1px solid var(--ds-border);
}

.hero__stat-value {
    font-family: var(--ds-font-display);
    font-size: var(--ds-text-3xl);
    font-weight: var(--ds-weight-bold);
    color: var(--ds-accent-bright);
    display: block;
}

.hero__stat-label {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-muted);
    margin-top: var(--ds-space-1);
}

/* Hero 背景動畫：網格 */
.hero__grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(69, 162, 158, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(69, 162, 158, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 80%);
}

/* Hero 光暈 */
.hero__glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    animation: glow-pulse 8s ease-in-out infinite;
}

.hero__glow--1 {
    background: rgba(69, 162, 158, 0.08);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
}

.hero__glow--2 {
    background: rgba(102, 252, 241, 0.04);
    bottom: -300px;
    right: -100px;
    width: 500px;
    height: 500px;
    animation-delay: -4s;
}

@keyframes glow-pulse {

    0%,
    100% {
        opacity: 0.6;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.15);
    }
}

/* ── 產品截圖 ────────────────────────────────── */
.showcase {
    background: var(--ds-bg-surface);
    border-top: 1px solid var(--ds-border);
    border-bottom: 1px solid var(--ds-border);
}

.showcase__frame {
    background: var(--ds-bg-card);
    border: 1px solid var(--ds-border-hover);
    border-radius: var(--ds-radius-xl);
    overflow: hidden;
    box-shadow: var(--ds-shadow-xl);
    position: relative;
}

.showcase__topbar {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    background: var(--ds-bg-elevated);
    border-bottom: 1px solid var(--ds-border);
}

.showcase__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ds-bg-hover);
}

.showcase__dot:nth-child(1) {
    background: #ff5f57;
}

.showcase__dot:nth-child(2) {
    background: #ffbd2e;
}

.showcase__dot:nth-child(3) {
    background: #28c940;
}

.showcase__img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: var(--ds-bg-primary);
}

/* Placeholder 模擬圖表畫面 */
.showcase__placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background:
        linear-gradient(180deg,
            var(--ds-bg-primary) 0%,
            rgba(69, 162, 158, 0.03) 50%,
            var(--ds-bg-primary) 100%);
    position: relative;
    overflow: hidden;
}

.showcase__placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            transparent 58px,
            rgba(69, 162, 158, 0.04) 58px,
            rgba(69, 162, 158, 0.04) 60px),
        repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 58px,
            rgba(69, 162, 158, 0.04) 58px,
            rgba(69, 162, 158, 0.04) 60px);
}

/* ── 特色卡片區 ──────────────────────────────── */
.features {
    position: relative;
}

.features::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: rgba(69, 162, 158, 0.04);
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
}

/* ── 定價卡片 ────────────────────────────────── */
.pricing__card {
    text-align: center;
    padding: var(--ds-space-10);
    display: flex;
    flex-direction: column;
}

.pricing__card--featured {
    border-color: var(--ds-accent-dim);
    background: linear-gradient(145deg, #1a2230 0%, #12161e 100%);
    box-shadow: var(--ds-shadow-glow);
    transform: scale(1.03);
}

.pricing__card--featured:hover {
    transform: scale(1.05);
}

.pricing__name {
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ds-text-muted);
    margin-bottom: var(--ds-space-4);
}

.pricing__price {
    font-family: var(--ds-font-display);
    font-size: var(--ds-text-5xl);
    font-weight: var(--ds-weight-black);
    color: var(--ds-text-primary);
    margin-bottom: var(--ds-space-1);
}

.pricing__price span {
    font-size: var(--ds-text-lg);
    font-weight: var(--ds-weight-normal);
    color: var(--ds-text-muted);
}

.pricing__desc {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    margin-bottom: var(--ds-space-8);
}

.pricing__features {
    text-align: left;
    margin-bottom: var(--ds-space-8);
    flex: 1;
}

.pricing__feature {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    padding: var(--ds-space-2) 0;
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
}

.pricing__feature::before {
    content: '✓';
    color: var(--ds-accent);
    font-weight: bold;
    font-size: var(--ds-text-sm);
    flex-shrink: 0;
}

.pricing__feature--disabled {
    opacity: 0.35;
}

.pricing__feature--disabled::before {
    content: '—';
    color: var(--ds-text-muted);
}

/* ── 評價區 ──────────────────────────────────── */
.testimonials {
    background: var(--ds-bg-surface);
    border-top: 1px solid var(--ds-border);
    border-bottom: 1px solid var(--ds-border);
}

.testimonial__card {
    padding: var(--ds-space-8);
}

.testimonial__text {
    font-size: var(--ds-text-lg);
    font-style: italic;
    color: var(--ds-text-secondary);
    line-height: var(--ds-leading-relaxed);
    margin-bottom: var(--ds-space-6);
    position: relative;
    padding-left: var(--ds-space-6);
    border-left: 2px solid var(--ds-accent-dim);
}

.testimonial__author {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
}

.testimonial__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ds-gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-weight-bold);
    color: var(--ds-text-inverse);
}

.testimonial__name {
    font-weight: var(--ds-weight-semibold);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-primary);
}

.testimonial__role {
    font-size: var(--ds-text-xs);
    color: var(--ds-text-muted);
}

/* ── CTA 區 ──────────────────────────────────── */
.cta {
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta__glow {
    position: absolute;
    width: 500px;
    height: 300px;
    background: rgba(69, 162, 158, 0.06);
    border-radius: 50%;
    filter: blur(100px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cta h2 {
    position: relative;
    z-index: 1;
}

.cta p {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto var(--ds-space-8);
    font-size: var(--ds-text-lg);
}

.cta .hero__actions {
    position: relative;
    z-index: 1;
}

/* ── Footer ──────────────────────────────────── */
.footer {
    border-top: 1px solid var(--ds-border);
    padding: var(--ds-space-16) 0 var(--ds-space-8);
}

.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--ds-space-10);
    margin-bottom: var(--ds-space-12);
}

@media (max-width: 768px) {
    .footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--ds-space-8);
    }
}

@media (max-width: 480px) {
    .footer__grid {
        grid-template-columns: 1fr;
    }
}

.footer__brand-desc {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-muted);
    line-height: var(--ds-leading-relaxed);
    margin-top: var(--ds-space-4);
    max-width: 300px;
}

.footer__heading {
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ds-text-muted);
    margin-bottom: var(--ds-space-5);
}

.footer__link {
    display: block;
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    padding: var(--ds-space-1) 0;
    transition: color var(--ds-transition-fast);
}

.footer__link:hover {
    color: var(--ds-accent-bright);
}

.footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--ds-space-8);
    border-top: 1px solid var(--ds-border);
    font-size: var(--ds-text-xs);
    color: var(--ds-text-muted);
}

/* ── 響應式 ──────────────────────────────────── */
@media (max-width: 768px) {
    .hero__title {
        font-size: var(--ds-text-4xl);
    }

    .hero__subtitle {
        font-size: var(--ds-text-base);
    }

    .hero__actions {
        flex-direction: column;
    }

    .hero__stats {
        flex-direction: column;
        gap: var(--ds-space-6);
    }

    .nav__links {
        display: none;
    }

    .pricing__card--featured {
        transform: none;
    }

    .pricing__card--featured:hover {
        transform: translateY(-2px);
    }
}

@media (max-width: 480px) {
    .ds-section {
        padding-top: var(--ds-space-16);
        padding-bottom: var(--ds-space-16);
    }

    .ds-container {
        padding-left: var(--ds-space-4);
        padding-right: var(--ds-space-4);
    }
}

/* ============================================================
   DEMO MODE (Phase 4 Fullscreen Terminal + Glass Modals)
   ============================================================ */
body.demo-mode {
    margin: 0;
    overflow: hidden;
    /* Stop page scrolling */
    background: var(--ds-bg-primary);
}

/* 1. Fullscreen Chart/App Layer */
.app-demo-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background: radial-gradient(circle at 50% 50%, #0d121c 0%, #06070a 100%);
}

#mock-chart {
    position: absolute;
    left: 60px;
    /* 避讓 Sidebar 預設寬度 */
    width: calc(100% - 60px);
    height: 100%;
    z-index: 2;
}

/* HUD Overlay on top of chart */
.terminal-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    /* Let clicks pass through to chart if needed */
}

.terminal-overlay__top-left {
    position: absolute;
    top: 80px;
    /* Below Navbar */
    left: calc(60px + var(--ds-space-6));
    /* 避讓 Sidebar */
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
    font-family: var(--ds-font-mono);
    transition: all 0.4s ease;
}

.terminal-overlay__ticker {
    font-size: var(--ds-text-3xl);
    font-weight: var(--ds-weight-black);
    color: var(--ds-text-primary);
}

.terminal-overlay__price {
    font-size: var(--ds-text-xl);
    color: var(--ds-text-inverse);
    background: var(--ds-accent);
    padding: var(--ds-space-1) var(--ds-space-3);
    border-radius: var(--ds-radius-sm);
    display: inline-block;
}

.terminal-overlay__gex {
    font-size: var(--ds-text-lg);
    color: var(--ds-accent-bright);
}

.terminal-overlay__bottom-center {
    position: absolute;
    bottom: var(--ds-space-24);
    /* 抬高一點騰出 bottom bar 空間 */
    left: calc(50% + 30px);
    /* 考慮到左邊縮進 60px，中心也稍微右移 */
    transform: translateX(-50%);
    pointer-events: auto;
    transition: all 0.4s ease;
}

/* 3. Bottom Nav (Z: 100) */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(6, 7, 10, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--ds-border);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    cursor: pointer;
}

.nav-bottom:hover {
    background: rgba(102, 252, 241, 0.15);
    /* 懸停喚起主題色 */
}

/* 頂部一個隱形的區域用來在縮下去後喚出 */
.nav-bottom__summon-zone {
    position: absolute;
    top: -10px;
    height: 10px;
    width: 100%;
}

.nav-bottom__inner {
    padding: var(--ds-space-3) var(--ds-space-4);
    display: flex;
    flex-direction: column;
}

.nav-bottom__summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-bottom__hint {
    color: var(--ds-accent-dim);
    font-style: italic;
}

.nav-bottom__expanded-info {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0;
}

.nav-bottom.expanded .nav-bottom__expanded-info {
    max-height: 100px;
    opacity: 1;
    padding-top: var(--ds-space-4);
    margin-top: var(--ds-space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-bottom__links a {
    color: var(--ds-text-secondary);
    margin-left: var(--ds-space-4);
}

.nav-bottom__links a:hover {
    color: var(--ds-text-primary);
}

/* 4. Sidebar Two-Layer Design (Z: 90) */
.sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    /* Below Nav */
    bottom: 40px;
    /* Above Bottom Nav */
    z-index: 90;
    display: flex;
    transition: transform 0.4s ease;
}

.sidebar__layer1 {
    width: 60px;
    background: rgba(6, 7, 10, 0.5);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--ds-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--ds-space-4);
    gap: var(--ds-space-4);
}

.sidebar__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-md);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar__icon:hover {
    background: rgba(102, 252, 241, 0.2);
    color: var(--ds-text-primary);
}

.sidebar__layer2 {
    width: 200px;
    background: rgba(13, 18, 28, 0.85);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--ds-border);
    display: flex;
    flex-direction: column;
    padding: var(--ds-space-6);
    transform: translateX(-100%);
    /* 預設收起 */
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar__layer2.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.sidebar__title {
    font-family: var(--ds-font-mono);
    color: var(--ds-text-muted);
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    margin-bottom: var(--ds-space-6);
    border-bottom: 1px solid var(--ds-border);
    padding-bottom: var(--ds-space-2);
}

.sidebar__link {
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
    padding: var(--ds-space-3) 0;
    transition: color 0.2s;
}

.sidebar__link:hover {
    color: var(--ds-text-primary);
}

/* 5. Logged-In State (Focus Mode) */
body.logged-in .nav {
    transform: translateY(-90%);
    /* 退縮到幾乎不見，留下一小段喚起區 */
}

body.logged-in .nav:hover {
    transform: translateY(0);
    /* 懸停時拉下來 */
}

body.logged-in .nav-bottom {
    transform: translateY(90%);
    /* 往下降 */
}

body.logged-in .nav-bottom:hover {
    transform: translateY(0);
    /* 懸停時升上來 */
}

body.logged-in .terminal-overlay__bottom-center {
    opacity: 0;
    /* 隱藏解鎖按鈕 */
    pointer-events: none;
}

body.logged-in .sidebar {
    top: 20px;
    bottom: 20px;
}

/* 確保 Modals 始終在最上方 */
.glass-modal-container {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-modal-container.visible {
    opacity: 1;
}

.glass-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 7, 10, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1;
}

.glass-modal {
    position: relative;
    z-index: 2;
    background: rgba(18, 22, 30, 0.65);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ds-radius-xl);
    padding: var(--ds-space-10);
    width: 90%;
    max-width: 900px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(102, 252, 241, 0.1) inset;
    transform: scale(0.95) translateY(10px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    max-height: 90vh;
    overflow-y: auto;
}

.glass-modal.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.glass-modal--sm {
    max-width: 420px;
    padding: var(--ds-space-10) var(--ds-space-8);
}

.glass-modal__close {
    position: absolute;
    top: var(--ds-space-4);
    right: var(--ds-space-4);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--ds-text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--ds-transition-fast);
}

.glass-modal__close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--ds-text-primary);
}

/* Forms inside Auth Modal */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
}

.auth-form__group {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
}

.auth-form__group label {
    font-size: var(--ds-text-xs);
    font-family: var(--ds-font-mono);
    color: var(--ds-text-muted);
    text-transform: uppercase;
}

.ds-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-3) var(--ds-space-4);
    color: var(--ds-text-primary);
    font-family: var(--ds-font-mono);
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: all var(--ds-transition-fast);
}

.ds-input:focus {
    border-color: var(--ds-accent-dim);
    box-shadow: 0 0 0 2px rgba(69, 162, 158, 0.15);
}

/* Pulse Animation for large buttons */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 252, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(102, 252, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(102, 252, 241, 0);
    }
}

.pulse-btn {
    animation: pulse-ring 2.5s infinite;
}