.notes-skip { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--background); padding: .75rem; }
.notes-skip:focus { top: .75rem; }
.notes-shell { max-width: 72rem; padding: 7rem 2rem 3.5rem; margin: auto; min-height: 85vh; }
.notes-index { max-width: 56rem; padding-top: 7rem; }
.notes-heading { padding-bottom: 1.15rem; border-bottom: 1px solid var(--card-border); }
.notes-heading h1, .note-heading h1 { font-family: var(--font-serif); color: var(--primary); font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.notes-heading h1 { font-size: 2.5rem; line-height: 1.2; }
.notes-heading p { color: var(--text-meta); margin-top: .5rem; }
.notes-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(10rem, 15rem); gap: 1rem; padding-top: 1.25rem; }
.notes-controls label { display: block; color: var(--text-meta); font-size: .8rem; margin-bottom: .5rem; }
.notes-controls input, .notes-controls select { width: 100%; min-height: 2.75rem; border: 1px solid var(--card-border); border-radius: 4px; padding: .6rem .75rem; background: var(--background); color: var(--text-body); font: inherit; }
.notes-shell :focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.notes-count { color: var(--text-soft); font-size: .8rem; margin: .85rem 0; }
.notes-entry { display: grid; grid-template-columns: 7rem minmax(0,1fr); gap: 1.25rem; padding: 1.1rem 0; border-top: 1px solid var(--card-border); }
.notes-entry[hidden], [hidden].notes-empty { display: none; }
.notes-entry-meta { color: var(--text-soft); font-size: .8rem; padding-top: .3rem; display: flex; flex-direction: column; gap: .5rem; }
.notes-entry h2 { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.notes-entry h2 a { color: var(--primary); }
.notes-entry h2 a:hover { color: var(--accent-dark); }
.notes-entry p { color: var(--text-meta); line-height: 1.6; margin: .35rem 0; overflow-wrap: anywhere; }
.note-tags { display: flex; flex-wrap: wrap; gap: .35rem .85rem; list-style: none; margin-top: .45rem; padding: 0; }
.note-tags a { font-size: .8rem; color: var(--text-meta); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--card-border); }
.note-tags a:hover { color: var(--accent-dark); }
.notes-empty { padding: 3rem 0; color: var(--text-soft); }
.note-back { display: inline-block; font-size: .9rem; color: var(--text-meta); margin-bottom: 1.15rem; }
.note-layout { display: grid; grid-template-columns: minmax(0, 49rem) minmax(0, 12rem); gap: 2.5rem; align-items: start; }
.note-article { min-width: 0; }
.note-heading { padding-bottom: 1.25rem; border-bottom: 1px solid var(--card-border); margin-bottom: 1.4rem; }
.note-heading h1 { font-size: 2.25rem; line-height: 1.25; }
.note-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--text-soft); font-size: .8rem; margin-top: .65rem; }
.note-description { line-height: 1.6; color: var(--text-meta); margin-top: .7rem; }
.note-draft { color: var(--accent-dark); font-size: .75rem; margin-bottom: .5rem; }
.note-outline { position: sticky; top: 7rem; border-left: 1px solid var(--card-border); padding-left: 1.25rem; font-size: .8rem; max-height: calc(100vh - 9rem); overflow-y: auto; }
.note-outline summary { color: var(--primary); font-weight: 600; cursor: pointer; }
.note-outline ol { list-style: none; padding: .75rem 0 0; }
.note-outline li { margin: .45rem 0; line-height: 1.45; }
.note-outline a { color: var(--text-meta); overflow-wrap: anywhere; }
.note-outline a:hover { color: var(--accent-dark); }
.note-outline .toc-h3 { padding-left: .85rem; }
.note-prose { color: var(--text-body); font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere; }
.note-prose > :first-child { margin-top: 0; }
.note-prose p, .note-prose ul, .note-prose ol, .note-prose blockquote, .note-prose pre, .note-prose table { margin: .8rem 0; }
.note-prose h2, .note-prose h3, .note-prose h4 { color: var(--primary); font-weight: 600; line-height: 1.35; scroll-margin-top: 7rem; }
.note-prose h2 { margin: 1.8rem 0 .65rem; font-size: 1.4rem; }
.note-prose h3 { margin: 1.4rem 0 .5rem; font-size: 1.2rem; }
.note-prose h4 { margin: 1.15rem 0 .45rem; font-size: 1.08rem; }
.note-prose ul, .note-prose ol { padding-left: 1.5rem; }
.note-prose li { margin: .2rem 0; }
.note-prose li > p { margin: .35rem 0; }
.note-prose a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.note-prose blockquote { border-left: 3px solid var(--accent); padding: .1rem 0 .1rem 1.25rem; color: var(--text-meta); }
.note-prose img, .note-prose video { max-width: 100%; height: auto; display: block; margin: 1rem auto; border-radius: 4px; }
.note-prose pre { background: var(--neutral-100); padding: .85rem 1rem; border: 1px solid var(--card-border); border-radius: 4px; overflow-x: auto; line-height: 1.65; }
.note-prose code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
.note-prose :not(pre) > code { background: var(--neutral-100); padding: .15rem .3rem; border-radius: 3px; }
.note-prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .95rem; }
.note-prose th, .note-prose td { padding: .45rem .75rem; border: 1px solid var(--card-border); text-align: left; }
.note-prose th { background: var(--neutral-100); font-weight: 600; }
/* texmath forces 1em with !important; restore legible math sizes here. */
.note-prose .katex { font-size: 1.12em !important; }
.note-prose eqn { display: block; min-width: 0; max-width: 100%; margin: .85rem 0; }
.note-prose .katex-display { margin: 0; padding: .35rem 0; overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.note-prose .katex-display > .katex { font-size: 1.25em !important; width: max-content; min-width: 100%; }
.note-prose section.eqno { gap: .75rem; }
.note-prose section.eqno > eqn { flex: 1; width: auto; margin-left: 0; }
.note-prose section.eqno > span { flex: 0 0 auto; width: auto; color: var(--text-meta); font-size: .9em; }
/* Highlight.js emits types and function calls separately from keywords in C++. */
.note-prose {
  --syntax-keyword: #8736a5;
  --syntax-type: #096b72;
  --syntax-function: #1756a9;
  --syntax-string: #23713b;
  --syntax-number: #a34c0a;
  --syntax-comment: #596779;
  --syntax-meta: #974047;
}
.dark .note-prose {
  --syntax-keyword: #d5a6ff;
  --syntax-type: #70d5d1;
  --syntax-function: #8bbdff;
  --syntax-string: #9bd68b;
  --syntax-number: #ffc184;
  --syntax-comment: #a3b1c2;
  --syntax-meta: #f0a6af;
}
.note-prose pre code { color: var(--text-body); tab-size: 4; }
.note-prose .hljs-keyword, .note-prose .hljs-selector-tag { color: var(--syntax-keyword); }
.note-prose .hljs-type, .note-prose .hljs-title.class_ { color: var(--syntax-type); }
.note-prose .hljs-title, .note-prose .hljs-built_in { color: var(--syntax-function); }
.note-prose .hljs-string, .note-prose .hljs-char.escape_ { color: var(--syntax-string); }
.note-prose .hljs-number, .note-prose .hljs-literal { color: var(--syntax-number); }
.note-prose .hljs-comment { color: var(--syntax-comment); font-style: italic; }
.note-prose .hljs-meta { color: var(--syntax-meta); }
.note-end { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--card-border); color: var(--text-meta); font-size: .85rem; }
@media(max-width: 1023px) {
  .notes-shell { padding-top: 6rem; }
  .note-layout { display: flex; flex-direction: column; gap: 1.25rem; }
  .note-article { width: 100%; }
  .note-outline { order: -1; position: static; width: 100%; max-height: 18rem; }
}
@media(max-width: 639px) {
  .notes-shell { padding: 5.5rem 1.25rem 2.5rem; }
  .notes-heading h1 { font-size: 2.15rem; }
  .note-heading h1 { font-size: 2rem; }
  .notes-controls { grid-template-columns: minmax(0,1fr); gap: 1rem; }
  .notes-entry { grid-template-columns: minmax(0,1fr); gap: .35rem; }
  .notes-entry-meta { flex-direction: row; }
  .note-prose { font-size: 1rem; }
}
