:root {
    --archive-ink: #1d2830;
    --archive-muted: #68747d;
    --archive-faint: #8b959c;
    --archive-border: #dfe4e7;
    --archive-surface: #f5f7f8;
    --archive-sidebar: #f7f8f9;
    --archive-accent: #c4553d;
    --archive-accent-dark: #9d3f2d;
    --archive-blue: #316ea5;
    --archive-teal: #247765;
    --archive-amber: #946518;
    --archive-violet: #72528a;
    --archive-sidebar-width: 288px;
    --reading-progress: 0%;
}

* {
    letter-spacing: 0;
}

html {
    scroll-behavior: smooth;
}

body,
input,
button {
    font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
}

body {
    background: #fff;
    color: var(--archive-ink);
    font-size: 16px;
}

::selection {
    background: #f4d7cf;
    color: var(--archive-ink);
}

.progress {
    background: var(--archive-accent);
    height: 3px;
}

.reading-progress {
    height: 2px;
    left: var(--archive-sidebar-width);
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 60;
}

.reading-progress span {
    background: var(--archive-accent);
    display: block;
    height: 100%;
    width: var(--reading-progress);
}

.sidebar {
    background: var(--archive-sidebar);
    border-right: 1px solid var(--archive-border);
    padding: 0 0 32px;
    position: fixed;
    width: var(--archive-sidebar-width);
}

.sidebar > h1 {
    border-bottom: 1px solid var(--archive-border);
    margin: 0 0 20px;
    padding: 24px 22px 20px;
    text-align: left;
}

.sidebar > h1 a {
    align-items: center;
    color: var(--archive-ink);
    display: flex;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    background: #fff;
    border: 1px solid var(--archive-border);
    border-radius: 7px;
    display: grid;
    flex: 0 0 44px;
    height: 44px;
    overflow: hidden;
    place-items: center;
}

.brand-mark img {
    display: block;
    height: 44px;
    object-fit: cover;
    width: 44px;
}

.brand-copy {
    display: block;
    min-width: 0;
}

