/**
 * 🎬 AiLydian Cinematic Hero Film Experience
 * "The AI Revolution" - Short Film Animation
 * Version: 2.0.0 CINEMATIC EDITION
 * Date: 2025-10-07
 *
 * Story: A professional's day transformed by AI companions
 * Characters:
 *   - Real Human (Protagonist)
 *   - 6 AI Characters (LyDian assistants)
 * Duration: 45 seconds auto-play loop
 * Style: Apple Event + Sci-Fi + Documentary
 */

/* ========== CINEMATIC HERO CONTAINER ========== */

.hero-cinematic {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Film grain texture overlay */
.hero-cinematic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        );
    pointer-events: none;
    z-index: 100;
    animation: film-grain 0.3s steps(10) infinite;
}

@keyframes film-grain {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

/* ========== SCENE SYSTEM ========== */

.film-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(1.2);
    transition: opacity 2s ease, transform 3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

.film-scene.active {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
}

.film-scene.exiting {
    opacity: 0;
    transform: scale(0.95);
    filter: blur(10px);
}

/* ========== SCENE 1: MORNING STRUGGLE ========== */

.scene-morning {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.human-character {
    position: relative;
    width: 400px;
    height: 500px;
    animation: character-breathe 4s ease-in-out infinite;
}

/* Silhouette of person at desk */
.human-silhouette {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    clip-path: polygon(
        30% 20%, 70% 20%, 75% 30%, 80% 45%,
        80% 80%, 70% 100%, 30% 100%, 20% 80%,
        20% 45%, 25% 30%
    );
    position: relative;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

/* Desk with papers */
.desk-papers {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow:
        0 -20px 0 rgba(255, 255, 255, 0.1),
        0 -40px 0 rgba(255, 255, 255, 0.08),
        0 -60px 0 rgba(255, 255, 255, 0.06);
}

/* Stress indicators - floating anxious thoughts */
.stress-bubble {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 77, 77, 0.3);
    border-radius: 50%;
    animation: stress-float 3s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

.stress-bubble:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.stress-bubble:nth-child(2) {
    top: 40%;
    right: 15%;
    animation-delay: 1s;
}

.stress-bubble:nth-child(3) {
    top: 60%;
    left: 20%;
    animation-delay: 2s;
}

@keyframes stress-float {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-30px) scale(1.2);
        opacity: 0.6;
    }
}

@keyframes character-breathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.02) translateY(-5px); }
}

/* ========== SCENE 2: AI ARRIVAL ========== */

.scene-ai-arrival {
    background: radial-gradient(circle at center, #0a1128 0%, #000000 100%);
}

/* Portal effect for AI appearance */
.ai-portal {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #10A37F,
        #1a73e8,
        #9333ea,
        #ec4899,
        #10A37F
    );
    animation: portal-spin 4s linear infinite;
    filter: blur(40px);
    opacity: 0;
}

.ai-portal.active {
    animation: portal-open 2s ease forwards, portal-spin 4s linear infinite;
}

@keyframes portal-open {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
}

@keyframes portal-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== AI CHARACTERS (6 COMPANIONS) ========== */

.ai-companion {
    position: absolute;
    width: 150px;
    height: 200px;
    opacity: 0;
    transform: scale(0);
    animation: ai-materialize 1.5s ease forwards;
}

/* Chat AI - Legal Assistant */
.ai-legal {
    top: 10%;
    left: 15%;
    animation-delay: 0.2s;
}

