/* MetaCloud Landing — Glass Tales with Step Nav + Detail Panel */

:root {
    --bg: #08080f;
    --glass: rgba(155, 93, 229, 0.04);
    --glass-b: rgba(155, 93, 229, 0.14);
    --glass-shine: rgba(255, 255, 255, 0.03);
    --p: #9b5de5;
    --pl: #c77dff;
    --pd: #7b2cbf;
    --p-faint: rgba(155, 93, 229, 0.06);
    --p-glow: rgba(155, 93, 229, 0.25);
    --el: rgba(155, 93, 229, 0.12);
    --el-s: rgba(155, 93, 229, 0.25);
    --el-b: rgba(199, 125, 255, 0.6);
    --text: #f0f0fa;
    --text-2: #a8a8cc;
    --text-3: #6a6a88;
    --r: 18px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.world {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ═══ AMBIENT ═══ */
.ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(100px); will-change: transform, opacity; }
.orb-1 {
    width: min(550px, 75vw); height: min(550px, 75vw);
    background: radial-gradient(circle, var(--pd), rgba(123, 44, 191, 0.4));
    top: -5%; left: -10%;
    opacity: 0.35;
    animation: drift1 14s ease-in-out infinite;
}
.orb-2 {
    width: min(450px, 65vw); height: min(450px, 65vw);
    background: radial-gradient(circle, var(--p), rgba(155, 93, 229, 0.3));
    bottom: -10%; right: -5%;
    opacity: 0.3;
    animation: drift2 18s ease-in-out infinite;
}
.orb-3 {
    width: min(350px, 50vw); height: min(350px, 50vw);
    background: radial-gradient(circle, rgba(199, 125, 255, 0.5), rgba(123, 44, 191, 0.2));
    top: 35%; left: 35%;
    opacity: 0.2;
    animation: drift3 12s ease-in-out infinite;
}
@keyframes drift1 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.35; }
    15% { transform: translate(80px, -50px) scale(1.12); opacity: 0.4; }
    30% { transform: translate(120px, 30px) scale(1.05); opacity: 0.3; }
    50% { transform: translate(40px, 80px) scale(1.18); opacity: 0.45; }
    65% { transform: translate(-60px, 50px) scale(0.95); opacity: 0.28; }
    80% { transform: translate(-40px, -30px) scale(1.08); opacity: 0.38; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
}
@keyframes drift2 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.3; }
    20% { transform: translate(-70px, 60px) scale(1.15); opacity: 0.38; }
    40% { transform: translate(50px, -70px) scale(0.9); opacity: 0.22; }
    60% { transform: translate(-90px, -40px) scale(1.1); opacity: 0.35; }
    80% { transform: translate(30px, 50px) scale(1.05); opacity: 0.32; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
}
@keyframes drift3 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.2; }
    25% { transform: translate(100px, -60px) scale(1.2); opacity: 0.3; }
    50% { transform: translate(-50px, 70px) scale(0.85); opacity: 0.15; }
    75% { transform: translate(-80px, -40px) scale(1.15); opacity: 0.28; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.2; }
}

/* ═══ CAPTION ═══ */
.caption {
    text-align: center;
    z-index: 30;
    font-size: clamp(2rem, 3.5vw, 1.7rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-2);
    opacity: 0;
    transition: opacity 0.8s;
    max-width: 800px;
    line-height: 1.4;
    margin: 0 auto;
    padding: 2rem 0rem;
    flex-shrink: 0;
}
.caption.show { opacity: 1; }

/* ═══ STAGE ═══ */
.stage-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    min-height: 0;
    transition: transform 0.8s cubic-bezier(0.25,0.1,0.25,1);
}

.stage-wrap.shifted {
    transform: translateX(-10%);
}

.stage {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 24px);
}

