/* ═══════════════════════════════════════════════════════════
   How It Works — Unlock Animation Styles
   ═══════════════════════════════════════════════════════════ */

.how-it-works {
    padding: 5rem 2rem 3rem;
    background: var(--bg-deep, #0a0a0f);
    overflow: hidden;
}

.how-container {
    max-width: 900px;
    margin: 0 auto;
}

.how-it-works .section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.how-it-works .section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.how-it-works .section-header p {
    color: var(--text-secondary, #8a8f9d);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Steps Row ── */
.how-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 3rem;
}

.how-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface, #12121a);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-radius: 12px;
    transition: all 0.5s ease;
    opacity: 0.4;
}

.how-step.active {
    opacity: 1;
    border-color: rgba(74, 158, 255, 0.3);
    box-shadow: 0 4px 24px rgba(74, 158, 255, 0.1);
}

.how-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: #4a9eff;
    border: 1.5px solid rgba(74, 158, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all 0.5s ease;
}

.how-step.active .how-step-num {
    background: transparent;
    color: #4a9eff;
    border-color: #4a9eff;
    box-shadow: 0 0 16px rgba(74, 158, 255, 0.25);
}

.how-step-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    color: var(--text-primary, #f0f2f5);
}

.how-step-text p {
    font-size: 0.8rem;
    color: var(--text-muted, #5a5f6d);
    line-height: 1.4;
}

.how-step-connector {
    width: 40px;
    height: 2px;
    background: var(--border, rgba(255, 255, 255, 0.06));
    flex-shrink: 0;
    position: relative;
    transition: background 0.5s ease;
}

.how-step-connector.active {
    background: rgba(74, 158, 255, 0.4);
}

/* ── Animated Tree ── */
.how-tree-wrapper {
    position: relative;
}

.how-tree-label {
    text-align: center;
    color: var(--text-muted, #5a5f6d);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.how-tree-viewport {
    background: var(--bg-surface, #12121a);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow-x: auto;
}

.how-tree-svg {
    width: 100%;
    min-width: 700px;
    max-width: 880px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ── Level Labels ── */
.how-level-label {
    fill: #2a2f3d;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    transition: fill 0.6s ease;
}

.how-level-label.lit {
    fill: #5a5f6d;
}

/* ── Nodes — Locked State (default) ── */
.how-node rect {
    fill: #1a1a20;
    stroke: #2a2a34;
    stroke-width: 2;
    transition: fill 0.6s ease, stroke 0.6s ease, filter 0.6s ease;
}

.how-node .how-node-title {
    fill: #3a3f4d;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    transition: fill 0.6s ease;
}

.how-node .how-node-sub {
    fill: #2a2f3d;
    font-size: 10px;
    font-family: 'Outfit', sans-serif;
    transition: fill 0.6s ease;
}

/* Lock icon */
.how-lock {
    color: #3a3f4d;
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.4s ease;
}

/* ── Nodes — Unlocked States ── */
.how-node.unlocked .how-lock {
    opacity: 0;
    transform: translateY(-6px);
}

/* Level 0 — Blue Core */
.how-node.unlocked[data-unlock="0"] rect {
    fill: #1a2a3a;
    stroke: #4a9eff;
    filter: drop-shadow(0 0 12px rgba(74, 158, 255, 0.3));
}
.how-node.unlocked[data-unlock="0"] .how-node-title { fill: #f0f2f5; }
.how-node.unlocked[data-unlock="0"] .how-node-sub { fill: #8a8f9d; }

/* Level 1 — Green Branches */
.how-node.unlocked[data-unlock="1"] rect {
    fill: #1a3a2a;
    stroke: #34d399;
    filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.25));
}
.how-node.unlocked[data-unlock="1"] .how-node-title { fill: #f0f2f5; }

/* Level 2 — Purple Leaves */
.how-node.unlocked[data-unlock="2"] rect {
    fill: #2a2440;
    stroke: #a78bfa;
    filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.25));
}
.how-node.unlocked[data-unlock="2"] .how-node-title { fill: #f0f2f5; }

/* Level 3 — Orange Sub-leaves */
.how-node.unlocked[data-unlock="3"] rect {
    fill: #3a2a1a;
    stroke: #f59e0b;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.25));
}
.how-node.unlocked[data-unlock="3"] .how-node-title { fill: #f0f2f5; }

/* ── Connection Lines — Locked (hidden, ready to draw) ── */
.how-line {
    fill: none;
    stroke: #2a2a34;
    stroke-width: 2;
    opacity: 0;
}

/* Connection Lines — Unlocked: draw + color + fade in */
.how-conn.unlocked .how-line {
    opacity: 0.7;
    stroke-dashoffset: 0 !important;
    transition: stroke-dashoffset 0.7s ease-out, stroke 0.4s ease, opacity 0.3s ease;
}

.how-conn.unlocked[data-unlock="1"] .how-line { stroke: #4a9eff; }
.how-conn.unlocked[data-unlock="2"] .how-line { stroke: #34d399; }
.how-conn.unlocked[data-unlock="3"] .how-line { stroke: #a78bfa; }

/* ── Replay Button ── */
.how-replay-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-radius: 8px;
    color: var(--text-muted, #5a5f6d);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.how-replay-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.how-replay-btn:hover {
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.3);
    color: #4a9eff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .how-steps {
        flex-direction: column;
        gap: 0;
    }

    .how-step-connector {
        width: 2px;
        height: 24px;
    }

    .how-step {
        width: 100%;
        max-width: 320px;
    }

    .how-tree-viewport {
        padding: 1rem;
    }

    .how-it-works .section-header h2 {
        font-size: 2rem;
    }
}