/* news list (templates/news.php, snippets/news-teaser.php), cards in the style of appointments.css */

/* search in all articles */
.news-search {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0 1rem;
    margin-bottom: 1.5rem;
}
.news-search input[type=search] {
    flex: 1 1 8rem;
    min-width: 0;
    height: 40px;
    padding: 0 .5rem;
    border: 0;
    border-bottom: 1px solid var(--color-green);
    font: inherit;
    font-size: var(--fs-300);
}
.news-search .button {
    margin-top: 0;
    min-width: 0;
}
.news-search input[type=search]:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.news-note {
    color: var(--color-text-grey);
}
.news-note a {
    color: var(--color-link);
}
.news-note mark,
.news-text mark {
    background-color: var(--color-light-green);
    color: inherit;
}

.news-year {
    margin-bottom: 0;
    font-size: var(--fs-500);
    font-weight: var(--fw-bold);
    text-transform: none;
}
.news-month {
    margin-top: 1.25rem;
    font-size: var(--fs-300);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.news-list {
    margin: 0;
    padding: 0;
    margin-top: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-green);
}
.news-list:last-child,
.news .news-list:last-of-type {
    border-bottom: 0;
}

/* one article: image or date block | title, date, intro text; the title link covers the whole card */
.news-item {
    position: relative;
    list-style: none;
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    margin-bottom: 1rem;
    border: 1px var(--color-dark-grey) solid;
    background: var(--color-white);
    overflow: hidden;
}
.news-item:hover,
.news-item:focus-within {
    border-color: var(--color-link);
}

.news-image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 9rem;
    object-fit: cover;
}

.news-date-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .125rem;
    padding: .75rem .5rem;
    background: var(--color-code-green);
    text-align: center;
}
.news-day {
    font-size: var(--fs-500);
    font-weight: var(--fw-bold);
    line-height: 1.2;
}
.news-month-short {
    font-size: var(--fs-200);
    font-weight: var(--fw-semi-bold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.news-body {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .75rem 1rem;
    /* allow the grid item to shrink, so overflow-wrap can break very long words */
    min-width: 0;
    overflow-wrap: break-word;
}
.news-body p {
    margin: 0;
}
.news-title {
    margin: 0;
    /* German hyphenation for long words */
    hyphens: auto;
    font-size: var(--fs-400);
    font-weight: var(--fw-semi-bold);
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.3;
}
.news-title a {
    color: var(--color-text);
    text-decoration: none;
}
.news-title a::after {
    content: "";
    position: absolute;
    inset: 0;
}
.news-item:hover .news-title a,
.news-title a:focus-visible {
    color: var(--color-link);
    text-decoration: underline;
}
.news-title a:focus-visible {
    outline: none;
}
.news-title a:focus-visible::after {
    outline: 2px solid var(--color-link);
    outline-offset: -2px;
}
.news-body .news-date {
    margin: 0;
    font-size: var(--fs-200);
}
.news-text {
    font-size: var(--fs-300);
    line-height: 1.5;
    /* long intro texts: first lines only, the article has the rest */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}
.news-text p {
    margin: 0;
}
/* search excerpts are short already and the match must stay visible */
p.news-text {
    display: block;
}

.news .pagination,
main > .pagination {
    margin-top: 1rem;
}

@media screen and (max-width: 40rem) {
    .news-item {
        grid-template-columns: 5.5rem minmax(0, 1fr);
    }
    .news-image {
        min-height: 5.5rem;
    }
    .news-day {
        font-size: var(--fs-400);
    }
    .news-body {
        padding: .625rem .75rem;
    }
    .news-text {
        -webkit-line-clamp: 3;
    }
}