.brand-copy strong {
    color: var(--archive-ink);
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

.brand-copy small {
    color: var(--archive-muted);
    display: block;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 2px;
}

.sidebar .search {
    border-bottom: 0;
    margin: 0 20px 22px;
    padding: 0;
}

.sidebar .search input {
    background: #fff;
    border: 1px solid var(--archive-border);
    border-radius: 6px;
    color: var(--archive-ink);
    font-size: 13px;
    height: 40px;
    padding: 0 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.sidebar .search input:focus {
    border-color: var(--archive-accent);
    box-shadow: 0 0 0 3px rgba(196, 85, 61, .12);
    outline: none;
}

.sidebar .search .clear-button {
    align-items: center;
    display: flex;
    height: 40px;
    justify-content: center;
}

.sidebar .sidebar-nav {
    line-height: 1.45;
    padding: 0 14px 36px;
}

.sidebar .sidebar-label {
    color: var(--archive-faint);
    font-size: 11px;
    font-weight: 700;
    margin: 24px 10px 7px;
}

.sidebar .sidebar-label:first-child {
    margin-top: 0;
}

.sidebar ul {
    margin: 0;
}

.sidebar ul li {
    margin: 2px 0;
}

.sidebar ul li a {
    border-radius: 5px;
    color: #46535c;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    padding: 8px 10px;
    transition: background-color 140ms ease, color 140ms ease;
    white-space: normal;
}

.sidebar ul li a:hover {
    background: #eceff1;
    color: var(--archive-ink);
    text-decoration: none;
}

.sidebar ul li.active > a {
    background: #fff;
    border-right: 0;
    box-shadow: inset 3px 0 0 var(--archive-accent);
    color: var(--archive-accent-dark);
    font-weight: 700;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar:hover::-webkit-scrollbar-thumb {
    background: #c8d0d4;
    border-radius: 6px;
}

.content {
    left: var(--archive-sidebar-width);
    padding-top: 0;
}

.markdown-section {
    color: #354149;
    margin: 0 auto;
    max-width: 900px;
    padding: 64px 56px 120px;
}

.markdown-section > div:first-child {
    color: var(--archive-faint) !important;
    font-size: 12px !important;
    margin-bottom: 14px;
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section strong {
    color: var(--archive-ink);
}

.markdown-section h1 {
    font-size: 38px;
    font-weight: 750;
    line-height: 1.22;
    margin: 0 0 18px;
}

.markdown-section h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.35;
    margin: 54px 0 18px;
}

.markdown-section h3 {
    font-size: 20px;
    line-height: 1.4;
    margin: 40px 0 14px;
}

.markdown-section p,
.markdown-section li {
    line-height: 1.85;
}

.markdown-section p {
    margin: 1em 0;
}

.markdown-section a {
    color: var(--archive-blue);
    text-underline-offset: 3px;
}

.markdown-section code {
    background: #f1f3f4;
    border: 1px solid #e4e8ea;
    color: #a34632;
}

.markdown-section blockquote {
    background: var(--archive-surface);
    border-left: 3px solid var(--archive-accent);
    color: #58646c;
    margin: 26px 0 34px;
    padding: 16px 20px;
}

.markdown-section blockquote p {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.markdown-section table {
    border: 1px solid var(--archive-border);
    border-radius: 6px;
}

.markdown-section td,
.markdown-section th {
    border-color: var(--archive-border);
    padding: 10px 14px;
}

.markdown-section th {
    background: var(--archive-surface);
}

.page-updates .markdown-section > p:first-of-type {
    color: #56626a;
    font-size: 17px;
    line-height: 1.8;
    max-width: 760px;
}

.month-index {
    align-items: center;
    border-bottom: 1px solid var(--archive-border);
    display: flex;
    gap: 24px;
    margin: 8px 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.month-index::-webkit-scrollbar {
    display: none;
}

.month-index span,
.month-index a {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 42px;
}

.month-index span {
    color: var(--archive-faint);
    font-weight: 600;
}

.month-index a {
    border-bottom: 2px solid transparent;
    color: #44515a;
    font-weight: 700;
    text-decoration: none;
}

.month-index a:hover,
.month-index a:focus-visible {
    border-bottom-color: var(--archive-accent);
    color: var(--archive-accent-dark);
}

.page-updates .update-date {
    align-items: center;
    border-top: 1px solid var(--archive-border);
    display: flex;
    font-size: 22px;
    gap: 12px;
    margin: 0;
    padding: 42px 0 10px;
}

.page-updates .update-date:first-of-type {
    border-top: 0;
}

.page-updates .update-date::before {
    background: var(--archive-accent);
    border-radius: 2px;
    content: "";
    flex: 0 0 6px;
    height: 20px;
}

.page-updates .update-date a {
    color: var(--archive-ink);
    text-decoration: none;
}

.page-updates .update-date + ul {
    list-style: none;
    margin: 0 0 30px;
    padding: 0;
}

.page-updates .update-entry {
    border-bottom: 1px solid #e8ebed;
    color: #3d4951;
    list-style: none;
    margin: 0;
    min-height: 58px;
    padding: 15px 0 15px 88px;
    position: relative;
}

.page-updates .update-entry:last-child {
    border-bottom: 0;
}

.page-updates .update-label {
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    left: 0;
    line-height: 24px;
    min-width: 62px;
    padding: 0 7px;
    position: absolute;
    text-align: center;
    top: 18px;
}

.update-entry--new .update-label {
    background: #eef8f5;
    color: var(--archive-teal);
}

.update-entry--fix .update-label {
    background: #eef5fa;
    color: var(--archive-blue);
}

.update-entry--balance .update-label,
.update-entry--adjustment .update-label {
    background: #fbf5e8;
    color: var(--archive-amber);
}

.update-entry--experience .update-label {
    background: #f5f0f8;
    color: var(--archive-violet);
}

.update-entry--stability .update-label {
    background: #f0f2f3;
    color: #59666e;
}

.update-entry--development .update-label,
.update-entry--note .update-label {
    background: #f5f0f8;
    color: var(--archive-violet);
}

.update-entry--rule .update-label {
    background: #f8efed;
    color: var(--archive-accent-dark);
}

.mobile-brand {
    display: none;
}

.sidebar-toggle {
    display: none;
}

.back-to-top {
    align-items: center;
    background: var(--archive-ink);
    border: 0;
    border-radius: 6px;
    bottom: 24px;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 20px;
    height: 42px;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    right: 24px;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease, background-color 160ms ease;
    width: 42px;
    z-index: 45;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: var(--archive-accent-dark);
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media screen and (max-width: 960px) {
    .markdown-section {
        padding-left: 38px;
        padding-right: 38px;
    }
}

@media screen and (max-width: 768px) {
    .reading-progress {
        left: 0;
        z-index: 90;
    }

    .mobile-brand {
        align-items: center;
        background: rgba(255, 255, 255, .97);
        border-bottom: 1px solid var(--archive-border);
        color: var(--archive-ink);
        display: flex;
        font-size: 14px;
        font-weight: 700;
        gap: 9px;
        height: 58px;
        left: 0;
        padding: 0 16px 0 64px;
        pointer-events: none;
        position: fixed;
        right: 0;
        text-decoration: none;
        top: 0;
        z-index: 55;
    }

    .mobile-brand img,
    .mobile-brand span {
        pointer-events: auto;
    }

    .mobile-brand img {
        border: 1px solid var(--archive-border);
        border-radius: 5px;
        height: 30px;
        object-fit: cover;
        width: 30px;
    }

    .sidebar {
        box-shadow: 14px 0 36px rgba(29, 40, 48, .16);
        left: calc(var(--archive-sidebar-width) * -1);
        width: var(--archive-sidebar-width);
        z-index: 70;
    }

    .sidebar-toggle,
    body.close .sidebar-toggle {
        align-items: center;
        background: #fff;
        border: 1px solid var(--archive-border);
        border-radius: 6px;
        bottom: auto;
        display: flex;
        height: 38px;
        justify-content: center;
        left: 12px;
        padding: 0;
        position: fixed;
        top: 10px;
        width: 40px;
        z-index: 80;
    }

    .sidebar-toggle .sidebar-toggle-button {
        display: block;
        height: 16px;
        width: 18px;
    }

    .sidebar-toggle span {
        background: var(--archive-ink);
        height: 2px;
        margin-bottom: 4px;
        transition: opacity 140ms ease, transform 140ms ease;
        width: 18px;
    }

    body.close .sidebar-toggle {
        left: 232px;
    }

    body.close .sidebar-toggle span:first-child {
        transform: translateY(6px) rotate(45deg);
    }

    body.close .sidebar-toggle span:nth-child(2) {
        opacity: 0;
    }

    body.close .sidebar-toggle span:last-child {
        transform: translateY(-6px) rotate(-45deg);
    }

    body.close .sidebar {
        transform: translateX(var(--archive-sidebar-width));
    }

    body.close .content,
    body.close .mobile-brand {
        transform: none;
    }

    .content {
        left: 0;
        max-width: 100%;
        padding-top: 58px;
        width: 100%;
    }

    main {
        width: 100%;
    }

    .markdown-section {
        max-width: 100%;
        padding: 30px 20px 88px;
    }

    .markdown-section > div:first-child {
        margin-bottom: 10px;
    }

    .markdown-section h1 {
        font-size: 29px;
        line-height: 1.28;
        margin-bottom: 14px;
    }

    .markdown-section h2 {
        font-size: 22px;
    }

    .page-updates .markdown-section > p:first-of-type {
        font-size: 15px;
        line-height: 1.8;
    }

    .markdown-section blockquote {
        margin: 22px 0 28px;
        padding: 14px 16px;
    }

    .month-index {
        gap: 20px;
        margin-right: -20px;
        padding-right: 20px;
    }

    .page-updates .update-date {
        font-size: 20px;
        padding-top: 34px;
    }

    .page-updates .update-entry {
        line-height: 1.75;
        min-height: 0;
        padding: 15px 0;
    }

    .page-updates .update-label {
        display: inline-block;
        left: auto;
        line-height: 22px;
        margin: 0 8px 7px 0;
        min-width: 56px;
        padding: 0 6px;
        position: static;
        top: auto;
        vertical-align: 1px;
    }

    .back-to-top {
        bottom: 18px;
        right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
