/* Shared blog chrome. Namespaced tokens never recolor a guide's diagrams. */
:root {
  /* One page frame for blog pages and native Canvases. At desktop sizes,
     64rem includes two 2rem gutters, leaving a 60rem / 960px content axis. */
  --content-width: 64rem;
  --lm-page-gutter: 2rem;
  --lm-page-inner-width: calc(var(--content-width) - 2 * var(--lm-page-gutter));
  --lm-bg: #fff;
  --lm-ink: #202020;
  --lm-muted: #737373;
  --lm-line: #e8e8e8;
  --lm-hover: #f5f5f5;
  --lm-glass-top: #fff;
  --lm-glass-surface: #f7f8f9;
  --lm-glass-hover: #eff1f3;
  --lm-row-hover: rgba(0, 0, 0, .025);
  --lm-glass-line: rgba(65, 80, 95, .13);
  --lm-glass-edge: rgba(255, 255, 255, .8);
  --lm-glass-sheen: linear-gradient(135deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .02) 60%);
  --lm-glass-shadow: 0 8px 28px rgba(25, 35, 45, .05);
  --lm-glass-filter: none;
  --header-height: 4.25rem;
  --lm-chrome-offset: var(--header-height);
}
html.dark {
  --lm-bg: #111;
  --lm-ink: #ededed;
  --lm-muted: #a3a3a3;
  --lm-line: #303030;
  --lm-hover: #222;
  --lm-glass-top: #16181a;
  --lm-glass-surface: #1c1f22;
  --lm-glass-hover: #292d32;
  --lm-row-hover: rgba(255, 255, 255, .04);
  --lm-glass-line: rgba(200, 216, 232, .15);
  --lm-glass-edge: rgba(255, 255, 255, .07);
  --lm-glass-sheen: linear-gradient(135deg, rgba(225, 236, 247, .045), rgba(225, 236, 247, 0) 60%);
  --lm-glass-shadow: 0 6px 24px rgba(0, 0, 0, .14);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --lm-glass-top: rgba(255, 255, 255, .62);
    --lm-glass-surface: rgba(243, 246, 249, .54);
    --lm-glass-hover: rgba(230, 236, 242, .6);
    --lm-glass-filter: blur(24px) saturate(140%);
  }
  html.dark {
    --lm-glass-top: rgba(20, 22, 25, .66);
    --lm-glass-surface: rgba(32, 36, 40, .58);
    --lm-glass-hover: rgba(50, 56, 63, .64);
  }
}
.reading-shell-header {
  position: sticky;
  inset: 0 0 auto;
  z-index: 110;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: var(--header-height);
  margin: 0;
  padding: 0 clamp(1.25rem, 3vw, 3rem);
  border: 0;
  border-bottom: 1px solid var(--lm-glass-line);
  background: transparent;
  box-shadow: 0 3px 20px rgba(20, 30, 40, .035);
  color: var(--lm-ink);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.4;
}
.reading-shell-header.is-document-reader .site-title { margin-inline-end: auto; }
/* Every normal page shares the list's reading axis, including native Canvases.
   Only focus mode uses the full-bleed control layout; glass always spans the page. */
:root:not(.reading-focus) .reading-shell-header {
  padding-inline: max(var(--lm-page-gutter), calc((100% - var(--content-width)) / 2 + var(--lm-page-gutter)));
}
/* Blur the decorative layer, not the header: fixed controls must stay
   viewport-relative, and the glass must never intercept their clicks. */