.slot {
    width: clamp(240px, 38vw, 700px);
    height: clamp(300px, 52vh, 800px);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.wave-area {
    width: clamp(60px, 12vw, 200px);
    height: clamp(60px, 10vh, 120px);
    position: relative;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ═══ WAVE PARTICLES ═══ */
.wave-particle {
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--pl);
    box-shadow: 0 0 20px var(--pl), 0 0 40px rgba(155,93,229,0.25);
    opacity: 0;
}

.wave-text {
    position: absolute;
    font-size: 1.2rem;
    font-family: monospace;
    font-weight: 700;
    color: var(--pl);
    opacity: 0;
    white-space: nowrap;
    text-shadow: 0 0 14px var(--pl);
}

/* ═══ UI CARDS ═══ */
.ui-card {
    background: var(--glass);
    border: 1px solid var(--glass-b);
    border-radius: var(--r);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 var(--glass-shine);
    padding: 32px;
    opacity: 0;
    transform: translateX(50px) scale(0.85);
    transition: opacity 1.2s cubic-bezier(0.25,0.1,0.25,1), transform 1.2s cubic-bezier(0.25,0.1,0.25,1);
}
.ui-card.visible { opacity: 1; transform: translateX(0) scale(1); }
.ui-card.exit { opacity: 0; transform: translateX(-80px) scale(0.8); transition: opacity 0.5s, transform 0.5s; }

/* ═══ PERSON ═══ */
.ui-person { width: 400px; padding: 64px 48px; text-align: center; animation: person-bob 3s ease-in-out infinite; }
.person-head { width: 104px; height: 104px; border-radius: 50%; background: var(--el-s); margin: 0 auto 28px; }
.person-body { width: 140px; height: 112px; border-radius: 36px 36px 0 0; background: var(--el); margin: 0 auto 28px; }
.person-speech { display: flex; justify-content: center; }
.speech-wave { display: flex; gap: 8px; align-items: center; height: 56px; }
.speech-wave span {
    width: 10px; border-radius: 5px; background: var(--el-b);
    animation: speech-bar 0.6s ease-in-out infinite alternate;
}
.speech-wave span:nth-child(1) { height: 14px; animation-delay: 0s; }
.speech-wave span:nth-child(2) { height: 36px; animation-delay: 0.1s; }
.speech-wave span:nth-child(3) { height: 48px; animation-delay: 0.2s; }
.speech-wave span:nth-child(4) { height: 28px; animation-delay: 0.3s; }
.speech-wave span:nth-child(5) { height: 18px; animation-delay: 0.4s; }
@keyframes speech-bar { to { height: 8px; } }
@keyframes person-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ═══ WATCH ═══ */
.ui-watch { width: 480px; padding: 56px; }
.watch-body {
    width: 320px; height: 420px; margin: 0 auto;
    border: 4px solid var(--glass-b); border-radius: 96px;
    padding: 48px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 32px;
}
.watch-rec { display: flex; align-items: center; gap: 16px; }
.rec-dot { width: 26px; height: 26px; border-radius: 50%; background: #f44; animation: blink 1s infinite; }
.rec-text { font-size: 1.5rem; font-weight: 700; color: #f44; letter-spacing: 0.1em; }
@keyframes blink { 50% { opacity: 0.2; } }
.watch-bars { display: flex; gap: 10px; align-items: flex-end; height: 80px; }
.watch-bars span {
    width: 16px; border-radius: 6px; background: var(--el-b);
    animation: bar 0.8s ease-in-out infinite alternate;
}
.watch-bars span:nth-child(1) { height: 24px; animation-delay: 0s; }
.watch-bars span:nth-child(2) { height: 56px; animation-delay: 0.12s; }
.watch-bars span:nth-child(3) { height: 36px; animation-delay: 0.24s; }
.watch-bars span:nth-child(4) { height: 68px; animation-delay: 0.36s; }
.watch-bars span:nth-child(5) { height: 44px; animation-delay: 0.48s; }
@keyframes bar { to { height: 12px; } }
.watch-data { display: flex; align-items: center; gap: 16px; color: var(--el-b); }
.watch-data svg { width: 44px; height: 44px; animation: heartbeat 1.2s ease-in-out infinite; }
.data-bar { width: 72px; height: 12px; background: var(--el); border-radius: 6px; animation: data-pulse 2s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.25); } 28% { transform: scale(1); } 42% { transform: scale(1.15); } 56% { transform: scale(1); } }
@keyframes data-pulse { 0%, 100% { width: 72px; opacity: 0.6; } 50% { width: 104px; opacity: 1; } }

/* ═══ AI ═══ */
.ui-ai { width: 480px; padding: 64px; text-align: center; }
.ai-orb { width: 220px; height: 220px; margin: 0 auto 36px; position: relative; display: grid; place-items: center; }
.ai-core { width: 90px; height: 90px; border-radius: 50%; background: var(--pl); box-shadow: 0 0 60px var(--p-glow); animation: ai-pulse 2s ease-in-out infinite; }
.ai-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--glass-b); animation: ai-spin 4s linear infinite; }
.ai-ring-2 { inset: -28px; animation-duration: 6s; animation-direction: reverse; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 60px var(--p-glow); } 50% { transform: scale(1.18); box-shadow: 0 0 90px var(--p-glow), 0 0 24px var(--pl); } }
.ai-thoughts { font-size: 1.4rem; font-family: 'Inter', monospace; color: var(--pl); opacity: 0.8; min-height: 36px; }

