/*
 * News tiles — loaded only by /news/** pages.
 *
 * Kept out of styles.css on purpose: styles.css is cached for a month and is
 * referenced by ~10,000 generated pages, so touching it means re-deploying the
 * whole site for a change that only affects the news section. Every rule below
 * uses the same design tokens as styles.css, so the two stay visually unified.
 */

/* Resting tiles carry their own edge; hover only swaps it for the accent. */
:root {
    --news-tile-border: #cbd5e1;
}

body.dark-mode {
    --news-tile-border: #33415c;
}

/* ---------------------------------------------------------------- page head */

/* Centred like every other AimostAll page header, just without the tall
   gradient band: the site line, the H1, the subtitle and the live counter sit
   on one axis instead of hugging the left edge. */
.news-head {
    text-align: center;
    margin: 18px 0 16px;
}

.news-head__site {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.news-head__site a,
.news-head__site a:visited {
    color: inherit;
    text-decoration: none;
}

.news-head__site a:hover,
.news-head__site a:focus-visible {
    color: var(--accent-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.news-head__title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    line-height: 1.15;
    margin: 0;
    color: var(--text-primary);
}

.news-head__subtitle {
    margin: 6px auto 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
    max-width: 62ch;
}

.news-head__status {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ----------------------------------------------------------------- toolbar */

.news-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.news-bar__search {
    flex: 1 1 240px;
    min-width: 0;
    padding: 9px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.news-bar__search::placeholder {
    color: var(--text-tertiary);
}

.news-bar__search:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.16);
}

.news-bar__filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

/* Pills reuse the directory's .type-filter look so news matches the catalog. */
.news-bar .news-platform-filter,
.news-bar .news-more-toggle {
    padding: 7px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.news-bar .news-platform-filter:hover,
.news-bar .news-more-toggle:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.news-bar .news-platform-filter:focus-visible,
.news-bar .news-more-toggle:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.news-bar .news-platform-filter.active {
    color: #ffffff;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.news-bar .news-more-toggle[aria-expanded="true"] {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

/* ------------------------------------------------------- collapsible topics */

.news-drawer {
    display: grid;
    gap: 12px;
    margin: 0 0 16px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.news-drawer[hidden] {
    display: none;
}

.news-drawer__group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.news-drawer .news-nav-group__label {
    flex: 0 0 100%;
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.news-drawer__chip {
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.2;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.news-drawer__chip:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    text-decoration: none;
}

.news-drawer__chip.active {
    color: #ffffff;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* -------------------------------------------------------------------- tiles */

.news-grid--tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 27vw, 300px), 1fr));
    gap: 14px;
    /* Stretch, not start: every tile in a row ends on the same baseline. */
    align-items: stretch;
}

.news-card--tile {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--news-tile-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.news-card--tile:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.14);
}

.news-card--tile:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.news-card--tile .news-card__media {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    border-radius: 0;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.news-card--tile .news-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* When a publisher serves no usable image, the box keeps the tile's shape and
   shows the source initial instead of collapsing the card to text. */
.news-card--tile .news-card__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
}

.news-card--tile .news-card__media--empty::after {
    content: attr(data-initial);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
}

.news-card--tile .news-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Fill the stretched tile so the border reaches the shared baseline. */
    flex: 1 1 auto;
    padding: 12px 14px 14px;
    min-width: 0;
}

.news-card--tile .news-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.news-card--tile .news-card__time {
    color: var(--text-tertiary);
    white-space: nowrap;
}

.news-card--tile .news-card__source {
    font-weight: 700;
    color: var(--accent-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.news-card--tile .news-card__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.32;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card--tile .news-card__summary {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The old card kept a repeated date line under the summary; the meta row above
   already carries it, so the tile drops it entirely. */
.news-card--tile .news-card__footer {
    display: none;
}

.news-grid--tiles .news-empty {
    grid-column: 1 / -1;
}

/* --------------------------------------------------- below-the-feed context */

.news-explore {
    margin: 22px 0 0;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.news-explore__label {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.news-explore__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 13px;
}

.news-explore__links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.news-explore__links a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 768px) {
    .news-head {
        margin-top: 12px;
    }

    /* One scrollable row instead of a wrapping block of pills. */
    .news-bar__filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .news-bar__filters::-webkit-scrollbar {
        display: none;
    }

    .news-bar .news-platform-filter {
        flex: 0 0 auto;
    }

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

@media (prefers-reduced-motion: reduce) {
    .news-card--tile {
        transition: none;
    }

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

/* ---------------------------------------------------- feed section wrapper */

/* Tiles sit directly on the page background: the old `.news-section--page`
   panel wrapped them in a second card, which read as a box inside a box. */
.news-feed-section {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.news-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