.site-header.reading-shell-header::before {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 0;
  background: var(--lm-glass-sheen), var(--lm-glass-top);
  box-shadow: inset 0 1px 0 var(--lm-glass-edge), inset 0 -1px 0 var(--lm-glass-edge);
  opacity: 1;
  pointer-events: none;
  backdrop-filter: var(--lm-glass-filter);
  -webkit-backdrop-filter: var(--lm-glass-filter);
}
.reading-shell-header.is-reader { gap: .8rem; }
.reading-shell-header a { color: inherit; text-decoration: none; }
.reading-shell-header .site-title {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: .55rem;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
}
.reading-shell-header .site-logo {
  display: block;
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  background: currentColor;
  -webkit-mask: url('/brand/site-mark.svg?v=20260915-weijing1') center / contain no-repeat;
  mask: url('/brand/site-mark.svg?v=20260915-weijing1') center / contain no-repeat;
}
.reading-shell-header .site-nav {
  display: flex;
  flex: none;
  flex-direction: row;
  align-items: stretch;
  gap: 1.65rem;
  align-self: stretch;
  margin-left: auto;
}
.reading-shell-header.is-reader .site-nav {
  gap: clamp(1rem, 2vw, 1.65rem);
  margin-inline: 1.25rem .8rem;
}
.reading-shell-header .site-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0;
  color: var(--lm-muted);
  font-size: .98rem;
  font-weight: 400;
  white-space: nowrap;
  text-decoration: none;
  transition: color 160ms ease;
}
.reading-shell-header .site-nav-link::after {
  content: none;
  display: none;
}
.reading-shell-header a:hover { color: var(--lm-muted); }
.reading-shell-header .site-nav-link:is(:hover, :focus-visible, .is-active) {
  color: var(--lm-ink);
  text-decoration: none;
  background: transparent;
  box-shadow: none;
}
.reading-shell-header .site-nav-link.is-active { font-weight: 600; }
.reader-breadcrumb {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex: 1;
  min-width: 0;
  font-size: .95rem;
  color: var(--lm-muted);
}
.reader-breadcrumb a, .reader-breadcrumb > span:not(.reader-current) { flex: none; }
.reader-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lm-ink); }
.reader-actions { display: flex; flex: none; align-items: center; gap: .55rem; }
:is(.reading-shell-header, .reader-floating-controls) .reader-icon-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: .55rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--lm-ink);
  cursor: pointer;
  box-sizing: border-box;
  transition: opacity 160ms ease;
  touch-action: manipulation;
}
/* Keep pointer and fullscreen states glyph-only; keyboard focus keeps its outline. */
:is(.reading-shell-header, .reader-floating-controls) .reader-icon-button:is(:hover, :focus-visible, :active),
.reader-floating-controls .reader-toggle[aria-pressed="true"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: none;
  opacity: 1;
}
:is(.reading-shell-header, .reader-floating-controls) .reader-icon-button:is(:hover, :active) { opacity: .72; }
/* Controls never consume navigation width. Their group is outside the header,
   so shrinking remains available even while focus-mode chrome is hidden. */
.reader-floating-controls {
  position: fixed;
  right: max(1.25rem, calc((100vw - var(--content-width)) / 2 - 4rem), calc(env(safe-area-inset-right) + 1rem));
  bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
  z-index: 115;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 44px;
  pointer-events: none;
}
.reader-floating-controls .reader-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  pointer-events: auto;
}
.reader-floating-controls .back-to-top {
  position: relative;
  right: auto;
  bottom: auto;
  flex: none;
  width: 44px;
  height: 44px;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}
