/* Apple-style scroll-driven experiences */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.08s linear;
}

.scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.4s ease;
}

.scroll-hint.is-hidden { opacity: 0; pointer-events: none; }

.scroll-hint-chevron {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    animation: scroll-hint-bounce 2s ease-in-out infinite;
}

@keyframes scroll-hint-bounce {
    0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.5; }
    50% { transform: rotate(45deg) translateY(6px); opacity: 1; }
}

/* Hero parallax target */
.scroll-hero .hero-content,
.scroll-hero .hero-phone-wrap,
.scroll-hero .hero-mascot-wrap {
    will-change: transform, opacity;
}

/* --- Sticky scroll story (Connect steps) --- */
.scroll-story-track {
    height: 185vh;
    position: relative;
}

.scroll-story-pin {
    position: sticky;
    top: var(--header-height);
    height: calc(var(--viewport-height) - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    text-align: center;
}

.scroll-story-intro {
    margin-bottom: 1.25rem;
}

.scroll-story-counter {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.scroll-story-continue {
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.scroll-story-continue.is-visible {
    opacity: 0.65;
    transform: translateY(0);
}

.scroll-story-intro .section-title { margin-bottom: 0.5rem; }
.scroll-story-intro .section-lead { margin-bottom: 0; }

.scroll-story-stage {
    position: relative;
    width: 100%;
    max-width: 520px;
    min-height: 220px;
}

.scroll-story-step {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    opacity: 0;
    transform: translateY(32px) scale(0.96);
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.scroll-story-step.is-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    z-index: 2;
}

.scroll-story-step.is-exiting {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
    z-index: 1;
}

.scroll-story-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.15);
    color: var(--primary-glow);
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.scroll-story-step[data-accent="warm"] .scroll-story-step-num {
    background: rgba(255, 184, 77, 0.15);
    color: var(--accent);
}

.scroll-story-step[data-accent="purple"] .scroll-story-step-num {
    background: rgba(88, 86, 214, 0.15);
    color: #9D9BF5;
}

.scroll-story-step h3 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.65rem;
}

.scroll-story-step p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.55;
    max-width: 400px;
}

.scroll-story-nav {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
}

.scroll-story-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.35s ease, transform 0.35s ease;
}

.scroll-story-dot.is-active {
    background: var(--accent);
    transform: scale(1.25);
}

/* --- Persona scroll story (life profiles) --- */
.scroll-story--personas .scroll-story-track { height: 340vh; }

.scroll-story-stage--personas {
    max-width: 560px;
    min-height: 300px;
}

.persona-step {
    text-align: left;
    align-items: flex-start;
    padding: 2rem 1.75rem;
}

.persona-step h3 {
    font-size: clamp(1.35rem, 3.2vw, 1.65rem);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.persona-step-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.65rem;
}

.persona-step[data-accent="warm"] .persona-step-label { color: var(--accent); }
.persona-step[data-accent="purple"] .persona-step-label { color: #9D9BF5; }

.persona-problem {
    color: var(--text-soft);
    font-size: 0.98rem;
    line-height: 1.55;
    margin-bottom: 1rem;
    max-width: none;
}

.persona-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.persona-modules li {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
}

.persona-outcome {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-subtle);
    max-width: none;
}

.persona-outcome::before {
    content: '→ ';
    color: var(--accent);
    font-weight: 700;
}

/* --- Remi scroll chat --- */
.scroll-story--remi .scroll-story-track { height: 210vh; }

.scroll-story--remi .scroll-story-pin {
    max-width: 680px;
    margin: 0 auto;
}

.scroll-story-chat {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.scroll-story-item {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-story-item.is-active {
    opacity: 1;
    transform: translateY(0);
}

/* --- App showcase --- */
.scroll-showcase-track {
    height: 145vh;
    position: relative;
}

.scroll-showcase-pin {
    position: sticky;
    top: var(--header-height);
    height: calc(var(--viewport-height) - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.scroll-showcase-headline {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    margin-bottom: 0.5rem;
}

.scroll-showcase-headline.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-showcase-lead {
    opacity: 0;
    transition: opacity 0.4s ease 0.1s;
    margin-bottom: 2rem;
}

.scroll-showcase-lead.is-visible { opacity: 1; }

.scroll-showcase-device {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    will-change: transform, opacity;
    transform: scale(0.82) translateY(60px);
    opacity: 0;
}

.scroll-showcase-device .app-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.75),
        0 16px 40px rgba(0, 122, 255, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

.scroll-showcase-device .app-image--phone {
    /* PNG already includes dark titanium frame + Dynamic Island */
    border-radius: 0;
    background: transparent;
}

.scroll-showcase-glow {
    position: absolute;
    width: 60%;
    height: 50%;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.3) 0%, rgba(255, 184, 77, 0.08) 50%, transparent 70%);
    filter: blur(70px);
    z-index: -1;
    pointer-events: none;
}

/* Pain cards scroll stagger */
.pain-card.scroll-stagger {
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.pain-card.scroll-stagger.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.pain-card.scroll-stagger:nth-child(2) { transition-delay: 0.08s; }
.pain-card.scroll-stagger:nth-child(3) { transition-delay: 0.16s; }

@media (max-width: 1024px), (max-height: 900px) {
    .scroll-story-track,
    .scroll-showcase-track {
        height: auto;
    }

    .scroll-story-pin,
    .scroll-showcase-pin {
        position: relative;
        top: auto;
        height: auto;
        min-height: 0;
        padding: 3rem max(1.25rem, var(--safe-left)) 3rem max(1.25rem, var(--safe-right));
    }

    .scroll-story-stage {
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .scroll-story-stage--personas {
        max-width: 640px;
        gap: 1.25rem;
    }

    .scroll-story-step {
        position: relative;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .scroll-story-step.is-exiting {
        opacity: 1;
        transform: none;
    }

    .persona-step {
        width: 100%;
    }

    .scroll-story-nav { display: none; }

    .scroll-story-counter,
    .scroll-story-continue { display: none; }

    .scroll-story-item {
        opacity: 1;
        transform: none;
    }

    .scroll-showcase-device {
        transform: none;
        opacity: 1;
    }

    .scroll-showcase-headline,
    .scroll-showcase-lead {
        opacity: 1;
        transform: none;
    }

    .scroll-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-hint-chevron { animation: none; }
    .scroll-story-step,
    .scroll-story-item,
    .scroll-showcase-device,
    .scroll-showcase-headline,
    .scroll-showcase-lead,
    .pain-card.scroll-stagger {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .scroll-story-track,
    .scroll-showcase-track { height: auto; }

    .scroll-story-pin,
    .scroll-showcase-pin {
        position: relative;
        height: auto;
    }

    .scroll-story-step { position: relative; }
    .scroll-story-stage { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
    .scroll-story-nav { display: none; }
    .scroll-hint { display: none; }
}
