/* Shared reading and chat tokens. No remote fonts, images or stylesheets. */
@font-face {
  font-family: "Notebook Serif";
  src: url("../assets/fonts/notebook-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root, [data-md-color-scheme="default"] {
  color-scheme: light;
  --notebook-canvas: #f5f6f0;
  --notebook-paper: #fdfdf9;
  --notebook-ink: #29372e;
  --notebook-muted: #697368;
  --notebook-line: #dfe4d9;
  --notebook-accent: #4d6854;
  --notebook-soft: #eaf0e5;
  --notebook-gold: #a87e38;
  --notebook-shadow: 0 8px 32px #23352205;
  --notebook-serif: "Notebook Serif", "Noto Serif CJK SC", "Songti SC", "SimSun", Georgia, serif;
  --md-text-font: "Inter", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --md-code-font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --md-default-bg-color: var(--notebook-canvas);
  --md-default-fg-color: var(--notebook-ink);
  --md-default-fg-color--light: var(--notebook-muted);
  --md-default-fg-color--lighter: #96a18f;
  --md-default-fg-color--lightest: var(--notebook-line);
  --md-primary-fg-color: var(--notebook-accent);
  --md-primary-bg-color: #fff;
  --md-accent-fg-color: #709064;
  --md-typeset-color: var(--notebook-ink);
  --md-typeset-a-color: var(--notebook-accent);
  --md-code-bg-color: #eef1e9;
  --md-code-fg-color: #344337;
  --md-footer-bg-color: var(--notebook-canvas);
  --md-footer-fg-color: var(--notebook-ink);
  --md-footer-bg-color--dark: var(--notebook-canvas);
  --md-footer-fg-color--light: var(--notebook-muted);
  --md-footer-fg-color--lighter: var(--notebook-muted);
}
[data-md-color-scheme="slate"] {
  color-scheme: dark;
  --notebook-canvas: #171d19;
  --notebook-paper: #1e2620;
  --notebook-ink: #e4e9df;
  --notebook-muted: #a1ad9e;
  --notebook-line: #354136;
  --notebook-accent: #aec7a1;
  --notebook-soft: #2a382a;
  --notebook-gold: #cfb47a;
  --notebook-shadow: 0 8px 32px #0000000c;
  --md-default-fg-color--lighter: #899582;
  --md-primary-bg-color: #1b281c;
  --md-accent-fg-color: #d2dfbf;
  --md-code-bg-color: #263127;
  --md-code-fg-color: #d3dfc8;
  --md-code-hl-number-color: #dfb285;
  --md-code-hl-string-color: #b7ce9a;
  --md-code-hl-keyword-color: #c6b7d8;
  --md-code-hl-comment-color: #91a18b;
}
html { scroll-padding-top: 5rem; }
body { background: var(--notebook-canvas); -webkit-font-smoothing: antialiased; }
::selection { background: #8aa47144; }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a, button { transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--notebook-accent); outline-offset: 4px; }
summary { cursor: pointer; }
.md-grid { max-width: 72rem; }
.notebook-header { background: color-mix(in srgb, var(--notebook-paper) 94%, transparent); color: var(--notebook-ink); box-shadow: none; border-bottom: 1px solid var(--notebook-line); backdrop-filter: blur(14px); }
.notebook-header .md-header__inner { height: 3.6rem; gap: .8rem; padding: 0 1.6rem; }
.notebook-brand { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; font-family: var(--notebook-serif); font-size: 1.1rem; letter-spacing: -.025em; }
.notebook-brand > svg { width: 1.65rem; height: 1.65rem; fill: none; stroke: var(--notebook-accent); stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.notebook-brand-dot { color: var(--notebook-gold); }
.notebook-header .md-header__title { display: none; }
.notebook-topnav { display: flex; align-items: center; gap: 1.45rem; margin-left: auto; font-size: .7rem; }
.notebook-topnav a { color: var(--notebook-muted); padding: .5rem 0; position: relative; }
.notebook-topnav a:hover, .notebook-topnav a[aria-current] { color: var(--notebook-ink); }
.notebook-topnav a[aria-current]::after { content: ""; position: absolute; height: 2px; background: var(--notebook-accent); left: 0; right: 0; bottom: 0; border-radius: 2px; }
.notebook-header-actions { display: flex; align-items: center; gap: .2rem; margin-left: 1.2rem; }
.notebook-header .md-header__button { color: var(--notebook-muted); margin: .1rem; padding: .35rem; border-radius: .5rem; }
.notebook-header .md-header__button:hover { opacity: 1; background: var(--notebook-soft); color: var(--notebook-accent); }
.notebook-header .md-header__button svg { height: 1rem; width: 1rem; }
.notebook-menu { order: -1; }
.notebook-header .md-search { padding: 0; }
.notebook-header .md-search__form { background: var(--notebook-soft); border-radius: .6rem; color: var(--notebook-ink); }
.notebook-header .md-search__input { color: var(--notebook-ink); }
.notebook-header .md-search__input::placeholder { color: var(--notebook-muted); }
.notebook-header .md-search__icon { color: var(--notebook-muted); }
.notebook-header .md-search__inner { width: 11rem; }
.notebook-search-toggle { display: none; }
[data-md-toggle="search"]:checked ~ .notebook-header .md-search__inner { width: 34.4rem; }
.md-search-result__meta { background: var(--notebook-soft); color: var(--notebook-muted); }
.md-search-result__article { color: var(--notebook-ink); }
.md-main__inner { margin-top: 1.5rem; padding: 0 1rem; }
.md-sidebar { font-size: .72rem; }
.md-sidebar--primary { width: 11.4rem; }
.md-sidebar--secondary { width: 10.5rem; }
.md-nav__title { font-size: .67rem; font-weight: 600; letter-spacing: .04em; color: var(--notebook-muted); }
.md-nav__link { line-height: 1.65; border-radius: .4rem; padding: .3rem .4rem; margin: .12rem 0; }
.md-nav__link:hover { background: var(--notebook-soft); color: var(--notebook-accent); }
.md-nav__link--active { background: var(--notebook-soft); color: var(--notebook-accent); font-weight: 600; }
.md-nav__item .md-nav__link--active { color: var(--notebook-accent); }
.md-nav__item--nested > .md-nav__link { color: var(--notebook-ink); }
.md-content { min-width: 0; }
.md-content__inner { max-width: 43rem; margin: .5rem auto 2.5rem; padding: 2.1rem 2.4rem; background: var(--notebook-paper); border: 1px solid var(--notebook-line); border-radius: 1rem; box-shadow: var(--notebook-shadow); }
.md-typeset { font-size: .82rem; line-height: 1.95; }
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-family: var(--notebook-serif); letter-spacing: -.015em; color: var(--notebook-ink); }
.md-typeset h1 { font-size: 1.75rem; font-weight: 400; line-height: 1.45; margin: 0 0 1.5rem; overflow-wrap: anywhere; }
.md-typeset h2 { font-size: 1.3rem; font-weight: 400; line-height: 1.5; margin: 2.3rem 0 .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--notebook-line); }
.md-typeset h3 { font-size: 1.05rem; font-weight: 400; margin-top: 1.8rem; }
.md-typeset p { margin: 1em 0; }
.md-typeset a:not(.headerlink):hover { text-decoration: underline; text-underline-offset: .2em; }
.md-typeset .headerlink { color: var(--notebook-muted); font-family: var(--md-text-font); }
.md-typeset blockquote { color: var(--notebook-muted); border-left: .15rem solid var(--notebook-accent); padding-left: 1rem; }
.md-typeset code { border-radius: .25rem; padding: .12rem .28rem; font-size: .84em; }
.md-typeset pre { border: 1px solid var(--notebook-line); border-radius: .65rem; }
.md-typeset pre > code { padding: 1rem; line-height: 1.7; }
.md-typeset table:not([class]) { font-size: .72rem; border: 1px solid var(--notebook-line); border-radius: .6rem; overflow: hidden; background: var(--notebook-paper); }
.md-typeset table:not([class]) th { background: var(--notebook-soft); color: var(--notebook-ink); padding: .8em 1em; }
.md-typeset table:not([class]) td { border-color: var(--notebook-line); padding: .75em 1em; }
.md-typeset .admonition, .md-typeset details { box-shadow: none; border-radius: .55rem; font-size: .75rem; }
.md-typeset img { border-radius: .5rem; }
.md-typeset .arithmatex { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: .25rem 0; }
.md-typeset .katex { font-size: 1.13em; }
.md-content__button { color: var(--notebook-muted); }
.md-footer, .md-footer-meta { background: var(--notebook-canvas); color: var(--notebook-muted); }
.md-footer { border-top: 1px solid var(--notebook-line); }
.md-footer__link { color: var(--notebook-ink); }
.md-copyright { color: var(--notebook-muted); font-size: .62rem; }
.md-top { border: 1px solid var(--notebook-line); border-radius: 2rem; background: var(--notebook-paper); color: var(--notebook-accent); box-shadow: var(--notebook-shadow); }
/* Homepage intentionally shares tokens, without the reading-page paper or sidebars. */
.md-main__inner:has(.notebook-home) { max-width: 64rem; padding: 0 1.4rem; margin-top: 1.5rem; }
.md-content__inner:has(.notebook-home) { max-width: none; margin: 0; border: 0; padding: 0 0 1.5rem; box-shadow: none; background: transparent; }
.md-main__inner:has(.notebook-home) .md-sidebar--secondary { display: none; }
.notebook-homepage .md-footer__inner { display: none; }
.notebook-home h1, .notebook-home h2, .notebook-home h3, .notebook-home p { margin: 0; }
.notebook-hero { min-height: 23rem; position: relative; overflow: hidden; border-radius: 1.2rem; isolation: isolate; border: 1px solid var(--notebook-line); }
.notebook-home .notebook-hero-image { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: 64% 58%; border-radius: 0 !important; z-index: -2; }
.notebook-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #f6f4eafc 0%, #f6f4eaf2 25%, #f6f4ea66 49%, transparent 72%); z-index: -1; }
[data-md-color-scheme="slate"] .notebook-hero::after { background: linear-gradient(90deg, #1c251dfc 0%, #1c251de8 25%, #1c251d44 51%, transparent 73%); }
.notebook-hero-copy { padding: 2.7rem 2.8rem; }
.notebook-eyebrow { font-family: var(--md-text-font); font-size: .54rem; letter-spacing: .14em; font-weight: 500; color: var(--notebook-muted); }
.notebook-hero-copy > .notebook-eyebrow { display: flex; gap: .4rem; align-items: center; margin-bottom: 1.15rem; color: var(--notebook-accent); }
.notebook-eyebrow > span { width: .3rem; height: .3rem; background: var(--notebook-accent); border-radius: 50%; }
.notebook-home .notebook-hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.18; letter-spacing: -.055em; font-weight: 400; }
.notebook-hero h1 > span { color: var(--notebook-gold); }
.notebook-home .notebook-hero-description { color: var(--notebook-ink); font-size: .72rem; line-height: 1.9; margin-top: 1.15rem; }
.notebook-hero-actions { display: flex; align-items: center; gap: .6rem; margin-top: 1.5rem; }
.notebook-button { display: inline-flex; align-items: center; justify-content: center; gap: 1rem; padding: .6rem .9rem; border-radius: .5rem; font-size: .65rem; line-height: 1.5; font-family: var(--md-text-font); color: var(--md-primary-bg-color) !important; background: var(--notebook-accent); border: 1px solid transparent; cursor: pointer; }
.notebook-button:hover { transform: translateY(-2px); text-decoration: none !important; box-shadow: 0 4px 12px #24382418; }
.notebook-button-quiet { color: var(--notebook-ink) !important; background: color-mix(in srgb, var(--notebook-paper) 50%, transparent); border-color: var(--notebook-line); }
.notebook-hero-caption { position: absolute; bottom: .9rem; right: 1.1rem; font-family: var(--notebook-serif); font-size: .6rem; color: #fff9df; text-shadow: 0 1px 8px #352d1e; letter-spacing: .05em; }
.notebook-home-search { width: 100%; display: flex; align-items: center; gap: .7rem; margin: 1rem 0 2.3rem; padding: .8rem 1rem; background: var(--notebook-paper); border: 1px solid var(--notebook-line); border-radius: .7rem; color: var(--notebook-muted); text-align: left; font: inherit; font-size: .72rem; cursor: text; }
.notebook-home-search:hover { border-color: var(--notebook-accent); }
.notebook-home-search svg { width: 1rem; height: 1rem; stroke: var(--notebook-accent); stroke-width: 1.5; fill: none; }
.notebook-home-search kbd { margin-left: auto; font-family: var(--md-text-font); font-size: .55rem; padding: .12rem .35rem; box-shadow: none; border: 1px solid var(--notebook-line); border-radius: .25rem; background: var(--notebook-canvas); color: var(--notebook-muted); }
.notebook-home-section { margin-bottom: 2.4rem; scroll-margin-top: 5rem; }
.notebook-section-heading { display: flex; align-items: end; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.notebook-home .notebook-section-heading h2 { border: none; padding: 0; margin-top: .2rem; font-size: 1.3rem; }
.notebook-section-heading > a, .notebook-section-aside { font-size: .63rem; color: var(--notebook-muted); }
.notebook-subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.notebook-subject { color: var(--notebook-ink) !important; background: var(--notebook-paper); border: 1px solid var(--notebook-line); border-radius: .8rem; padding: 1.25rem; text-decoration: none !important; }
.notebook-subject:hover { transform: translateY(-4px); border-color: var(--notebook-accent); box-shadow: var(--notebook-shadow); }
.notebook-subject-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.notebook-subject-icon { display: grid; place-items: center; background: var(--notebook-soft); color: var(--notebook-accent); border-radius: .55rem; width: 2.25rem; height: 2.25rem; }
.notebook-subject-icon svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.notebook-card-arrow { color: var(--notebook-muted); font-size: .9rem; transition: transform 160ms ease; }
.notebook-subject:hover .notebook-card-arrow, .notebook-course:hover > .notebook-card-arrow { transform: translate(2px, -2px); color: var(--notebook-accent); }
.notebook-home .notebook-card-overline { font-size: .49rem; letter-spacing: .1em; color: var(--notebook-muted); margin-bottom: .25rem; }
.notebook-home .notebook-subject h3 { font-size: 1.1rem; font-weight: 400; margin-bottom: .55rem; }
.notebook-home .notebook-subject > p:not(.notebook-card-overline) { font-size: .64rem; color: var(--notebook-muted); line-height: 1.85; }
.notebook-card-tags { display: block; border-top: 1px solid var(--notebook-line); padding-top: .75rem; margin-top: 1.1rem; color: var(--notebook-accent); font-size: .56rem; }
.notebook-course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem .9rem; }
.notebook-course { display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; border: 1px solid var(--notebook-line); background: var(--notebook-paper); border-radius: .65rem; text-decoration: none !important; color: var(--notebook-ink) !important; }
.notebook-course:hover { background: var(--notebook-soft); border-color: var(--notebook-accent); }
.notebook-course-number { font-family: var(--notebook-serif); font-size: 1.3rem; color: var(--notebook-gold); }
.notebook-home .notebook-course h3 { font-family: var(--md-text-font); font-size: .75rem; font-weight: 500; margin-bottom: .2rem; }
.notebook-home .notebook-course p { font-size: .6rem; color: var(--notebook-muted); line-height: 1.7; }
.notebook-course > .notebook-card-arrow { margin-left: auto; }
.notebook-home-note { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 0 .4rem; border-top: 1px solid var(--notebook-line); color: var(--notebook-muted); }
.notebook-home-note > span { color: var(--notebook-accent); font-size: 1.3rem; }
.notebook-home-note p, .notebook-home-note a { font-size: .61rem; }
.notebook-home-note a { flex-shrink: 0; margin-left: auto; }
@keyframes notebook-page-in { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.notebook-page-enter { animation: notebook-page-in 180ms ease-out; }
@keyframes notebook-target { 0%, 45% { background: var(--notebook-soft); box-shadow: -.25rem 0 0 var(--notebook-accent); } 100% { background: transparent; box-shadow: none; } }
.notebook-target { animation: notebook-target 1800ms ease-out; }
@media (min-width: 1220px) { .md-main__inner:has(.notebook-home) .md-sidebar--primary { display: none; } }
@media (max-width: 1219px) {
  .notebook-topnav { gap: 1rem; }
  .notebook-header-actions { margin-left: auto; }
  .notebook-header .md-search__inner { width: 9rem; }
  .md-sidebar--primary .md-nav__title { background: var(--notebook-paper); color: var(--notebook-ink); }
  .md-sidebar--primary .md-nav--primary { background: var(--notebook-paper); }
}
@media (max-width: 1050px) { .notebook-topnav { display: none; } }
@media (max-width: 760px) {
  .notebook-header .md-header__inner { height: 3.1rem; padding: 0 .6rem; gap: .2rem; }
  .notebook-brand { font-size: 1rem; gap: .35rem; }
  .notebook-brand > svg { width: 1.4rem; height: 1.4rem; }
  .notebook-repo { display: none; }
  .notebook-header .md-header__button { padding: .3rem; }
  .notebook-header-actions { gap: 0; }
  .notebook-search-toggle { display: block; }
  .notebook-header .md-search__inner { width: 90%; }
  [data-md-toggle="search"]:checked ~ .notebook-header .md-search__inner { width: 100%; }
  .md-main__inner { padding: 0 .45rem; margin-top: .6rem; }
  .md-content__inner { padding: 1.2rem .9rem; border-radius: .75rem; margin: .3rem 0 1.5rem; }
  .md-typeset h1 { font-size: 1.4rem; }
  .md-typeset { font-size: .79rem; }
  .md-main__inner:has(.notebook-home) { padding: 0 .7rem; margin-top: .7rem; }
  .notebook-hero { display: flex; flex-direction: column; min-height: auto; }
  .notebook-home .notebook-hero-image { position: relative; height: 12rem; object-position: 69% 40%; z-index: 0; }
  .notebook-hero::after { display: none; }
  .notebook-hero-copy { order: 1; padding: 1.5rem 1.3rem 1.6rem; background: var(--notebook-paper); }
  .notebook-hero-copy > .notebook-eyebrow { margin-bottom: .7rem; }
  .notebook-home .notebook-hero h1 { font-size: clamp(1.5rem, 8.4vw, 2.1rem); }
  .notebook-hero-caption { top: 10.7rem; bottom: auto; font-size: .5rem; }
  .notebook-home .notebook-hero-description { font-size: .68rem; margin-top: .9rem; }
  .notebook-hero-actions { margin-top: 1.1rem; }
  .notebook-home-search { margin-bottom: 1.8rem; font-size: .65rem; padding: .75rem; gap: .5rem; }
  .notebook-home-search kbd { font-size: .45rem; }
  .notebook-section-heading > a { font-size: .55rem; }
  .notebook-section-aside { display: none; }
  .notebook-subject-grid, .notebook-course-grid { grid-template-columns: 1fr; gap: .6rem; }
  .notebook-subject { padding: 1rem; }
  .notebook-subject-top { margin-bottom: .7rem; }
  .notebook-home-note { align-items: start; flex-wrap: wrap; }
  .notebook-home-note p { flex: 1; }
  .notebook-home-note a { width: auto; flex-basis: calc(100% - 2rem); margin-left: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (min-width: 761px) and (max-width: 959px) {
  .notebook-search-toggle { display: block; }
  .notebook-header .md-search__inner { width: 90%; }
  [data-md-toggle="search"]:checked ~ .notebook-header .md-search__inner { width: 100%; }
}
.notebook-source-link { display: flex; align-items: center; gap: .55rem; padding: .65rem .8rem; color: var(--notebook-muted); font-size: .62rem; }
.notebook-source-link .md-icon svg { width: 1rem; height: 1rem; fill: currentColor; }
