.article-page {
  --note-display: Georgia, "Noto Serif CJK SC", "Songti SC", STSong, SimSun, serif;
  --note-code: var(--surface-deep);
  --note-rule: color-mix(in srgb, var(--accent) 30%, var(--line));
  min-height: 100vh;
}

.note-progress {
  position: fixed;
  z-index: 15;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transform-origin: left;
  transform: scaleX(0);
}

.note-reader { padding-block-end: 5rem; }

.note-masthead {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 5.1vw, 3.5rem);
  border: 1px solid var(--note-rule);
  border-radius: 1.45rem;
  background:
    radial-gradient(ellipse at 88% 8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 48%),
    linear-gradient(130deg, var(--surface), var(--surface-deep));
  box-shadow: var(--shadow);
}

.note-breadcrumb { margin-block-end: clamp(.75rem, 2vw, 1.35rem); }
.note-breadcrumb ol,
.note-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .72rem;
  color: var(--muted);
  font-size: .82rem;
}
.note-breadcrumb ol { margin: 0; padding: 0; list-style: none; }
.note-breadcrumb li { min-width: 0; overflow-wrap: anywhere; }
.note-breadcrumb li + li::before {
  content: "/";
  margin-inline-end: .72rem;
  color: var(--fine);
}
.note-breadcrumb a:hover,
.note-source:hover,
.note-reader-footer a:hover { color: var(--accent-text); }

.note-masthead h1 {
  position: relative;
  max-width: 22em;
  margin: 0;
  color: var(--text);
  font: 680 clamp(1.95rem, 4.9vw, 3.9rem)/1.21 var(--note-display);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.note-masthead h1 a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: .12em;
}
.note-masthead h1 img { max-width: 100%; height: auto; }
.note-masthead h1 code { font-family: var(--mono); font-size: .85em; }

.note-metadata { margin-block-start: clamp(1rem, 2.5vw, 1.7rem); }
.note-format {
  padding: .18rem .55rem;
  border: 1px solid var(--note-rule);
  border-radius: .39rem;
  background: var(--accent-wash);
  color: var(--accent-text);
  font: 650 .72rem/1.5 var(--mono);
}
.note-source {
  padding-inline-start: .68rem;
  border-inline-start: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.note-source span { color: var(--accent); }

.note-orbit {
  position: absolute;
  z-index: -1;
  inset: 49% clamp(1.2rem, 4vw, 3.2rem) auto auto;
  width: clamp(6rem, 16vw, 10rem);
  aspect-ratio: 1;
  border: 1px solid var(--note-rule);
  border-radius: 50%;
  color: var(--accent);
  transform: translateY(-50%);
  opacity: .64;
  pointer-events: none;
}
.note-orbit::before,
.note-orbit::after,
.note-orbit i { position: absolute; border-radius: 50%; content: ""; }
.note-orbit::before { inset: 10%; border: 1px dashed var(--note-rule); }
.note-orbit::after {
  inset: 27%;
  box-shadow: -.6rem .3rem 0 .05rem color-mix(in srgb, var(--accent) 32%, transparent);
  transform: rotate(-18deg);
}
.note-orbit i { inset: -7% 23%; border: 1px solid var(--note-rule); transform: rotate(48deg); }
.note-orbit b { position: absolute; inset: 2% 11% auto auto; font-size: .9rem; }
.note-orbit span { position: absolute; inset: auto auto 8% 8%; font-size: 2rem; line-height: 1; }

.note-reader-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(.75rem, 2.5vw, 1.6rem);
  margin-block-start: clamp(.75rem, 2.5vw, 1.6rem);
}
.note-reader-grid:not(:has(.note-toc)) { max-width: 57rem; }