/* ═══ CALENDAR ═══ */
.ui-calendar { width: 520px; padding: 48px; }
.cal-top { margin-bottom: 32px; }
.cal-dots { display: flex; gap: 14px; }
.cal-dots span { width: 16px; height: 16px; border-radius: 50%; background: var(--el-s); }
.cal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cal-cell { height: 96px; border-radius: 20px; background: var(--p-faint); }
.cal-cell-hl { border: 3px solid var(--pl); background: rgba(155,93,229,0.08); position: relative; animation: cal-glow 2.5s ease-in-out infinite; }
@keyframes cal-glow { 0%, 100% { box-shadow: 0 0 0 rgba(155,93,229,0); } 50% { box-shadow: 0 0 20px rgba(155,93,229,0.3); } }
.cal-ev { position: absolute; bottom: 10px; left: 10px; right: 10px; height: 14px; border-radius: 8px; background: var(--pl); transform: scaleX(0); transition: transform 0.8s 0.5s; }
.ui-calendar.visible .cal-ev { transform: scaleX(1); }

/* ═══ DRIVE ═══ */
.ui-drive { width: 560px; padding: 48px; }
.drive-bar { margin-bottom: 32px; }
.drive-bar-line { width: 180px; height: 14px; background: var(--el); border-radius: 8px; }
.drive-files { display: flex; gap: 28px; }
.d-file { width: 140px; height: 168px; border-radius: 24px; background: var(--p-faint); border: 1px solid transparent; display: grid; place-items: center; }
.file-thumb { width: 84px; height: 56px; border-radius: 10px; background: var(--el); }
.file-thumb-play { position: relative; }
.file-thumb-play::after { content:''; position: absolute; left: 50%; top: 50%; transform: translate(-30%,-50%); border-left: 16px solid var(--pl); border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.file-lines { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.file-lines span { height: 6px; background: var(--el); border-radius: 4px; }
.file-lines span:nth-child(1) { width: 60px; }
.file-lines span:nth-child(2) { width: 48px; }
.file-lines span:nth-child(3) { width: 32px; }

/* ═══ EMAIL ═══ */
.ui-email { width: 600px; padding: 48px; }
.em-header { margin-bottom: 32px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--glass-b); padding-bottom: 28px; }
.em-to { width: 200px; height: 14px; background: var(--el); border-radius: 8px; }
.em-subj { width: 280px; height: 14px; background: var(--el-s); border-radius: 8px; }
.em-body { margin-bottom: 32px; }
.em-text { font-size: 1.6rem; color: var(--text-2); line-height: 1.7; opacity: 0; transition: opacity 0.6s; min-height: 4.5em; }
.ui-email.visible .em-text { opacity: 1; }
.em-attach { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 20px; border: 1px solid var(--glass-b); color: var(--pl); margin-bottom: 24px; }
.em-attach svg { width: 36px; height: 36px; }
.em-attach-name { width: 140px; height: 10px; background: var(--el); border-radius: 6px; }
.em-send { display: flex; justify-content: flex-end; }
.em-send-btn { width: 112px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--pd), var(--pl)); opacity: 0.8; animation: send-glow 3s ease-in-out infinite; }
@keyframes send-glow { 0%, 100% { opacity: 0.6; box-shadow: none; } 50% { opacity: 1; box-shadow: 0 0 24px rgba(155,93,229,0.4); } }

