/* ─────────────────────────
   SECTION .how-works
───────────────────────── */
.how-works {
    padding: 40px 0 40px;
}

/* ── HEADER ROW ── */
.how-works__head {
    margin-bottom: 12px;
}

.how-works__title {
    margin-bottom: 12px;
    margin-top: 8px;
}
/* Mobile: button below title, full width */
.how-works__btn-wrap .button-black {
    width: 100%;
    justify-content: center;
    font-size: 15px;
    padding: 18px 28px;
}

/* ── GRID ──
   Mobile:  1 col
   768px:   2 col
   1024px:  custom – card1 wide, card2 narrow, card3 wide-ish, card4 right-tall
*/
.how-works__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ─────────────────────────
   CARD BASE
───────────────────────── */
.hw-card {
    background: var(--white);
    box-shadow: 0px 5px 50px rgba(18, 17, 39, 0.1);
    backdrop-filter: blur(2px);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 24px;
}

.hw-card__title {
    font-size: 20px;
    margin-top: 0;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -.01em;
    margin-bottom: 16px;
}

.hw-card__description{
    color: var(--grey-3);
}

.hw-card__description.text.classic-list ul li{
    margin-bottom: .2rem;
}


/* Step badge: "1 шаг" with partial orange underline */
.hw-card__step {
    margin-top: 12px;
    display: inline-block;
    font-size: 28px;
    font-weight: 700;
    color: var(--grey-2);
    letter-spacing: .01em;
    position: relative;
    padding: 0 0 6px;
    max-width: fit-content;

}
/* Orange underline fill = step/4 % width */
.hw-card__step::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 4px;
    background: var(--primary);
    border-radius: 1px;
    transition: width .4s ease;
}
.hw-card[data-step="1"] .hw-card__step::after { width: 25%; }
.hw-card[data-step="2"] .hw-card__step::after { width: 50%; }
.hw-card[data-step="3"] .hw-card__step::after { width: 75%; }
.hw-card[data-step="4"] .hw-card__step::after { width: 100%; }

/* Underline base (grey) */
.hw-card__step::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 4px;
    background: #e0e0de;
    border-radius: 1px;
}

/* Card illustration */
.hw-card__img-wrap{
    margin: 0 -24px -24px;
}
.hw-card__img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 1px;
    max-height: 328px;
    object-fit: contain;
}

/* ─────────────────────────
   TABLET  768px — 2 columns
───────────────────────── */
.how-works__grid{
    grid-template-areas: "hw-card--1"
    "hw-card--2"
    "hw-card--3"
    "hw-card--4";
}

.hw-card--1{
    grid-area: hw-card--1;
}

.hw-card--2{
    grid-area: hw-card--2;
}

.hw-card--3{
    grid-area: hw-card--3;
}

.hw-card--4{
    grid-area: hw-card--4;
}

@media (min-width: 768px) {
    .how-works { padding: 52px 0 68px; }
    .how-works__head {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 24px;
        flex-wrap: wrap;
        margin-bottom: 36px;
    }
    .how-works__head-left { flex: 1; }
    .how-works__title { margin-bottom: 0; }
    .how-works__btn-wrap .button-black {
        width: auto;
        justify-content: flex-start;
        padding: 16px 28px;
        font-size: 14px;
    }

    .how-works__grid{
        display: grid;
        grid-template-areas: "hw-card--1 hw-card--1"
        "hw-card--2 hw-card--4"
    "hw-card--3 hw-card--4";
        grid-template-columns: 1fr 1fr;
    }

    .hw-card__title { font-size: 20px; }
}

/* ─────────────────────────
   DESKTOP  1024px
   Custom grid:
   col-1: card1 (2-col wide, has image right)
   col-2: card2 (1-col, no image)
   col-3: card3 (1-col, has image right)
   col-4: card4 (1-col, tall right)

   Layout mirrors design:
   Row1: [card1: 2 cols] [card4: 1 col, spans 2 rows]
   Row2: [card2: 1 col]  [card3: 1 col]
───────────────────────── */
@media (min-width: 64rem) {
    .how-works { padding: 48px 0 120px; }

    /* Card 1: spans 2 cols, row 1 */
    .hw-card--1 {
        flex-direction: row;
        align-items: flex-start;
        gap: 0;
        padding: 0;
    }
    .hw-card--1 .hw-card__body {
        flex: auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        padding: 24px;
        height: 100%;
    }

    .hw-card--1 .hw-card__body{
        width: 55%;
    }

    .hw-card__description{
        flex: 1 1;
        padding-bottom: 16px;
        z-index: 1;
    }

    .hw-card--1 .hw-card__img-wrap{
        height: 100%;
        width: 45%;
        padding: 24px;
        margin: -24px;
    }
    .hw-card--1 .hw-card__img {
        width: 100%;
        flex-shrink: 0;
        margin-top: 0;
        align-self: center;
        height: 100%;
    }

    /* Card 2: col 1, row 2 */
    .hw-card--3 {
        justify-content: space-between;
    }

    .hw-card--3 .hw-card__body {
        width: 50%;
    }

    .hw-card--3 .hw-card__img-wrap{
        width: 256px;
    }

    /* Card 3: col 2, row 2 */
    .hw-card--3 {
        flex-direction: row;
    }

    .hw-card--3 .hw-card__body{
        display: flex;
        flex-direction: column;
    }

    .hw-card--3 .hw-card__img-wrap {
        width: 304px;
        height: 226px;
        position: absolute;
        right: 0;
        top: calc(50% - 113px);
    }

    /* Card 4: col 3, spans both rows */
    .hw-card--4 .hw-card__step{
        position: absolute;
        bottom: 24px;
    }
    .hw-card--4 .hw-card__img {
        width: 100%;
        margin-top: auto;
        padding-top: 20px;
    }

    .hw-card__title { font-size: 28px; }

    .hw-card--3 .hw-card__title{
        white-space: nowrap;
    }
}

@media (min-width: 80rem) {
    .how-works__grid {
        grid-template-columns: calc(25% - 16px) calc(41% - 16px) calc(34% - 16px);
        grid-template-rows: auto auto;
        grid-template-areas: "hw-card--1 hw-card--1 hw-card--4"
        "hw-card--2 hw-card--3 hw-card--4";
        gap: 24px;
    }
}
