:root {
    --accent-color-servicesPL: #2e62c5;
}
.section-service {
    background-color: #f9f9fa;
    border-top: 1px solid #f2f2f2;
    border-bottom: 1px solid #f2f2f2;
}
.services {
    --with-service-image: 24%;

    max-width: 1392px;
    padding: 40px 30px;
    margin: 20px auto;
    display: flex;
}

.services .title-services {
    flex-basis: 25%;
    box-sizing: border-box;
    flex-grow: 0;
    flex-shrink: 0;
    color: #222;
}

.services .title-services .title {
    font-size: 3rem;
    line-height: 3rem;
    font-weight: bold;
    margin-bottom: 30px;
}

.services .title-services .title:after {
    content: "";
    display: block;
    height: 3px;
    width: 100px;
    background-color: var(--accent-color-servicesPL);
}

.services .title-services .all_services {
    border: 1px solid var(--accent-color-servicesPL);
    color: var(--accent-color-servicesPL);
    border-radius: 2px;
    padding: 15px 20px;
    display: inline;
    line-height: 80px;
    transition-duration: 300ms;
}

.services .title-services .all_services:hover {
    background-color: var(--accent-color-servicesPL);
    color: white;
}

.services .services-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-around;
    flex-basis: 75%;
    box-sizing: border-box;
}

.services-images .image {
    background-size: cover;
    background-position: center center;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    position: absolute;
    transition: transform 0.3s ease; /* Smooth transition for the scale effect */
}

.services-images .post-card {
    position: relative;
    height: 200px;
    width: var(--with-service-image);
    flex-basis: var(--with-service-image);
    flex-shrink: 0;
    flex-grow: 0;
    overflow: hidden; /* Ensure the image does not overflow */
}
.services-images .post-card:first-child, .services-images .post-card:last-child {
    width: calc(var(--with-service-image) * 2);
    flex-basis: calc(var(--with-service-image) * 2);
}

.services-images .post-card:hover .image {
    transform: scale(1.25);
}

.services-images .service-description {
    position: absolute;
    bottom: 0;
    background-color: var(--accent-color-servicesPL);
    padding: 10px;
    margin: 10px;
    color: white;
}

@media only screen and (max-width: 991px) {
    .services .title-services, .services .services-images{
        flex-basis: 100%;
    }
    .services {
        --with-service-image: 49%;
        flex-wrap: wrap;
    }
    .services-images .post-card:first-child, .services-images .post-card:last-child {
        width: var(--with-service-image);
        flex-basis: var(--with-service-image);
    }
    
    .services-images .service-description {
        background-color: #2e62c582;
    }
}
@media only screen and (max-width: 720px){
    .services {
        /*--with-service-image: 100%;*/
        flex-wrap: wrap;
    }
    .services-images .post-card {
        height: 300px;
    }
}

@media only screen and (max-width: 559px){
    .services {
        --with-service-image: 45%;
        flex-wrap: wrap;
    }
    .services-images .post-card {
        height: 200px;
    }
}

@media only screen and (max-width: 420px){
    .services {
        flex-wrap: wrap;
    }
    .services-images .post-card {
        height: 140px;
    }
    .services-images .service-description {
        height: calc(100% - 20px);
        box-sizing: border-box;
    }
}

@media only screen and (max-width: 350px){
    .services {
        --with-service-image: 50%;
        padding: 40px 10px;
     }
     .services .services-images {
         gap: 0;
     }
}

/* START projects */
.projects {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1392px;
    margin: 20px auto;
}

.projects .item {
    background-color: var(--accent-color-servicesPL);
    color: white;
    flex-basis: 25%;
    flex-grow: 1;
    flex-shrink: 0;
    height: 220px;
    position: relative;
}

.projects .item a {
    color: white;
}

.projects .item .main-title {
    margin: 25px 30px 0 30px;
    font-size: 26px;
    line-height: 30px;
}

.projects .item .main-description {
    position: absolute;
    bottom: 0;
    left: 0;
    margin: 0 32px 34px 32px;
}

.projects .project {
    overflow: hidden;
}
.projects .project .background {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-image: url("https://via.placeholder.com/700x525");
    background-size: cover;
    background-position: center center;
    transform: scale(1);
    transition-duration: 350ms;
    padding: 20px;
}
.projects .project .background::after { /* Затемняющий фон */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0); /* Полупрозрачный чёрный фон */
    pointer-events: none; /* Чтобы затемнение не влияло на взаимодействие с изображением */
    transition-duration: 500ms;
}
.projects .project:hover .background::after{
    background-color: rgba(0, 0, 0, 0.5);
}
.projects .project .background:hover {
    transform: scale(1.2);
}

.projects .project .title, .projects .project .description {
    transition-duration: 350ms;
    transition-timing-function: ease-out;
    position: absolute;
    color: white;
    opacity: 0;
}

.projects .project .title {
    left: 20px;
    top: 10px;
}
.projects .project:hover .title {
    transform: translateY(10px);
    opacity: 0.8;
}
.projects .project .description {
    left: 20px;
    top: 60px;
    width: 70%;
    font-weight: bold;
}
.projects .project:hover .description {
    opacity: 1;
    transform: translateY(-10px);
}
/* END projects */

@media only screen and (max-width: 991px) {
    .projects .item {
        flex-basis: max(50%, 320px);
    }
}

@media (pointer: coarse) and (hover: none) {
    .projects .project .background::after {
        background-color: rgba(0, 0, 0, 0.5);
    }
    .projects .project .title {
        transform: translateY(10px);
        opacity: 0.8;
    }
    .projects .project .description {
        opacity: 1;
        transform: translateY(-10px);
    }
}