/* ═══ STEP NAV ═══ */
.step-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 2rem 1rem;
    z-index: 40;
    flex-shrink: 0;
}

.step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--glass-b);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    padding: 0;
}

.step-dot.active {
    background: var(--pl);
    border-color: var(--pl);
    box-shadow: 0 0 16px var(--p-glow);
}

.step-dot:hover { border-color: var(--pl); }

.dot-label {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-3);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.step-dot:hover .dot-label,
.step-dot.active .dot-label { opacity: 1; color: var(--text-2); }

/* ═══ DETAIL PANEL ═══ */
.detail-panel {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%) translateX(40px);
    width: min(360px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    background: var(--glass);
    border: 1px solid var(--glass-b);
    border-radius: var(--r);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s, transform 0.6s cubic-bezier(0.25,0.1,0.25,1);
    z-index: 50;
}

.detail-panel.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.detail-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--pl);
}

.detail-desc {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

.detail-examples {
    font-size: 0.85rem;
    color: var(--text-3);
    line-height: 1.8;
    white-space: pre-wrap;
}

.detail-examples::before {
    content: 'Example use cases';
    display: block;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-close {
    position: absolute;
    top: 12px; right: 12px;
    background: none; border: none;
    color: var(--text-3);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s;
}
.detail-close:hover { color: var(--text); }

/* ═══ TOP BAR (brand + CTA) ═══ */
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    z-index: 40;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(155,93,229,0.06);
    background: rgba(8, 8, 15, 0.6);
    backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-link { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; }
.brand-logo {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--pd), var(--pl));
    border-radius: 9px; display: grid; place-items: center;
    font-weight: 900; font-size: 0.9rem; color: #fff;
}
.brand-logo-img {
    width: 34px; height: 34px;
    border-radius: 9px;
    object-fit: cover;
}
.brand-text { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.hl { color: var(--pl); }

.bottom-actions { display: flex; align-items: center; gap: 1.2rem; }

.top-nav { display: flex; align-items: center; gap: 2rem; }
.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
}
.nav-link:hover { color: var(--text); }
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0; right: 0;
    height: 2px;
    background: var(--pl);
    border-radius: 1px;
    transform: scaleX(0);
    transition: transform 0.25s;
}
.nav-link:hover::after { transform: scaleX(1); }

.btn-join {
    display: inline-flex; align-items: center;
    padding: 0.6rem 1.4rem;
    background: linear-gradient(135deg, var(--pd), var(--pl));
    color: #fff; font-weight: 600; font-size: 0.9rem;
    border-radius: 10px; text-decoration: none;
    box-shadow: 0 0 28px var(--p-glow);
    transition: transform 0.25s, box-shadow 0.25s;
}
.btn-join:hover { transform: scale(1.04); box-shadow: 0 0 44px var(--p-glow); }

