:root {
  --page-width: 780px;
  --prose-width: 690px;
  --page-x: 46px;
  --page-y: 42px;
  --text: #262626;
  --heading: #151515;
  --muted: #6f6a61;
  --link: #8a4b12;
  --faint: #ded6ca;
  --paper: #fffdf8;
  --page-bg: #f4f1eb;
  --quote-bg: #fbf6ec;
  --code-bg: #f7f3ea;
  --control-accent: #8a4b12;
  --block-indent: 13px;
  --block-gap: 4px;
  --block-control-size: 17px;
  --block-control-gap: 9px;
  --reading-indent: calc(var(--block-control-size) + var(--block-control-gap));
  --block-line-height: 1.7;
  --text-size: 1rem;
}

html {
  font-size: 17px;
  background: var(--page-bg);
}

body {
  max-width: var(--page-width);
  margin-top: 34px;
  margin-bottom: 72px;
  padding: var(--page-y) var(--page-x) 72px;
  border: 1px solid var(--faint);
  background: var(--paper);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: var(--block-line-height);
}

.site-header,
.site-footer,
.topic-content,
.prose-page,
body > h1 {
  max-width: var(--prose-width);
  margin-right: auto;
  margin-left: auto;
}

.site-header {
  margin-top: 0;
  margin-bottom: 1.7rem;
  padding-bottom: 0.8rem;
  border-bottom-color: var(--faint);
}

.site-title {
  font-size: 1.28rem;
}

.site-title,
body > h1,
.block-type-block_part > summary h2,
.block-type-block_part > h2,
.reading-node[open] > summary > span,
.reading-node[open] .block-type-block_section > summary > span,
.reading-node[open] .block-type-h1 > summary > span {
  color: var(--heading);
}

body > h1 {
  margin-bottom: 1.5rem;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.site-nav,
.topic-subtitle {
  color: var(--muted);
}

.site-nav,
.site-footer,
.block-type-h2 h5,
.block-type-h3 h6,
.content-figure-caption,
.twf-prompt,
.twf-response-input {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-nav a {
  color: #51473c;
}

a {
  color: var(--link);
}

a:hover {
  color: #66370d;
}

.topic-content {
  max-width: var(--prose-width);
}

.block {
  margin-top: var(--block-gap);
  margin-bottom: var(--block-gap);
}

.topic-content > .reading-node {
  margin-left: 0;
  border-top: 1px solid var(--faint);
}

.topic-content > .block-type-block_part {
  margin-left: 0;
  border-top: 1px solid var(--faint);
}

.topic-content > .reading-node:last-child {
  border-bottom: 1px solid var(--faint);
}

.topic-content > .reading-node > summary,
.topic-content > .block-type-block_part > summary {
  min-height: 3.1rem;
  padding-top: 0.8rem;
  padding-bottom: 0.75rem;
}

.topic-content > .block-type-block_part > .chapter-content {
  padding-left: var(--reading-indent);
}

.part-description {
  margin-block: var(--block-gap) 0.8rem;
}

.part-description .article-paragraph + .article-paragraph {
  margin-top: 0.6rem;
}

.topic-content > .block-type-block_part > .chapter-content > .reading-node {
  margin-left: 0;
}

.reading-node[open] > summary {
  margin-bottom: 0.4rem;
}

.reading-node[open] > .article-content {
  max-width: none;
  padding-left: var(--reading-indent);
}

.lesson-title,
.content-section-title,
.block > summary,
.lesson-section > summary,
.list-toggle {
  align-items: center;
  grid-template-columns: var(--block-control-size) minmax(0, 1fr);
  column-gap: var(--block-control-gap);
}

.lesson-title::before,
.content-section-title::before,
.block > summary::before,
.lesson-section > summary::before,
.list-toggle::before {
  margin-top: 0;
  background-color: var(--control-accent);
  opacity: 1;
}

.reading-node[open] > summary > span {
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.25;
}

.reading-node[open] > .article-content > .block-type-block_section,
.reading-node[open] > .article-content > .block-type-h1 {
  margin-left: 0;
  border-top: 1px solid var(--faint);
}

.reading-node[open] > .article-content > .block-type-block_section > summary,
.reading-node[open] > .article-content > .block-type-h1 > summary {
  padding-top: 0.72rem;
  padding-bottom: 0.64rem;
}

.reading-node[open] > .article-content > .block-type-block_section[open] > .article-content,
.reading-node[open] > .article-content > .block-type-h1[open] > :not(.content-section-title) {
  max-width: none;
  padding-left: 0;
}

.reading-node[open] .article-content > .block-type-h1[open] > :not(.content-section-title) {
  margin-left: 0;
}

.reading-node[open] .block-type-block_section > summary > span,
.reading-node[open] .block-type-h1 > summary > span {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.32;
}

.reading-node[open] .block-type-h2,
.reading-node[open] .block-type-h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  margin-left: 0;
}

.block-type-h2 h5,
.block-type-h3 h6 {
  color: var(--heading);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

.block-type-h2 h5 {
  font-size: 1rem;
}

.block-type-h3 h6 {
  font-size: 0.95rem;
}

.reading-node[open] .article-content p.block,
.reading-node[open] .article-content .article-paragraph {
  margin: 0.55rem 0;
  color: var(--text);
  line-height: 1.72;
}

.reading-node[open] .article-content .typed-list,
.topic-content .typed-list {
  margin: 0.55rem 0 1rem;
  padding-left: 2rem;
}

.reading-node[open] .article-content li > .typed-list,
.topic-content li > .typed-list {
  margin: 0.35rem 0 0.45rem;
  padding-left: 1.35rem;
}

.reading-node[open] .article-content .block-type-block_item,
.topic-content .block-type-block_item {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-left: 0.1rem;
  line-height: 1.62;
}

.content-quote,
blockquote {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.45rem 0 0.45rem 1rem;
  border-left: 3px solid var(--faint);
  background: var(--quote-bg);
  color: #4a4035;
  font-style: italic;
}

.content-admonition {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--faint);
  border-left: 3px solid var(--link);
  background: var(--quote-bg);
}

.admonition-title {
  margin: 0 0 0.4rem;
  color: var(--heading);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
}

.content-code {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  overflow: auto;
  border: 1px solid var(--faint);
  background: var(--code-bg);
  color: #2f2a24;
}

.content-code code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.content-table {
  margin: 1rem 0;
  overflow-x: auto;
}

.content-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.93rem;
}

