/*
 * Layout - Article: a reading column with a table of contents beside it and a
 * progress bar, around the blocks nested inside.
 */

.layout-article {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: var(--section-gap);
}

.layout-article__progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #6b5ef0, #c17be0, #f2a0b8);
}

/* The nested blocks sit in this column, so their own column drops its gutters. */
.layout-article__main {
    --column-max: none;
    --column-gutter: 0px;

    width: 100%;
    max-width: var(--measure);
    justify-self: center;
    padding-top: 8px;
}

/* Who wrote it, above the text. */
.layout-article__author {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

/* Dates right under the author sit closer to them than the text does. */
.layout-article__author:has(+ .layout-article__dates) {
    margin-bottom: 16px;
}

.layout-article__avatar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6b5ef0, #8f63e8);
    object-fit: cover;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.layout-article__author-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.layout-article__author-name {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
}

.layout-article__author-name:hover {
    color: var(--accent-ink);
}

.layout-article__author-about {
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-muted);
}

/* When it was published and last changed, under the author. */
.layout-article__dates {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 32px;
    font-size: 12px;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.layout-article__dates-sep {
    color: #c4c1cc;
}

/* The contents rail beside the column; below 1240px it moves above the text instead. */
.layout-article__toc {
    display: none;
}

.layout-article__toc-title,
.layout-article__inline-toc-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-faint);
}

.layout-article__inline-toc {
    margin: 0 0 32px;
    padding: 16px 20px;
    border-radius: 16px;
    background: #f7f6fb;
    border: 1px solid rgba(22, 21, 28, 0.06);
}

.layout-article__inline-toc-list {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
}

.layout-article__inline-toc-link {
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-soft);
}

.layout-article__toc-link {
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-soft);
}

.layout-article__toc-link:hover {
    color: var(--ink);
}

.layout-article__toc-link--sub {
    padding-left: 12px;
}

@media (min-width: 1240px) {
    .layout-article {
        grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr);
        gap: 40px;
    }

    .layout-article__toc {
        display: block;
        padding-top: 8px;
        justify-self: start;
        width: 100%;
        max-width: 220px;
    }

    .layout-article__toc-inner {
        position: sticky;
        top: 96px;
    }

    .layout-article__toc-list {
        margin-top: 12px;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .layout-article__inline-toc {
        display: none;
    }

    .layout-article__main {
        grid-column: 2;
    }
}
