/* How It Works Section - Vertical Timeline Layout */
#how-it-works {
    border-top: 0;
    position: relative;
}

/* Subtle background texture for premium feel */
#how-it-works::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(79, 70, 229, 0.015) 0%, transparent 50%);
    pointer-events: none;
}

[data-theme="dark"] #how-it-works::before {
    background: radial-gradient(circle at 20% 30%, rgba(79, 70, 229, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(79, 70, 229, 0.04) 0%, transparent 50%);
}

.how-wrapper {
    position: relative;
    display: grid;
    justify-content: center;
    /* center the composition */
}

.how-steps {
    position: relative;
    /* Define a dedicated timeline column width so we can center precisely */
    --timeline-col: 4rem;
    --timeline-border: 1px;
    /* keep in sync with .how-step__number border */
    margin-inline: auto;
    /* ensure the list itself is centered */
    width: 100%;
    /* occupy full width of the wrapper */
    list-style: none;
    padding: 0;
    margin: 0;
}

.how-steps::before {
    content: '';
    position: absolute;
    left: calc(var(--timeline-col) / 2);
    top: calc(var(--timeline-col) / 2);
    /* center of first circle */
    bottom: calc(var(--timeline-col) / 2);
    /* center of last circle */
    width: 1px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.08) 0%, rgba(17, 24, 39, 0.04) 50%, rgba(17, 24, 39, 0.08) 100%);
}

.how-step {
    position: relative;
    display: grid;
    /* 3-col grid: bubble | body | ghost bubble (for balance) */
    grid-template-columns: var(--timeline-col) 1fr var(--timeline-col);
    column-gap: 1rem;
    align-items: start;
    padding-bottom: 1rem;
}

.how-step:last-child {
    padding-bottom: 0;
}

.how-step__content {
    position: relative;
    display: contents;
    /* allow grid children to place directly */
}

.how-step__number {
    grid-column: 1;
    grid-row: 1;
    width: var(--timeline-col);
    height: var(--timeline-col);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: var(--timeline-border) solid var(--border-color);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.04);
    justify-self: center;
}

.how-step__digit {
    font-size: 1.125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #4338ca;
    /* indigo-700 for emphasis */
    letter-spacing: -0.025em;
}

[data-theme="dark"] .how-step__digit {
    color: #818cf8;
    /* indigo-400 for more vibrancy */
}

.how-step__body {
    grid-column: 2 / 4;
    /* let text occupy the right balancing column too */
    grid-row: 1;
    padding-top: 0.5rem;
}

.how-step__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    /* gray-900 */
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.how-step__description {
    color: var(--text-secondary);
    /* gray-500 */
    line-height: 1.6;
    font-size: 0.9375rem;
    max-width: 36rem;
    /* wider measure for this section */
}

/* Sentence wrapping control: mobile defaults to natural wrapping (inline).
   On md+ viewports, keep the entire following sentence on one line; if it
   doesn't fully fit at line end, it moves as a whole to the next line. */
.no-wrap-next {
    display: inline;
}

@media (min-width: 768px) {
    .no-wrap-next {
        white-space: nowrap;
    }
}

/* Hover state only on number circle */
.how-step__number {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.how-step__number:hover {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.how-step__digit {
    transition: color 0.2s ease;
}

.how-step__number:hover .how-step__digit {
    color: #4f46e5;
    /* indigo-600 */
}

/* Subtle scale-in on reveal for number circles */
.chat-reveal.is-visible .how-step__number {
    animation: how-circle-in 180ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes how-circle-in {
    from {
        transform: scale(0.98);
    }

    to {
        transform: scale(1);
    }
}

.how-cta-row {
    text-align: center;
}

.how-cta-row .cta-button {
    align-self: center;
}

/* Kicker tone and tracking */
.how-kicker {
    letter-spacing: 0.14em;
    color: var(--text-muted);
    /* slate-500 for cooler editorial tone */
}

/* CTA callout refinement */
.how-cta-card {
    border-color: rgba(17, 24, 39, 0.06) !important;
    /* softer hairline */
    padding: calc(1.5rem + 2px);
}

@media (min-width: 768px) {
    .how-cta-card {
        padding: calc(2rem + 2px);
    }
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .how-steps {
        --timeline-col: 3rem;
    }

    .how-steps::before {
        top: calc(var(--timeline-col) / 2);
        bottom: calc(var(--timeline-col) / 2);
    }

    .how-step__digit {
        font-size: 1rem;
    }

    .how-step__title {
        font-size: 1.125rem;
    }

    .how-step__description {
        font-size: 0.875rem;
    }
}