/* Journal: the article list and a single article. */

@layer pages {
    /* ---------- Article list ---------- */

    .posts {
        display: grid;
        gap: 1.875rem;
    }

    .post-card {
        position: relative;
        display: flex;
        flex-direction: column;
        border: 1px solid var(--line);
        transition: box-shadow var(--steady) var(--ease), border-color var(--steady) var(--ease);
    }

    .post-card:hover {
        border-color: transparent;
        box-shadow: var(--shadow-soft);
    }

    .post-card__media {
        display: block;
        aspect-ratio: 4 / 3;
        overflow: hidden;
        background: var(--linen);
    }

    .post-card__media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform var(--slow) var(--ease-out);
    }

    .post-card:hover .post-card__media img {
        transform: scale(1.05);
    }

    .post-card__category {
        position: absolute;
        top: var(--space-md);
        right: var(--space-md);
        padding: 0.3125rem 0.75rem;
        font-size: var(--text-sm);
        color: var(--navy);
        background: var(--white);
    }

    .post-card__body {
        display: grid;
        gap: var(--space-sm);
        padding: var(--space-lg);
    }

    .post-card__body h2 {
        font-size: var(--text-xl);
    }

    .post-card__body h2 a {
        color: var(--navy);
        text-decoration: none;
    }

    .post-card__body h2 a:hover {
        color: var(--sand-ink);
    }

    .post-card__meta {
        font-size: var(--text-sm);
        color: var(--sand-ink);
    }

    @media (min-width: 40rem) {
        .posts {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (min-width: 64rem) {
        .posts {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    /* ---------- Single article ---------- */

    .article-section {
        padding-block: clamp(3.5rem, 3rem + 2vw, 5.5rem);
    }

    .article {
        display: grid;
        gap: var(--space-2xl);
    }

    /* Lets the wide table scroll inside its wrapper instead of stretching the column. */
    .article__body {
        max-width: 56rem;
        min-width: 0;
        font-size: 1.0625rem;
    }

    .article__meta {
        font-size: var(--text-sm);
        color: var(--sand-ink);
    }

    .article__body > p:nth-of-type(2) {
        font-size: var(--text-lg);
        color: var(--navy);
    }

    .article__figure {
        aspect-ratio: 16 / 9;
        margin-block: var(--space-xl);
        overflow: hidden;
        background: var(--linen);
    }

    .article__figure img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .article__body table {
        width: 100%;
        min-width: 26rem;
        border-collapse: collapse;
        text-align: left;
    }

    .article__body :is(th, td) {
        padding: var(--space-sm) var(--space-md);
        border-bottom: 1px solid var(--line);
    }

    .article__body thead th {
        color: var(--white);
        background: var(--navy);
    }

    .article__body tbody th {
        font-weight: 500;
        color: var(--navy);
    }

    .article__body .table-scroll {
        border: 1px solid var(--line);
    }

    .article__aside {
        display: grid;
        gap: var(--space-lg);
        align-content: start;
    }

    .article__aside .fact-card {
        display: grid;
        gap: var(--space-md);
        justify-items: start;
    }

    .article__more {
        padding: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
        border: 1px solid var(--line);
    }

    .article__more h2 {
        font-size: 1.5rem;
    }

    .article__more ul {
        display: grid;
        margin-top: var(--space-sm);
        padding: 0;
        list-style: none;
    }

    .article__more a {
        display: block;
        padding-block: var(--space-sm);
        font-weight: 500;
        color: var(--navy);
        text-decoration: none;
        border-bottom: 1px solid var(--line);
    }

    .article__more li:last-child a {
        border-bottom: 0;
    }

    .article__more a:hover {
        color: var(--sand-ink);
    }

    @media (min-width: 66rem) {
        .article {
            grid-template-columns: minmax(0, 1fr) 21.5rem;
            gap: clamp(2.5rem, 4vw, 4rem);
            align-items: start;
        }

        .article__aside {
            position: sticky;
            top: calc(var(--header-height) + var(--space-lg));
        }
    }
}
