/**
 * How It Works Section Styles
 * Displays animated steps with numbered circles and connecting lines
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    --hiw-bg-color: #F9F9F7;
    --hiw-circle-bg: #ffffff;
    --hiw-number-color: #2B5F9E;
    --hiw-line-color: #DE5C54;
    --hiw-heading-color: #2B5F9E;
    --hiw-title-color: #333333;
    --hiw-description-color: #666666;
}

/* ==========================================================================
   Section Container
   ========================================================================== */

.how-it-works-section {
    width: 100%;
    background-color: var(--hiw-bg-color);
    padding: 80px 20px;
}

.how-it-works-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   Section Header
   ========================================================================== */

.how-it-works-heading {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--hiw-heading-color);
    margin: 0 0 60px 0;
    text-align: center;
}

/* ==========================================================================
   Steps Container
   ========================================================================== */

.how-it-works-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 20px;
    position: relative;
    overflow: visible;
}

/* ==========================================================================
   Individual Step
   ========================================================================== */

.how-it-works-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
}

.how-it-works-step:last-child {
    margin-bottom: 0;
}

/* Mobile: 50/50 split between circle and content */
@media (max-width: 767px) {
    .how-it-works-step {
        gap: 15px;
    }
    
    .step-number-wrapper {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .step-content {
        flex: 0 0 calc(50% - 15px);
        max-width: calc(50% - 15px);
    }
}

/* ==========================================================================
   Number Circle
   ========================================================================== */

.step-number-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.step-number-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background-color: var(--hiw-circle-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    z-index: 2;
    position: relative;
}

.step-number {
    font-size: 2rem;
    font-weight: 600;
    color: var(--hiw-number-color);
}

/* ==========================================================================
   Straight horizontal dashed line — behind circles, clipped between first/last
   ========================================================================== */

.hiw-line-track {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.how-it-works-line {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hiw-line-track-desktop {
    display: none;
}

.hiw-line-track-mobile {
    display: none;
}

.hiw-line-desktop {
    transform-origin: left center;
    background: repeating-linear-gradient(
        90deg,
        var(--hiw-line-color) 0,
        var(--hiw-line-color) 12px,
        transparent 12px,
        transparent 20px
    );
}

.hiw-line-mobile {
    transform-origin: top center;
    background: repeating-linear-gradient(
        180deg,
        var(--hiw-line-color) 0,
        var(--hiw-line-color) 12px,
        transparent 12px,
        transparent 20px
    );
}

@media (min-width: 768px) {
    .hiw-line-track-desktop {
        display: block;
        height: 3px;
        top: 70px;
    }
    .hiw-line-desktop {
        height: 3px;
    }
}

@media (max-width: 767px) {
    .hiw-line-track-mobile {
        display: block;
        width: 3px;
    }
    .hiw-line-mobile {
        width: 3px;
        height: 100%;
    }
}

/* ==========================================================================
   Step Content
   ========================================================================== */

.step-content {
    flex: 1;
    padding-top: 10px;
}

/* Mobile: Remove extra padding for 50/50 layout */
@media (max-width: 767px) {
    .step-content {
        padding-top: 0;
    }
}

.step-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--hiw-title-color);
    margin: 0 0 12px 0;
}

.step-description {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--hiw-description-color);
    margin: 0;
}

/* ==========================================================================
   CTA Button
   ========================================================================== */

.how-it-works-cta {
    text-align: center;
    margin-top: 60px;
}

.how-it-works-cta-button {
    display: inline-block;
    padding: 16px 48px;
    background-color: var(--coral-primary);
    color: var(--white);
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-pill);
    border: 3px solid var(--coral-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.how-it-works-cta-button::after {
    content: '›';
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    transition: transform 0.2s;
}

.how-it-works-cta-button:hover {
    background-color: transparent;
    color: var(--coral-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-button);
}

.how-it-works-cta-button:hover::after {
    transform: translateY(-50%) translateX(4px);
}

.how-it-works-cta-button:active {
    transform: translateY(0);
}

.how-it-works-cta-button:focus {
    outline: 3px solid var(--coral-primary);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .how-it-works-cta {
        margin-top: 40px;
    }
    
    .how-it-works-cta-button {
        padding: 14px 40px;
        font-size: 16px;
    }
}

/* ==========================================================================
   Desktop Layout (Horizontal)
   ========================================================================== */

@media (min-width: 768px) {
    .how-it-works-steps {
        flex-direction: row;
        justify-content: space-around;
        gap: 0;
        position: relative;
    }

    .how-it-works-step {
        flex: 1 1 0;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 0;
        max-width: 320px;
        position: relative;
        z-index: 1;
        display: flex;
    }

    .step-number-wrapper {
        flex-direction: column;
        align-items: center;
        width: 100%;
        justify-content: center;
        position: relative;
    }

    .step-number-circle {
        width: 140px;
        height: 140px;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .step-number {
        font-size: 3.5rem;
    }

    .step-content {
        padding-top: 30px;
        width: 100%;
    }

    .step-title {
        font-size: 18px;
    }

    .step-description {
        font-size: 18px;
    }
}

/* ==========================================================================
   Large Desktop
   ========================================================================== */

@media (min-width: 1024px) {
    .how-it-works-section {
        padding: 100px 40px;
    }

    .how-it-works-heading {
        font-size: 3rem;
        margin-bottom: 80px;
    }

    .how-it-works-step {
        max-width: 380px;
    }

}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */

@media (max-width: 767px) {
    .how-it-works-section {
        padding: 60px 15px;
    }

    .how-it-works-heading {
        font-size: 2rem;
        margin-bottom: 50px;
    }

    .how-it-works-step {
        margin-bottom: 80px;
        gap: 15px;
    }

    .step-number-wrapper {
        position: static;
        flex: 0 0 50%;
        max-width: 50%;
    }

    .step-number-circle {
        width: 140px;
        height: 140px;
        margin: 0 auto;
    }

    .step-number {
        font-size: 3.5rem;
    }

    .step-content {
        flex: 0 0 calc(50% - 15px);
        max-width: calc(50% - 15px);
        padding-top: 0;
    }

    .step-title {
        font-size: 18px;
        text-align: left;
    }

    .step-description {
        font-size: 18px;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .how-it-works-section {
        padding: 40px 12px;
    }

    .how-it-works-heading {
        font-size: 1.75rem;
        margin-bottom: 40px;
    }

    .how-it-works-step {
        gap: 12px;
        margin-bottom: 70px;
    }

    .step-number-wrapper {
        position: static;
        flex: 0 0 50%;
        max-width: 50%;
    }

    .step-number-circle {
        width: 140px;
        height: 140px;
        margin: 0 auto;
    }

    .step-number {
        font-size: 3.5rem;
    }

    .step-content {
        flex: 0 0 calc(50% - 12px);
        max-width: calc(50% - 12px);
    }

    .step-title {
        font-size: 16px;
    }

    .step-description {
        font-size: 16px;
    }
}
