:root {
    --news-accent: var(--section-accent, #018584);
    --news-accent-soft: rgba(1, 133, 132, 0.1);
    --news-heading: #111827;
    --news-body: #4b5563;
    --news-muted: #6b7280;
    --news-line: #e5e7eb;
    --news-radius: 16px;
}

/* BADGE */
.news-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    border-radius: 999px;
    background: var(--news-accent-soft);
    color: var(--news-accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.news-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(1, 133, 132, 0.18);
}

a.news-badge:hover,
a.news-badge:focus {
    background: rgba(1, 133, 132, 0.18);
    color: var(--news-accent);
}

/* sits on top of card images */
.news-badge--overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

a.news-badge--overlay:hover,
a.news-badge--overlay:focus {
    background: #fff;
    color: var(--news-accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

/* META */
.news-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 0;
    color: var(--news-muted);
    font-size: 13px;
    line-height: 1.4;
}

.news-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.news-meta__item i {
    color: var(--news-accent);
}

.news-meta__item+.news-meta__item::before {
    content: "";
    width: 4px;
    height: 4px;
    margin: 0 12px;
    border-radius: 50%;
    background: #d1d5db;
}

.news-meta--lg {
    font-size: 14px;
}

.news-meta--lg .news-meta__item i {
    font-size: 15px;
}

/* CARD */
.news-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--news-line);
    border-radius: var(--news-radius);
    background: #fff;
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.news-card:hover,
.news-card:focus-within {
    border-color: transparent;
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.1);
}

/* image keeps its natural ratio: no fixed frame, no cropping */
.news-card__media {
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

.news-card__media img {
    display: block;
    width: 100%;
    height: auto;
}

/* bottom fade so the image edge meets the card body softly */
.news-card__media::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.news-card:hover .news-card__media::after {
    opacity: 1;
}

.news-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 22px 24px 24px;
}

.news-card__title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--news-heading);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* marker highlight: grows left to right under the text on hover, wraps per line.
   .home-news-link: same effect on the homepage's theme post-item cards */
.news-card__link,
.news-card__link:hover,
.post-item .post-item-description .home-news-link {
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(rgba(1, 133, 132, 0.16), rgba(1, 133, 132, 0.16));
    background-position: 0 88%;
    background-repeat: no-repeat;
    background-size: 0% 45%;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: color 0.2s ease, background-size 0.4s ease;
}

/* stretched link: whole card is clickable */
.news-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.news-card:hover .news-card__link,
.news-card:focus-within .news-card__link,
.post-item:hover .post-item-description .home-news-link,
.post-item:focus-within .post-item-description .home-news-link {
    color: var(--news-accent);
    background-size: 100% 45%;
}

.news-card__link:focus-visible {
    outline: none;
}

.news-card:has(.news-card__link:focus-visible) {
    outline: 2px solid var(--news-accent);
    outline-offset: 3px;
}

.news-card__excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--news-body);
    font-size: 15px;
    line-height: 1.7;
    text-align: left;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.news-card__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
    color: var(--news-accent);
    font-size: 14px;
    font-weight: 600;
}

.news-card__more i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.news-card:hover .news-card__more i {
    transform: translateX(4px);
}

/* HORIZONTAL: image left, text right */
.news-card--horizontal {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.news-card--horizontal .news-card__media {
    align-self: center;
}

.news-card--horizontal .news-card__body {
    justify-content: center;
    gap: 14px;
    padding: 32px 36px;
}

.news-card--horizontal .news-card__title {
    font-size: 22px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
}

/* LAYOUTS */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* HOME: News / Events carousels keep the theme's post-item card; meta line sits above the title */
.post-item .post-item-description .home-news-meta {
    display: block;
    top: 0;
    margin-bottom: 8px;
}

.home-news-sep {
    margin: 0 8px;
}

/* INFINITE LOADER STATUS: one child visible per data-state (idle|loading|done|error) */
.news-feed-status {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    color: var(--news-muted);
    font-size: 14px;
    text-align: center;
}

.news-feed-status>div {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}

.news-feed-status[data-state="loading"] .news-feed-status__loading,
.news-feed-status[data-state="done"] .news-feed-status__done,
.news-feed-status[data-state="error"] .news-feed-status__error {
    display: inline-flex;
}

.news-feed-status.is-js .news-feed-status__more {
    display: none;
}

.news-feed-status__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--news-accent-soft);
    border-top-color: var(--news-accent);
    border-radius: 50%;
    animation: news-spin 0.8s linear infinite;
}

@keyframes news-spin {
    to {
        transform: rotate(360deg);
    }
}

.news-feed-status__done {
    border-radius: 999px;
    background: var(--news-accent-soft);
    color: var(--news-accent);
    font-weight: 500;
}

.news-feed-status__retry {
    padding: 0;
    border: 0;
    background: none;
    color: var(--news-accent);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* EMPTY STATE */
.news-empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 48px 24px;
    text-align: center;
}

.news-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    border-radius: 50%;
    background: var(--news-accent-soft);
    color: var(--news-accent);
    font-size: 32px;
}

.news-empty__title {
    margin: 0 0 12px;
    color: var(--news-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: none;
}

.news-empty__text {
    margin: 0 0 28px;
    color: var(--news-body);
    font-size: 16px;
    line-height: 1.7;
}

@media (max-width: 991.98px) {
    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .news-list {
        gap: 20px;
    }

    .news-card--horizontal {
        grid-template-columns: 1fr;
    }

    .news-card--horizontal .news-card__body {
        padding: 24px;
    }

    .news-card--horizontal .news-card__title {
        font-size: 20px;
        -webkit-line-clamp: 3;
    }
}

/* Mobile type scale matches the homepage (see home.css) */
@media (max-width: 767px) {
    .news-card--horizontal .news-card__title {
        font-size: 18px;
    }

    .news-empty__title {
        font-size: var(--section-heading-size);
        line-height: var(--section-heading-line);
    }

    .news-empty__text {
        font-size: 15px;
    }
}

@media (max-width: 575.98px) {
    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-card__body,
    .news-card--horizontal .news-card__body {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-card,
    .news-card__link,
    .home-news-link,
    .news-card__more i {
        transition: none;
    }

    .news-card:hover {
        transform: none;
    }
}
