.how-it-works {
    padding: 80px 20px;
    background-color: #ffffff;
    overflow-x: hidden;
}

.how-it-works__title {
    width: 1440px;
    height: 61px;
    flex-shrink: 0;
    color: rgba(0, 64, 113, 0.89);
    text-align: center;
    font-family: "Bosch Sans";
    font-size: 48px;
    font-style: normal;
    font-weight: 900;
    line-height: normal;
    margin-bottom: 50px;
    margin: 0 auto 50px auto;
    max-width: 100%;
}

.how-it-works__steps {
    display: grid;
    gap: 20px;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 4 cards: Always 4x1 or 2x2, NEVER 3+1 */
.how-it-works__steps[data-count="4"] {
    grid-template-columns: repeat(4, 305px);
    max-width: 1280px;
}

/* Other quantities */
.how-it-works__steps[data-count="5"] {
    grid-template-columns: repeat(3, 305px);
    max-width: 975px;
}

.how-it-works__steps[data-count="6"] {
    grid-template-columns: repeat(3, 305px);
    max-width: 975px;
}

.how-it-works__steps[data-count="8"] {
    grid-template-columns: repeat(4, 305px);
    max-width: 1280px;
}

/* Default 2x2 */
.how-it-works__steps:not([data-count]) {
    grid-template-columns: repeat(2, 305px);
    max-width: 650px;
}

/* Force 2x2 when 4 cards won't fit in one line */
@media (max-width: 1320px) {
    .how-it-works__steps[data-count="4"] {
        grid-template-columns: repeat(2, 305px) !important;
        max-width: 650px;
    }
}

/* Breakpoint: 2 cards won't fit, go to 1 column */
@media (max-width: 650px) {
    .how-it-works__steps,
    .how-it-works__steps[data-count="4"],
    .how-it-works__steps[data-count="5"],
    .how-it-works__steps[data-count="6"],
    .how-it-works__steps[data-count="8"],
    .how-it-works__steps:not([data-count]) {
        grid-template-columns: 1fr !important;
        justify-items: center;
        max-width: 335px;
    }
}

.step-card {
    width: 305px;
    height: 332px;
    background: #003B6A;
    box-sizing: border-box;
    padding: 20px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    position: relative;
    outline: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.step-card:hover,
.step-card:focus {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(30, 77, 107, 0.3);
}

.step-card:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.step-card--highlighted {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(30, 77, 107, 0.4);
    border: 2px solid var(--primary-blue);
}

.step-card__icon {
    position: absolute;
    left: 111px;
    top: 24px;
    width: 89px;
    height: 89px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
}

.step-card__icon img {
    width: 89px;
    height: 89px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.step-card__line {
    position: absolute;
    left: 76px;
    top: 141px;
    width: 151.003px;
    height: 2px;
    background: #F00;
    box-sizing: border-box;
}

.step-card__content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    margin-top: 130px;
}

.step-card__step {
    width: 260px;
    height: 61px;
    flex-shrink: 0;
    color: #FFF;
    text-align: center;
    font-family: "Bosch Sans";
    font-size: 20px;
    font-style: normal;
    font-weight: 900;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

/* Título agora integrado ao step */

.step-card__description {
    width: 260px;
    color: #FFF;
    text-align: center;
    font-family: "Bosch Sans";
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    margin: 0;
    white-space: pre-line;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .how-it-works {
        padding: 60px 15px;
    }

    .how-it-works__title {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .how-it-works {
        padding: 50px 10px;
    }

    .how-it-works__title {
        font-size: 28px;
    }
}