/**
 * Секция "Как это работает" — шаги с иконкой, заголовком, описанием
 * и опциональными чипами/плашкой.
 *
 * Разметка: template-parts/how-it-works.php, стиль подключается оттуда же.
 * Переменная --hiw-steps (число шагов) выставляется инлайном на .hiw-steps.
 */

.hiw {
    background: #FFFFFF;
    padding: 88px 0;
    position: relative;
    z-index: 1;
}

.hiw-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.hiw-title {
    font-weight: 700;
    font-size: 54px;
    line-height: 105%;
    color: var(--ink);
    text-align: center;
    margin: 0 0 52px;
}

.hiw-steps {
    display: grid;
    /* --hiw-steps проставляет шаблон по числу карточек, 3 — запасное значение */
    grid-template-columns: repeat(var(--hiw-steps, 3), 1fr);
    gap: 20px;
    position: relative;
}

/* пунктирная линия «конвейера» между карточками */
.hiw-steps::before {
    content: "";
    position: absolute;
    top: 86px;
    /* тянется от центра первой карточки до центра последней: 100% / (2 × колонок) */
    left: calc(100% / (var(--hiw-steps, 3) * 2));
    right: calc(100% / (var(--hiw-steps, 3) * 2));
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 16px);
}

.hiw-step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 13px;
    background: linear-gradient(180deg, #F5F5FA 0%, #FFFFFF 100%);
    border: 1px solid #EBEBF5;
    border-radius: 32px;
    padding: 28px;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.hiw-step:hover {
    transform: translateY(-4px);
    border-color: rgba(51, 51, 255, .28);
    box-shadow: 0 28px 60px -26px rgba(51, 51, 255, .3);
}

.hiw-step-num {
    font-weight: 700;
    font-size: 12px;
    line-height: 100%;
    letter-spacing: .14em;
    color: var(--muted-2);
}

.hiw-step-icon {
    width: 56px;
    height: 56px;
}

.hiw-step-icon img {
    width: 56px;
    height: 56px;
    display: block;
}

.hiw-step-title {
    font-weight: 500;
    font-size: 24px;
    line-height: 120%;
    color: var(--ink);
    margin: 0;
}

.hiw-step-desc {
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--muted);
}

.hiw-step-desc b {
    color: var(--ink-2);
    font-weight: 500;
}

.hiw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: auto;
    padding-top: 8px;
}

.hiw-chip {
    font-weight: 500;
    font-size: 12px;
    line-height: 100%;
    color: #5F5A6B;
    background: #F7F7FC;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 9px;
}

/* плашка со скоростью: градиентная рамка через двойной background */
.hiw-speed {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 9px;
    margin-top: auto;
    padding: 10px 15px 10px 12px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: linear-gradient(#FFFFFF, #FFFFFF) padding-box,
                var(--grad) border-box;
}

.hiw-speed img {
    width: 18px;
    height: 18px;
}

.hiw-speed-text {
    font-weight: 700;
    font-size: 15px;
    line-height: 100%;
    white-space: nowrap;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.hiw-speed-text s {
    font-weight: 400;
    color: var(--muted-2);
    -webkit-text-fill-color: var(--muted-2);
}

@media screen and (max-width: 1024px) {
    .hiw {
        padding: 60px 0;
    }

    .hiw-steps {
        grid-template-columns: 1fr;
        max-width: 520px;
        margin: 0 auto;
    }

    .hiw-steps::before {
        display: none;
    }
}

@media screen and (max-width: 862px) {
    .hiw-title {
        font-size: 36px;
        margin-bottom: 32px;
    }

    .hiw-step-title {
        font-size: 20px;
    }
}

@media screen and (max-width: 648px) {
    .hiw-container {
        padding: 0 16px;
    }
}
