/* Notes share an editorial palette; diagram colours remain topic-specific.
   Load last, and opt in with notes-editorial so the rest of the site is unchanged. */
html:has(body.notes-editorial) { background: #fff; color-scheme: light; }
html:has(body.notes-editorial), body.notes-editorial { scrollbar-color: #b5b5b0 #fff; }
html:has(body.notes-editorial) ::-webkit-scrollbar-track { background: #fff; }
html:has(body.notes-editorial) ::-webkit-scrollbar-thumb { background: #b5b5b0; }

body.notes-editorial,
body.notes-editorial.note-page {
  --editorial-serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --editorial-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --site-font-stack: var(--editorial-mono);
  --note-page: #fff;
  --note-surface: #fff;
  --note-surface-muted: #f6f6f4;
  --note-text: #171717;
  --note-body: #343434;
  --note-muted: #656565;
  --note-soft: #6e6e6e;
  --note-border: #dededb;
  --note-border-strong: #222;
  --note-accent: #b82020;
  --note-accent-strong: #8e1414;
  --site-bg: var(--note-page);
  --site-bg-soft: var(--note-surface-muted);
  --site-surface: var(--note-surface);
  --site-surface-strong: var(--note-surface-muted);
  --site-surface-alt: #f0f0ee;
  --site-text: var(--note-text);
  --site-text-muted: var(--note-muted);
  --site-text-soft: var(--note-soft);
  --site-border: var(--note-border);
  --site-border-strong: var(--note-border-strong);
  --site-accent: var(--note-accent);
  --site-accent-strong: var(--note-accent-strong);
  --site-accent-soft: #b820200a;
  --site-accent-soft-strong: #b8202014;
  --site-shadow: none;
  --site-shadow-soft: none;
  --theme: var(--note-page);
  --entry: var(--note-surface);
  --primary: var(--note-text);
  --secondary: var(--note-muted);
  --tertiary: var(--note-surface-muted);
  --content: var(--note-body);
  --border: var(--note-border);
  --code-bg: var(--note-surface-muted);
  --hljs-bg: var(--note-surface-muted);
  --shell-canvas: #fff;
  --shell-paper: #fff;
  --shell-paper-deep: #f6f6f4;
  --shell-ink: #171717;
  --shell-muted: #656565;
  --shell-rule: #222;
  --shell-rule-soft: #dededb;
  --shell-accent: #b82020;
  --shell-shadow: none;
  color: var(--note-text);
  font-family: var(--editorial-mono);
  font-size: 15px;
  line-height: 1.75;
}

html body.notes-editorial { background: #fff !important; background-image: none !important; }
html body.notes-editorial::before { background: none !important; }
body.notes-editorial ::selection { background: #f4dada; color: #171717; }
body.notes-editorial :focus-visible { outline: 2px solid #b82020; outline-offset: 4px; }

/* A small masthead and a single rule replace the boxed site chrome. */
body.notes-editorial > .header {
  background: #fffffff5 !important;
  border-bottom: 1px solid #222 !important;
  backdrop-filter: none;
}
body.notes-editorial > .header .nav { max-width: 1184px; }
body.notes-editorial > .header .logo a {
  background: transparent !important;
  border: 0 !important;
  padding: 0.6rem 0;
  font: 700 22px/1.1 var(--editorial-serif);
  text-transform: none;
}
body.notes-editorial > .header :is(.menu, #menu) a {
  font: 11px/1.5 var(--editorial-mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
body.notes-editorial > .header :is(.menu, #menu) a::before { content: none; }
body.notes-editorial > .header :is(.menu, #menu) .active { color: #b82020 !important; }
body.notes-editorial > .footer { border-top-width: 1px !important; }

/* Plain articles and notebook containers. Width stays generous for figures. */
body.notes-editorial .main {
  box-sizing: border-box;
  width: calc(100% - 48px) !important;
  max-width: 820px !important;
  margin: 3rem auto !important;
  padding: 0 !important;
}
body.notes-editorial .post-single {
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}
body.notes-editorial .post-single::after { content: none; }
body.notes-editorial .post-header {
  border-bottom: 2px solid #222;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
}
body.notes-editorial :is(.post-title, .post-content h1, .post-content h2, .post-content h3, .post-content h4) {
  font-family: var(--editorial-serif);
  font-weight: 700;
  color: var(--note-text);
  letter-spacing: -0.025em;
  text-transform: none;
}
body.notes-editorial .post-title {
  font-size: clamp(2.35rem, 5vw, 3.8rem);
  line-height: 1.08;
  margin: 1rem 0 1.25rem;
  text-wrap: balance;
}
body.notes-editorial :is(.post-content, .post-content p, .post-content li, .post-content dd, .post-content dt) {
  font-size: 15px;
  line-height: 1.85;
}
body.notes-editorial .post-content h1 { font-size: 2.4rem; line-height: 1.15; }
body.notes-editorial .post-content h2 { font-size: 2rem; line-height: 1.2; margin-top: 2.5rem; }
body.notes-editorial .post-content h3 { font-size: 1.5rem; line-height: 1.3; }
body.notes-editorial .post-content h4 { font-size: 1.2rem; line-height: 1.35; }
body.notes-editorial :is(.breadcrumbs, .post-meta) {
  font: 11px/1.7 var(--editorial-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.notes-editorial .breadcrumbs a { font: inherit; }
body.notes-editorial .post-description { font-size: 14px; line-height: 1.7; }
body.notes-editorial .post-content a { text-underline-offset: 0.18em; }
body.notes-editorial .post-content blockquote {
  border: 0;
  border-left: 2px solid #b82020;
  border-radius: 0;
  background: #f6f6f4;
  box-shadow: none;
}
body.notes-editorial :is(.toc, .paginav, .share-buttons, .post-tags a) { border-radius: 0; box-shadow: none; }
body.notes-editorial .toc { border: 0; border-bottom: 1px solid #dededb; padding: 0 0 1.5rem; }
body.notes-editorial .toc a { color: #343434; font-size: 12px; }
body.notes-editorial .toc a:hover { color: #b82020; }
body.notes-editorial .post-content table:not(.highlighttable) thead { background: #eee; }

/* Interactive notebooks: serif hierarchy, mono marginalia, neutral paper.
   No SVG text or math-font overrides: plots retain their own readable labels. */
body.notes-editorial.note-page.tda-notes-page .main { max-width: 1120px !important; }
body.notes-editorial.note-page.tda-notes-page .post-single { border: 0 !important; padding: 0 !important; }
body.notes-editorial.note-page.tda-notes-page .post-header { border: 0; padding: 0; margin-bottom: 1.5rem; }
body.notes-editorial.note-page.tda-notes-page .tda-display {
  font-family: var(--editorial-serif);
  font-size: clamp(2.65rem, 5vw, 4rem) !important;
  font-weight: 700;
  line-height: 1.08 !important;
  letter-spacing: -0.03em;
  text-transform: none;
}
body.notes-editorial.note-page.tda-notes-page .tda-hero {
  border-bottom: 2px solid #222 !important;
  padding-bottom: 2rem !important;
}
body.notes-editorial.note-page.tda-notes-page :is(.post-content, .post-content p, .post-content li, .post-content dd, .post-content dt) {
  font-size: 15px;
  line-height: 1.8;
}
body.notes-editorial.note-page.tda-notes-page .tda-section h2 {
  font: 700 clamp(1.8rem, 3vw, 2.35rem)/1.15 var(--editorial-serif);
  color: var(--note-text);
  margin: 0;
  letter-spacing: -0.025em;
}
body.notes-editorial.note-page.tda-notes-page .tda-section :is(h3, h4) {
  font: 700 1.45rem/1.25 var(--editorial-serif);
  color: var(--note-text);
  letter-spacing: -0.015em;
}
body.notes-editorial.note-page.tda-notes-page :is(.tda-callout-title, .ts-why-item strong, .ts-reference-card strong) {
  font: 700 1.25rem/1.3 var(--editorial-serif);
}
body.notes-editorial.note-page.tda-notes-page :is(.tda-kicker, .tda-sidebar-label, .tda-lecture-meta, .ts-strip-label) {
  color: #b82020 !important;
  font: 11px/1.6 var(--editorial-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body.notes-editorial.note-page.tda-notes-page :is(.tda-hero-meta, .tda-hero-note, .ts-hero-diagram figcaption, .ts-why-item p, .tda-figure figcaption, .tda-widget-summary, .tda-widget-caption, .ts-widget-note) {
  font-size: 12px;
  line-height: 1.7;
}
body.notes-editorial.note-page.tda-notes-page .tda-toc-card {
  border: 0 !important;
  border-right: 1px solid #dededb !important;
  padding: 0 1.25rem 0 0;
}
body.notes-editorial.note-page.tda-notes-page .tda-toc-card h2 {
  font: 700 1.5rem/1.2 var(--editorial-serif);
  margin: 0.35rem 0 1rem;
}
body.notes-editorial.note-page.tda-notes-page .tda-toc-link { font-size: 11px; line-height: 1.6; }
body.notes-editorial.note-page.tda-notes-page .tda-progress { background: #fffffff5 !important; }
body.notes-editorial.note-page.tda-notes-page .tda-callout { border-left: 2px solid #dededb !important; }
body.notes-editorial.note-page.tda-notes-page :is(.tda-widget-button, .tda-button, .tda-mini-button) {
  border-radius: 0;
  font-family: var(--editorial-mono);
}
body.notes-editorial.note-page.tda-notes-page :is(.tda-widget-button.is-active, .tda-widget-button:hover, .tda-button:hover, .tda-mini-button:hover) {
  background: #f9eeee !important;
}
body.notes-editorial.ts-notes-page { --ts-plot-paper: #fff; --ts-grid: #e7e7e3; }

/* Conference notebooks use the same ink and rules without decorative sheets. */
body.notes-editorial.ac-school-page {
  --ac-ink: #171717; --ac-copy: #343434; --ac-paper: #fff;
  --ac-paper-glass: #fff; --ac-rule: #dededb; --ac-red: #b82020; --ac-blue: #b82020;
}
body.notes-editorial.acl26-page {
  --acl-page: #fff; --acl-page-deep: #f6f6f4; --acl-paper: #fff;
  --acl-surface: #f6f6f4; --acl-surface-strong: #eee;
  --acl-ink: #171717; --acl-body: #343434; --acl-muted: #656565;
  --acl-accent: #b82020; --acl-accent-strong: #8e1414;
  --acl-border: #aaa; --acl-border-soft: #dededb;
}
body.notes-editorial.ac-school-page .main { max-width: 1040px !important; }
body.notes-editorial .ac-notes-background { display: none; }
body.notes-editorial .ac-title-mark::after { background: #f4dada; }
body.notes-editorial :is(.ac-overview, .ac-notebook-card, .acl26-hero, .acl26-callout, .acl26-story, .acl26-further, .acl26-thesis) {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
}
body.notes-editorial .acl26-lede { color: #343434 !important; }
body.notes-editorial :is(.ac-section-title, .ac-notebook-card h3, .acl26-display, .acl26-section h2) {
  font-family: var(--editorial-serif);
  color: #171717;
  letter-spacing: -0.025em;
}

/* Reader chrome changes; original handwritten page images stay untouched. */
body.notes-editorial.ws-reader-page {
  --ws-reader-bg: #fff; --ws-reader-paper: #fff; --ws-reader-paper-muted: #f6f6f4;
  --ws-reader-ink: #171717; --ws-reader-copy: #343434; --ws-reader-muted: #656565;
  --ws-reader-rule: #dededb; --ws-reader-rule-soft: #eee;
  --ws-reader-blue: #b82020; --ws-reader-blue-dark: #8e1414; --ws-reader-red: #b82020;
}
body.notes-editorial.ac-reader-page {
  --reader-bg: #fff; --reader-paper: #fff; --reader-ink: #171717;
  --reader-copy: #343434; --reader-rule: #dededb; --reader-rule-soft: #eee;
  --reader-red: #b82020; --reader-blue: #b82020;
}
body.notes-editorial :is(.ws-reader-bar, .ac-reader-bar) {
  background: #fffffff5;
  border-bottom: 1px solid #222;
  box-shadow: none;
  backdrop-filter: none;
}
body.notes-editorial :is(.ws-reader-heading, .ac-reader-heading) h1 { font-family: var(--editorial-serif); }
body.notes-editorial :is(.ws-reader-back, .ws-reader-download, .ac-reader-back, .ac-reader-download) { border-radius: 0; }
body.notes-editorial :is(.ws-reader-summary, .ac-reader-summary) {
  background: #fff;
  border: 0;
  border-top: 2px solid #222;
  border-bottom: 1px solid #dededb;
  box-shadow: none;
}
body.notes-editorial :is(.ws-reader-summary, .ac-reader-summary) h2 { font-family: var(--editorial-serif); font-size: 1.6rem; }
body.notes-editorial :is(.ws-reader-summary, .ac-reader-summary) li { border-left-color: #dededb; }

/* The standalone paper keeps its experiment layout and semantic plot colours. */
body.notes-editorial.notes-standalone {
  --paper: #fff; --ink: #171717; --muted: #656565; --light: #f6f6f4; --line: #dededb;
  --coral: #b82020; --serif: var(--editorial-serif); --sans: var(--editorial-mono); --mono: var(--editorial-mono);
}
body.notes-editorial.notes-standalone :is(h1, h2, h3) { font-family: var(--editorial-serif); font-weight: 700; letter-spacing: -0.03em; }
body.notes-editorial.notes-standalone .site-nav { background: #fffffff5; border-bottom: 1px solid #222; }
body.notes-editorial.notes-standalone .guide-brand { font-family: var(--editorial-serif); font-size: 20px; }
body.notes-editorial.notes-standalone :is(.explorer, .concept-panel) { border-radius: 0; box-shadow: none; }

@media (max-width: 899px) {
  body.notes-editorial .main,
  body.notes-editorial.note-page.tda-notes-page .main { width: calc(100% - 40px) !important; margin: 2rem auto !important; padding: 0 !important; }
  body.notes-editorial.note-page.tda-notes-page .tda-toc-card { border-right: 0 !important; padding: 0; }
}
@media (max-width: 540px) {
  body.notes-editorial > .header .logo a { font-size: 20px; }
  body.notes-editorial :is(.post-content, .post-content p, .post-content li, .post-content dd, .post-content dt),
  body.notes-editorial.note-page.tda-notes-page :is(.post-content, .post-content p, .post-content li, .post-content dd, .post-content dt) { font-size: 14px; }
  body.notes-editorial .post-content h2 { font-size: 1.75rem; }
  body.notes-editorial.note-page.tda-notes-page .tda-display { font-size: 2.65rem !important; }
}
