/* ==========================================================================
   Worthington - Scroll-triggered Animations
   ========================================================================== */

/* --------------------------------------------------------------------------
   Conversation Demo Container
   -------------------------------------------------------------------------- */
.conversation-demo {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
    min-height: 220px;
    position: relative;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Voice Mode
   -------------------------------------------------------------------------- */
.voice-container {
    padding: 1rem 1.25rem;
    margin-bottom: var(--space-sm);
    border-radius: 12px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.voice-container.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.voice-user {
    background-color: var(--color-ink);
    color: var(--color-paper);
    max-width: 520px;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.voice-assistant {
    background-color: var(--color-paper-dark);
    color: var(--color-ink);
    max-width: 520px;
    border-bottom-left-radius: 4px;
}

.voice-meta {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.voice-user .voice-meta {
    color: rgba(255, 255, 255, 0.6);
}

.voice-assistant .voice-meta {
    color: var(--color-ink-muted);
}

.voice-assistant.is-speaking .voice-meta {
    color: var(--color-highlight);
}

/* Voice Waveform */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 0.45s ease, opacity 0.45s ease, margin 0.45s ease;
}

.voice-container.is-speaking .voice-waveform,
.voice-waveform.is-speaking {
    height: 28px;
    margin-bottom: 0.5rem;
    opacity: 1;
}

.voice-waveform.is-done {
    height: 12px;
    margin-bottom: 0.5rem;
    opacity: 0.3;
}

.wave-bar {
    width: 4px;
    height: 8px;
    border-radius: 2px;
    background-color: currentColor;
    opacity: 0.6;
    transition: height 0.1s ease;
}

.voice-user .wave-bar {
    background-color: var(--color-highlight);
}

.voice-assistant .wave-bar {
    background-color: var(--color-highlight);
}

/* Animate waveform when speaking */
.voice-container.is-speaking .wave-bar,
.voice-waveform.is-speaking .wave-bar {
    animation: wave 0.5s ease-in-out infinite;
    opacity: 1;
}

.voice-container.is-speaking .wave-bar:nth-child(1),
.voice-waveform.is-speaking .wave-bar:nth-child(1) { animation-delay: 0.0s; }
.voice-container.is-speaking .wave-bar:nth-child(2),
.voice-waveform.is-speaking .wave-bar:nth-child(2) { animation-delay: 0.05s; }
.voice-container.is-speaking .wave-bar:nth-child(3),
.voice-waveform.is-speaking .wave-bar:nth-child(3) { animation-delay: 0.1s; }
.voice-container.is-speaking .wave-bar:nth-child(4),
.voice-waveform.is-speaking .wave-bar:nth-child(4) { animation-delay: 0.15s; }
.voice-container.is-speaking .wave-bar:nth-child(5),
.voice-waveform.is-speaking .wave-bar:nth-child(5) { animation-delay: 0.2s; }
.voice-container.is-speaking .wave-bar:nth-child(6),
.voice-waveform.is-speaking .wave-bar:nth-child(6) { animation-delay: 0.25s; }
.voice-container.is-speaking .wave-bar:nth-child(7),
.voice-waveform.is-speaking .wave-bar:nth-child(7) { animation-delay: 0.3s; }
.voice-container.is-speaking .wave-bar:nth-child(8),
.voice-waveform.is-speaking .wave-bar:nth-child(8) { animation-delay: 0.35s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 32px; }
}

.voice-transcript {
    display: block;
    font-size: 0.9375rem;
    line-height: 1.5;
    min-height: 1em;
}

/* --------------------------------------------------------------------------
   Feature 02 - Task Demo
   -------------------------------------------------------------------------- */
.task-demo {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    opacity: 0;
    transform: translateX(-16px);
    transition: opacity 0.65s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.65s cubic-bezier(0.25, 1, 0.5, 1);
    border-bottom: 1px solid var(--color-border);
}

.task-item:last-child {
    border-bottom: none;
}

.task-item.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.task-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.task-item.is-complete .task-checkbox {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.task-item.is-complete .task-checkbox::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.task-text {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--color-ink-light);
}

.task-item.is-complete .task-text {
    color: var(--color-ink-muted);
    text-decoration: line-through;
}

.task-status {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: transparent;
    transition: color 0.3s ease;
}

.task-item.is-complete .task-status {
    color: var(--color-success);
}

/* --------------------------------------------------------------------------
   Step 2 Breakout — Heading entrance + dark context overrides
   -------------------------------------------------------------------------- */

/* Heading enters from left (now left-aligned in two-column layout) */
.journey-step--breakout .journey-step-text h3 {
    transform: translateX(-16px);
}

.journey-step--breakout.is-active .journey-step-text h3 {
    transform: translateX(0);
}

/* Step 2 waveform bars — light on dark */
.journey-step--breakout .step2-transcript-bubble .wave-bar {
    background-color: rgba(255, 255, 255, 0.7);
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .voice-container {
        max-width: 100%;
    }

    /* Step 2 waveform inside bubble — slightly smaller on tablet */
    .voice-waveform.is-speaking,
    .voice-waveform.is-done {
        height: 16px;
    }
}

@media (max-width: 480px) {
    .task-item {
        font-size: 0.875rem;
    }

    .task-status {
        font-size: 0.6875rem;
    }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    /* Journey step transitions */
    .journey-step {
        opacity: 1 !important;
        transition: none !important;
    }

    .journey-step-text h3 {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .journey-step-marker {
        transition: background-color 0.15s linear, border-color 0.15s linear !important;
        transform: none !important;
    }

    .journey-step.is-active .journey-step-marker {
        transform: none !important;
    }

    .journey-track-fill {
        transition: none !important;
    }

    .journey-step-graphic {
        transition: none !important;
        box-shadow: none !important;
    }

    /* Step 1 onboarding cards */
    .onboard-card {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Step 1 icon crossfade — show in final checked state immediately */
    .onboard-icon--source,
    .onboard-icon--check {
        transition: none !important;
    }

    /* Step 3 task items */
    .task-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .task-checkbox {
        transition: background-color 0.1s linear, border-color 0.1s linear !important;
    }

    /* Step 4 savings */
    .savings-number,
    .savings-unit,
    .savings-label {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Voice waveform — stop animating, just show static bars */
    .voice-container.is-speaking .wave-bar {
        animation: none !important;
        height: 20px !important;
    }

    /* Voice containers */
    .voice-container {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Call status dot */
    .call-status-dot {
        animation: none !important;
    }

    /* Notification banner — no slide animation */
    .step2-notification {
        transition: opacity 0.15s linear !important;
        transform: translateY(0) !important;
    }

    /* Step 4 morphing calendar — appear immediately in final "after" state */
    .week-calendar {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .week-block {
        transition: none !important;
    }

    .week-label--before,
    .week-label--after {
        transition: none !important;
    }

    /* Step 2 breakout heading — no translate */
    .journey-step--breakout .journey-step-text h3 {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* --------------------------------------------------------------------------
   Phone Call Chrome
   -------------------------------------------------------------------------- */
.phone-call-chrome {
    background-color: #111;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.phone-call-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.625rem 1.25rem 0.625rem;
}

.phone-call-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.call-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    animation: callDotRinging 1.2s ease-in-out infinite;
    transition: background-color 0.4s ease;
}

.call-status-dot.is-connected {
    background-color: #34c759;
    animation: callDotPulse 2s ease-in-out infinite;
}

@keyframes callDotRinging {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.2); }
}

@keyframes callDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.call-status-label {
    font-family: var(--font-body);
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.4s ease;
}

.phone-call-contact {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.phone-call-timer {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
    min-height: 1em;
}

/* Conversation area inside chrome */
.phone-call-chrome .conversation-demo {
    margin-top: 0;
    padding: 0.875rem 1.125rem 1.125rem;
    border-top: none;
    background-color: #1c1c1e;
    min-height: auto;
}

.phone-call-chrome .voice-assistant {
    background-color: #2c2c2e;
    color: #f5f5f7;
}

