/*
 * The commits of the project, on their page and on the home page. Built on the tokens and the
 * components of the theme (a Bootstrap card, the content card of the home page), so the colours
 * and both schemes come from the theme and nothing of it is overridden here.
 */

/* The history: a column of cards. */
.site-commits {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-inline-size: 0;
}

.site-commits__pagination { margin-block-start: 1.25rem; }

/* A card of the history. The subject covers the card; the link of the author stays above it. */
.site-commit {
    --bs-card-spacer-y: 1rem;
    --bs-card-spacer-x: 1.125rem;
    --bs-card-border-radius: .75rem;
    transition: border-color .12s;
}

.site-commit:hover,
.site-commit:has(.stretched-link:focus-visible) { border-color: var(--accent); }

.site-commit__subject {
    margin: 0;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.site-commit__subject a { color: var(--fg); text-decoration: none; }
.site-commit__subject a:focus-visible { outline: none; }
.site-commit:hover .site-commit__subject a,
.site-commit__subject a:focus-visible { color: var(--accent); }

/* The rest of the message keeps its own line breaks, as it was written. */
.site-commit__body {
    margin-block-start: .375rem;
    color: var(--fg-muted);
    font-size: .8125rem;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.site-commit .site-commit-meta { margin-block-start: .75rem; }

/* The line of the author, the date, the branch and the hash, shared by both places. */
.site-commit-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .375rem .5rem;
    color: var(--fg-muted);
    font-size: .6875rem;
}

.site-commit-meta__author {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

.site-commit-meta__author a {
    position: relative;
    z-index: 2;
    color: var(--fg-muted);
    text-decoration: none;
}

.site-commit-meta__author a:hover { color: var(--accent); }

.site-commit-meta__date {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--fg-dim);
    font-family: var(--bs-font-monospace);
}

.site-commit-meta__refs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .375rem;
    margin-inline-start: auto;
}

.site-commit-meta__branch,
.site-commit-meta__hash {
    padding: .0625rem .4375rem;
    border: 1px solid var(--border);
    border-radius: .25rem;
    font-family: var(--bs-font-monospace);
    font-size: .65625rem;
    line-height: 1.5;
    white-space: nowrap;
}

.site-commit-meta__branch {
    border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
    background: var(--accent-soft);
    color: var(--accent);
}

.site-commit-meta__hash {
    background: var(--bg-inset);
    color: var(--fg-dim);
}

/*
 * The block of the home page spans both columns under the news and the forum: the subjects are
 * long, and a third card alone in a row would leave half of it empty.
 */
.site-home__blocks > .site-content-card--commits { grid-column: 1 / -1; }

.site-content-card--commits {
    border-radius: .875rem;
    overflow: hidden;
}

.site-content-card--commits .site-content-card__body { padding: 0; }

.site-commit-row {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .875rem 1.25rem;
    transition: background-color .1s;
}

.site-commit-row:not(:last-child) { border-block-end: 1px solid var(--border); }

.site-commit-row:hover,
.site-commit-row:has(.stretched-link:focus-visible) { background: var(--bg-elev-2); }

.site-commit-row:has(.stretched-link:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.site-commit-row__subject {
    margin: 0;
    font-size: .90625rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.site-commit-row__subject a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--fg);
    text-decoration: none;
}

.site-commit-row__subject a:focus-visible { outline: none; }
.site-commit-row:hover .site-commit-row__subject a,
.site-commit-row__subject a:focus-visible { color: var(--accent); }

@media (max-width: 520px) {
    .site-commit {
        --bs-card-spacer-y: .875rem;
        --bs-card-spacer-x: 1rem;
    }

    .site-commit-row { padding: .875rem 1rem; }
    .site-commit-meta__refs { flex-basis: 100%; margin-inline-start: 0; }
}