.reader-floating-controls .back-to-top.is-visible { transition-delay: 0s; }
.reading-shell-header .btn-dark {
  background-image: none;
  filter: none;
}
.reading-shell-header .btn-dark::before { content: none; }
.dark .reading-shell-header .btn-dark { color: #d7e1ec; filter: none; }
.reader-icon-button svg { display: block; width: 1.25rem; height: 1.25rem; pointer-events: none; }
.theme-moon .moon-disc { fill: currentColor; fill-opacity: .08; }
/* Show the target mode, with no overlapping glyphs during a theme change. */
.theme-sun { display: none; }
.theme-moon { display: block; }
.dark .theme-sun { display: block; }
.dark .theme-moon { display: none; }
.reader-contract, .reading-focus .reader-expand { display: none !important; }
.reading-focus .reader-contract { display: block !important; }
:is(.reading-shell-header, .reader-floating-controls) [hidden] { display: none !important; }
:is(.reading-shell-header, .reader-floating-controls) :is(a, button):focus-visible { outline: 2px solid var(--lm-ink); outline-offset: 4px; }
.reading-shell-header .reading-progress { right: 0; left: 0; height: 1px; }
.reading-shell-header .reading-progress > span { background: var(--lm-muted); }
.reading-heading .eyebrow { text-transform: none; }
.footer-nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover, .footer-nav a[aria-current] { color: var(--lm-ink); }
.reading-focus body > main.prose { max-width: var(--content-width); }
.reading-focus .reading-shell-header.is-reader .site-nav { display: none; }
.reading-focus :is(.comment-shell, #waline, .graphcomment, body > footer) { display: none; }
.reader-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Only hover-capable focus mode auto-hides. Tab focus can always reveal the
   header; the independent lower-right reading controls stay available. */
.reading-focus.reader-autohide { --lm-chrome-offset: 0px; }
.reading-focus.reader-autohide .reading-shell-header {
  margin-bottom: calc(-1 * var(--header-height));
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.reading-focus.reader-autohide.reader-chrome-revealed,
.reading-focus.reader-autohide:has(.reading-shell-header :focus-visible, .book-nav :focus-visible) {
  --lm-chrome-offset: var(--header-height);
}
.reading-focus.reader-autohide.reader-chrome-revealed .reading-shell-header,
.reading-focus.reader-autohide .reading-shell-header:has(:focus-visible),
.reading-focus.reader-autohide:has(.book-nav :focus-visible) .reading-shell-header {
  opacity: 1;
  pointer-events: auto;
}
.reading-focus.reader-autohide .reading-shell-header:has(:focus-visible) { transition: none; }
/* Reading controls stay glyph-only. Glass belongs to navigation, selected
   links, list feedback and the comment editor, never this control dock. */
.pagination .btn { padding: .45rem .7rem; border-radius: .6rem; }

/* Native documents share the page axis, not an article template or iframe. */
.demo-page .rail { top: var(--header-height); }
.demo-page .progress { top: calc(var(--header-height) - 2px); z-index: 120; height: 2px; pointer-events: none; }
.demo-page :is(section, .section, .hero) { scroll-margin-top: calc(var(--header-height) + 1.5rem); }
.reading-focus .demo-page .rail { display: none; }
.reading-focus .demo-page :is(.content, .main) { margin-left: 0; }
@media (max-width: 600px) {
  .reader-floating-controls {
    right: calc(env(safe-area-inset-right) + 1rem);
    bottom: calc(env(safe-area-inset-bottom) + 1rem);
  }
}
@media print {
  .reader-floating-controls { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-floating-controls .reader-icon-button { transition: none; }
}
@media (forced-colors: active) {
  .reader-floating-controls .reader-icon-button { color: ButtonText; }
  .reader-floating-controls .reader-icon-button:focus-visible { outline-color: Highlight; }
}
@media (min-width: 601px) and (max-width: 767px) {
  :root { --lm-page-gutter: 1.25rem; }
}
@media (max-width: 820px) {
  /* Reader navigation gets its own touch-friendly row. Keep the true height in
     the shared token so Canvas chapter bars and anchor offsets stay in sync. */
  :root:has(body > .reading-shell-header.is-reader) { --header-height: 6.5rem; }
  :root.reading-focus:has(body > .reading-shell-header.is-reader) { --header-height: 3.75rem; }
  .reading-shell-header.is-reader {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 3.75rem 2.75rem;
    column-gap: .6rem;
    row-gap: 0;
  }
  .reading-shell-header.is-reader .site-title { grid-area: 1 / 1; }
  .reading-shell-header.is-reader .reader-breadcrumb { grid-area: 1 / 2; }
  .reading-shell-header.is-reader .reader-actions { grid-area: 1 / 3; }
  .reading-shell-header.is-reader .site-nav {
    grid-area: 2 / 1 / 3 / -1;
    justify-content: center;
    margin: 0;
  }
  .reading-focus .reading-shell-header.is-reader { grid-template-rows: 3.75rem; }
  .demo-page :is(section, .section, .hero) { scroll-margin-top: calc(var(--header-height) + 5rem); }
  .reading-focus .demo-page :is(section, .section, .hero) { scroll-margin-top: calc(var(--header-height) + 1rem); }
}
@media (max-width: 600px) {
  :root { --header-height: 3.75rem; --lm-page-gutter: 1rem; }
  .reading-shell-header { height: var(--header-height); padding: 0 1rem; gap: .65rem; }
  .reading-shell-header .site-title { font-size: 1.2rem; gap: .35rem; }
  .reading-shell-header .site-logo { width: 1.45rem; height: 1.45rem; }
  .reading-shell-header.is-reader { column-gap: .5rem; }
  .reader-breadcrumb { gap: .5rem; font-size: .88rem; }
  .reader-actions { gap: .35rem; }
  .reading-shell-header .reader-icon-button { width: 2.75rem; height: 2.75rem; padding: .75rem; }
  /* Four native column links need a second row on small screens, just like
     reader pages. Brand/actions keep the same position when changing pages. */
  :root:has(body > .reading-shell-header:not(.is-reader)) { --header-height: 6.5rem; }
  .reading-shell-header:not(.is-reader) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 3.75rem 2.75rem;
    column-gap: .5rem;
    row-gap: 0;
  }
  .reading-shell-header:not(.is-reader) .site-title { grid-area: 1 / 1; }
  .reading-shell-header:not(.is-reader) .reader-actions { grid-area: 1 / 2; }
  .reading-shell-header:not(.is-reader) .site-nav {
    grid-area: 2 / 1 / 3 / -1;
    justify-content: center;
    margin: 0;
  }
}
@media (pointer: coarse) {
  .reading-shell-header .reader-icon-button { min-width: 2.75rem; min-height: 2.75rem; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root { --lm-glass-top: #fff; --lm-glass-surface: #f5f6f7; --lm-glass-hover: #edf0f2; --lm-glass-sheen: none; --lm-glass-filter: none; }
  html.dark { --lm-glass-top: #16181a; --lm-glass-surface: #202326; --lm-glass-hover: #2a2f34; --lm-glass-sheen: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .reading-shell-header, .reading-shell-header * { transition: none !important; }
}
