/* ============================================================
   Section 04 — How it works (pinned accordion scrollytelling)
   Desktop (>=1024px): the whole block (title + sub + accordion +
   card stage + trust pills) pins for the section's scroll runway.
   Scrolling advances the active step: the expanded item collapses
   to its compact "tab" (number + name + eyebrow) and the next one
   expands, while the right-hand card cross-fades to match.
   Steps: Prepare → Diagnose → Fix → Verify → Remember (loop).
   Mobile: a plain stacked list, every step expanded with its
   own inline card. Reuses existing tokens.
   ============================================================ */

.nl-how-it-works {
    background: #020617;
    position: relative;
    /* Hairlines bracket §3 as its own dark band */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* NOTE: no overflow:hidden — it would break the pinned (sticky) block. */
}

/* Mobile-first: normal flowing section */
.nl-hiw__pin {
    max-width: 1248px;
    margin: 0 auto;
    padding: 88px clamp(20px, 4vw, 64px);
}

/* ─── Header ─── */
.nl-hiw__header {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.nl-hiw__title {
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.2px;
    color: #FFFFFF;
    margin: 0;
}

.nl-hiw__subtitle {
    margin: 16px auto 0;
    max-width: 700px;
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: clamp(15px, 1.7vw, 17px);
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.2px;
    color: #AFBCD5;
}

/* ─── Steps (mobile: stacked, all expanded) ─── */
.nl-hiw__scrolly {
    margin-top: 48px;
}

.nl-hiw__step + .nl-hiw__step {
    margin-top: 40px;
}

.nl-hiw__step-head {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    text-align: left;
    cursor: default;
}

.nl-hiw__step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex-shrink: 0;
    background: var(--nl-blue, #3B82F6);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #FFFFFF;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* "Remember" closes the loop — purple accent, matching the band's old label */
.nl-hiw__step-num--loop {
    background: #7C5CFA;
    border-color: rgba(167, 139, 250, 0.5);
}

.nl-hiw__step-heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.nl-hiw__step-title {
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: #FFFFFF;
    transition: color 0.3s ease;
}

.nl-hiw__step-eyebrow {
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nl-blue, #3B82F6);
}

.nl-hiw__step-eyebrow--loop {
    color: #A78BFA;
}

/* Body: expanded by default (mobile); desktop collapses inactive ones */
.nl-hiw__step-body {
    display: grid;
    grid-template-rows: 1fr;
}

.nl-hiw__step-body-in {
    overflow: hidden;
    min-height: 0;
}

.nl-hiw__step-desc {
    margin: 10px 0 0 54px; /* aligns with the heading text (num 40 + gap 14) */
    font-family: var(--nl-font, 'Plus Jakarta Sans', sans-serif);
    font-size: 15.5px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.2px;
    color: #AFBCD5;
}

/* Inline card — mobile only */
.nl-hiw__step-card-inline {
    display: block;
    margin: 18px 0 0 0;
    width: 100%;
    max-width: 620px;
    height: auto;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

/* Sticky card stage — desktop only */
.nl-hiw__sticky {
    display: none;
}

/* ════════════ Desktop: pinned accordion ════════════ */
@media (min-width: 1024px) {

    /* The section is taller than the viewport — that extra height is the
       scroll runway that drives the 5 accordion states. */
    .nl-how-it-works {
        height: calc(100vh + 2200px);
    }

    .nl-hiw__pin {
        position: sticky;
        top: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-top: 96px; /* clears the sticky site header */
        padding-bottom: 28px;
    }

    .nl-hiw__scrolly {
        display: grid;
        grid-template-columns: minmax(320px, 420px) 1fr;
        gap: 56px;
        align-items: center;
        max-width: 1150px;
        margin: 40px auto 0;
        width: 100%;
    }

    /* Accordion items: compact tabs separated by hairlines */
    .nl-hiw__step {
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        padding: 13px 0;
        opacity: 0.62;
        transition: opacity 0.3s ease;
    }

    .nl-hiw__step:first-child {
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .nl-hiw__step + .nl-hiw__step {
        margin-top: 0;
    }

    .nl-hiw__step.is-active {
        opacity: 1;
    }

    .nl-hiw__step:not(.is-active):hover {
        opacity: 0.85;
    }

    .nl-hiw__step-head {
        cursor: pointer;
    }

    .nl-hiw__step.is-active .nl-hiw__step-head {
        cursor: default;
    }

    /* Compressed: muted title + tinted number */
    .nl-hiw__step:not(.is-active) .nl-hiw__step-num {
        background: rgba(59, 130, 246, 0.14);
        border-color: rgba(59, 130, 246, 0.3);
        color: #7DA8F0;
    }

    .nl-hiw__step:not(.is-active) .nl-hiw__step-num--loop {
        background: rgba(124, 92, 250, 0.14);
        border-color: rgba(167, 139, 250, 0.32);
        color: #B6A3F5;
    }

    .nl-hiw__step:not(.is-active) .nl-hiw__step-title {
        color: #AFBCD5;
    }

    /* Collapse/expand */
    .nl-hiw__step-body {
        grid-template-rows: 0fr;
        opacity: 0;
        transition: grid-template-rows 0.45s cubic-bezier(0.22, 1, 0.36, 1),
            opacity 0.3s ease;
    }

    .nl-hiw__step.is-active .nl-hiw__step-body {
        grid-template-rows: 1fr;
        opacity: 1;
        transition: grid-template-rows 0.45s cubic-bezier(0.22, 1, 0.36, 1),
            opacity 0.35s ease 0.12s;
    }

    .nl-hiw__step-desc {
        font-size: 15px;
        margin-bottom: 4px;
    }

    /* The card lives in the stage on desktop */
    .nl-hiw__step-card-inline {
        display: none;
    }

    .nl-hiw__sticky {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .nl-hiw__stage {
        position: relative;
        width: 100%;
        aspect-ratio: 720 / 430; /* reserves the tallest card — no layout shift */
    }

    .nl-hiw__card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        opacity: 0;
        /* Subtle spring: the activating card eases up + scales in as it fades */
        transform: translateY(16px) scale(0.985);
        transition: opacity 0.3s ease, transform 0.55s cubic-bezier(0.34, 1.3, 0.5, 1);
        filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.4));
    }

    .nl-hiw__card.is-active {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Shorter laptop screens: tighten so the pinned block always fits */
@media (min-width: 1024px) and (max-height: 820px) {
    .nl-hiw__pin {
        padding-top: 84px;
    }

    .nl-hiw__title {
        font-size: 32px;
    }

    .nl-hiw__subtitle {
        font-size: 14.5px;
        margin-top: 10px;
    }

    .nl-hiw__scrolly {
        margin-top: 24px;
        max-width: 1040px;
    }

    .nl-hiw__step {
        padding: 10px 0;
    }

    .nl-hiw__step-desc {
        font-size: 14px;
    }
}

/* Respect reduced motion — instant state changes, no springs */
@media (prefers-reduced-motion: reduce) {
    .nl-hiw__step,
    .nl-hiw__step-num,
    .nl-hiw__step-title,
    .nl-hiw__step-body,
    .nl-hiw__card {
        transition: none;
    }

    .nl-hiw__card {
        transform: none;
    }
}
