article {
    --img-scale: 1.001;
    --title-color: black;
    --link-icon-translate: -20px;
    --link-icon-opacity: 0;
    position: relative;
    border-radius: 16px;
    box-shadow: none;
    background: #fff;
    transform-origin: center;
    transition: all 0.4s ease-in-out;
    overflow: hidden;
    margin-top: 30px;
}

article a::after {
    position: absolute;
    inset-block: 0;
    inset-inline: 0;
    cursor: pointer;
    content: "";
}

/* basic article elements styling */
article h2 {
    margin: 0 0 18px 0;
    font-size: 1.0rem;
    color: #4b4a4a;
    transition: color 0.3s ease-out;
}

.text-catalog {
    color: #808080;
    font-size: 13px;
    line-height: 1.5;
    height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    word-break: break-word;
}


figure {
    margin: 0;
    padding: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

article img {
    max-width: 100%;
    transform-origin: center;
    transform: scale(var(--img-scale));
    transition: transform 0.4s ease-in-out;
}

.article-body {
    padding: 24px;
}

article a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #28666e;
}

article a:focus {
    outline: 1px dotted #28666e;
}

article a .icon {
    min-width: 24px;
    width: 24px;
    height: 24px;
    margin-left: 5px;
    transform: translateX(var(--link-icon-translate));
    opacity: var(--link-icon-opacity);
    transition: all 0.3s;
}

/* using the has() relational pseudo selector to update our custom properties */
article:has(:hover, :focus) {
    --img-scale: 1.1;
    --title-color: #0031cb;
    --link-icon-translate: 0;
    --link-icon-opacity: 1;
    box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px,
    rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
}

/************************
Generic layout (demo looks)
**************************/

*,
*::before,
*::after {
    box-sizing: border-box;
}

.articles {
    display: grid;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 24px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;

}

@media screen and (max-width: 500px) {
    /*.btn-custom{*/
    /*    display: flex;*/
    /*    justify-content: center;*/
    /*    align-items: center;*/
    /*}*/
    /*.text-catalog{*/
    /*    text-align: center;*/
    /*}*/
    /*h2{*/
    /*    text-align: center;*/
    /*}*/
}

/* حالت موبایل */
@media screen and (max-width: 380px) {



    .article-wrapper {
        display: flex;
        flex-direction: column;
        position: relative;
        gap: 0;
        overflow: hidden;
    }

    figure {
        width: 100%;
        height: 100%;
        margin: 0;
        position: relative;
    }
    figure img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* تصویر کل فضای کارت را پوشش می‌دهد */
    }
    .article-body {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 16px;
        text-align: center;
        background: rgba(0, 0, 0, 0.5); /* پس‌زمینه نیمه شفاف */
        color: white;
    }
    .article-body h2 {
        margin-bottom: 10px;
        font-size: 1.2rem;
    }
    .article-body p {
        font-size: 0.9rem;
        margin-bottom: 10px;
        color: #f1f1f1;
    }
    .article-body a {
        background: #007bff;
        color: white;
        padding: 10px 20px;
        border-radius: 5px;
        text-decoration: none;
        font-size: 0.9rem;
    }
    .article-body a:hover {
        background: #0056b3;
    }
}
