/*
 * Внешний контейнер компонента.
 *
 * Благодаря container-type адаптив зависит
 * от ширины col-lg-8, а не от ширины экрана.
 */
.service-cards-wrap {
    --service-card-gap: 18px;
    --service-card-radius: 20px;

    --service-card-blue: #1769d2;
    --service-card-title: #17213d;
    --service-card-text: #566078;
    --service-card-border: #e6eaf1;

    width: 100%;
    min-width: 0;

    container-name: service-cards;
    container-type: inline-size;
}


/* =========================
   Сетка
   ========================= */

.service-cards {
    display: grid;

    /*
     * col-lg-8 на широком экране:
     * 3 карточки в ряд.
     */
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: var(--service-card-gap);

    width: 100%;
    margin: 0;
}


/* =========================
   Карточка
   ========================= */

.service-card {
    min-width: 0;
    height: 100%;
}

.service-card__link {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    height: 100%;
    min-height: 345px;

    padding: 20px;

    overflow: hidden;

    color: inherit;
    text-decoration: none;

    background: #fff;

    border: 1px solid var(--service-card-border);
    border-radius: var(--service-card-radius);

    box-shadow:
        0 2px 5px rgba(24, 45, 84, 0.03),
        0 8px 24px rgba(24, 45, 84, 0.055);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.service-card__link:hover {
    color: inherit;
    text-decoration: none;

    transform: translateY(-4px);

    border-color: rgba(23, 105, 210, 0.22);

    box-shadow:
        0 5px 12px rgba(24, 45, 84, 0.05),
        0 18px 40px rgba(24, 45, 84, 0.10);
}

.service-card__link:focus {
    color: inherit;
    text-decoration: none;
}

.service-card__link:focus-visible {
    outline: 3px solid rgba(23, 105, 210, 0.25);
    outline-offset: 3px;
}

.service-card__link--static:hover {
    transform: none;
}


/* =========================
   Изображение
   ========================= */

.service-card__image {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 145px;

    margin-bottom: 17px;

    flex-shrink: 0;
}

.service-card__image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center;

    transition: transform 0.3s ease;
}

.service-card__link:hover .service-card__image img {
    transform: scale(1.035);
}


/* =========================
   Контент
   ========================= */

.service-card__content {
    padding-right: 3px;
    padding-bottom: 45px;
}

.service-card__title {
    margin: 0 0 9px;

    color: var(--service-card-title);

    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;

    overflow-wrap: break-word;
}

.service-card__description {
    margin: 0;

    color: var(--service-card-text);

    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;

    overflow-wrap: break-word;
}

.service-card__description p {
    margin: 0;
}

.service-card__description p + p {
    margin-top: 8px;
}


/* =========================
   Стрелка
   ========================= */

.service-card__arrow {
    position: absolute;

    right: 18px;
    bottom: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    color: var(--service-card-blue);

    transition:
        transform 0.25s ease,
        color 0.25s ease;
}

.service-card__arrow svg {
    display: block;

    width: 25px;
    height: 25px;
}

.service-card__link:hover .service-card__arrow {
    transform: translateX(5px);
}


/* =====================================================
   Адаптив относительно ширины col-lg-8,
   а НЕ относительно viewport
   ===================================================== */


/*
 * Когда доступной ширины для трёх карточек уже мало.
 *
 * Например, на многих разрешениях Bootstrap col-lg-8
 * будет примерно 600-750px.
 */
@container service-cards (max-width: 760px) {
    .service-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .service-card__link {
        min-height: 325px;
    }
}


/*
 * Узкая колонка / мобильная версия.
 */
@container service-cards (max-width: 480px) {
    .service-cards {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .service-card__link {
        min-height: 0;

        padding: 18px;

        border-radius: 18px;
    }

    .service-card__image {
        height: 165px;
        margin-bottom: 14px;
    }

    .service-card__content {
        padding-bottom: 42px;
    }

    .service-card__title {
        font-size: 18px;
    }

    .service-card__description {
        font-size: 14px;
    }

    .service-card__arrow {
        right: 16px;
        bottom: 16px;
    }
}


/* =========================
   Отключение анимаций
   ========================= */

@media (prefers-reduced-motion: reduce) {
    .service-card__link,
    .service-card__image img,
    .service-card__arrow {
        transition: none;
    }

    .service-card__link:hover,
    .service-card__link:hover .service-card__image img,
    .service-card__link:hover .service-card__arrow {
        transform: none;
    }
}