/* News archive (index.php) - live /news/: search bar, 3-up 500px image cards,
   numbered pagination. Values from the child theme CSS (rem→px ×16). Enqueued on
   the posts page, search and term archives only. */

.news_archive {
    background: var(--background);
}

.screen_reader_text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Search bar ------------------------------------------------------------- */
.news_search {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 32px 0;

    @media (max-width: 500px) {
        flex-direction: column;
        align-items: stretch;
    }
}

.news_search_input {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    border: 1px solid var(--grey-2);
    border-radius: var(--radius-sm);
    transition: border-color .3s var(--ease);

    &:focus-within {
        border-color: var(--secondary);
    }

    & > svg {
        flex: none;
        width: 24px;
        height: 24px;
        margin-right: 8px;
        color: var(--grey-mid);
    }

    & input {
        width: 100%;
        padding: 12px 32px 12px 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--black);
        font-family: var(--font-body);
        font-size: 16px;
        font-weight: 400;

        &::-webkit-search-cancel-button { display: none; }
    }
}

.news_search_clear {
    position: absolute;
    right: 8px;
    display: inline-flex;
    padding: 8px;
    border: 0;
    background: none;
    color: var(--grey-mid);
    cursor: pointer;

    & svg { width: 16px; height: 16px; }
    &[hidden] { display: none; }
}

.news_search_button {
    flex: none;
    font-size: 19.2px;

    & span { font-size: 19.2px; }
}

.news_search_status {
    min-height: 1.5em;
    margin: 0 0 16px;
    color: var(--text-muted);

    &:empty { display: none; }
}

.news_empty {
    padding: 32px 0 64px;
    color: var(--text-muted);
}

/* Card grid -------------------------------------------------------------- */
.news_list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    gap: 32px;
    margin-bottom: 64px;

    @media (max-width: 1024px) { grid-template-columns: repeat(2, 1fr); }
    @media (max-width: 746px)  { grid-template-columns: 1fr; }
}

.news_item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    overflow: hidden;
    text-decoration: none;
}

.news_item_image {
    position: absolute;
    inset: 0;

    &::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(8, 35, 60, 0) 0%, rgba(8, 35, 60, .85) 100%);
        z-index: 1;
    }

    &::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 5px;
        background: var(--secondary-alt);
        z-index: 1;
    }

    & img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .6s var(--ease);
    }
}

.news_item:hover .news_item_image img,
.news_item:focus-visible .news_item_image img {
    transform: scale(1.04);
}

.news_item_content {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 16px;
}

.news_item_tag {
    position: relative;
    align-self: flex-start;
    margin-bottom: auto;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--secondary-alt);
    color: var(--white);
    font-family: var(--font-display);
    font-size: 11.2px;
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
}

.news_item_text {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.news_item_date {
    color: var(--white);
    font-family: var(--font-body);
    font-size: 11.2px;
    font-weight: 400;
}

.news_item_title {
    margin: 4px 0 0;
    color: var(--white);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.15;
    text-transform: uppercase;
}

/* Pagination ------------------------------------------------------------- */
.news_pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin-bottom: 64px;

    &[hidden] { display: none; }

    & .page-numbers {
        position: relative;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        margin: 0;
        padding: 0 !important;
        list-style: none !important;

        & li {
            margin: 0;
            list-style: none;
        }

        & a,
        & span {
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 30px;
            height: 30px;
            border-radius: var(--radius);
            color: var(--text);
            font-family: var(--font-body);
            font-size: 16px;
            font-weight: 500;
            text-decoration: none;
            transition: background-color .2s var(--ease);

            &:hover { background: var(--grey-2); }
        }

        & span.current {
            color: var(--secondary);
            background: rgba(235, 235, 235, .5);
        }

        & a.prev,
        & a.next {
            background: var(--primary);
            font-weight: 600;

            & svg { width: 24px; height: 24px; color: var(--white); }
            &:hover { background: var(--primary-mid); }
        }

        & li.dots span {
            background: none;
        }
    }
}
