/* ── How It Works — curiosity-driven flow ───────────────── */

#how-it-works {
    position: relative;
}

/* Shooting star — plays once via index.js (moved to body while animating) */
.hiw-shooting-star {
    display: flex;
    flex-direction: row;
    align-items: center;
    pointer-events: none;
    opacity: 0;
}

body > .hiw-shooting-star,
.hiw-shooting-star.is-active {
    position: fixed;
    right: 0;
    left: auto;
    z-index: 48;
}

.hiw-shooting-star.is-active {
    opacity: 1;
}

@keyframes hiwShootingStar {
    0% {
        opacity: 0;
        transform: translate3d(1.5rem, 0, 0);
    }
    8% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(calc(-100vw - 10rem), 1.5rem, 0);
    }
}

.hiw-shooting-star__head {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 0 4px 1px rgba(255, 255, 255, 0.95),
        0 0 12px 3px rgba(196, 181, 253, 0.85),
        0 0 22px 6px rgba(139, 92, 246, 0.45);
}

.hiw-shooting-star__trail {
    flex-shrink: 0;
    width: 5.5rem;
    height: 2px;
    margin-left: -1px;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(139, 92, 246, 0.2) 18%,
        rgba(196, 181, 253, 0.55) 55%,
        rgba(255, 255, 255, 0.85) 100%
    );
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.45);
}

@media (max-width: 1023px) {
    .hiw-shooting-star {
        top: 3.25rem;
        z-index: 30;
    }

    .hiw-shooting-star__head {
        width: 7px;
        height: 7px;
    }

    .hiw-shooting-star__trail {
        width: 4.5rem;
    }

    .hiw-shooting-star.is-active {
        animation-duration: 1.5s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hiw-shooting-star.is-active {
        opacity: 0 !important;
        animation: none !important;
    }
}

/* Header */
.hiw-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem 0.4rem 0.45rem;
    margin-bottom: 1rem;
    border-radius: 9999px;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.22);
    font-size: 0.75rem;
    font-weight: 700;
    color: #6ee7b7;
    letter-spacing: 0.04em;
}

.hiw-eyebrow-dot {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #34d399, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: #fff;
    animation: hiwPulse 2s ease-in-out infinite;
}

@keyframes hiwPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

.hiw-headline {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.hiw-sub {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    color: #94a3b8;
    max-width: 32rem;
    margin: 0.75rem auto 0;
    line-height: 1.65;
}

.hiw-sub em {
    color: #e2e8f0;
    font-style: normal;
    font-weight: 600;
}

/* Pipeline — track aligned to card icons, emerges from behind */
.hiw-pipeline {
    position: relative;
    margin-top: 3rem;
}

.hiw-track {
    display: none;
    position: absolute;
    z-index: 0;
    height: 2px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) scaleX(0);
    transform-origin: center center;
}

@media (min-width: 768px) {
    .hiw-track {
        display: block;
    }

    .hiw-pipeline.hiw-animate .hiw-track {
        animation: hiwTrackEmerge 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
    }

    .hiw-track-inner {
        position: relative;
        width: 100%;
        height: 100%;
        border-radius: 9999px;
        background: rgba(255, 255, 255, 0.08);
        overflow: hidden;
    }

    .hiw-track-fill {
        position: absolute;
        inset: 0 auto 0 0;
        height: 100%;
        width: 0;
        border-radius: inherit;
        background: rgba(167, 139, 250, 0.75);
    }

    .hiw-pipeline.hiw-animate .hiw-track-fill {
        animation: hiwTrackFill 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.65s forwards;
    }
}

@keyframes hiwTrackEmerge {
    from {
        opacity: 0;
        transform: translateY(-50%) scaleX(0);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scaleX(1);
    }
}

@keyframes hiwTrackFill {
    from { width: 0; }
    to { width: 100%; }
}

/* Step cards */
.hiw-steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .hiw-steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

.hiw-step {
    position: relative;
    z-index: 1;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: #111114;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.hiw-step.reveal {
    transform: translateY(20px);
}

.hiw-step.reveal.visible {
    transform: none;
}

.hiw-step:nth-child(1).reveal.visible { transition-delay: 0ms; }
.hiw-step:nth-child(2).reveal.visible { transition-delay: 120ms; }
.hiw-step:nth-child(3).reveal.visible { transition-delay: 240ms; }

