:root {
    --card-grid-template: 1fr;
    --card-grid-gap: 1.5rem;
    --card-padding: 2vh 3vw;
    --card-pills-gap: 4vw;
    --card-internal-gap: 1vh;
    --pills-small-padding: 1px 4px;
    --pills-small-radius: 80px;
    --pills-medium-radius: 100px;
    --pills-medium-padding: 2px 6px;
}

.card-grid {
    display: grid;
    grid-template-columns: var(--card-grid-template);
    grid-auto-rows: auto auto auto auto auto;
    gap: var(--card-grid-gap);
}

.card {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 5;
    gap: var(--card-internal-gap);
    background-color: var(--surface-container);
    padding: var(--card-padding);
    border-radius: var(--corner-radius);
}

.card figure {
    position: relative;
}

.card img {
    border-radius: var(--corner-radius);
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.card figure span {
    border-radius: var(--pills-medium-radius);
    border: 1.5px solid var(--on-surface-var);
    position: absolute;
    background-color: var(--secondary);
    color: var(--on-secondary);
    padding: var(--pills-medium-padding);
    top: 5%;
    right: 5%;
}

.card h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: var(--on-surface-var);
}

.card div {
    display: flex;
    gap: var(--card-pills-gap);
    flex-wrap: wrap;
    align-items: center;
}

.card>div>span {
    height: min-content;
    padding: var(--pills-small-padding);
    border-radius: var(--pills-small-radius);
    border: 1.5px solid var(--outline);
    background-color: var(--surface-container-highest);
    color: var(--on-surface-var);
    white-space: nowrap;
}

.card p {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card a,
.card span {
    font-weight: 600;
    font-size: var(--body-large-font-size);
    line-height: var(--body-large-line-height);
}

.card a {
    color: var(--primary);
    text-align: end;
    align-self: end;
}

@media screen and (min-width: 768px) {
    :root {
        --card-grid-template: repeat(2, 1fr);
        --card-padding: 2vh 1.5vw;
        --card-pills-gap: 2vw;
        --pills-medium-padding: 4px 8px;
        --pills-small-padding: 2px 6px;
    }
}

@media screen and (min-width: 1024px) {
    :root {
        --card-grid-gap: 2rem;
        --card-grid-template: repeat(3, 1fr);
        --card-padding: 1.5vh 1vw;
        --card-internal-gap: 1.5vh;
        --pills-medium-padding: 6px 10px;
        --pills-small-padding: 4px 8px;
    }

    .card>div {
        row-gap: 1vh;
    }
}
