:root {
  color-scheme: light;
  --reader-font: 1.125rem;
  --reader-width: 75ch;
  --reader-ff: Georgia, 'Times New Roman', serif;
  --page-bg: #f7fafc;
  --surface: #ffffff;
  --text: #17243a;
  --muted: #53647a;
  --line: #d9e3ed;
  --accent: #075f93;
  --accent-soft: #e8f4fc;
  --header-bg: rgba(255, 255, 255, .96);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
:root.dark {
  color-scheme: dark;
  --page-bg: #0c1424;
  --surface: #111e32;
  --text: #e3eaf4;
  --muted: #a8b8cf;
  --line: #2c3b50;
  --accent: #7dcefc;
  --accent-soft: #17334a;
  --header-bg: rgba(12, 20, 36, .96);
}
@media (prefers-color-scheme: dark) {
  :root:not(.light):not(.dark) {
    color-scheme: dark;
    --page-bg: #0c1424;
    --surface: #111e32;
    --text: #e3eaf4;
    --muted: #a8b8cf;
    --line: #2c3b50;
    --accent: #7dcefc;
    --accent-soft: #17334a;
    --header-bg: rgba(12, 20, 36, .96);
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 6rem; }
body { margin: 0; background: var(--page-bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .13em; }
.source-note-meta { display: block; margin: .4em 0; font: 600 .75rem/1.5 system-ui, sans-serif; color: var(--muted); }
.source-note-link { overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: .75rem; left: 1rem; transform: translateY(-180%); z-index: 100; padding: .65rem 1rem; background: var(--surface); border: 2px solid var(--accent); border-radius: .5rem; }
.skip-link:focus { transform: none; }
#siteHeader { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; min-height: 4.25rem; padding: .75rem max(1rem, calc((100vw - 1440px) / 2)); border-bottom: 1px solid var(--line); background: var(--header-bg); }
.site-brand { display: inline-flex; gap: .55rem; align-items: center; font-weight: 700; text-decoration: none; color: var(--text); }
.site-brand svg { flex-shrink: 0; color: var(--accent); }
.header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.header-actions > a, .header-actions > button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .4rem .7rem; border-radius: .45rem; font-size: .875rem; text-decoration: none; }
.header-actions > a:hover { background: var(--accent-soft); }
main { max-width: 1440px; margin: 0 auto; padding: 2.75rem 2rem 4rem; }
.reader-intro { padding: 0 0 2rem; max-width: 58rem; }
.eyebrow { color: var(--accent); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .11em; margin: 0 0 .5rem; }
.reader-label { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.2; letter-spacing: -.025em; margin: 0 0 .8rem; }
.edition-note { font-size: .95rem; max-width: 72ch; color: var(--muted); margin: 0; }
.edition-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: 1rem; font-size: .875rem; }
body[data-document-id="thesis"] [data-edition="thesis"],
body[data-document-id="outline"] [data-edition="outline"],
body[data-document-id="summary"] [data-edition="summary"] { font-weight: 700; text-decoration-thickness: 2px; }
.reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 2.25rem; align-items: start; }
.contents-rail { grid-column: 2; grid-row: 1; position: sticky; top: 6rem; min-width: 0; }
#tocPanel { border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; background: var(--surface); }
#tocPanel > summary { padding: .75rem 1rem; cursor: pointer; font-weight: 700; font-size: .9rem; }
#toc { max-height: calc(100dvh - 11rem); overflow-y: auto; overscroll-behavior: contain; padding: .2rem .75rem .75rem; font-size: .82rem; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: .15rem 0; }
.toc-list a { display: block; border-radius: .3rem; padding: .3rem .45rem; color: var(--muted); text-decoration: none; line-height: 1.45; overflow-wrap: anywhere; }
.toc-list a:hover, .toc-list a[aria-current="true"], .toc-list a[aria-current="location"] { color: var(--accent); background: var(--accent-soft); }
.toc-level-1 > a, .toc-level-2 > a { font-weight: 600; }
.toc-level-3 > a { padding-left: 1.15rem; }
.toc-level-4 > a, .toc-level-5 > a, .toc-level-6 > a { padding-left: 1.65rem; }
.toc-questions { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.toc-questions > summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .3rem .45rem; }
#reader { grid-column: 1; grid-row: 1; width: 100%; max-width: var(--reader-width); min-width: 0; margin: 0 auto; padding: 2.4rem clamp(1.25rem, 3vw, 3rem); background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; font-family: var(--reader-ff); font-size: var(--reader-font); line-height: 1.85; overflow-wrap: break-word; }
#reader:focus { outline: none; }
#reader h1, #reader h2, #reader h3, #reader h4, #reader h5, #reader h6 { line-height: 1.35; color: var(--text); scroll-margin-top: 6rem; text-wrap: pretty; }
#reader h1 { font-size: 2em; margin: 2em 0 .65em; letter-spacing: -.02em; }
#reader > h1:first-child { margin-top: 0; }
#reader h2 { font-size: 1.5em; margin: 2.25em 0 .75em; padding-bottom: .4em; border-bottom: 1px solid var(--line); }
#reader h3 { font-size: 1.22em; margin: 1.9em 0 .6em; }
#reader h4, #reader h5, #reader h6 { font-size: 1.05em; margin: 1.7em 0 .55em; }
#reader p { margin: 0 0 1.15em; }
#reader ul, #reader ol { padding-left: 1.5em; }
#reader li { padding-left: .1em; margin: .35em 0; }
#reader blockquote { margin: 1.5em 0; padding: .15em 0 .15em 1.2em; color: var(--muted); border-left: 3px solid var(--accent); }
#reader blockquote p:last-child { margin-bottom: 0; }
#reader pre { overflow: auto; padding: 1rem; background: var(--page-bg); border: 1px solid var(--line); border-radius: .4rem; font-size: .85em; }
#reader code { font-size: .85em; overflow-wrap: anywhere; }
#reader table { display: block; overflow-x: auto; border-collapse: collapse; max-width: 100%; font-size: .9em; }
#reader th, #reader td { border: 1px solid var(--line); padding: .5em .7em; }
#reader img { max-width: 100%; height: auto; }
#reader hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.outline-map-link { display: block; width: fit-content; min-height: 1.5rem; margin: -.65rem 0 1.25rem; font: 600 .8rem/1.5 system-ui, sans-serif; }
#reader [id] { scroll-margin-top: 6rem; }
#reader :target { background-color: var(--accent-soft); box-shadow: 0 0 0 .3rem var(--accent-soft); border-radius: .1rem; }
.footnote-ref { font-size: .72em; line-height: 0; vertical-align: super; }
.footnote-ref a { text-decoration: none; padding: .15em; }
.footnotes { font-size: .9em; }
.footnote-backref { text-decoration: none; white-space: nowrap; padding: .1rem .3rem; }
.unlinked-notes { border-top: 1px solid var(--line); margin-top: 3rem; }
.unlinked-notes > p { color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: .85em; }
.unlinked-notes dt { font-weight: 700; margin: 1.2em 0 .3em; }
.unlinked-notes dd { margin: 0; }
.reader-footer { margin: 0 auto; max-width: 1440px; padding: 1.5rem 2rem 2rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .875rem; }
.reader-footer p { margin: .4rem 0; }
@media (min-width: 1700px) { main { max-width: 1600px; } }
@media (max-width: 1050px) {
  main { padding: 2rem 1.1rem 3rem; }
  .reading-layout { display: flex; flex-direction: column; gap: 1.25rem; }
  .contents-rail { position: static; width: 100%; max-width: var(--reader-width); margin: 0 auto; }
  #toc { max-height: min(45dvh, 23rem); }
  #reader { padding: 1.7rem clamp(1rem, 4vw, 2rem); }
}
@media (max-width: 560px) {
  #siteHeader { align-items: flex-start; padding: .6rem .85rem; gap: .5rem; }
  .site-brand { font-size: .9rem; min-height: 2.5rem; }
  .site-brand svg { width: 20px; }
  .header-actions { gap: .2rem; }
  .header-actions > a, .header-actions > button { padding: .35rem .5rem; font-size: .8rem; }
  main { padding: 1.6rem .65rem 2rem; }
  .reader-intro { padding: 0 .35rem 1.5rem; }
  #reader { border-radius: .45rem; line-height: 1.8; }
  #reader h1 { font-size: 1.7em; }
  .reader-footer { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  :root { color-scheme: light; --text: #000; --muted: #333; --line: #bbb; --surface: #fff; --page-bg: #fff; --accent: #000; }
  #siteHeader, .contents-rail, .edition-links, .skip-link, .reader-footer, .outline-map-link { display: none !important; }
  main { max-width: none; padding: 0; }
  .reader-intro { padding-bottom: 1rem; }
  .reading-layout { display: block; }
  #reader { max-width: none; border: 0; padding: 0; font-size: 11pt; line-height: 1.5; }
  #reader h1, #reader h2, #reader h3 { break-after: avoid; }
  #reader :target { background: none; box-shadow: none; }
  a { text-decoration: none; }
}

#reader .related-reading {
  padding-inline-start: .8rem;
  border-inline-start: 2px solid var(--line);
  font: .875rem/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--muted);
}
.related-reading span { display: block; font-weight: 600; }
