/**
 * How It Works Section Styles - Timeline Design
 *
 * @package Etches
 * @since 1.0.0
 */

.how-it-works-section {
    padding: 100px 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
    overflow: hidden;
}

/* Decorative Background Elements - Timeline line starts after header */
.how-it-works-section::before {
    content: '';
    position: absolute;
    top: 250px; /* Starts after header section */
    left: 50%;
    width: 2px;
    height: calc(100% - 250px);
    background: linear-gradient(
        to bottom,
        transparent 0%,
        #E6E3DF 5%,
        #E6E3DF 95%,
        transparent 100%
    );
    transform: translateX(-50%);
    z-index: 0;
}

/* Section Header */
.how-it-works-header {
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
}

.how-it-works-title {
    font-size: 2.75rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1a1a1a;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.how-it-works-subtitle {
    font-size: 1.125rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
}

/* Steps Container */
.how-it-works-steps {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    z-index: 1;
}

/* Individual Step - Horizontal Timeline Layout */
.how-it-works-step {
    display: flex;
    align-items: center;
    gap: 60px;
    margin-bottom: 80px;
    position: relative;
    flex-direction: row-reverse; /* Default: text left, image right */
}

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

/* Alternate layout - even steps have text on right */
.how-it-works-step:nth-child(even) {
    flex-direction: row; /* Even steps: text right, image left */
}

/* Badge positioning - branch from center */
.how-it-works-step .step-content {
    display: flex;
    flex-direction: column;
}

/* Odd steps: badge aligned to right (towards center) */
.how-it-works-step:nth-child(odd) .step-number {
    align-self: flex-end;
    margin-right: -20px;
}

/* Even steps: badge aligned to left (towards center) */
.how-it-works-step:nth-child(even) .step-number {
    align-self: flex-start;
    margin-left: -20px;
}

/* Step Image Container */
.step-image {
    flex: 0 0 45%;
    position: relative;
}

.step-image::before {
    content: '';
    display: block;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.step-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.how-it-works-step:hover .step-image img {
    transform: scale(1.03);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

/* Step Content */
.step-content {
    flex: 1;
    position: relative;
    padding: 20px 0;
}

/* Step Number Badge */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #C4A484 0%, #B89C7D 100%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(196, 164, 132, 0.35);
    position: relative;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hover effect */
.how-it-works-step:hover .step-number {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(196, 164, 132, 0.5);
}

/* Connector line from badge towards center */
.step-number::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #C4A484, transparent);
    top: 50%;
    transform: translateY(-50%);
}

/* Odd steps: line goes to the right (towards center) */
.how-it-works-step:nth-child(odd) .step-number::before {
    left: 100%;
    margin-left: 5px;
    background: linear-gradient(90deg, #C4A484, transparent);
}

/* Even steps: line goes to the left (towards center) */
.how-it-works-step:nth-child(even) .step-number::before {
    right: 100%;
    left: auto;
    margin-right: 5px;
    background: linear-gradient(-90deg, #C4A484, transparent);
}

/* Step Title */
.step-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a1a;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Step Subtitle */
.step-subtitle {
    font-size: 1.0625rem;
    color: #C4A484;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

/* Step Description */
.step-description {
    font-size: 1rem;
    color: #555;
    line-height: 1.75;
}

.step-description p {
    margin-bottom: 16px;
}

.step-description p:last-child {
    margin-bottom: 0;
}

/* Tablet adjustments */
@media (max-width: 991px) {
    .how-it-works-section {
        padding: 70px 0;
    }

    .how-it-works-section::before {
        display: none;
    }

    .how-it-works-header {
        margin-bottom: 60px;
    }

    .how-it-works-title {
        font-size: 2.25rem;
    }

    .how-it-works-step {
        gap: 40px;
        margin-bottom: 60px;
    }

    .step-image {
        flex: 0 0 40%;
    }

    .step-number {
        width: 60px;
        height: 60px;
        font-size: 1.125rem;
    }

    /* Reset branch positioning on tablet - center badges */
    .how-it-works-step:nth-child(odd) .step-number,
    .how-it-works-step:nth-child(even) .step-number {
        align-self: center;
        margin-left: 0;
        margin-right: 0;
    }

    .step-number::before {
        display: none;
    }

    .step-title {
        font-size: 1.5rem;
    }

    .step-description {
        font-size: 0.9375rem;
    }
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .how-it-works-section {
        padding: 50px 0;
    }

    .how-it-works-header {
        margin-bottom: 50px;
    }

    .how-it-works-title {
        font-size: 2rem;
    }

    .how-it-works-subtitle {
        font-size: 1rem;
    }

    /* Stack layout on mobile */
    .how-it-works-step {
        flex-direction: column !important;
        gap: 30px;
        margin-bottom: 50px;
        text-align: center;
    }

    .step-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .step-content {
        padding: 0;
    }

    .step-number {
        width: 55px;
        height: 55px;
        font-size: 1rem;
        margin-left: auto;
        margin-right: auto;
    }

    .step-title {
        font-size: 1.375rem;
    }

    .step-subtitle {
        font-size: 0.8125rem;
    }

    .step-description {
        font-size: 0.9375rem;
    }
}

@media (max-width: 480px) {
    .how-it-works-title {
        font-size: 1.75rem;
    }

    .step-title {
        font-size: 1.25rem;
    }

    .step-image {
        max-width: 100%;
    }
}

/* Animation on scroll (optional) */
@media (prefers-reduced-motion: no-preference) {
    .how-it-works-step {
        opacity: 0;
        animation: fadeInUp 0.6s ease forwards;
    }

    .how-it-works-step:nth-child(1) {
        animation-delay: 0.1s;
    }

    .how-it-works-step:nth-child(2) {
        animation-delay: 0.2s;
    }

    .how-it-works-step:nth-child(3) {
        animation-delay: 0.3s;
    }

    .how-it-works-step:nth-child(4) {
        animation-delay: 0.4s;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Print styles */
@media print {
    .how-it-works-section::before {
        display: none;
    }

    .step-number::before {
        display: none;
    }

    .how-it-works-step {
        page-break-inside: avoid;
        margin-bottom: 40px;
    }
}