.ai-legal .ai-body {
    background: linear-gradient(135deg, #10A37F 0%, #0d8f6f 100%);
    clip-path: polygon(
        50% 0%, 80% 20%, 100% 50%, 80% 80%,
        50% 100%, 20% 80%, 0% 50%, 20% 20%
    );
    width: 100%;
    height: 60%;
    position: relative;
    box-shadow: 0 20px 60px rgba(16, 163, 127, 0.6);
    animation: ai-hover 3s ease-in-out infinite;
}

/* Medical AI - Doctor Companion */
.ai-medical {
    top: 10%;
    right: 15%;
    animation-delay: 0.4s;
}

.ai-medical .ai-body {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    clip-path: polygon(
        30% 0%, 70% 0%, 100% 30%, 100% 70%,
        70% 100%, 30% 100%, 0% 70%, 0% 30%
    );
    width: 100%;
    height: 60%;
    box-shadow: 0 20px 60px rgba(236, 72, 153, 0.6);
    animation: ai-hover 3s ease-in-out infinite 0.5s;
}

/* Code AI - Developer Assistant */
.ai-code {
    bottom: 15%;
    left: 10%;
    animation-delay: 0.6s;
}

.ai-code .ai-body {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    clip-path: polygon(
        20% 0%, 80% 0%, 100% 20%, 100% 80%,
        80% 100%, 20% 100%, 0% 80%, 0% 20%
    );
    width: 100%;
    height: 60%;
    box-shadow: 0 20px 60px rgba(26, 115, 232, 0.6);
    animation: ai-hover 3s ease-in-out infinite 1s;
}

/* Analytics AI - Data Scientist */
.ai-analytics {
    bottom: 15%;
    right: 10%;
    animation-delay: 0.8s;
}

.ai-analytics .ai-body {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    clip-path: circle(50% at 50% 50%);
    width: 100%;
    height: 60%;
    box-shadow: 0 20px 60px rgba(147, 51, 234, 0.6);
    animation: ai-hover 3s ease-in-out infinite 1.5s;
}

/* Voice AI - Communication Expert */
.ai-voice {
    top: 50%;
    left: 5%;
    animation-delay: 1s;
}

.ai-voice .ai-body {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    clip-path: polygon(
        50% 0%, 100% 38%, 82% 100%,
        18% 100%, 0% 38%
    );
    width: 100%;
    height: 60%;
    box-shadow: 0 20px 60px rgba(245, 158, 11, 0.6);
    animation: ai-hover 3s ease-in-out infinite 2s;
}

/* Video AI - Content Creator */
.ai-video {
    top: 50%;
    right: 5%;
    animation-delay: 1.2s;
}

.ai-video .ai-body {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    clip-path: polygon(
        25% 0%, 75% 0%, 100% 50%,
        75% 100%, 25% 100%, 0% 50%
    );
    width: 100%;
    height: 60%;
    box-shadow: 0 20px 60px rgba(6, 182, 212, 0.6);
    animation: ai-hover 3s ease-in-out infinite 2.5s;
}

@keyframes ai-materialize {
    0% {
        opacity: 0;
        transform: scale(0) translateY(100px);
        filter: blur(20px);
    }
    60% {
        transform: scale(1.2) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

@keyframes ai-hover {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* AI name labels */
.ai-label {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    animation: label-fade-in 1s ease forwards 1.5s;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes label-fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== SCENE 3: COLLABORATION ========== */

.scene-collaboration {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* Data flow connections between human and AIs */
.data-connection {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(16, 163, 127, 0.8) 50%,
        transparent 100%
    );
    animation: data-flow 2s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes data-flow {
    0% {
        width: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 300px;
        opacity: 0;
    }
}

/* Holographic workspace */
.hologram-workspace {
    position: absolute;
    width: 600px;
    height: 400px;
    background: rgba(16, 163, 127, 0.05);
    border: 2px solid rgba(16, 163, 127, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    animation: hologram-flicker 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes hologram-flicker {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 0 0 30px rgba(16, 163, 127, 0.4);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 60px rgba(16, 163, 127, 0.6);
    }
}

/* Floating UI elements - documents, charts, code */
.floating-element {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    backdrop-filter: blur(10px);
    animation: float-ui 4s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    top: 20%;
    left: 10%;
    width: 200px;
    height: 150px;
    animation-delay: 0s;
}

.floating-element:nth-child(2) {
    top: 60%;
    right: 15%;
    width: 180px;
    height: 120px;
    animation-delay: 1s;
}

.floating-element:nth-child(3) {
    bottom: 20%;
    left: 20%;
    width: 220px;
    height: 140px;
    animation-delay: 2s;
}

@keyframes float-ui {
    0%, 100% {
        transform: translateY(0) rotateY(0deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-30px) rotateY(15deg);
        opacity: 1;
    }
}

/* ========== SCENE 4: TRANSFORMATION ========== */

.scene-transformation {
    background: radial-gradient(circle at center,
        #10A37F 0%,
        #0d8f6f 30%,
        #0a1128 100%
    );
}

/* Energy burst effect */
.energy-burst {
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(16, 163, 127, 0.8) 0%,
        rgba(16, 163, 127, 0.4) 30%,
        transparent 70%
    );
    animation: burst-expand 3s ease-out infinite;
    opacity: 0;
}

@keyframes burst-expand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Success particles */
.success-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    animation: particle-rise 3s ease-out infinite;
}

@keyframes particle-rise {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-400px) scale(1);
        opacity: 0;
    }
}

/* ========== SCENE 5: ECOSYSTEM VIEW ========== */

.scene-ecosystem {
    background: #000000;
}

/* Orbital system - similar to current but cinematic */
.ecosystem-orbit {
    position: absolute;
    width: 600px;
    height: 600px;
    border: 2px solid rgba(16, 163, 127, 0.3);
    border-radius: 50%;
    animation: orbit-rotate 20s linear infinite;
}

.ecosystem-orbit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle,
        rgba(16, 163, 127, 0.8) 0%,
        rgba(16, 163, 127, 0.2) 100%
    );
    border-radius: 50%;
    box-shadow:
        0 0 60px rgba(16, 163, 127, 0.8),
        0 0 120px rgba(16, 163, 127, 0.4);
    animation: core-pulse 3s ease-in-out infinite;
}

@keyframes orbit-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes core-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* ========== SCENE 6: CALL TO ACTION ========== */

.scene-cta {
    background: linear-gradient(135deg, #1a1a2e 0%, #000000 100%);
    flex-direction: column;
}

.cta-text {
    font-size: 4rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(50px);
    animation: text-rise 1.5s ease forwards;
    background: linear-gradient(135deg, #10A37F 0%, #1a73e8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes text-rise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cta-button {
    padding: 20px 60px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    background: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    animation: button-pop 1s ease forwards 0.5s;
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(255, 255, 255, 0.3);
}

.cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 30px 80px rgba(255, 255, 255, 0.5);
}

@keyframes button-pop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== CINEMATIC LETTERBOX ========== */

.letterbox {
    position: fixed;
    width: 100%;
    height: 80px;
    background: #000000;
    z-index: 200;
    pointer-events: none;
}

.letterbox-top {
    top: 0;
    left: 0;
}

.letterbox-bottom {
    bottom: 0;
    left: 0;
}

/* ========== SCENE TIMELINE INDICATOR ========== */

.timeline-indicator {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 150;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.timeline-dot.active {
    background: #10A37F;
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.8);
    transform: scale(1.3);
}

.timeline-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 1024px) {
    .ai-companion {
        width: 120px;
        height: 160px;
    }

    .hologram-workspace {
        width: 500px;
        height: 350px;
    }

    .cta-text {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .letterbox {
        height: 40px;
    }

    .ai-companion {
        width: 100px;
        height: 140px;
    }

    .human-character {
        width: 300px;
        height: 400px;
    }

    .hologram-workspace {
        width: 90vw;
        height: 300px;
    }

    .cta-text {
        font-size: 2rem;
    }

    .cta-button {
        padding: 15px 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .ai-companion {
        width: 80px;
        height: 120px;
    }

    .timeline-indicator {
        bottom: 60px;
    }
}

/* ========== ACCESSIBILITY ========== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */

.film-scene,
.ai-companion,
.floating-element,
.energy-burst,
.ecosystem-orbit {
    will-change: transform, opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