.hiw-step:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.hiw-step-inner {
    position: relative;
    border-radius: inherit;
    background: transparent;
    padding: 1.5rem 1.35rem 1.35rem;
    height: 100%;
}

.hiw-step-num {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    font-size: 2.75rem;
    font-weight: 900;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.06);
    pointer-events: none;
    user-select: none;
}

.hiw-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    margin-bottom: 1rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.hiw-icon-wrap {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #c4b5fd;
    transition: transform 0.25s ease;
}

.hiw-step:hover .hiw-icon-wrap {
    transform: scale(1.04);
}

.hiw-step-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.45rem;
    letter-spacing: -0.01em;
}

.hiw-step-desc {
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.hiw-step-tease {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.85rem;
}

/* Mini preview mockups */
.hiw-preview {
    border-radius: 0.85rem;
    background: #0a0a0e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    min-height: 5.5rem;
}

.hiw-preview-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.hiw-preview-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.hiw-preview-dot:first-child { background: #f87171; }
.hiw-preview-dot:nth-child(2) { background: #facc15; }
.hiw-preview-dot:nth-child(3) { background: #4ade80; }

.hiw-preview-body {
    padding: 0.65rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    line-height: 1.4;
    color: #64748b;
}

.hiw-preview-body--search {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow: hidden;
    min-height: 1.4em;
}

.hiw-preview-body .hiw-hl {
    flex-shrink: 0;
    color: #cbd5e1;
}

.hiw-preview-body .hiw-typing {
    display: inline-block;
    vertical-align: baseline;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid rgba(167, 139, 250, 0.7);
    width: 0;
    max-width: calc(100% - 3.5rem);
    animation: hiwTyping 3s steps(16, end) infinite, hiwCaret 0.6s step-end infinite;
}

@keyframes hiwTyping {
    0%, 100% { width: 0; }
    40%, 60% { width: 16ch; }
}

@keyframes hiwCaret {
    50% { border-color: transparent; }
}

.hiw-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 0.75rem 0.65rem;
}

.hiw-preview-tag {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.hiw-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.65rem;
}

.hiw-preview-price {
    font-weight: 800;
    color: #fff;
}

.hiw-preview-unlock {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #4ade80;
    font-weight: 700;
    animation: hiwUnlockPop 2.5s ease-in-out infinite;
}

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

.hiw-preview-result {
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.hiw-preview-spark {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #F472B6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.45rem;
    color: #fff;
    animation: hiwSparkSpin 4s linear infinite;
}

@keyframes hiwSparkSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hiw-preview-output {
    flex: 1;
    font-size: 0.625rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.hiw-preview-output strong {
    color: #f472b6;
    font-weight: 600;
}

/* Mobile: cards use standard reveal stagger */
@media (max-width: 767px) {
    .hiw-step:nth-child(1).reveal.visible { transition-delay: 0ms; }
    .hiw-step:nth-child(2).reveal.visible { transition-delay: 100ms; }
    .hiw-step:nth-child(3).reveal.visible { transition-delay: 200ms; }
}

/* Bottom CTA strip */
.hiw-cta-strip {
    margin-top: 2.5rem;
    padding: 1.15rem 1.25rem;
    border-radius: 1.15rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(244, 114, 182, 0.06));
    border: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 640px) {
    .hiw-cta-strip {
        flex-direction: row;
        text-align: left;
    }
}

.hiw-cta-text {
    font-size: 0.9375rem;
    color: #cbd5e1;
}

.hiw-cta-text strong {
    color: #fff;
    font-weight: 700;
}

.hiw-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    border-radius: 0.85rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #8B5CF6, #F472B6);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    white-space: nowrap;
}

.hiw-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(139, 92, 246, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    .hiw-eyebrow-dot,
    .hiw-track,
    .hiw-track-fill,
    .hiw-preview-unlock,
    .hiw-preview-spark,
    .hiw-typing {
        animation: none !important;
    }

    .hiw-pipeline.hiw-animate .hiw-track {
        opacity: 1;
        transform: translateY(-50%) scaleX(1);
    }

    .hiw-pipeline.hiw-animate .hiw-track-fill {
        width: 100%;
    }
}
