@import url("../vendor/papercss/1.9.2/paper.min.css");

:root {
  color-scheme: light;
  --grid-size: 32px;
  --baseline-offset: 31px;
  --grid-line: rgba(43, 58, 85, 0.12);
  --paper-bg: #fdfaf0;
  --ink-navy: #2b3a55;
  --ink-black: #1e293b;
  --ink-blue: #2563eb;
  --ink-red: #dc2626;
  --ink-green: #059669;
  --hl-yellow: #fef08a;
  --hl-pink: #fecdd3;
  --hl-blue: #bfdbfe;
  --hl-green: #a7f3d0;
  --sidebar-width: 16.5rem;
  --header-height: 4.25rem;
  --font-reading: "Comic Neue", cursive, sans-serif;
  --font-hand: "Patrick Hand", cursive;
  --font-mono: "Space Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
body { min-height: 100vh; background: var(--paper-bg); color: var(--ink-black); font-family: var(--font-reading); font-size: 18px; line-height: var(--grid-size); }
[hidden] { display: none !important; }
a { color: var(--ink-blue); text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink-red); outline-offset: 3px; }
::selection { background: var(--hl-yellow); color: var(--ink-black); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 12px; background: var(--paper-bg); border: 1px solid var(--ink-navy); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: sticky; top: 0; z-index: 35; width: 100%; height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1rem; background: var(--paper-bg); border-bottom: 1px solid var(--ink-navy); font-family: var(--font-mono); font-size: .78rem; }
.site-brand { color: var(--ink-navy); font-weight: 700; text-decoration: none; }
.header-navigation { display: flex; align-items: center; gap: 1rem; }
.home-link { color: var(--ink-navy); text-decoration: none; }
.navigation-toggle, .drawer-close { display: none; border: 1px solid var(--ink-navy); border-radius: 4px; padding: 4px 10px; color: var(--ink-navy); background: transparent; }
.site-layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0,1fr); align-items: start; min-height: calc(100vh - var(--header-height)); }
/* Prevent intrinsic content widths from expanding the page beyond the viewport. */
.site-layout,
.reading-area,
.article-body {
  min-width: 0;
  max-width: 100%;
}
.reading-area {
  width: 100%;
}
.article-body > * {
  max-width: 100%;
}
.article-body img,
.article-body video,
.article-body iframe,
.article-body svg {
  max-width: 100%;
}
.article-body pre {
  max-width: 100%;
  overflow-x: auto;
}
.article-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); height: calc(100dvh - var(--header-height)); padding: 1.2rem 1rem; overflow-y: auto; background: #f7f2e3; border-right: 1px solid var(--ink-navy); font-family: var(--font-mono); font-size: .73rem; line-height: 1.6; }
.sidebar-heading h2 { color: var(--ink-navy); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-description { margin: .5rem 0 1.25rem; color: #586477; font-size: .68rem; }
.phase-section { margin: .35rem 0; }
.sidebar summary { display: flex; align-items: center; min-height: 36px; padding: .25rem 0; color: var(--ink-navy); font-weight: 700; cursor: pointer; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::after { content: "+"; margin-left: auto; font-size: 1rem; }
.sidebar details[open] > summary::after { content: "−"; }
.subject-section { margin-left: .55rem; padding-left: .65rem; border-left: 1px solid rgba(43,58,85,.25); }
.subject-section > summary { font-weight: 400; }
.lecture-list { list-style: none; margin: .25rem 0 .5rem; }
.lecture-link { display: block; padding: .45rem .55rem; margin: .2rem 0; color: var(--ink-blue); border-left: 2px solid transparent; text-decoration: none; line-height: 1.45; }
.lecture-link small { display: block; margin-top: .15rem; font-size: .62rem; }
.lecture-link[aria-current="page"] { color: var(--ink-black); background: rgba(254,240,138,.35); border-left-color: var(--ink-red); font-weight: 700; }
.lecture-link:hover { background: rgba(191,219,254,.35); }
.reading-area { min-width: 0; padding: .75rem clamp(.9rem,1.8vw,1.5rem) 2.5rem; }
.reading-column { width: 100%; max-width: none; margin: 0; }
.breadcrumbs { margin: 0 0 .25rem; color: var(--ink-navy); font-family: var(--font-mono); font-size: .63rem; line-height: 1.5; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; }
.breadcrumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--ink-red); }
.breadcrumbs a { color: var(--ink-blue); }
.lecture-header { padding: .35rem 0 .45rem; margin-bottom: .1rem; border-bottom: 1px solid var(--ink-navy); }
.eyebrow { margin: 0; color: var(--ink-red); font-family: var(--font-mono); font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lecture-header h1 { margin: .1rem 0 .2rem; color: var(--ink-black); font-family: var(--font-hand); font-size: clamp(2.25rem,4vw,3.3rem); font-weight: 700; line-height: 1.1; text-align: center; letter-spacing: 0; overflow-wrap: anywhere; }
.lecture-description { margin: 0; color: var(--ink-blue); font-family: var(--font-hand); font-size: 1.2rem; text-align: center; }
.article-body { padding: .55rem 1rem 1.5rem; background-image: linear-gradient(var(--grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--grid-line) 1px,transparent 1px); background-size: var(--grid-size) var(--grid-size); background-position: 0 var(--baseline-offset); color: var(--ink-black); font-family: var(--font-reading); font-size: 18px; line-height: var(--grid-size); overflow-wrap: anywhere; }
.article-body h1,.article-body h2,.article-body h3,.article-body h4,.article-body p,.article-body ul,.article-body ol,.article-body li { margin: 0; padding: 0; }
.article-body h1,.article-body h2,.article-body h3,.article-body h4 { font-family: var(--font-hand); font-weight: 700; }
.article-body h1 { margin: 0 0 var(--grid-size); font-size: 34px; line-height: calc(var(--grid-size)*2); text-align: center; }
.article-body h2 { margin: var(--grid-size) 0; color: var(--ink-blue); font-size: 28px; line-height: var(--grid-size); }
.article-body h3 { margin: var(--grid-size) 0; color: var(--ink-navy); font-size: 24px; line-height: var(--grid-size); }
.article-body h4 { margin: var(--grid-size) 0 0; color: var(--ink-red); font-size: 21px; line-height: var(--grid-size); }
.article-body p { margin: 0 0 var(--grid-size); text-align: justify; text-align-last: left; text-justify: inter-word; hyphens: auto; }
.article-body ul,.article-body ol { margin: 0 0 var(--grid-size); padding-left: 32px; list-style: none; }
.article-body li { position: relative; margin: 0; }
.article-body ul li::before { content: "•"; position: absolute; left: -20px; color: var(--ink-blue); font-weight: 700; }
.article-body ol { counter-reset: note-counter; }
.article-body ol li::before { counter-increment: note-counter; content: counter(note-counter) "."; position: absolute; left: -24px; color: var(--ink-red); font-family: var(--font-hand); font-weight: 700; }
.article-body strong,.article-body b { font-weight: 700; }
.article-body .hl-yellow,.article-body .hl-pink,.article-body .hl-blue,.article-body .hl-green,.lecture-header .hl-yellow { border-radius: 2px; }
.article-body .hl-yellow,.lecture-header .hl-yellow { background: var(--hl-yellow); }
.article-body .hl-pink { background: var(--hl-pink); }
.article-body .hl-blue { background: var(--hl-blue); }
.article-body .hl-green { background: var(--hl-green); }
.article-body .text-blue { color: var(--ink-blue); }
.article-body .text-red { color: var(--ink-red); }
.article-body .text-green { color: var(--ink-green); }
.article-body .bold { font-weight: 700; }
.article-body .arrow { color: var(--ink-red); font-family: var(--font-hand); font-weight: 700; margin-right: 8px; }
.article-body .annotation { display: block; margin-bottom: var(--grid-size); color: var(--ink-red); font-family: var(--font-hand); text-align: center; }
.article-body .handwritten-highlight { color: var(--ink-blue); font-family: var(--font-hand); font-size: 24px; font-weight: 700; }
.article-body blockquote { margin: 0 0 var(--grid-size); padding-left: 18px; color: var(--ink-blue); border-left: 3px solid var(--ink-red); font-style: normal; }
.article-body pre { max-width: 100%; margin: 0 0 var(--grid-size); padding: .7rem 1rem; overflow-x: auto; background: rgba(255,255,255,.72); border: 1px solid var(--ink-navy); font-family: var(--font-mono); font-size: .75rem; line-height: 1.5; }
.article-body code { font-family: var(--font-mono); font-size: .8em; background: rgba(191,219,254,.35); }
.article-body figure { margin: var(--grid-size) 0; }
.article-body img,.article-body svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.article-body figcaption { margin: 0 0 var(--grid-size); color: var(--ink-red); font-family: var(--font-hand); font-size: .95rem; text-align: center; }
.article-body table { width: 100%; margin: 0 0 var(--grid-size); border-collapse: collapse; background: rgba(255,255,255,.75); font-family: var(--font-reading); font-size: .9rem; line-height: 1.5; }
.article-body th,.article-body td { padding: .4rem .55rem; border: 1px solid rgba(43,58,85,.55); vertical-align: top; }
.article-body th { color: var(--ink-navy); font-weight: 700; }
.article-body .table-scroll,.article-body .math-block { max-width: 100%; margin: 0 0 var(--grid-size); overflow-x: auto; background: rgba(255,255,255,.7); }
.article-body .math-block { padding: .35rem .5rem; text-align: center; }
.article-body .math-block > mjx-container[display="true"] { width: max-content; min-width: 100%; max-width: none; overflow: visible; }
.article-body .callout { margin: 0 0 var(--grid-size); padding: .55rem .75rem; }
.article-body .callout-warning { border-color: var(--ink-red); }
.article-body .callout-important { border-color: var(--ink-green); }
.article-body .callout-title { margin-bottom: .25rem; color: var(--ink-red); font-family: var(--font-hand); font-size: 1.15rem; }
.article-body .diagram-scroll { max-width: 100%; overflow-x: auto; padding: .4rem; border: 1px dashed var(--ink-navy); background: rgba(255,255,255,.7); }
.lecture-navigation { display: flex; justify-content: space-between; gap: 1rem; margin-top: .75rem; padding-top: .5rem; border-top: 1px solid var(--ink-navy); font-family: var(--font-mono); font-size: .68rem; }
.lecture-navigation small { display: block; color: var(--ink-red); }
.lecture-navigation a { color: var(--ink-blue); text-decoration: none; }
.lecture-navigation [aria-disabled="true"] { color: #657085; }
.page-footer { display: none; }
@media (max-width: 70rem) {
  .site-header { padding-inline: .75rem; }
  .site-layout { display: block; }
  .js .navigation-toggle,.js .drawer-close { display: inline-flex; align-items: center; justify-content: center; }
  .js .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(21rem,calc(100vw - 2rem)); height: 100dvh; visibility: hidden; transform: translateX(-100%); border-right: 1px solid var(--ink-navy); }
  .js .navigation-open .sidebar { visibility: visible; transform: translateX(0); }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 30; padding: 0; background: rgba(30,41,59,.35); border: 0; }
  body.navigation-open { overflow: hidden; }
  .reading-area { padding: .65rem .65rem 1.75rem; }
  .article-body { padding-inline: .65rem; }
}
@media (max-width: 70rem) {
  /* Keep the contents drawer control visible in the compact header. */
  .site-header .header-navigation .navigation-toggle {
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    visibility: visible;
    opacity: 1;
    position: relative;
    z-index: 2;
    min-height: 2rem;
    margin: 0;
    padding: .35rem .6rem;
    border: 1px solid var(--ink-navy);
    border-radius: 4px;
    background: var(--paper-bg);
    color: var(--ink-navy);
    font: 600 .78rem/1.2 var(--font-mono);
    white-space: nowrap;
  }
}
@media (max-width: 37.5rem) {
  body { font-size: 16px; }
  .site-brand { max-width: 14rem; font-size: .68rem; }
  .header-navigation { gap: .5rem; }
  .reading-area { padding-inline: .3rem; }
  .article-body { padding-inline: .45rem; font-size: 16px; line-height: 28px; }
  /* Narrow screens: preserve comfortable reading without stretched word gaps
     or aggressive automatic hyphenation from desktop justified paragraphs. */
  .article-body p {
    text-align: left;
    text-align-last: left;
    text-justify: auto;
    hyphens: none;
    word-break: normal;
    overflow-wrap: break-word;
  }
  .site-header { height: auto; min-height: var(--header-height); }
  .site-header .site-brand {
    max-width: calc(100vw - 9rem);
    font-size: .82rem;
  }
  .breadcrumbs { font-size: .65rem; line-height: 1.5; }
  .article-body h1 { font-size: 28px; line-height: 28px; }
  .article-body h2 { font-size: 23px; line-height: 28px; }
  .article-body h3 { font-size: 20px; line-height: 28px; }
  .lecture-header h1 { font-size: 2rem; }
  .breadcrumbs { font-size: .56rem; }
  .article-body table { font-size: .72rem; }
}
@media print {
  .site-header,.sidebar,.drawer-backdrop,.skip-link,.lecture-navigation { display: none !important; }
  body { background: white; color: black; }
  .site-layout { display: block; }
  .reading-area { padding: 0; }
  .article-body { background: none; }
}




/* PaperCSS 1.9.2 is used as a real component layer; this stylesheet owns the
   site shell, layout, typography and accessible navigation. */
html { font-size: 16px; }
.sidebar nav {
  display: block;
  position: static;
  z-index: auto;
  width: auto;
  padding: 0;
  background: transparent;
}
.breadcrumbs,
.header-navigation,
.lecture-navigation {
  background: transparent;
  padding: 0;
  position: static;
  z-index: auto;
}
.sidebar nav a,
.breadcrumbs a,
.header-navigation a,
.lecture-navigation a {
  border: 0;
  padding-bottom: 0;
  background-image: none;
}
.article-body .callout.alert {
  width: 100%;
  border-width: 2px;
  box-shadow: none;
}
.article-body .callout.alert-secondary {
  color: var(--ink-navy);
  background: rgba(191,219,254,.24);
  border-color: var(--ink-blue);
}
.article-body .callout.alert-warning,
.article-body .callout.alert-danger {
  color: var(--ink-black);
  background: rgba(254,205,211,.22);
  border-color: var(--ink-red);
}
.article-body .callout.alert-success {
  color: var(--ink-black);
  background: rgba(167,243,208,.24);
  border-color: var(--ink-green);
}
.article-body .callout-title {
  color: var(--ink-navy);
  font-family: var(--font-hand);
  font-size: 1.15rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-hand);
  font-size: 1.2rem;
}
.site-brand .brand-icon {
  display: inline-block;
  filter: invert(28%) sepia(92%) saturate(2350%) hue-rotate(214deg) brightness(98%) contrast(99%);
  width: 2rem;
  height: 2rem;
  margin: 0;
  border: 0;
  border-radius: 0;
  vertical-align: middle;
}
.sidebar summary {
  gap: .4rem;
}
.sidebar summary .nav-icon {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.sidebar .subject-section summary .nav-icon { filter: invert(28%) sepia(92%) saturate(2350%) hue-rotate(214deg) brightness(98%) contrast(99%); }
.sidebar .lecture-list li { text-indent: 0; }
.sidebar .lecture-list li::before { content: none; }
.sidebar summary .navigation-index {
  display: inline-block;
  margin-right: .1rem;
}
html.rough-notation-ready .lecture-header h1 .hl-yellow,
html.rough-notation-ready .article-body h2 > .hl-blue,
html.rough-notation-ready .article-body h2 > .hl-pink,
html.rough-notation-ready .article-body h2 > .hl-yellow,
html.rough-notation-ready .article-body h2 > .hl-green {
  background: transparent !important;
  border-radius: 0;
  padding-inline: 0;
  box-decoration-break: initial;
  -webkit-box-decoration-break: initial;
}
.rough-annotation {
  pointer-events: none !important;
}
@media (max-width: 37.5rem) {
  .site-brand { font-size: .95rem; }
  .site-brand .brand-icon { width: 1.65rem; height: 1.65rem; }
}


/* Header integration: neutralize PaperCSS's global anchor/nav treatments and
   keep the notebook mark and name on one stable line at every viewport. */
.site-header {
  min-width: 0;
  flex-wrap: nowrap;
}
.site-header .site-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .55rem;
  max-width: none;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
  background-image: none;
  border: 0;
  border-bottom: 0;
  padding: 0;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  line-height: 1.1;
}
.site-header .site-brand .brand-icon {
  display: block;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  max-width: none;
  object-fit: contain;
}
/* Keep the header navigation visible above PaperCSS responsive nav defaults. */
.site-header > .header-navigation {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  width: auto;
  min-width: max-content;
  margin-left: auto;
  visibility: visible !important;
  opacity: 1 !important;
}
.site-header > .header-navigation .home-link {
  display: inline-block !important;
  visibility: visible !important;
  color: var(--ink-navy);
}
.site-header > .header-navigation .navigation-toggle {
  display: none !important;
}
@media (max-width: 70rem) {
  .site-header > .header-navigation .navigation-toggle {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
.site-header .header-navigation {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  margin-right: 0;
  padding: 0;
  background: transparent;
}
.site-header .header-navigation a,
.site-header .header-navigation a:visited {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 0;
  background: none;
  color: var(--ink-navy);
  font-family: var(--font-hand);
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
}
@media (max-width: 37.5rem) {
  .site-header .site-brand {
    font-size: .95rem;
  }
  .site-header .site-brand .brand-icon {
    flex-basis: 1.65rem;
    width: 1.65rem;
    height: 1.65rem;
  }
}