.btn-sign {
    font-size: 0.9rem; color: var(--text-2);
    text-decoration: none; transition: color 0.2s;
    font-weight: 500;
}
.btn-sign:hover { color: var(--text); }

/* ═══ BURGER MENU ═══ */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px; height: 36px;
    background: none; border: none;
    cursor: pointer; padding: 6px;
    z-index: 1001;
}
.burger span {
    display: block;
    width: 100%; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══ RESPONSIVE ═══ */

/* Tablet */
@media (max-width: 1024px) {
    .slot { width: clamp(200px, 36vw, 400px); height: clamp(280px, 42vh, 500px); }
    .stage { gap: clamp(6px, 1.5vw, 16px); }
    .detail-panel { width: min(320px, 85vw); }
    .ui-card { transform-origin: center; scale: 0.7; }
    .ui-card.visible { scale: 0.7; }
}

/* Mobile */
@media (max-width: 768px) {
    .burger { display: flex; }
    .bottom-bar {
        flex-wrap: wrap;
        padding: 0.8rem 1rem;
    }
    .top-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1.2rem 0;
        border-top: 1px solid rgba(155,93,229,0.1);
        margin-top: 0.8rem;
    }
    .top-nav.open {
        display: flex;
    }
    .top-nav .nav-link {
        font-size: 1.1rem;
        color: var(--text);
        padding: 0.5rem 0;
    }
    .top-nav .nav-link::after { display: none; }
    .bottom-actions { display: none; flex-basis: 100%; justify-content: center; gap: 1.2rem; padding: 0.8rem 0 0.4rem; }
    .top-nav.open ~ .bottom-actions { display: flex; }

    .stage { flex-direction: column; gap: 12px; }
    .slot { width: clamp(200px, 70vw, 320px); height: clamp(220px, 38vh, 360px); }
    .ui-card { transform-origin: center; scale: 0.5; }
    .ui-card.visible { scale: 0.5; }
    .wave-area { width: 80px; height: 50px; transform: rotate(90deg); }
    .caption { font-size: clamp(1.4rem, 5vw, 2rem); padding: 2rem 1rem; }
    .detail-panel {
        top: auto; bottom: 0; right: 0; left: 0;
        transform: translateY(100%);
        width: 100%;
        max-height: 65vh;
        border-radius: var(--r) var(--r) 0 0;
        padding: 24px 20px env(safe-area-inset-bottom, 24px);
        overflow-y: auto;
    }
    .detail-panel.show {
        transform: translateY(0);
    }
    .stage-wrap.shifted { transform: none; }
    .btn-join { padding: 0.55rem 1.1rem; font-size: 0.85rem; }
    .step-nav { gap: 20px; padding: 1.5rem 1rem; }
    .step-dot { width: 32px; height: 32px; }
    .ui-card { padding: 20px; }

    /* Reduce animation load on mobile */
    .orb { filter: blur(70px); }
    .orb-3 { display: none; }
    .orb-1 { animation-duration: 20s; }
    .orb-2 { animation-duration: 24s; }
}

/* Small phones */
@media (max-width: 400px) {
    .slot { width: 140px; height: 170px; }
    .ui-card { padding: 16px; }
    .step-nav { gap: 14px; }
    .step-dot { width: 36px; height: 36px; }
    .caption { font-size: 1.3rem; }
    .bottom-bar { padding: 0.7rem 0.8rem; }
    .brand-text { font-size: 0.95rem; }
    .btn-join { padding: 0.5rem 0.9rem; font-size: 0.8rem; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .caption { padding: 1rem; font-size: 1.2rem; }
    .step-nav { padding: 0.8rem; }
    .stage-wrap { padding: 0.5rem; }
    .slot { height: clamp(140px, 50vh, 200px); }
}

/* ═══ ACCESSIBILITY ═══ */
@media (prefers-reduced-motion: reduce) {
    .orb { animation: none !important; opacity: 0.2; }
}
