:root {
    color-scheme: light;
    --paper: #f7f5ee;
    --paper-2: #eceff4;
    --ink: #15202b;
    --muted: #5f6875;
    --line: rgba(21, 32, 43, 0.16);
    --line-strong: rgba(21, 32, 43, 0.28);
    --blue: #295b8d;
    --red: #9f3d3d;
    --gold: #9a7b2f;
    --panel: rgba(255, 255, 255, 0.62);
    --nav-h: 72px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(21, 32, 43, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(21, 32, 43, 0.028) 1px, transparent 1px),
        radial-gradient(circle at 12% 18%, rgba(41, 91, 141, 0.12), transparent 32rem),
        radial-gradient(circle at 88% 16%, rgba(159, 61, 61, 0.09), transparent 30rem),
        linear-gradient(135deg, var(--paper), var(--paper-2));
    background-size: 32px 32px, 32px 32px, auto, auto, auto;
    font-family: "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(21, 32, 43, 0.016) 0 1px, transparent 1px 5px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.45), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.35));
}

a {
    color: inherit;
}

.topbar {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(250px, 1fr);
    align-items: center;
    width: min(1160px, calc(100% - 32px));
    min-height: var(--nav-h);
    padding: 12px 18px;
    border: 1px solid var(--line);
    background: rgba(247, 245, 238, 0.78);
    box-shadow: 0 18px 46px rgba(21, 32, 43, 0.12);
    backdrop-filter: blur(16px);
    transform: translateX(-50%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: white;
}

.brand span {
    display: grid;
    gap: 2px;
}

.brand strong {
    font-size: 1.02rem;
    font-weight: 700;
}

.brand em {
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-style: normal;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    gap: 9px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
}

.slider::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--blue);
    transition: transform 0.24s ease;
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

.nav-links {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    border-color: rgba(41, 91, 141, 0.25);
    background: rgba(41, 91, 141, 0.08);
    color: var(--ink);
}

.hero-scroll-stage {
    position: relative;
    height: 188vh;
}

.hero-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 640px;
    overflow: hidden;
}

.manuscript-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.manuscript-field::before {
    content: "";
    position: absolute;
    inset: 114px 34px 34px;
    border: 1px solid rgba(21, 32, 43, 0.1);
    background: rgba(255, 255, 255, 0.18);
}

.axis-line {
    position: absolute;
    background: rgba(21, 32, 43, 0.16);
    transform-origin: center;
}

.axis-line-x {
    top: 51%;
    left: 7%;
    width: 86%;
    height: 1px;
    transform: rotate(-3deg);
}

.axis-line-y {
    top: 19%;
    left: 50%;
    width: 1px;
    height: 62%;
    transform: rotate(5deg);
}

.formula-ghost {
    position: absolute;
    left: 50%;
    top: 45%;
    z-index: 1;
    width: min(1120px, calc(100% - 36px));
    color: rgba(21, 32, 43, 0.18);
    font-family: Georgia, "Times New Roman", serif;
    font-size: min(17vw, 11rem);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) rotate(-2deg);
    transition: opacity 0.12s linear, transform 0.12s linear;
}

.formula-ghost sup {
    font-size: 0.45em;
}

.formula-cloud {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.formula-token {
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(21, 32, 43, 0.88);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.02rem;
    line-height: 1;
    opacity: 0;
    transform-origin: center;
    will-change: transform, opacity;
    white-space: nowrap;
}

.formula-token.major {
    color: var(--blue);
    font-size: 1.22rem;
    font-weight: 700;
}

.formula-token.red {
    color: var(--red);
}

.margin-notes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.margin-notes span {
    position: absolute;
    color: rgba(21, 32, 43, 0.26);
    font-size: 1rem;
    font-style: italic;
    transform: rotate(-10deg);
}

.margin-notes span:nth-child(1) {
    top: 24%;
    left: 9%;
}

.margin-notes span:nth-child(2) {
    right: 9%;
    top: 30%;
    transform: rotate(8deg);
}

.margin-notes span:nth-child(3) {
    right: 14%;
    bottom: 18%;
    transform: rotate(-6deg);
}

.hero-copy {
    position: absolute;
    left: 50%;
    top: 57%;
    z-index: 5;
    width: min(860px, calc(100% - 36px));
    opacity: 0;
    text-align: center;
    transform: translate(-50%, -24%);
    transition: opacity 0.12s linear, transform 0.12s linear;
}

.eyebrow,
.section-kicker {
    margin: 0 0 18px;
    color: var(--red);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 22px;
    font-size: 5.1rem;
    font-weight: 700;
    line-height: 1.02;
}

h2 {
    margin-bottom: 18px;
    font-size: 3.6rem;
    font-weight: 700;
    line-height: 1.08;
}

h3 {
    margin-bottom: 12px;
    font-size: 1.48rem;
    font-weight: 700;
}

.lead,
.section-head p,
.study-layout p,
.about-layout p,
.site-footer {
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.78;
}

.lead {
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
}

.chalk-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    min-height: 48px;
    padding: 12px 20px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.38);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chalk-button:hover {
    border-color: rgba(41, 91, 141, 0.35);
    background: rgba(41, 91, 141, 0.09);
    transform: translateY(-2px);
}