.content-table th,
.content-table td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--faint);
  text-align: left;
  vertical-align: top;
}

.content-table th {
  background: var(--code-bg);
  color: var(--heading);
  font-weight: 700;
}

.content-quote p {
  line-height: 1.62;
}

.content-figure {
  margin-top: 1rem;
  margin-bottom: 1.1rem;
  margin-left: 0;
}

.content-image {
  border-color: var(--faint);
  border-radius: 0;
  background: var(--paper);
}

.content-figure-caption,
.content-asset-caption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

code {
  padding: 0.1rem 0.25rem;
  background: var(--code-bg);
  color: #5f3b12;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.twf-article {
  margin-top: 0.7rem;
  margin-bottom: 0.8rem;
}

.twf-item {
  border-top: 1px solid var(--faint);
}

.twf-item > .twf-prompt,
.twf-review-section > summary {
  padding-top: 0.55rem;
  padding-bottom: 0.45rem;
}

.twf-response-input {
  border-color: var(--faint);
  background: #fffaf0;
}

@media (max-width: 680px) {
  html {
    font-size: 16px;
  }

  body {
    max-width: none;
    margin: 0;
    border: 0;
    padding-right: 18px;
    padding-left: 18px;
    background: var(--paper);
  }

  body > h1 {
    font-size: 1.8rem;
  }

  .reading-node[open] > summary > span {
    font-size: 1.14rem;
  }
}

/* GuideBook lessons look like standalone lesson pages (see .lesson-section in
   main.css): same section size and rule, and one text edge with headings
   hanging left. Only the open/close arrows differ. */
:is(.lesson-node, .orientation-node) {
  --lesson-indent: 2.1rem;
}

:is(.lesson-node, .orientation-node)[open] > .article-content > :is(.block-type-block_section, .block-type-h1) {
  border-top-color: #c4b8a6;
}

:is(.lesson-node, .orientation-node)[open] > .article-content > :is(.block-type-block_section, .block-type-h1) > summary {
  padding-top: 0.45rem;
  padding-bottom: 0.4rem;
}

:is(.lesson-node, .orientation-node)[open] :is(.block-type-block_section, .block-type-h1) > summary > span {
  font-size: 1.32rem;
  line-height: 1.25;
}

:is(.lesson-node, .orientation-node)[open] > .article-content > .block-type-block_section[open] > .article-content {
  margin-bottom: 1.2rem;
  padding-left: var(--lesson-indent);
}

:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > .content-subsection > h5,
:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > .content-subsubsection > h6 {
  margin-left: calc(-1 * var(--lesson-indent));
}

:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > :is(.typed-list, .content-definition-list),
:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > :is(.content-subsection, .content-subsubsection) > :is(.typed-list, .content-definition-list) {
  padding-left: 0;
}

:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > .typed-list > li,
:is(.lesson-node, .orientation-node) .block-type-block_section > .article-content > :is(.content-subsection, .content-subsubsection) > .typed-list > li {
  padding-left: 0;
}

/* With sections now as large as the old lesson title, the open lesson title
   steps up so the levels stay clear inside the book. */
:is(.lesson-node, .orientation-node)[open] > summary > span {
  font-size: 1.6rem;
  line-height: 1.2;
}

/* Lesson focus: the open lesson fills the page like a standalone lesson. Its
   place in the book (part indents and rules) is dropped, and its title takes
   the page-title style. */
.topic-content :has(.lesson-focus-current):not(.lesson-focus-current *) {
  margin-left: 0 !important;
  padding-left: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
}

.lesson-focus-current > summary {
  display: block;
  padding-top: 0.6rem;
}

.lesson-focus-current > summary::before {
  display: none;
}

.lesson-focus-current > summary > span {
  font-size: 2.25rem;
  line-height: 1.15;
}

.lesson-focus-current[open] > .article-content {
  padding-left: 0;
}

/* Phones: the same smaller indent as standalone lessons, a smaller focus title,
   and section arrows kept inside the narrow page margin. */
@media (max-width: 680px) {
  :is(.lesson-node, .orientation-node) {
    --lesson-indent: 1.3rem;
  }

  .lesson-focus-current > summary > span {
    font-size: 1.8rem;
  }

  .lesson-focus-current[open] > .article-content {
    padding-left: var(--reading-indent);
  }
}
