/* Hero Section */
.hero-section {
    position: relative;
    width: calc(100% - 32px);
    height: calc(100vh - 96px);
    min-height: 800px;
    padding: 0;
    overflow: hidden;
    background-color: var(--color-bg-base);
    border-radius: 48px;
    margin: 80px auto 16px auto;
}

/* Animations */
@keyframes heroFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes heroSlideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Background Animation */
/* Background Animation */
.stars-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    /* Layer 2: Stars */
    overflow: hidden;
    animation: heroFadeIn 1.5s ease-out forwards;
}

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

/* Dashboard Image Animation */
.hero-dashboard-wrapper {
    /* ... existing props ... */
    opacity: 0;
    /* Star hidden */
    animation: heroSlideUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s forwards;
    will-change: transform, opacity;
}

@media (max-width: 768px) {
    .hero-section {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100dvh;
        min-height: auto;
        padding-bottom: 0;
    }
}







/* Container */
.hero-container {
    max-width: 1920px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    z-index: 3;
    /* Layer 3: Content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Layout Adjustments for Absolute Positioning */
.hero-split-layout {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

/* 1. Center Media (Chat Safe Zone) */
.hero-pos-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Define Safe Zone: Text/Buttons (bottom) only */
    padding-top: 0;
    padding-bottom: 300px;
    pointer-events: none;
    /* Pass clicks */
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* Align chat to bottom of safe zone */
    align-items: center;
    box-sizing: border-box;
}

/* Chat Emulation Styles */
.hero-chat-emulation {
    width: 100%;
    max-width: 650px;
    /* Messenger Column Width */
    height: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    /* Push content down */
    flex-direction: column;
    /* Fade out top messages */
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
}

/* Inner Chat Content (Injected by JS) */
.chat-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    /* Take up space */
}

