:root {
    --primary: #2f6fb3;
    --primary-dark: #1d4f82;
    --text: #1f2937;
    --muted: #64748b;
    --line: #dbe4ee;
    --surface: #ffffff;
    --background: #f6f9fc;
    --code: #0f172a;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: "Source Sans Pro", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.72;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.site-name {
    color: var(--text);
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.site-header nav {
    display: flex;
    gap: 1.15rem;
    font-size: 0.92rem;
}

.site-header nav a[aria-current="page"] {
    color: var(--text);
    font-weight: 700;
}

.notes-shell,
.article-shell {
    width: min(1040px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 4rem 0 5rem;
}

.article-shell {
    width: min(860px, calc(100% - 2rem));
}

.series-intro,
.article-header {
    max-width: 800px;
}

.eyebrow {
    margin: 0 0 0.55rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: #172033;
    font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
    font-size: clamp(2.15rem, 5vw, 3.5rem);
    line-height: 1.13;
    letter-spacing: -0.025em;
}

.series-intro > p:not(.eyebrow),
.article-summary {
    margin: 1.25rem 0 0;
    color: #455468;
    font-size: 1.08rem;
}

.series-meta,
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1.3rem;
    margin-top: 1.35rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2.6rem;
}

.course-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.course-card {
    min-height: 280px;
}

.course-tags {
    margin: 0 0 1rem;
    gap: 0.45rem;
}

.course-tags span {
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    color: #31587f;
    background: #edf5fc;
    font-size: 0.78rem;
    font-weight: 700;
}

.note-card {
    display: flex;
    flex-direction: column;
    min-height: 255px;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 9px 28px rgba(31, 41, 55, 0.045);
}

.note-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.note-card h2 {
    margin: 0.65rem 0 0;
    font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
    font-size: 1.25rem;
    line-height: 1.35;
}

.note-card h2 a {
    color: #172033;
}

.note-card p {
    margin: 0.75rem 0 1.1rem;
    color: #516073;
    font-size: 0.94rem;
}

.read-link {
    margin-top: auto;
    font-size: 0.9rem;
    font-weight: 750;
}

.note-article {
    padding: clamp(1.3rem, 4vw, 3.4rem);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 14px 42px rgba(31, 41, 55, 0.055);
}

.article-header {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}

.article-header h1 {
    font-size: clamp(2rem, 5vw, 3.1rem);
}

.article-body {
    margin-top: 2.2rem;
    font-size: 1rem;
}

.article-body h2,
.article-body h3,
.article-body h4 {
    color: #172033;
    font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
    line-height: 1.35;
}

.article-body h2 {
    margin: 2.7rem 0 1rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--line);
    font-size: 1.55rem;
}

.article-body h3 {
    margin: 1.9rem 0 0.7rem;
    font-size: 1.2rem;
}

.article-body h4 {
    margin: 1.35rem 0 0.55rem;
    font-size: 1.02rem;
}

.chapter-outline {
    margin: 0 0 2.25rem;
    padding: 1.15rem 1.3rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f7fbff;
}

.chapter-outline h2 {
    margin: 0 0 0.7rem;
    padding: 0;
    border: 0;
    font-size: 1.15rem;
}

.chapter-outline ol {
    margin: 0;
}

.article-body p {
    margin: 0.78rem 0;
}

.article-body ul,
.article-body ol {
    padding-left: 1.55rem;
}

.article-body li {
    margin: 0.35rem 0;
}

.article-body figure {
    margin: 1.5rem auto;
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
}

.article-body figure img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 760px;
    margin: 0 auto;
    border-radius: 6px;
}

.article-body .equation-image {
    display: inline-block;
    width: auto;
    max-width: 100%;
    height: 1.45em;
    margin: 0 0.08em;
    vertical-align: -0.32em;
}

.article-body figcaption {
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.84rem;
    text-align: center;
}

.article-body pre,
.article-body .code-block {
    overflow-x: auto;
    border-radius: 10px;
    background: var(--code);
    color: #e5edf7;
}

.article-body pre {
    padding: 1rem;
    font-size: 0.86rem;
    line-height: 1.55;
}

.article-body code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.text-note-body dl {
    display: grid;
    grid-template-columns: minmax(6rem, auto) 1fr;
    gap: 0.55rem 1rem;
    margin: 1rem 0;
}

.text-note-body dt {
    color: #213249;
    font-weight: 750;
}

.text-note-body dd {
    margin: 0;
}

.text-note-body .formula-block {
    overflow-x: auto;
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbfe;
    text-align: center;
}

.text-note-body .formula-block mjx-container {
    margin: 0 !important;
}

.text-note-body .numbered-point {
    padding-left: 0.2rem;
}

.inline-equation {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    padding: 0.08rem 0.3rem;
    border-radius: 4px;
    background: #eef3f8;
    color: #213249;
    vertical-align: middle;
}

.article-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.2rem 0;
}

.article-body th,
.article-body td {
    min-width: 7rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    text-align: left;
}

.article-body blockquote {
    margin: 1.2rem 0;
    padding: 0.25rem 1rem;
    border-left: 3px solid var(--primary);
    color: #455468;
    background: #f7fbff;
}

.article-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin: 1.35rem 0 0;
    font-size: 0.92rem;
}

.article-pagination > :last-child {
    text-align: right;
}

@media (max-width: 720px) {
    .notes-shell,
    .article-shell {
        padding-top: 2.3rem;
    }

    .site-header {
        min-height: 60px;
    }

    .note-grid {
        grid-template-columns: 1fr;
    }

    .note-card {
        min-height: auto;
    }

    .article-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .text-note-body dl {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}