.note-toc {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}
.note-toc summary {
  display: flex;
  align-items: center;
  gap: .56rem;
  padding: .85rem 1rem;
  color: var(--text);
  font-size: .82rem;
  font-weight: 720;
  cursor: pointer;
  list-style: none;
}
.note-toc summary::-webkit-details-marker { display: none; }
.note-toc summary::after {
  content: "";
  width: .46rem;
  height: .46rem;
  margin-inline-start: auto;
  border-inline-end: 1px solid var(--muted);
  border-block-end: 1px solid var(--muted);
  transform: translateY(-20%) rotate(45deg);
  transition: transform .16s ease;
}
.note-toc details[open] summary::after { transform: translateY(20%) rotate(225deg); }
.note-toc summary:focus-visible,
.note-table:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.note-toc-mark { color: var(--accent); font: 700 1rem/1 var(--mono); }
.note-toc nav {
  position: relative;
  max-height: min(40vh, 19rem);
  overflow: auto;
  padding: .05rem .55rem .72rem;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.note-toc ul { list-style: none; margin: 0; padding: 0; }
.note-toc li ul {
  margin-inline-start: .78rem;
  padding-inline-start: .35rem;
  border-inline-start: 1px solid var(--line);
}
.note-toc a {
  display: block;
  padding: .33rem .45rem;
  border-radius: .38rem;
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  transition: color .18s ease, background-color .18s ease;
}
.note-toc a:focus-visible { outline-offset: -2px; }
.note-toc .katex { font-size: 1em; }
.note-toc a:hover {
  color: var(--accent-text);
  background: var(--accent-wash);
}

.article-content {
  min-width: 0;
  padding: clamp(1rem, 4.1vw, 3.4rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  color: var(--text);
  font-size: clamp(.97rem, 1.18vw, 1.07rem);
  line-height: 1.88;
  overflow-wrap: anywhere;
  scroll-margin-block-start: 1rem;
}
.article-content :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.72em 0 .6em;
  line-height: 1.38;
  scroll-margin-block-start: 1.15rem;
}
.article-content :is(h1, h2) {
  padding-block-end: .37em;
  border-block-end: 1px solid var(--line);
  font-family: var(--note-display);
  font-weight: 700;
}
.article-content h1 { font-size: clamp(1.5rem, 3.2vw, 2.35rem); }
.article-content h2 { font-size: clamp(1.28rem, 2.8vw, 1.86rem); }
.article-content h3 { color: var(--accent-text); font-size: clamp(1.09rem, 2vw, 1.32rem); }
.article-content h4 { font-size: 1.02em; }
.article-content h5,
.article-content h6 { color: var(--muted); font-size: .93em; }
.article-content [data-reader-target] { border-radius: .25rem; color: var(--accent-text); }
.article-content :is(p, ul, ol, blockquote, pre, .note-table) { margin-block: 1.05em; }
.article-content :is(ul, ol) { padding-inline-start: 1.65rem; }
.article-content li + li { margin-block-start: .26rem; }
.article-content li > :is(ul, ol) { margin-block: .25rem; }
.article-content li::marker { color: var(--accent); }
.article-content strong { font-weight: 740; }
.article-content a[href] {
  color: var(--accent-text);
  text-decoration-line: underline;
  text-decoration-thickness: .075em;
  text-decoration-color: var(--accent);
  text-underline-offset: .19em;
}
.article-content a[href]:hover { color: var(--cyan); text-decoration-color: currentColor; }
.article-content img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border-radius: .52rem;
  vertical-align: middle;
}
.article-content blockquote {
  margin-inline: 0;
  padding: .7rem 1rem;
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 .6rem .6rem 0;
  background: linear-gradient(100deg, var(--accent-wash), var(--surface-deep));
  color: var(--muted);
}
.article-content blockquote > :first-child { margin-block-start: 0; }
.article-content blockquote > :last-child { margin-block-end: 0; }
.article-content :is(code, pre) { font-family: var(--mono); }
.article-content :not(pre) > code {
  padding: .11em .31em;
  border-radius: .28em;
  background: var(--accent-wash);
  color: var(--accent-text);
  font-size: .88em;
}
.article-content pre {
  overflow: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--note-code);
  color: var(--text);
  font-size: .88em;
  line-height: 1.65;
}

.note-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .65rem;
}
.note-table table {
  width: 100%;
  border-spacing: 0;
  text-align: start;
  font-size: .92em;
}
.note-table :is(th, td) { padding: .5rem .8rem; overflow-wrap: normal; }
.note-table :is(th, td) + :is(th, td) { border-inline-start: 1px solid var(--line); }
.note-table th { background: var(--accent-wash); color: var(--accent-text); }
.note-table th:not([align]) { text-align: start; }
.note-table td { border-block-start: 1px solid var(--line); }
.note-table tr:nth-child(even) td { background: var(--surface-deep); }
.article-content hr {
  height: 1px;
  margin: 2.3rem 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--note-rule), transparent);
}
.article-content .katex-display { overflow: auto hidden; padding-block: .3rem; }
.article-content .katex:has(> math[display="block"]) {
  display: block;
  overflow: auto hidden;
  padding-block: .3rem;
}
.article-content .katex > math[display="block"] { width: max-content; min-width: 100%; }
.article-content .contains-task-list { list-style: none; }
.article-content .task-list-item > input { margin-inline-end: .35rem; accent-color: var(--accent); }
.article-content .footnotes {
  margin-block-start: 2rem;
  padding-block-start: .45rem;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: .9em;
}
.article-content .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.article-content .footnotes li { scroll-margin-block-start: 1.15rem; }
.article-content > :first-child { margin-block-start: 0; }
.article-content > :last-child { margin-block-end: 0; }
.article-content > [data-note-chunk] { display: flow-root; }
[data-note-chunk] + [data-note-chunk] {
  margin-block-start: 1.65em;
  content-visibility: auto;
  contain-intrinsic-block-size: auto var(--note-chunk-estimate);
}
[data-note-chunk] > :first-child { margin-block-start: 0; }
[data-note-chunk] > :last-child { margin-block-end: 0; }

.note-reader-footer { padding: 1.4rem .1rem 0; color: var(--muted); font-size: .88rem; }

@media (min-width: 901px) {
  .note-reader-grid:has(.note-toc) { grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem); }
  .note-toc { grid-area: 1 / 2; position: sticky; top: 1.25rem; z-index: 3; }
  .note-toc nav { max-height: calc(100dvh - 6.5rem); }
  .article-content { grid-area: 1 / 1; }
  .note-masthead h1 { max-width: min(77%, 22em); }
}

@media (max-width: 585px) {
  .article-nav.site-header { display: flex; justify-content: space-between; flex-wrap: wrap; }
  .article-nav .site-nav { display: flex; gap: 0; }
  .article-nav .site-nav a { padding-inline: .43rem; }
  .note-masthead { border-radius: 1rem; }
  .note-orbit { opacity: .27; }
  .note-source { padding-inline-start: 0; border-inline-start: 0; }
  .article-content { border-radius: .9rem; }
}

@media (prefers-reduced-motion: no-preference) {
  [data-effects="on"] .note-masthead { animation: notebook-enter .42s cubic-bezier(.2, .7, .3, 1) both; }
}
@media (prefers-reduced-motion: reduce) {
  .note-toc summary::after, .note-toc a { transition: none; }
}
