.fresk-news-items {
    container-type: inline-size;

    &__grid {
        display: grid;
        gap: 1rem;
        grid-template-columns: 1fr;
    }

    @container (min-width: 480px) {
        &__grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @container (min-width: 768px) {
        &__grid {
            grid-template-columns: repeat(4, 1fr);
        }
    }

    &__card {
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 1rem;
        border-radius: $border-radius;
        box-shadow: 0 0 10px rgb(0 0 0 / .12);
        overflow: hidden;
        cursor: pointer;
        transition: transform .15s ease, box-shadow .15s ease;

        &:hover,
        &:focus-within {
            transform: translateY(-4px);
            box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .12);
        }
    }

    &__content {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
    }

    &__media {
        position: relative;
        margin: -1rem -1rem .75rem;
    }

    &__image {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 6;
        object-fit: cover;
    }

    &__badge {
        position: absolute;
        top: .5rem;
        inset-inline-start: .5rem;
        padding: .15rem .5rem;
        font-size: .7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: $white;
        background-color: $primary;
        border-radius: $border-radius;
    }

    &__date {
        display: block;
        margin-bottom: .35rem;
        font-size: .8rem;
        color: $text-muted;
    }

    &__title {
        margin-bottom: .5rem;
        font-weight: 700;
        color: $body-color !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    &__excerpt {
        margin-bottom: .5rem;
        font-size: .9rem;
        color: $text-muted;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    &__excerpt--empty {
        display: none;
    }

    &__meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: .35rem 1rem;
        margin-top: auto;
        padding-top: .75rem;
        font-size: .85rem;
    }

    &__author {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        min-width: 0;
        flex: 1 1 auto;
        color: $text-muted;
    }

    .userpicture {
        flex: 0 0 auto;
        width: 24px;
        height: 24px;
        border-radius: 50%;
    }

    &__authorname {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    &__read {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        flex: 0 0 auto;
        margin-inline-start: auto;
        line-height: 1;
        // !important because layout/_blocks.scss scopes
        // .block-region .block .card-body .card-text a to $secondary at (0,5,2), which
        // outweighs this class. Without it the link is primary on the frontpage and
        // secondary inside any block, for the same card.
        color: $primary !important;
        font-weight: 600;
        white-space: nowrap;

        &::after {
            content: '';
            position: absolute;
            inset: 0;
            z-index: 1;
        }

        .icon {
            width: 0.7em;
            height: 0.7em;
            max-width: none;
            max-height: none;
            margin: 0;
            font-size: 0.7em;
            line-height: 1;
            vertical-align: middle;
        }

        &:hover,
        &:focus {
            color: $primary !important;
        }
    }

    &__add {
        display: block;
        width: fit-content;
        margin-inline-start: auto;
        margin-bottom: .75rem;

        &.btn-primary {
            color: $white !important;
        }
    }

    &__toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: .5rem 1rem;
        margin-bottom: .75rem;

        .fresk-news-items__add {
            margin-bottom: 0;
        }
    }

    &__subscribe {
        color: $primary;
        font-weight: 600;
        white-space: nowrap;
    }

    &__actions,
    &__info {
        position: absolute;
        top: .25rem;
        z-index: 2;
    }

    &__actions {
        right: .25rem;
    }

    &__info {
        right: 2.25rem;

        // In the block there is no actions menu, so the "i" is the last child of the
        // media area and takes the corner slot instead of leaving a gap beside it.
        // Keyed on the DOM, not on .block, so it holds wherever the menu is absent.
        &:last-child {
            right: .25rem;
        }
    }

    &__icon-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.75rem;
        height: 1.75rem;
        padding: 0;
        border: 0;
        appearance: none;
        border-radius: 50%;
        color: $white;
        background-color: rgb(0 0 0 / .45);

        .icon {
            width: auto;
            height: auto;
            font-size: .85rem;
            line-height: 1;
            color: $white;
        }

        &:hover,
        &:focus,
        &:active,
        &.show {
            color: $white;
            background-color: rgb(0 0 0 / .65);

            .icon {
                color: $white;
            }
        }
    }

    &__info-menu {
        .dropdown-item-text {
            white-space: nowrap;
            font-size: .85rem;
            color: $text-muted;
        }
    }

    &__attachments {
        list-style: none;
        margin: 0 0 .5rem;
        padding: 0;
        font-size: .8rem;
    }

    &__attachment {
        position: relative;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        gap: .3rem;
        max-width: 100%;
        color: $primary;
    }

    &__attachment-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    a#{&}__authorname {
        position: relative;
        z-index: 2;
        color: $text-muted;

        &:hover,
        &:focus {
            color: $primary;
        }
    }

    &__footer {
        display: flex;
        justify-content: center;
        margin-top: 1rem;
    }

    &__viewall {
        // Same specificity clash as &__read: the footer link is hijacked to $secondary
        // inside a block region.
        color: $primary !important;
        font-weight: 600;

        &:hover,
        &:focus {
            color: $primary !important;
        }
    }

    &__empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 2rem 1rem;
    }

    &__empty-image {
        width: 120px;
        max-width: 100%;
        height: auto;
        margin-bottom: 1rem;
    }

    &__empty-text {
        margin: 0;
        font-weight: 700;
        color: $body-color;
    }
}

.block.block_news_items {
    .card-title {
        margin-left: 24px;
    }

    &::before {
        content: '';
        position: absolute;
        top: 20px;
        left: 0;
        height: 28px;
        width: 36px;
        background-image: url([[pix:theme|block_news_items/icon]]);
        background-size: 17px;
        background-position: center;
        background-repeat: no-repeat;
        background-color: $primary;
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
    }
}

#site-news-forum {
    margin-bottom: 1.5rem;

    > h2 {
        margin-bottom: 1rem;
    }

    .fresk-news-items {
        background-color: transparent;
        border: 0;
        box-shadow: none;
    }
}
