:root {
  color-scheme: light;
  --paper: #f5f2e8;
  --page: #faf8f0;
  --ink: #253a30;
  --subtle: #545d50;
  --deep: #173b30;
  --rule: #c8c5b4;
  --stamp: #a04d2d;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font: 17px/1.58 system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
img { display: block; width: 100%; height: auto; }
figure, p, h1, h2, h3 { margin: 0; }
a { color: var(--deep); text-decoration-thickness: .07em; text-underline-offset: .19em; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 2px solid #165676; outline-offset: 4px; }
.skip { position: fixed; z-index: 2; top: .75rem; left: .75rem; padding: .55rem .8rem; background: var(--page); transform: translateY(-200%); }
.skip:focus { transform: none; }
.shell { width: min(100% - 5rem, 68rem); margin-inline: auto; }

.site-header { padding-top: .5rem; }
.header-row { min-height: 5rem; border-bottom: 1px solid var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 1.35rem; }
.brand { font: 680 1.48rem/1 var(--serif); color: var(--ink); letter-spacing: -.055em; white-space: nowrap; text-decoration: none; }
.brand-dot { color: var(--stamp); }
.main-nav { display: flex; align-items: baseline; flex-wrap: wrap; gap: clamp(.75rem, 2.7vw, 2.3rem); }
.main-nav a, .header-contact { font-size: .88rem; text-decoration: none; color: var(--ink); }
.main-nav a { padding-block: .35rem; border-bottom: 1px solid transparent; }
.main-nav a:hover, .main-nav a[aria-current] { border-color: var(--stamp); color: var(--stamp); }
.header-contact { text-decoration: underline; text-underline-offset: .24em; }
.edition { margin-bottom: 1rem; color: var(--stamp); font-size: .83rem; font-weight: 650; }
.edition a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -.036em; font-weight: 600; }
h1 { font-size: clamp(2.12rem, 4.55vw, 3.65rem); line-height: 1.08; }
h2 { font-size: clamp(1.55rem, 2.9vw, 2.28rem); line-height: 1.13; }
h3 { font-size: 1.35rem; line-height: 1.2; }
.lead { margin-top: 1.2rem; font-size: clamp(1.05rem, 1.6vw, 1.2rem); max-width: 38rem; color: var(--subtle); }
.link-text { display: inline-block; font-weight: 650; }
.download-row { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: 1.35rem; }
.button { display: inline-flex; align-items: center; min-height: 2.6rem; padding: .5rem .76rem; border: 1px solid #8e9a87; background: var(--page); font-size: .89rem; line-height: 1.34; font-weight: 640; text-decoration: none; }
.button:hover { border-color: var(--stamp); }
.button-primary { background: var(--deep); color: #fff8e8; border-color: var(--deep); }
.button-primary:hover { background: #254b3e; color: #fff8e8; border-color: #254b3e; }

.title-page { display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: clamp(2rem, 6vw, 5rem); padding-block: 2.35rem 2.65rem; }
.cover-text h1 { max-width: 14ch; line-height: 1.04; font-size: clamp(2.4rem, 4.9vw, 3.8rem); }
.cover-text h1 em { font-weight: 500; color: var(--stamp); }
.cover-text .lead { max-width: 29rem; margin-top: 1.45rem; }
.cover-text .link-text { margin-top: 1.05rem; }
.cover-plate { border: 1px solid #738371; padding: .5rem .5rem 0; background: var(--deep); transform: rotate(.7deg); }
.cover-plate img { aspect-ratio: 1.28; object-fit: cover; object-position: 48% center; }
.cover-plate figcaption { color: #ece9d9; font: .94rem/1.45 var(--serif); padding: .7rem .32rem .8rem; }
.feature-spread, .teaching-spread { display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: 2.25rem 4rem; padding-block: 2.45rem; border-top: 1px solid var(--rule); }
.feature-text h2 { max-width: 17ch; }
.feature-text > p:not(.edition), .teaching-links p, .front-index p { margin-top: .68rem; color: var(--subtle); }
.feature-text .link-text { margin-top: .85rem; }
.paper-figure { padding: .42rem .42rem 0; background: var(--page); border: 1px solid var(--rule); }
.paper-figure figcaption { padding: .68rem .45rem .75rem; color: var(--subtle); font: .94rem/1.44 var(--serif); }
.front-index { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 4rem; border-block: 1px solid var(--rule); padding-block: 1.55rem 1.75rem; }
.front-index h2, .teaching-links h2 { font-size: clamp(1.62rem, 2.75vw, 2.25rem); }
.front-index h2 a, .teaching-links h2 a { color: var(--ink); text-decoration-color: #92887a; }
.author-note { margin-block: 2.35rem 3.2rem; border-left: 2px solid var(--stamp); padding-left: 1rem; display: flex; align-items: baseline; gap: .4rem 1.25rem; flex-wrap: wrap; }
.author-note p { color: var(--subtle); }

.article-header { padding-block: 2.65rem 1.55rem; border-bottom: 1px solid var(--rule); }
.article-header h1 { max-width: 18ch; }
.article-header .byline { margin-top: .78rem; font-size: .88rem; color: var(--subtle); }
.article-layout { display: grid; grid-template-columns: 11.5rem minmax(0,43rem); gap: 1.75rem 4.5rem; padding-block: 2rem 3.9rem; }
.article-nav nav { position: sticky; top: 1.25rem; display: grid; gap: .43rem; border-top: 1px solid var(--stamp); padding-block: .6rem; }
.article-nav strong { font-family: var(--serif); }
.article-nav a { color: var(--subtle); font-size: .89rem; }
.prose section + section { margin-top: 2.7rem; }
.prose h2 { font-size: clamp(1.50rem, 2.65vw, 2.05rem); }
.prose p, .prose ol:not(.course-list), .prose ul { margin-block: .7rem 0; }
.prose li + li { margin-top: .34rem; }
.prose .paper-figure { margin-top: 1.15rem; }
.prose details { border-bottom: 1px solid var(--rule); margin-top: .7rem; }
.prose summary { color: var(--deep); font-weight: 650; cursor: pointer; padding: .46rem .25rem .55rem; }
.prose pre { overflow: auto; max-block-size: 25rem; margin: .65rem 0 1.15rem; background: var(--deep); color: #f8f3de; padding: 1rem; font-size: .83rem; line-height: 1.48; }
.prose p code { overflow-wrap: anywhere; background: #ebe5d6; padding: .09em .19em; font-size: .86em; }
.measurements { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .7rem; border-block: 1px solid var(--rule); margin: 1rem 0; padding-block: .7rem; }
.measurements dt { font-size: .81rem; color: var(--subtle); }
.measurements dd { margin: .02rem 0 0; font: 620 clamp(1.25rem,3vw,1.95rem)/1.2 var(--serif); }
.table-wrap { overflow-x: auto; margin-top: 1.15rem; }
.reference .model-map { table-layout: fixed; }
.reference .model-map :is(th,td) { white-space: normal; overflow-wrap: anywhere; }
.reference .model-map th:first-child { width: 38%; }
.reference .model-map code { font-size: .86em; }
table { width: 100%; border-collapse: collapse; text-align: left; }
caption { text-align: left; color: var(--subtle); font-size: .84rem; padding-bottom: .55rem; }
th, td { padding: .62rem .45rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead { border-top: 1px solid var(--ink); }
tbody th { font-weight: 620; }
td { font-variant-numeric: tabular-nums; white-space: nowrap; }

.teaching-spread { border-top: 0; align-items: start; gap: 2rem; }
.teaching-links section + section { margin-top: 1.45rem; }
.books { border-top: 1px solid var(--rule); padding-block: 1.55rem .5rem; }
.books h2 { margin-bottom: .75rem; }
.book-row { display: flex; justify-content: space-between; align-items: start; gap: .85rem 1.25rem; padding-block: .85rem; border-bottom: 1px solid var(--rule); }
.book-row p { margin-top: .22rem; color: var(--subtle); }
.book-row .button { flex: 0 0 auto; }
.course-list { margin: .9rem 0 0; padding: 0 0 0 1.9rem; }
.course-list li { padding: .75rem .2rem; border-bottom: 1px solid var(--rule); }
.course-list li::marker { font-family: var(--serif); font-weight: 650; color: var(--stamp); }
.course-list li p { margin-top: .22rem; }
.personal-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.9rem 3rem; padding-top: 1.9rem; align-items: start; }
.personal-grid .prose h2:not(:first-child) { margin-top: 1.25rem; }
.site-footer { border-top: 1px solid var(--ink); padding-block: 1.5rem 1.85rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .85rem 2.25rem; align-items: start; }
.footer-row p { margin-top: .35rem; font-size: .83rem; color: var(--subtle); }
.footer-row nav { display: flex; align-items: baseline; flex-wrap: wrap; gap: .45rem 1.35rem; font-size: .87rem; }

@media (max-width: 830px) {
  .shell { width: min(100% - 3rem, 68rem); }
  .title-page { gap: 1.6rem; }
  .cover-text h1 { font-size: clamp(2.2rem, 5.2vw, 3.3rem); }
  .article-layout { grid-template-columns: 8.8rem minmax(0,1fr); gap: 1.45rem; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 2rem, 40rem); }
  .header-row { padding-block: .72rem .35rem; gap: .45rem 1rem; flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; gap: .27rem .92rem; }
  .title-page, .feature-spread, .teaching-spread, .front-index, .article-layout, .personal-grid { grid-template-columns: 1fr; }
  .title-page { gap: 2rem; padding-block: 2.5rem 2.15rem; }
  .cover-text h1 { font-size: clamp(2.25rem, 7.4vw, 3.15rem); }
  .cover-plate { transform: none; }
  .cover-plate img { aspect-ratio: 1.45; }
  .feature-spread { gap: 1.35rem; padding-block: 2rem; }
  .article-header { padding-top: 2.5rem; }
  .article-layout { padding-top: 1rem; }
  .article-nav nav { position: static; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .article-nav strong { grid-column: 1/-1; }
  .prose section + section { margin-top: 2.2rem; }
  .book-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
@media print {
  a { color: inherit; }
  .site-header, .site-footer, .article-nav, .download-row { display: none; }
  .shell { width: 100%; }
  .article-layout { display: block; }
  .prose section { break-inside: avoid; }
}

.offer-terms { margin-top: .95rem; max-width: 29rem; font-size: .87rem; color: var(--subtle); }
.front-facts { margin: 0; border-bottom: 0; padding-block: 1.1rem; }
.front-facts div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.front-facts dt { font-size: .87rem; }
.plan-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.plan-list li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .05rem 1rem; padding-block: .5rem; border-bottom: 1px solid var(--rule); }
.plan-list span { grid-column: 1; font-size: .9rem; color: var(--subtle); }
.plan-list b { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 620 1.12rem/1.2 var(--serif); white-space: nowrap; }
.reference .chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.reference .chips span { padding: .12rem .55rem; border: 1px solid var(--rule); background: var(--page); font-size: .82rem; color: var(--subtle); }
.reference section.note { margin-top: 1rem; padding: .85rem 1rem 1rem; border: 1px solid var(--deep); background: var(--page); }
.reference section.note p:first-child { margin-top: 0; }
.reference section.note p:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; }
.reference section.note .button { background: var(--deep); color: #fff8e8; border-color: var(--deep); }
.reference section.note .button:hover { background: #254b3e; border-color: #254b3e; }
.reference .button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.reference .button.light { font-weight: 560; }
@media (max-width: 650px) {
  .article-layout { grid-template-columns: minmax(0,1fr); }
  .front-facts { grid-template-columns: 1fr; gap: .45rem; }
  .front-facts div { flex-direction: row-reverse; align-items: baseline; gap: .7rem; }
  .front-facts dd { flex: 0 0 2.4em; }
}

.platform-nav { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .9rem; font-weight: 650; }
.platform-links { padding-block: 1.25rem; }
.platform-links p { margin-block: .5rem; }
.catalog { padding-block: 1.5rem 3rem; }
.catalog-group { padding-block: 1.35rem; border-top: 1px solid var(--rule); }
.subject-links { display: flex; flex-wrap: wrap; gap: .45rem 1rem; padding: 0; margin-block: .8rem 1.4rem; list-style: none; }
.subject-links small { color: var(--subtle); }
.catalog-search { margin-block: .4rem 1.35rem; }
.catalog-search label { display: block; margin-bottom: .3rem; font-weight: 650; }
.catalog-search input { width: min(100%, 30rem); padding: .5rem .65rem; font: inherit; border: 1px solid var(--rule); background: var(--page); color: var(--ink); }
.catalog-search [role="status"], .source-note, .vita-date { color: var(--subtle); font-size: .87rem; }
.case-list { padding: 0; display: grid; grid-template-columns: repeat(2,minmax(0, 1fr)); gap: .2rem 1.9rem; list-style: none; }
.case-list li { padding-block: .55rem; border-bottom: 1px solid var(--rule); }
.case-list a { font-weight: 650; }
.case-list p { font-size: .93rem; color: var(--subtle); margin-top: .2rem; }
.study-note { border-left: .2rem solid var(--stamp); padding: .45rem .85rem; background: var(--page); }
.reference .math.display { max-width: 100%; overflow-x: auto; }
.reference :is(.paper-figure, .figure, figure) { margin-block: .9rem; }
.reference figure img { max-height: 42rem; width: 100%; object-fit: contain; }
.reference figure figcaption, .reference .muted { color: var(--subtle); font-size: .9rem; }
.reference :is(.pills, .badges, .download-row) { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
.reference .notebook .nb-md { margin-top: 1rem; }
.reference .notebook .nb-code { margin-block: .8rem; }
.reference h3:not(:first-child) { margin-top: 1.1rem; }
.reference p.source-note { margin-top: 1.5rem; }
.vita { list-style: none; padding: 0; }
.vita li { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.vita li p { margin: .15rem 0; }
[hidden] { display: none !important; }

@media (max-width: 650px) {
  .case-list { grid-template-columns: 1fr; }
}

.feature-cases { padding-block: 1.7rem 2rem; }
.feature-case-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.45rem; margin-block: .9rem 1.15rem; }
.feature-case img { aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid var(--rule); background: var(--paper); }
.feature-case h3 { margin-top: .55rem; }
.feature-case p { margin-top: .35rem; color: var(--subtle); font-size: .94rem; }
.dimension-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: 0; list-style: none; }
.dimension-links [aria-current] { color: var(--stamp); font-weight: 650; }
@media (max-width: 830px) {
  .feature-case-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .feature-case-grid { grid-template-columns: 1fr; }
}

/* Lecture notes and problem classes */
.teaching-index { padding-bottom: 3.25rem; }
.teaching-header { padding-block: clamp(2.2rem, 5vw, 4.3rem) 2rem; }
.teaching-header .edition, .first-lecture .edition { margin-bottom: .65rem; }
.teaching-header h1 { font-size: clamp(2.55rem, 5.7vw, 4.45rem); }
.teaching-header .lead { max-width: 43rem; }
.study-links { display: flex; flex-wrap: wrap; gap: .45rem 1.5rem; margin-top: 1rem; font-weight: 620; }
.first-lecture { display: grid; grid-template-columns: 1fr 1fr; gap: min(4.5vw, 3.5rem); align-items: center;
  padding-block: 1.65rem; border-block: 1px solid var(--rule); }
.first-lecture h2 { font-size: clamp(1.65rem, 3.4vw, 2.7rem); max-width: 20ch; }
.first-lecture h2 a, .chapter-list a { text-decoration: none; }
.first-lecture h2 a:hover, .chapter-list a:hover { text-decoration: underline; }
.first-lecture p:not(.edition) { margin-block: .8rem; max-width: 34rem; }
.first-lecture figure, .lecture-figure { border: 1px solid var(--rule); background: var(--page); }
.teaching-contents { padding-top: 2.5rem; }
.contents-group { display: grid; grid-template-columns: minmax(9rem, 1fr) 3fr; gap: 1rem 2.25rem;
  padding-block: 1.55rem; border-bottom: 1px solid var(--rule); }
.contents-group h3 { color: var(--subtle); max-width: 13em; }
.chapter-list, .seminar-directory ul { padding: 0; margin: 0; list-style: none; }
.chapter-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.15rem 2rem; }
.subject-name { display: block; color: var(--stamp); font-weight: 620; font-size: .83rem; }
.chapter-list a { font: 600 1.23rem/1.25 var(--serif); display: inline-block; margin-top: .16rem; }
.prerequisites { margin-top: .85rem; font-size: .9rem; color: var(--subtle); }
.prerequisites strong { color: var(--ink); margin-right: .35rem; }
.lecture-figure { max-width: 31rem; }
.lecture-figure figcaption { padding: .55rem .85rem .75rem; }
.lecture-onward { margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--serif); }
.prose section:has(> #tutorial) { padding: 1.25rem clamp(.8rem, 2.4vw, 1.6rem); border-left: .2rem solid var(--stamp);
  background: var(--page); }
.prose details[open] { padding-bottom: .85rem; }
.reading-list li { padding-left: .35rem; }
.reading-list li + li { margin-top: .85rem; }
.reading-list a { font-weight: 620; }
.prose .reading-list p { margin-top: .15rem; }
.seminar-directory { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.15rem; margin-top: 1.2rem; }
.related-reading { font-size: .9rem; }
@media (max-width: 700px) {
  .first-lecture, .contents-group { grid-template-columns: 1fr; }
  .first-lecture { gap: 1.05rem; }
  .chapter-list { gap: .95rem 1.1rem; }
}
@media (max-width: 450px) {
  .chapter-list, .seminar-directory { grid-template-columns: 1fr; }
}
@media print {
  .study-links, .lecture-onward { display: none; }
  .prose section:has(> #tutorial) { break-inside: auto; }
}
.moved-bookmark { display: none; }
.moved-bookmark:target { display: block; padding: .75rem 1rem; border-left: .2rem solid var(--stamp); }
.prose:has(#tutorial), .prose:has(#chapter-problems) { min-width: 0; }
@media (max-width: 650px) {
  .prose:has(#tutorial) p mjx-container, .prose:has(#chapter-problems) p mjx-container {
    max-width: 100%; overflow-x: auto; padding-block: .18em; vertical-align: middle;
  }
}

.disciplines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.7rem;
  padding-block: .4rem 2rem; }
.discipline h2 { margin-top: .7rem; font-size: clamp(1.45rem, 2.35vw, 2rem); }
.discipline h2 a { text-decoration-thickness: .045em; }
.discipline p { color: var(--subtle); margin-block: .55rem .85rem; }
.discipline ul { list-style: none; padding: 0; margin: 0; }
.discipline li { border-top: 1px solid var(--rule); padding-block: .45rem; }
.discipline li a { text-decoration-thickness: .05em; }
.discipline img { aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid var(--rule); background: var(--page); }
.further-study { border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 0; }
.course-subjects { padding-left: 1.8rem; }
.course-subjects li { padding: .65rem 0 1rem .3rem; border-bottom: 1px solid var(--rule); }
.course-subjects li::marker { font-family: var(--serif); color: var(--stamp); }
.course-subjects li p { margin-top: .35rem; }
.subject-jumps { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .45rem; font-size: .9rem; }
.run-help { display: block; margin-top: .5rem; overflow-wrap: anywhere; }
.experiment-controls { margin-top: 1rem; }
.experiment-controls fieldset { min-width: 0; margin: 0; padding: .75rem 1rem 1rem; border: 1px solid var(--rule); background: var(--page); }
.experiment-controls legend { color: var(--deep); font: 600 1.24rem var(--serif); padding-inline: .3rem; }
.experiment-controls fieldset p { margin: 0 0 .75rem; }
.experiment-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .6rem 1rem; }
.experiment-fields label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
.experiment-fields select, .experiment-fields input { width: 100%; min-width: 0; padding: .45rem; font: inherit; font-weight: 400;
  color: var(--ink); background: var(--page); border: 1px solid #8e9a87; }
.experiment-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.experiment-actions button { font-family: inherit; cursor: pointer; }
.experiment-controls output:not(:empty) { display: block; margin-top: .6rem; }
.experiment-table { overflow: auto; }
.prose:has(#experiment) { min-width: 0; }
.prose .experiment-runs caption { margin-top: .7rem; }
.prose section:has(> #exercises) { border-left: .2rem solid var(--stamp); padding: 1.15rem; background: var(--page); }
@media (max-width: 800px) {
  .disciplines { grid-template-columns: 1fr; gap: 2rem; }
  .discipline img { max-width: 23rem; }
}
@media (max-width: 650px) {
  .prose:has(#experiment) p mjx-container { max-width: 100%; overflow-x: auto; padding-block: .18em; vertical-align: middle; }
  .prose:has(#experiment) pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media print {
  .experiment-runs tr[hidden] { display: table-row !important; }
  .experiment-controls { display: none; }
}
.discipline-shortcuts { display: none; }
@media (max-width: 800px) {
  .discipline-shortcuts { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; padding-bottom: 1.15rem; }
}

.course-readings { list-style: decimal; padding-left: 1.8rem; }
.course-readings li { padding: .25rem 0 .65rem .25rem; }
.course-readings li::marker { color: var(--stamp); font: 600 1.15rem var(--serif); }
.course-readings li > a { font: 600 1.2rem/1.3 var(--serif); }
.prose .course-readings li p { margin: .2rem 0 0; color: var(--subtle); }
.case-introduction { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.chapter-pager { margin-top: 2.4rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem 1.8rem; }
.chapter-pager span { font-size: .85rem; color: var(--subtle); }
.chapter-pager a { display: inline-block; font-size: 1rem; }
.course-book { max-width: 49rem; padding-block: 2rem 3rem; }
.book-header > p { margin-top: .8rem; }
.course-book > nav { margin: 2rem 0; padding: 1rem 0; border-block: 1px solid var(--rule); }
.course-book .book-part { margin-block: 2.8rem; }
.course-book .book-part > .chapter-aim { color: var(--subtle); font-style: italic; }
.course-book h4 { font: 600 1.15rem var(--serif); margin-bottom: .35rem; }
.book-tools { margin-top: .9rem; }
.book-tools button { font-family: inherit; cursor: pointer; }
.prose:has(.chapter-pager), .course-book .prose { min-width: 0; }
@media (max-width: 650px) {
  :is(.prose:has(.chapter-pager), .prose:has(#experiment), .course-book .prose) :is(p, li, td) mjx-container {
    display: inline-block; max-width: 100%; overflow-x: auto; padding-block: .18em; vertical-align: middle;
  }
  .course-book .experiment-runs { display: block; overflow-x: auto; }
}
.sampled-loop { margin-block: 1.2rem; padding: 1rem; border: 1px solid var(--rule); background: var(--page); }
.sampled-loop label { display: block; font-weight: 600; }
.sampled-loop input { display: block; width: 100%; margin-block: .75rem; accent-color: var(--stamp); }
.sampled-loop output { display: block; font-variant-numeric: tabular-nums; }
.sheet-pair { display: block; margin-top: .2rem; color: var(--subtle); font-size: .86rem; }
.case-introduction > section { margin-top: 1.65rem; }
.case-introduction > section > h3 { font: 600 1.4rem/1.25 var(--serif); }
@media print {
  .chapter-pager, .course-book .edition, .book-tools, .book-header > p:last-of-type, .sampled-loop { display: none; }
  .course-book.shell { width: 100%; max-width: none; padding: 0; font-size: 10.5pt; }
  .course-book .book-part { break-before: page; margin-block: 0; }
  .course-book .book-part > h2 { margin-top: 0; }
  .course-book .prose section { break-inside: auto; }
  .course-book :is(h2, h3, h4) { break-after: avoid; }
  .book-part figure, .book-part .math.display { break-inside: avoid; }
  .course-book .book-part figure img { max-height: 16rem; }
}
.worked-plot figure img { height: auto; }
.plot-data .table-scroll { overflow-x: auto; }
.plot-data caption { margin-block: .5rem; }
.plot-reader { margin-top: .85rem; padding: .85rem; border: 1px solid var(--rule); background: var(--page); }
.plot-reader label, .plot-reader output { display: block; }
.plot-reader input { display: block; width: 100%; margin-block: .65rem; accent-color: var(--stamp); }
.plot-reader output { font-variant-numeric: tabular-nums; }
@media print { .plot-reader { display: none; } }
.compared-topics { margin: 0; padding-left: 1.2rem; }
.compared-topics > li { margin: 1rem 0 1.5rem; }
.compared-topics h4 { margin: 0; font: 600 1.05rem var(--serif); }
.compared-topics p { margin: .35rem 0; overflow-wrap: anywhere; }

.course-map ol { padding-left: 1.45rem; margin-block: .85rem; }
.course-map li { padding: .25rem 0 .6rem .2rem; }
.course-map li::marker { color: var(--stamp); }
.course-map li > a { font-weight: 650; }
.course-map li p { margin-block: .2rem 0; }
.lab-index, .book-lab-link { margin-top: 1rem; padding: .8rem 1rem; border-left: 3px solid var(--stamp); background: var(--page); }
.lab-index strong { display: block; margin-bottom: .15rem; }
.reading-label, .example-label { color: var(--stamp); font-size: .78rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.prose .reading-label { margin-block: 0 .35rem; }
.prose .example-label { margin: 1.45rem 0 .16rem; }
.prose .example-label + :is(h3,h4) { margin-top: 0; }
.first-principles .math.display, .chapter-derivation .math.display { margin-block: .8rem; border-left: 2px solid var(--rule); padding-left: .65rem; }
.prose .course-lab { padding-top: 1.1rem; border-top: 2px solid var(--stamp); }
.lab-prediction { padding-block: .25rem; }
.reference .lab-chart { max-width: 37rem; }
.model-inputs:not([hidden]) { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(9rem, 1fr); gap: .7rem 1rem; padding: .75rem 1rem; background: var(--page); border: 1px solid var(--rule); }
.model-inputs label { font-size: .9rem; font-weight: 600; }
.model-inputs :is(input, select) { display: block; width: 100%; min-width: 0; margin-top: .3rem; accent-color: var(--stamp); }
.model-inputs output { grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.course-lab pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.prose:has(.first-principles) { min-width: 0; }
.prose .math.display { max-width: 100%; overflow-x: auto; }
@media (max-width: 650px) {
  .model-inputs:not([hidden]) { grid-template-columns: 1fr; }
  .chapter-jumps { gap: .45rem 1rem; }
}
@media print {
  .model-inputs, .chapter-jumps { display: none !important; }
  .course-map, .prose .first-principles, .prose .chapter-derivation, .prose .course-lab { break-inside: auto; }
  .reading-label, .example-label { break-after: avoid; }
}
.chapter-outline-link { display: none; }
@media (min-width: 801px) {
  #chapter-outline nav { max-height: calc(100vh - 2.5rem); overflow-y: auto; }
}
@media (max-width: 800px) {
  .article-layout:has(#chapter-outline) { grid-template-columns: minmax(0,1fr); }
  #chapter-outline { order: 1; }
  #chapter-outline nav { position: static; }
  .chapter-outline-link { display: inline; }
}
.equation-chain { display: grid; grid-template-columns: minmax(0, 1fr); gap: .16rem; padding-block: .35rem; }
.equation-step { min-width: 0; max-width: 100%; overflow-x: auto; }
.equation-step mjx-container[display="true"] { margin-block: .35em !important; }
.book-lab-link + section { margin-top: 1.5rem; }
@media print {
  body:has(.course-book) { --paper: white; --page: white; background: white; }
  body:has(.course-book) > .skip { display: none; }
}

.interactive-study { margin-block: 1.35rem; color: var(--ink); }
.concept-diagram { margin: 1.4rem 0 1.8rem; break-inside: avoid; }
.concept-diagram img { display: block; width: 100%; max-width: 51rem; height: auto; }
.concept-diagram figcaption { max-width: 76ch; margin: .45rem 0 0; line-height: 1.5; }
.concept-diagram figcaption strong { display: block; }
.diagram-enlarge { display: block; width: fit-content; max-width: 100%; }
.diagram-enlarge img { cursor: zoom-in; }
.diagram-enlarge span { font-size: .85rem; text-decoration: underline; }
@media print {
  .concept-diagram img { max-height: 71mm; object-fit: contain; }
  .diagram-enlarge span { display: none; }
}
.interactive-study fieldset { margin: 0; padding: .85rem clamp(.65rem, 2vw, 1.15rem) 1rem; min-width: 0; border: 1px solid #bbc9c3; border-radius: .35rem; background: #f8fbf8; }
.interactive-study legend { color: #174d59; font-size: .95rem; font-weight: 650; padding-inline: .4rem; }
.live-inputs { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(12rem,100%),1fr)); gap: .4rem 1.2rem; }
.live-inputs label, .live-inputs input { display: block; width: 100%; }
.live-inputs label span { font-size: .87rem; } .live-inputs b { float: right; font-variant-numeric: tabular-nums; }
.live-inputs input { height: 1.7rem; accent-color: #175261; }
.interactive-study figure { margin: .8rem 0; min-width: 0; }
.interactive-study canvas { display: block; width: 100%; height: 300px; }
.spatial-view canvas { cursor: grab; touch-action: none; border: 1px solid #d2dfd8; border-radius: .25rem; }
.spatial-view canvas:active { cursor: grabbing; }
.spatial-view canvas:focus-visible { outline: 3px solid #ad491d; outline-offset: 3px; }
.interactive-study .spatial-view figcaption { display: block; margin-top: .4rem; }
.spatial-hint { font-size: .85rem; margin-block: .3rem; color: #46605e; }
@media print { .spatial-hint, .spatial-actions { display: none; } }
.interactive-study figcaption { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.interactive-study figcaption span { border-left: .35rem solid; padding-left: .4rem; font-size: .83rem; }
.interactive-study output { display: block; font-weight: 600; padding-block: .4rem; }
.live-actions { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; margin: .4rem 0; }
.live-actions a { font-size: .84rem; }
.live-actions button { cursor: pointer; color: #174d59; border: 1px solid #9bb1a8; border-radius: .2rem; background: white; padding: .35rem .65rem; font: inherit; font-size: .84rem; }
.interactive-study details { margin-bottom: 0; }
@media print { .live-inputs, .live-actions, .live-data { display:none } .interactive-study { break-inside: avoid; } .interactive-study canvas { height: auto !important; max-height: none; } }
.print-experiment { display: none; }
@media print {
  .print-experiment { display: block; margin: .3rem 0; font-size: 9pt; }
  .pdf-download, .book-header > p:not(.lead), .live-data { display: none; }
  .course-book .interactive-study figure { break-inside: avoid; }
}
.live-reproduce { border-block-start: 1px solid var(--rule); margin-block: .6rem; padding-top: .65rem; }
.live-reproduce p { margin-block: .3rem; }
.live-reproduce code { display: block; overflow-wrap: anywhere; }
@media print {
  .interactive-study .live-inputs { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
  .interactive-study .live-inputs input { display: none; }
  .interactive-study .live-inputs label span { display: inline; font-size: 9pt; }
}

.topic-search input {
  display: block;
  width: min(100%, 34rem);
  padding: .55rem .7rem;
  margin-top: .3rem;
  border: 1px solid var(--subtle);
  border-radius: .2rem;
  background: var(--page);
  color: var(--ink);
  font: inherit;
}
.topic-search .topic-results { list-style: none; padding: 0; margin: 0; }
.topic-results li { border-bottom: 1px solid var(--rule); padding: .48rem 0; }
.topic-results small { display: block; color: var(--subtle); }
.topic-search .topic-count { margin: .5rem 0; font-size: .92rem; }
.topic-search .button:not([hidden]) { margin-top: .65rem; }
.topic-search [hidden] { display: none; }
@media print { .topic-search { display: none; } }

.notebook-launch, .notebook-toolbar, .notebook-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; }
.notebook-launch { margin: 1rem 0 1.4rem; }
.notebook-catalogue { padding:0; list-style:none; }
.notebook-catalogue li { display:grid; grid-template-columns: minmax(0, 11rem) 1fr; gap:1.2rem; padding:1rem 0; border-top:1px solid var(--rule); }
.notebook-catalogue img { width:100%; height:auto; }
@media (max-width:36rem) { .notebook-catalogue li { grid-template-columns:1fr; gap:.3rem; } .notebook-catalogue img { max-width:17rem; } }
.notebook-catalogue h3, .notebook-catalogue p { margin: .22rem 0; }
.notebook-toolbar { position:sticky; top:0; z-index:1; padding:.6rem 0; background:var(--paper); border-bottom:1px solid var(--rule); }
.notebook-controls[hidden] { display: none; }
.notebook-status { min-height: 1.65em; color: var(--subtle); }
.notebook-cell { padding: .8rem 1rem; background: #f5f7f4; border-left: 3px solid #547568; margin: 1.1rem 0; min-width: 0; }
.notebook-cell label { display:block; font: 600 .85rem/1.6 system-ui, sans-serif; }
.notebook-cell textarea { display:block; width:100%; box-sizing:border-box; font: .9rem/1.52 ui-monospace,monospace; color: #17362c; background: #fffef9; border:1px solid #b7c5ba; margin:.4rem 0 .55rem; padding:.55rem; resize:vertical; tab-size:4; }
.notebook-cell .button { font-size:.85rem; min-height:2.3rem; }
.notebook-output pre { white-space:pre-wrap; overflow-wrap:anywhere; background:transparent; color:#18362e; padding:.35rem 0; margin:.25rem 0; }
.notebook-output pre[data-kind=error], .notebook-output pre[data-kind=stderr] { color:#873820; }
.notebook-output img { display:block; width:auto; max-width:100%; height:auto; padding:.45rem 0; }
.notebook-toolbar button:disabled, .notebook-cell button:disabled { opacity:.55; }
.notebook-practice { margin:1.1rem 0; }

.prose details.study-aside {
  margin: 1.1rem 0;
  padding: 0 clamp(.8rem, 2vw, 1.15rem);
  border: 1px solid var(--rule);
  border-left: 3px solid #657b68;
  border-radius: .18rem;
  background: var(--page);
}
.prose .study-aside > summary { padding: .65rem .1rem; line-height: 1.4; }
.prose .study-aside[open] { padding-bottom: .85rem; }
.prose .study-aside[open] > summary { border-bottom: 1px solid var(--rule); }
.study-aside figure { margin: 1rem 0 .4rem; }
.study-aside figcaption { font-size: .92em; color: var(--subtle); margin-top: .4rem; }
.prose .study-aside pre { tab-size: 4; }
@media print {
  .course-book .study-aside { break-inside: auto; }
  .course-book .study-aside:not(:has(pre)) { break-inside: avoid; }
  .course-book .study-aside summary {
    display: block; break-inside: avoid; break-after: avoid;
  }
  .course-book .study-aside pre {
    white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; max-block-size: none;
    background: transparent; color: var(--ink); font-size: 8pt; padding: .35rem 0;
  }
  .course-book .study-aside figure { break-inside: avoid; }
}

/* Homepage: three selling points and the notebook carousel */
.front-index.usp { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 2.6rem; }
@media (max-width: 900px) { .front-index.usp { grid-template-columns: 1fr; } }
.hero-carousel { margin: 0; }
.hero-carousel .hero-slides { position: relative; list-style: none; margin: 0; padding: 0; aspect-ratio: 4 / 3.45; overflow: hidden; background: var(--paper); }
.hero-carousel .hero-slide { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility .7s; }
.hero-carousel .hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-carousel .hero-slide img { width: 100%; height: calc(100% - 3em); object-fit: contain; display: block; }
.hero-carousel .hero-slide p { position: absolute; left: 0; right: 0; bottom: 0; height: 2.8em; margin: 0; overflow: hidden; font: .95rem/1.4 var(--serif); color: var(--ink); }
.hero-carousel .hero-slide p span { color: var(--stamp); font-family: inherit; }
.hero-carousel .hero-slide p a { color: var(--ink); }
.hero-controls { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; border-top: 1px solid var(--rule); padding-top: .5rem; margin-top: .4rem; }
.hero-arrow { font: 1.15rem/1 var(--serif); color: var(--deep); background: transparent; border: 1px solid var(--rule); border-radius: 999px; width: 2.3rem; height: 2.3rem; cursor: pointer; }
.hero-arrow:hover, .hero-arrow:focus-visible { background: var(--deep); color: var(--paper); border-color: var(--deep); }
.hero-count { color: var(--subtle); font: .9rem/1 var(--serif); min-width: 3.4em; text-align: center; }
@media (prefers-reduced-motion: reduce) { .hero-carousel .hero-slide { transition: none; } }
.front-index .module-links { margin-top: .55rem; font-size: .92rem; }
.plot-carousel .plot-image { display: block; aspect-ratio: 16 / 9; background: var(--paper); }
.plot-carousel .plot-image img { width: 100%; height: 100%; object-fit: contain; transition: opacity .25s ease; }
.plot-carousel .plot-image img.is-fading { opacity: 0; }
.plot-carousel figcaption { min-height: 6.2em; }
.plot-carousel .plot-meta { color: var(--stamp); }
.plot-carousel .plot-title { color: var(--ink); }
.plot-carousel .plot-text { display: block; margin-top: .2rem; color: var(--subtle); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .plot-carousel .plot-image img { transition: none; } }
/* Sod page: test matrices, one at a time with arrows */
.matrix-carousel .hero-controls { border-top: 0; border-bottom: 1px solid var(--rule); margin: 0 0 .5rem; padding: 0 0 .5rem; }
.matrix-carousel .matrix-slides { list-style: none; margin: 0; padding: 0; height: min(82vh, 1150px); }
.matrix-carousel .matrix-slide { display: none; margin: 0; height: 100%; flex-direction: column; }
.matrix-carousel .matrix-slide.is-active { display: flex; }
.matrix-carousel .matrix-slide img { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: var(--paper); }
.matrix-carousel .matrix-slide p { flex: 0 0 auto; margin: .4rem 0 0; font: .95rem/1.45 var(--serif); color: var(--ink); }
.matrix-carousel .matrix-slide a { display: contents; }
/* Click-to-enlarge for figures: fit the screen, click again for full resolution */
.matrix-carousel .matrix-slide img { cursor: zoom-in; }
.figure-lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(23, 38, 32, .55); backdrop-filter: blur(2px); overflow: auto; display: flex; align-items: center; justify-content: center; padding: 3.5rem 1.5rem 1.5rem; }
.figure-lightbox img { max-width: min(100%, 1400px); max-height: calc(100vh - 5rem); width: auto; height: auto; margin: auto; cursor: zoom-in; background: var(--paper); border: .6rem solid var(--paper); border-radius: 4px; box-shadow: 0 12px 48px rgba(0, 0, 0, .35); }
.figure-lightbox img.is-full { max-width: none; max-height: none; cursor: zoom-out; }
.figure-lightbox-close { position: fixed; top: .7rem; right: 1rem; width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--deep); font: 1.6rem/1 var(--serif); cursor: pointer; }
.figure-lightbox-close:hover, .figure-lightbox-close:focus-visible { background: var(--deep); color: var(--paper); }

/* Entry pages by role and the comparison page */
.prose .feature-case-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.prose .start-list { grid-template-columns: 1fr; }
.prose .subject-links { margin-bottom: 0; }
.start-list .start-plan { color: var(--ink); font-weight: 620; }
.reference section.note h2 { font-size: 1.3rem; }
.plan-list strong a { color: inherit; text-decoration-color: #92887a; }
.reference .compare { table-layout: fixed; min-width: 34rem; font-size: .9rem; }
.reference .compare :is(th,td) { white-space: normal; overflow-wrap: break-word; }
.compare thead th:first-child { width: 7.2rem; }
.compare th[scope="row"] { font-weight: 650; }
.compare thead th { font: 620 1rem/1.25 var(--serif); }
.compare :is(td,th):last-child { background: var(--paper); }
@media (max-width: 560px) {
  .prose .feature-case-grid { grid-template-columns: 1fr; }
}

/* Recorded assistant session on the home page */
.assistant-demo { align-items: start; }
.demo-stage { border: 1px solid var(--rule); background: var(--page); padding: 1.1rem 1.25rem 1rem; }
.demo-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.demo-step { padding-left: .85rem; border-left: 2px solid var(--rule); font-size: .93rem; }
.demo-step > p + p, .demo-step > ul { margin-top: .25rem; }
.demo-step ul { padding-left: 1.1rem; }
.demo-role { color: var(--stamp); font-size: .8rem; font-weight: 650; }
.demo-user, .demo-assistant { border-left-color: var(--deep); }
.demo-call { color: var(--subtle); }
.demo-result { color: var(--ink); font-weight: 620; }
.demo-result::before { content: "→ "; color: var(--stamp); }
.demo-stage code { background: #ebe5d6; padding: .05em .22em; font-size: .86em; overflow-wrap: anywhere; }
.demo-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--subtle); }
.demo-foot .button { min-height: 2.1rem; padding: .3rem .7rem; }
.demo-stage.is-animated .demo-step { opacity: 0; transform: translateY(.35rem); transition: opacity .45s ease, transform .45s ease; }
.demo-stage.is-animated .demo-step.is-shown { opacity: 1; transform: none; }
