.handwritten-notes [id] { scroll-margin-top: 6rem; }
.handwritten-notes .calculation { margin: 1.4rem 0; padding: 1rem 1.2rem; border-left: 3px solid var(--brand); background: var(--card); line-height: 1.9; font-variant-numeric: tabular-nums; }
.handwritten-notes .note-table table { min-width: 0; font-variant-numeric: tabular-nums; }
.handwritten-notes .note-table th, .handwritten-notes .note-table td { padding: .65rem .75rem; overflow-wrap: normal; }
.handwritten-notes .note-table caption { caption-side: top; }
.handwritten-notes .note-figure img { display: block; width: 100%; height: auto; background: white; border-radius: 6px; }
.handwritten-notes .source-page { margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.handwritten-notes .source-page summary { cursor: pointer; min-height: 44px; padding: .6rem 0; font-weight: 700; }
.handwritten-notes .source-page figure { margin: .7rem 0; padding: 0; border: 0; box-shadow: none; }
.handwritten-notes .source-page img { max-width: 620px; margin: 0 auto; }
.handwritten-notes .source-page a:focus-visible, .handwritten-notes summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
.handwritten-notes .source-intro { color: var(--ink-muted); font-size: .88rem; }
.handwritten-notes pre { max-width: 100%; overflow-x: auto; }
.handwritten-notes .post-nav { gap: 1rem; }
.handwritten-notes .note-equation .katex-display { padding: .2rem 0; }
.handwritten-notes .note-chapters > a { min-width: 0; }
.handwritten-notes .lda-direction-comparison td > div { margin: .25rem 0; }
@media(max-width: 900px) {
  .handwritten-layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .handwritten-layout.sidebar-collapsed .blog-sidebar { padding: 0; border: 0; background: transparent; }
  .handwritten-layout.sidebar-collapsed .sidebar-toggle { width: 100%; min-height: 44px; justify-content: flex-start; padding: .65rem .8rem; margin: 0; }
  .handwritten-layout.sidebar-collapsed .sidebar-toggle::after { content: "Browse notes"; margin-left: .5rem; }
}
@media(max-width: 600px) {
  .handwritten-notes [id] { scroll-margin-top: 10rem; }
  .handwritten-notes .note-table th, .handwritten-notes .note-table td { padding: .45rem .3rem; font-size: .78rem; }
  .handwritten-notes .note-equation .katex { font-size: .93em; }
  .handwritten-notes .calculation { padding: .8rem; }
  .handwritten-notes .source-page { padding: .6rem; }
  .handwritten-notes .note-chapters > a { gap: .7rem; padding: .85rem; }
  .handwritten-notes .lda-direction-comparison table,
  .handwritten-notes .lda-direction-comparison tbody,
  .handwritten-notes .lda-direction-comparison tr { display: block; width: 100%; }
  .handwritten-notes .lda-direction-comparison caption { display: block; box-sizing: border-box; width: 100%; }
  .handwritten-notes .lda-direction-comparison thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .handwritten-notes .lda-direction-comparison tr { margin: .8rem 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .handwritten-notes .lda-direction-comparison th[scope="row"],
  .handwritten-notes .lda-direction-comparison td { display: block; box-sizing: border-box; width: 100%; padding: .65rem .8rem; border: 0; text-align: left; font-size: .9rem; }
  .handwritten-notes .lda-direction-comparison th[scope="row"] { background: var(--card); }
  .handwritten-notes .lda-direction-comparison td { border-top: 1px solid var(--line); }
  .handwritten-notes .lda-direction-comparison td::before { content: attr(data-label); display: block; margin-bottom: .3rem; font-weight: 700; color: var(--ink-muted); }
}