.chalk-button.primary {
    border-color: rgba(159, 61, 61, 0.3);
    box-shadow: inset 0 -2px 0 rgba(159, 61, 61, 0.12);
}

.scroll-cue {
    position: absolute;
    bottom: 28px;
    left: 50%;
    z-index: 5;
    display: grid;
    justify-items: center;
    gap: 8px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    transform: translateX(-50%);
}

.scroll-cue span {
    width: 1px;
    height: 42px;
    background: linear-gradient(to bottom, transparent, var(--red), transparent);
}

.scroll-cue em {
    font-style: normal;
}

.paper-section {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 102px 0;
}

.section-head {
    max-width: 760px;
    margin-bottom: 44px;
}

.section-head:not(.align-left) {
    margin-right: auto;
    margin-left: auto;
    text-align: center;
}

.index-list {
    border-top: 1px solid var(--line);
}

.index-row {
    display: grid;
    grid-template-columns: 72px minmax(160px, 0.52fr) minmax(260px, 1fr);
    gap: 26px;
    align-items: baseline;
    padding: 25px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    transition: color 0.18s ease, padding-left 0.18s ease, border-color 0.18s ease;
}

.index-row:hover {
    padding-left: 12px;
    border-color: rgba(159, 61, 61, 0.26);
    color: var(--blue);
}

.index-row span {
    color: var(--red);
    font-style: italic;
}

.index-row strong {
    font-size: 1.42rem;
    font-weight: 700;
}

.index-row em {
    color: var(--muted);
    font-size: 1.03rem;
    font-style: normal;
    line-height: 1.6;
}

.study-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.7fr) minmax(420px, 1fr);
    gap: 68px;
    align-items: start;
}

.thesis-columns {
    display: grid;
    gap: 18px;
}

.thesis-columns article {
    position: relative;
    padding: 24px 24px 24px 92px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.thesis-columns article::before {
    content: "";
    position: absolute;
    left: 66px;
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: var(--line);
}

.thesis-columns span {
    position: absolute;
    left: 22px;
    top: 27px;
    color: var(--red);
    font-size: 0.86rem;
    font-style: italic;
}

.thesis-columns p {
    margin-bottom: 0;
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(320px, 0.75fr);
    gap: 66px;
    align-items: start;
}

.about-layout a {
    color: var(--blue);
    text-decoration: none;
}

.site-footer {
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.92rem;
}

.site-footer p {
    margin-bottom: 14px;
}

.record-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.record-links a {
    color: var(--muted);
    text-decoration: none;
}

.counter {
    display: block;
    max-width: 100%;
}

@media (max-width: 980px) {
    .topbar {
        grid-template-columns: 1fr auto;
        gap: 10px;
        min-height: auto;
    }

    .language-switcher {
        justify-self: end;
    }

    .nav-links {
        grid-column: 1 / -1;
        justify-content: center;
        width: 100%;
    }

    .hero-scroll-stage {
        height: 178vh;
    }

    h1 {
        font-size: 4rem;
    }

    h2 {
        font-size: 2.9rem;
    }

    .study-layout,
    .about-layout {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .index-row {
        grid-template-columns: 56px 1fr;
    }

    .index-row em {
        grid-column: 2;
    }
}

@media (max-width: 680px) {
    .topbar {
        top: 10px;
        width: calc(100% - 20px);
        padding: 10px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    .brand strong {
        font-size: 0.92rem;
    }

    .brand em {
        display: none;
    }

    .language-switcher {
        font-size: 0.72rem;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-links a {
        min-height: 32px;
        padding: 0 9px;
        font-size: 0.8rem;
    }

    .hero-scroll-stage {
        height: 172vh;
    }

    .hero-sticky {
        min-height: 600px;
    }

    .manuscript-field::before {
        inset: 108px 14px 26px;
    }

    .formula-ghost {
        top: 42%;
        font-size: min(21vw, 4.9rem);
    }

    .formula-token {
        font-size: 0.82rem;
    }

    .formula-token.major {
        font-size: 0.98rem;
    }

    .hero-copy {
        top: 58%;
        width: calc(100% - 28px);
    }

    h1 {
        font-size: 2.9rem;
    }

    h2 {
        font-size: 2.3rem;
    }

    h3 {
        font-size: 1.24rem;
    }

    .lead,
    .section-head p,
    .study-layout p,
    .about-layout p {
        font-size: 1rem;
        line-height: 1.68;
    }

    .button-row {
        gap: 10px;
    }

    .chalk-button {
        flex: 1 1 140px;
        min-width: 0;
        padding: 11px 14px;
        text-align: center;
    }

    .paper-section {
        width: min(100% - 28px, 1120px);
        padding: 72px 0;
    }

    .index-row {
        grid-template-columns: 44px 1fr;
        gap: 12px;
        padding: 22px 0;
    }

    .index-row strong {
        font-size: 1.2rem;
    }

    .index-row em {
        font-size: 0.96rem;
    }

    .thesis-columns article {
        padding: 20px 18px 20px 70px;
    }

    .thesis-columns article::before {
        left: 52px;
    }

    .thesis-columns span {
        left: 16px;
        font-size: 0.76rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
