/* One visual grammar for all illustrated lessons, in both browser themes. */
.lesson-dialog { max-width: 1120px; padding: 20px 24px 24px; border-radius: 16px; }
.lesson-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); height: min(960px, 94dvh); max-height: 94dvh; overflow: hidden; }
/* The toolbar owns its row; scrolling content can never pass underneath it. */
.lesson-dialog .dialog-tools { position: static; margin: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.lesson-dialog #dialog-content { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 26px 18px 12px; scroll-padding-block: 18px; scrollbar-gutter: stable; }
.lesson-dialog .dialog-close { border: 0; border-radius: 50%; }
.lesson-kicker { margin-bottom: 16px; }
.lesson-intro .dialog-title { font-size: 30px; font-weight: 600; }
.lesson-intro .dialog-summary { line-height: 1.85; }
.lesson-intro .article-meta { margin-bottom: 30px; }
.teaching-board { background: none; border: 0; border-radius: 0; padding: 0; overflow: visible; }
.board-heading { margin-bottom: 16px; }
.board-label { font-size: 11px; }
.board-heading h3 { font-size: 18px; font-weight: 550; }
.board-viewport { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.board-viewport img, .lesson-figure img { background: var(--surface); color-scheme: light dark; }
.board-layout { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 34px; align-items: start; }
.board-figure { width: min(100%, 480px); justify-self: center; }
.board-notes { display: block; min-width: 0; }
.board-notes li, .board-notes li:first-child, .board-notes li:last-child { padding: 15px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.board-notes li:first-child { padding-top: 0; }
.board-notes li:last-child { border-bottom: 0; }
.board-notes li > div { min-width: 0; }
.board-notes h4 { font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.board-notes p { font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.note-number { background: #426b98; color: #fff; font-size: 11px; width: 21px; height: 21px; flex-basis: 21px; }
.board-figure figcaption { padding: 10px 1px 0; font-size: 11px; }
.figure-zoom, .section-zoom { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; }
.figure-zoom:hover, .section-zoom:hover { color: var(--ink); border-color: var(--border-strong); background: var(--surface-soft); }
.chapter-divider { margin-top: 35px; font-size: 13px; font-weight: 550; }
.lesson-map { margin-top: 9px; }
.lesson-map button { font-size: 12px; line-height: 1.7; }
.visual-section { grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); align-items: start; gap: 34px; padding-bottom: 34px; margin-bottom: 34px; }
.visual-section:nth-child(even) .lesson-figure { order: 0; }
.visual-copy { min-width: 0; }
.visual-section .lesson-figure { width: min(100%, 380px); justify-self: center; }
.visual-copy h3 { font-size: 18px; font-weight: 550; }
.visual-copy p { font-size: 14px; line-height: 1.95; }
.visual-step { width: auto; height: auto; display: block; margin-bottom: 10px; color: var(--muted); background: none; text-align: left; }
.lesson-figure { min-width: 0; background: none; border: 1px solid var(--line); border-radius: 9px; }
.lesson-figure-viewport { width: 100%; overflow-x: auto; background: var(--surface); scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-soft); }
.lesson-figure-viewport img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: contain; }
.lesson-figure-viewport.is-zoomed img { width: 900px; max-width: none; }
.lesson-figure-viewport:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.lesson-figure figcaption { background: var(--surface); display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px; font-size: 11px; line-height: 1.75; }
.lesson-figure figcaption > span { padding: 2px 0 0; background: none; font-size: 10px; white-space: nowrap; }
.lesson-figure figcaption > p { margin: 0; flex: 1; min-width: 0; }
.section-zoom { padding: 2px 5px; white-space: nowrap; flex: none; font-size: 10px; line-height: 1.7; }
.lesson-dialog .example-box { margin: 26px 0; border: 0; border-radius: 9px; padding: 24px 26px; }
.example-box h3 { font-size: 16px; font-weight: 550; }
.example-steps { margin: 15px 0 0; padding-left: 22px; }
.example-steps li { padding-left: 4px; margin: 8px 0; }
.example-box .example-note { margin: 13px 0 0; font-size: 11px; }
.lesson-dialog .quiz { border-radius: 0; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.lesson-dialog .quiz h3 { font-size: 17px; font-weight: 550; }
.quiz-option { border-color: var(--line); border-radius: 7px; }
.lesson-dialog .media-credit { font-size: 10px; background: var(--surface); }
@media (max-width: 1050px) {
  .board-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .board-figure { width: min(100%, 460px); }
  .board-notes { display: block; }
  .board-notes p { font-size: 14px; }
}
@media (max-width: 760px) {
  .lesson-dialog { padding: 14px 12px 16px; border-radius: 13px; }
  .lesson-dialog #dialog-content { padding: 20px 8px 12px; }
  .lesson-dialog .dialog-tools { padding-bottom: 12px; }
  .lesson-intro .dialog-title { font-size: 24px; line-height: 1.5; }
  .lesson-intro .dialog-summary { font-size: 13px; }
  .lesson-intro .article-meta { font-size: 10px; line-height: 1.9; margin-bottom: 25px; }
  .teaching-board { margin: 0; padding: 0; }
  .board-heading { gap: 10px; padding: 0; align-items: center; }
  .board-heading h3 { font-size: 16px; }
  .board-heading .figure-zoom { font-size: 10px; padding: 6px 8px; }
  .board-label { font-size: 10px; }
  .board-layout { gap: 20px; }
  .board-figure { width: min(100%, 400px); }
  .board-notes { display: block; padding: 0; }
  .board-notes li, .board-notes li:first-child, .board-notes li:last-child { padding: 12px 0; border-color: var(--line); }
  .board-notes h4 { font-size: 13px; }
  .board-notes p { font-size: 13px; line-height: 1.9; }
  .lesson-map button { font-size: 11px; }
  .visual-section { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .visual-copy { display: block; padding: 0; }
  .visual-copy h3 { font-size: 16px; }
  .visual-copy p { font-size: 13px; line-height: 1.95; }
  .visual-step { margin: 3px 0 0; min-width: 20px; font-size: 11px; align-self: flex-start; }
  .lesson-figure figcaption { font-size: 11px; padding: 10px; }
  .lesson-dialog .example-box { padding: 20px; font-size: 13px; }
}

/* Separate real examples into readable paragraphs with sources beside the explanation. */
.section-prose p { white-space: normal; margin: 0; }
.section-prose p + p { margin-top: 14px; }
.section-references { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; margin-top: 16px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.section-references > span { opacity: .85; }
.section-references a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.section-references a:hover { color: var(--ink); }
@media (max-width: 760px) {
  .section-prose p + p { margin-top: 12px; }
  .section-references { margin-top: 13px; font-size: 10px; gap: 5px 10px; }
}