/* 2. Bottom Left Text */
.hero-pos-text {
    position: absolute;
    bottom: 64px;
    left: 64px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

/* Override Header Alignments for Left Corner */
.hero-pos-text .section-header-standard {
    align-items: flex-start;
    text-align: left;
}

.hero-pos-text .hero-title {
    text-align: left;
    margin: 0;
}

.hero-pos-text .hero-subtitle {
    text-align: left;
    margin: 8px 0 0 0;
}

/* Explicitly style the passed container class */
.hero-section-header {
    display: flex;
    flex-direction: column;
    gap: 24px;
    /* Adjust gap as needed */
    align-items: flex-start;
    text-align: left;
    max-width: 66%;
}

/* 3. Bottom Right Actions */
.hero-pos-actions {
    position: absolute;
    bottom: 64px;
    right: 64px;
    z-index: 10;
    display: flex;
    align-items: flex-end;
}

/* Actions Container style */
.hero-actions {
    display: flex;
    gap: 32px;
    /* Updated to 32px */
    align-items: center;
}

@media (max-width: 1024px) {

    /* Tablet Compacting */
    .hero-pos-text {
        left: 40px;
        bottom: 40px;
        max-width: 400px;
    }

    .hero-pos-actions {
        right: 40px;
        bottom: 40px;
    }

    .hero-pos-media {
        max-width: 70%;
    }
}

@media (max-width: 768px) {
    .hero-section {
        background-color: var(--color-bg-base);
        height: 100dvh;
        min-height: -webkit-fill-available;
        padding: 0;
        margin: 0;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .hero-container {
        padding: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .hero-split-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
        justify-content: flex-end;
        position: relative;
        padding-bottom: 32px;
    }

    /* 1. Chat Area (Top/Middle - Grows Upwards) */
    .hero-pos-media {
        flex: 1;
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        z-index: 1;
        pointer-events: none;
        padding-top: 80px;
        margin-bottom: 0;
    }

    .hero-chat-emulation {
        max-width: 100%;
        padding: 0 16px;
        height: auto;
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }

    .hero-chat-card {
        padding: 0;
        height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        background: transparent;
    }

    .hero-chat-container {
        padding: 0;
        min-height: auto;
        height: auto;
        display: flex;
        flex-direction: column-reverse;
    }

    /* 2. Text Area (Pinned at Bottom) */
    .hero-pos-text {
        position: relative;
        left: auto;
        bottom: auto;
        padding: 0 24px;
        z-index: 10;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin-top: 32px;
        margin-bottom: 24px;
    }

    .hero-section-header {
        max-width: 100%;
        gap: 12px;
        align-items: flex-start;
        text-align: left;
    }

    .hero-pos-text .hero-title {
        font-size: 34px;
        line-height: 1.15;
        margin-top: 0;
    }

    .hero-pos-text .hero-subtitle {
        font-size: 16px;
        line-height: 1.5;
        opacity: 0.8;
    }

    /* 3. Actions Area (Pinned at Bottom) */
    .hero-pos-actions {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        padding: 0 24px;
        z-index: 10;
        box-sizing: border-box;
    }

    .hero-actions {
        display: flex;
        flex-direction: row;
        gap: 12px;
        width: 100%;
    }

    .hero-actions .btn {
        flex: 1;
        padding: 12px 16px;
        font-size: 14px;
        text-align: center;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 100px;
        min-height: 48px;
    }

    /* Adjust chat messages for mobile */
    .message-bubble {
        font-size: 14px !important;
        padding: 10px 14px;
    }

    .chat-message.is-visible {
        margin-bottom: 8px;
    }
}

/* Floating Messages */
.hero-floating-message {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(23, 23, 23, 0.6);
    /* Dark semi-transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    /* Pill shape */
    color: #fff;
    padding: 8px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    z-index: 5;
    /* Above background, below text safe zone if overlapping */
    opacity: 0;
    pointer-events: auto;
    /* Allow interaction if needed */
    animation: floatMessage 6s ease-in-out infinite, messageFadeIn 1s ease-out forwards;
    will-change: transform, opacity;
}

/* Size Variants */
.hero-floating-message.msg-sm {
    font-size: 13px;
    padding: 6px 12px;
}

.hero-floating-message.msg-md {
    font-size: 15px;
    padding: 10px 20px;
}

.hero-floating-message.msg-lg {
    font-size: 16px;
    padding: 12px 24px;
    font-weight: 500;
}

/* Icon Style */
.msg-icon {
    font-size: 1.2em;
}

/* Animations */
@keyframes messageFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes floatMessage {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Mobile Responsive: Hide Floating Messages to prevent clutter */
@media (max-width: 768px) {
    .hero-floating-message {
        display: none !important;
    }
}

/* Animated Word Rotator (Apple Style) */
.word-rotator {
    display: inline-flex;
    flex-direction: column;
    height: 1.25em;
    line-height: 1.25em;
    overflow: hidden;
    vertical-align: bottom;
    position: relative;
    /* masking for 3D effect depth cues */
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.word-track {
    display: flex;
    flex-direction: column;
    /* 3 words + 1 clone = 4 items. Cycle: Word 1 (2s) -> Word 2 (2s) -> Word 3 (2s). Total 6s. */
    animation: rotateWords 6s infinite cubic-bezier(0.32, 0.72, 0, 1);
}

.word-item {
    display: block;
    height: 1.25em;
    flex-shrink: 0;
    white-space: nowrap;
    background: var(--gradient-text-main);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 0.1em;
    text-align: left;
}

@keyframes rotateWords {

    0%,
    26% {
        transform: translateY(0);
    }

    33%,
    59% {
        transform: translateY(-25%);
    }

    66%,
    92% {
        transform: translateY(-50%);
    }

    100% {
        transform: translateY(-75%);
    }
}

/* Adjustments for Title Context */
.hero-pos-text h1,
.hero-title {
    line-height: 1.3;
}


.word-item {
    height: 1.3em;
    display: flex;
    align-items: center;
}

/* --- Dynamic Count Variations --- */

/* Count = 2 Words (3 Items: A, B, A) -> 4s duration */
.rotator-count-2 .word-track {
    animation-name: rotateWords2;
    animation-duration: 4s;
}

@keyframes rotateWords2 {

    0%,
    40% {
        transform: translateY(0);
    }

    50%,
    90% {
        transform: translateY(-33.33%);
    }

    100% {
        transform: translateY(-66.66%);
    }
}

/* Count = 3 Words (4 Items: A, B, C, A) -> 6s duration */
.rotator-count-3 .word-track {
    animation-name: rotateWords3;
    animation-duration: 6s;
}

@keyframes rotateWords3 {

    0%,
    25% {
        transform: translateY(0);
    }

    33%,
    58% {
        transform: translateY(-25%);
    }

    66%,
    91% {
        transform: translateY(-50%);
    }

    100% {
        transform: translateY(-75%);
    }
}

/* Count = 4 Words (5 Items: A, B, C, D, A) -> 8s duration */
.rotator-count-4 .word-track {
    animation-name: rotateWords4;
    animation-duration: 8s;
}

@keyframes rotateWords4 {

    0%,
    20% {
        transform: translateY(0);
    }

    25%,
    45% {
        transform: translateY(-20%);
    }

    50%,
    70% {
        transform: translateY(-40%);
    }

    75%,
    95% {
        transform: translateY(-60%);
    }

    100% {
        transform: translateY(-80%);
    }
}


/* --- Hero Chat Card --- */
.hero-chat-card {
    position: relative;
    width: 100%;
    max-width: 540px;
    /* Increased from 460px */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: transparent;
    border-radius: 24px;
}

.hero-chat-container {
    width: 100%;
    display: flex;
    flex-direction: column-reverse;
    /* Smoothly anchors content to bottom */
    min-height: 200px;
}





@media (min-width: 600px) {
    .hero-chat-card {
        max-width: 650px;
        /* Increased from 500px */
        padding: 24px;
    }
}


@media (min-width: 1000px) {
    .hero-chat-card {
        max-width: 800px;
        /* Increased from 550px */
    }
}


.hero-chat-messages {
    display: flex;
    flex-direction: column-reverse;
    /* Revert to column-reverse for smoothest growth */
    gap: 0;
    /* Gaps are handled by margins for smoother transitions */
    width: 100%;
}




.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    opacity: 0;
    /* Smooth height growth to push others up pleasantlty */
    max-height: 0;
    margin-bottom: 0;
    overflow: hidden;
    will-change: transform, opacity, max-height, margin-bottom;
}


.chat-message.user {
    transform-origin: bottom right;
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.ai {
    transform-origin: bottom left;
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message.is-visible {
    max-height: 500px;
    /* Allow enough room */
    margin-bottom: 12px;
    /* Restore gap smoothly */
    animation: iMessagePop 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1), margin-bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iMessagePop {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.92);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}






/* Exit Animation - Flying far upwards */
.chat-message.chat-exit {
    animation: iMessageExit 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes iMessageExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-600px) scale(0.8);
    }
}




/* User Message (Right-aligned) */
.chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0.1) 100%);
    background-size: 200% 200%;
    animation: morphGradient 8s ease infinite;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}


/* AI Message */
.chat-message.ai {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message.ai .message-bubble {
    background: #e5e5ea;
    /* Light opaque gray */
    color: #000000;
    /* Dark text for contrast */
    border-radius: 20px 20px 20px 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: none;
}







@keyframes morphGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Message Bubble Content */
.message-bubble {
    position: relative;
    padding: 10px 14px;
    font-size: 16px;
    /* Matched to hero subtitle */
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    font-family: var(--font-family-base);
}


@media (min-width: 600px) {
    .message-bubble {
        padding: 12px 16px;
        font-size: 16px;
    }
}


/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    /* Adjusted for 1.5 line-height */
}


.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background: #000000;
    /* Made black for light backgrounds */
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}


.typing-indicator .dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animations */
@keyframes chatCardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat Input Field */
.hero-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-border-white-10);
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-input-field {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    /* Matched to hero subtitle */
    line-height: 1.5;
    color: var(--color-text-primary);
    font-family: var(--font-family-base);
    padding: 8px 10px;
}


.chat-input-field::placeholder {
    color: var(--color-text-tertiary);
}

.chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text-secondary);
}

.chat-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-text-primary);
}

.chat-btn svg {
    width: 18px;
    height: 18px;
}