/*
|--------------------------------------------------------------------------
| Upgrade 021 Git-style Revisions
|--------------------------------------------------------------------------
*/

.history-header {
    max-width: 980px;
    margin: 0 auto 28px;
}

.history-header h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 950;
    letter-spacing: -.06em;
    margin: 10px 0;
}

.history-header p {
    color: var(--muted);
    font-size: 1.05rem;
}

.history-layout {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
    align-items: start;
}

.history-sidebar {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 92px;
}

.history-timeline {
    position: relative;
    display: grid;
    gap: 16px;
}

.history-commit-card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 14px;
}

.history-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #5865f2;
    box-shadow: 0 0 0 6px #eef0ff;
    margin-top: 26px;
}

.history-commit-body,
.commit-diff-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.history-commit-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.history-commit-head h2 {
    font-size: 1.12rem;
    font-weight: 950;
    margin: 8px 0 4px;
}

.history-commit-head p {
    color: var(--muted);
    margin: 0;
}

.history-commit-head a,
.compare-form button,
.restore-form button {
    border: 1px solid var(--border);
    background: var(--soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 9px 13px;
    font-weight: 950;
    text-decoration: none;
    white-space: nowrap;
}

.history-commit-meta {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 12px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .9rem;
}

.commit-type-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef0ff;
    color: #5865f2;
    font-size: .76rem;
    font-weight: 950;
    text-transform: capitalize;
}

.commit-type-created { background: #dcfce7; color: #166534; }
.commit-type-updated { background: #dbeafe; color: #1d4ed8; }
.commit-type-approved_suggestion { background: #ede9fe; color: #6d28d9; }
.commit-type-restored_revision { background: #fef3c7; color: #92400e; }

.history-contributor {
    border-top: 1px solid var(--border);
    padding: 10px 0;
}

.history-contributor:first-of-type {
    border-top: 0;
}

.history-contributor strong,
.history-contributor small {
    display: block;
}

.history-contributor small {
    color: var(--muted);
    margin-top: 3px;
}

.compare-form {
    display: grid;
    gap: 8px;
}

.compare-form label {
    font-weight: 950;
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
}

.compare-form select {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px;
    width: 100%;
}

.commit-detail-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.commit-detail-grid > .toc-card {
    position: sticky;
    top: 92px;
}

.commit-diff-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.commit-diff-head h2 {
    font-size: 1.2rem;
    font-weight: 950;
    margin: 0;
}

.diff-add {
    color: #15803d;
    font-weight: 950;
}

.diff-remove {
    color: #dc2626;
    font-weight: 950;
}

.diff-removed {
    background: #fecaca;
    color: #7f1d1d;
    border-radius: 5px;
    padding: 1px 4px;
    text-decoration: line-through;
}

.restore-form {
    margin-top: 16px;
}

.restore-form button {
    width: 100%;
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 1000px) {
    .history-layout,
    .commit-detail-grid {
        grid-template-columns: 1fr;
    }

    .history-sidebar,
    .commit-detail-grid > .toc-card {
        position: static;
    }
}
