@charset "UTF-8";

* {
  box-sizing: border-box;
}
/* The browser's focus scroll keeps a stop clear of the header, and 8px over the screen's foot, so a ring drawn
   outside its stop stands whole there: a code card's box stood with its ring 4px past the foot (R9-03). */
html {
  scroll-padding-top: calc(var(--header-height) + 72px);
  scroll-padding-bottom: 8px;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: var(--text-sm);
  line-height: 1.45;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:disabled {
  cursor: default;
  opacity: 0.6;
}
button,
input,
select {
  color: inherit;
}
button {
  border: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
main:focus {
  outline: none;
}
::selection {
  color: var(--ink);
  background: var(--accent-pale);
}
p,
h1,
h2,
h3,
h4 {
  margin-top: 0;
}
.icon {
  flex-shrink: 0;
  vertical-align: middle;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 100;
  padding: 12px;
  background: var(--surface);
  color: var(--accent-ink);
}
.skip-link:focus {
  top: 10px;
}
.boot {
  min-height: 70vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
  padding: 40px;
}
.boot a {
  text-decoration: underline;
}
.boot p {
  margin: 0;
  color: var(--muted);
}
.boot-mark {
  display: block;
  width: 48px;
  height: 48px;
}
/* The mark is painted in ink through its own drawing, so it follows the theme as the name beside it does. */
.brand-mark,
.boot-mark {
  background: var(--ink);
  -webkit-mask: url("mark.svg") center / contain no-repeat;
  mask: url("mark.svg") center / contain no-repeat;
}
.boot-mark {
  -webkit-mask-image: url("mark-large.svg");
  mask-image: url("mark-large.svg");
}
@media (forced-colors: active) {
  .brand-mark,
  .boot-mark {
    background: CanvasText;
  }
}
.noscript {
  padding: 40px;
  text-align: center;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: calc(var(--sidebar-width) + 2px);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.2;
}
.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.brand-sub {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 400;
}
.top-actions {
  flex: none;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.search-button {
  display: flex;
  gap: 10px;
  align-items: center;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 8px 0;
}
kbd {
  font: var(--text-xs)  var(--mono);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 2px 5px;
}
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: transparent;
}
.icon-button:hover {
  background: var(--hover);
}
.mobile-menu {
  display: none;
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sunken);
  border-right: 1px solid var(--line);
}
.sidebar-head {
  padding: 14px 22px 4px;
}
.overview-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: var(--radius);
}
.overview-link > .icon:last-child {
  margin-left: auto;
  width: 13px;
}
.overview-link.selected {
  background: var(--accent-pale);
  color: var(--accent-ink);
}
.lesson-nav {
  overflow-y: auto;
  padding: 0 12px 20px;
  scrollbar-width: thin;
}
.nav-group {
  margin: 14px 0 19px;
}
.nav-group h2 {
  margin: 0 10px 9px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.lesson-link:hover,
.overview-link:hover {
  background: var(--hover);
  color: var(--ink);
}
.lesson-link.current {
  color: var(--accent-ink);
  background: var(--accent-pale);
}
.lesson-number {
  width: 22px;
  flex-shrink: 0;
  color: var(--faint);
  font-size: var(--text-xs);
  text-align: right;
}
.lesson-link.current .lesson-number {
  color: var(--accent-ink);
}
.lesson-link.completed .lesson-number {
  color: var(--ok);
}
.lesson-link.completed.current .lesson-number {
  color: var(--ok);
}
.lesson-number .icon {
  width: 12px;
  height: 12px;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 14px 22px 16px;
  border-top: 1px solid var(--line);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.progress-label strong {
  font-size: var(--text-sm);
  color: var(--ink);
  white-space: nowrap;
  font-weight: 600;
}
.progress-label strong span {
  color: var(--faint);
  font-size: var(--text-xs);
}
.progress-track {
  height: 4px;
  border-radius: var(--radius-sm);
  margin: 10px 0;
  background: var(--line);
  overflow: hidden;
}
.progress-track i {
  display: block;
  height: 100%;
  background: var(--accent);
}
/* Under the bar: what the asterisk in the list means, and the reset. A note joins them only when progress cannot be saved. */
.progress-foot {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--muted);
}
.progress-note {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--muted);
}
.progress-foot button {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-xs);
}
.sidebar-source {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  margin-top: 12px;
  color: var(--muted);
}
.sidebar-source .icon {
  width: 12px;
}

.main {
  margin-left: var(--sidebar-width);
  padding: 40px 56px 0;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}
/* The home page's opening: the title, the line under it, the button and the map. What follows keeps its own
   distance from it. */
.hero {
  padding: 24px 0 0;
}
.hero h1 {
  margin: 0 0 14px;
  font: 600 var(--text-display) / 1.1 var(--sans);
  letter-spacing: -0.02em;
}
/* One line under the title; the button under it stands 28 over the map. */
.hero-description {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.55;
}
.hero > div:first-child {
  margin-bottom: 28px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  /* A plain button is filled from the tokens, never with the browser's own grey. */
  border: 1px solid transparent;
  background: var(--sunken);
  color: var(--ink);
  transition: background 0.15s;
}
.button:not(.primary, .secondary):hover:not(:disabled) {
  background: var(--line);
}
.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
}
.primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}
.secondary {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.secondary:hover {
  background: var(--hover);
}
.hero-cta {
  font-size: var(--text-sm);
}
.path-section {
  margin-top: 32px;
}
.section-heading {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
/* Which lessons come in parts, and when such a lesson counts as completed. */
.section-heading:has(+ .path-note) { margin-bottom: 8px; }
.path-note {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: var(--text-sm);
}
.section-heading h2 {
  font: 600 var(--text-xl) / 1.25 var(--sans);
  letter-spacing: -0.01em;
  margin: 0;
}
.path-count {
  color: var(--muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}
/* The count ends on a link to the guide that maps each lesson to its chapter. */
.path-count a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-ink); }
.path-count a .icon { width: 12px; height: 12px; }
/* An asterisk after a lesson's name marks it optional; the line under the progress bar says so. */
.lesson-optional {
  margin-left: 3px;
  color: var(--muted);
  text-decoration: none;
}
.path-tier,
.stage-optional {
  display: inline-block;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
  margin-top: 8px;
}
.stage-checkpoint {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin: 14px 0;
}
.stage-checkpoint small {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--muted);
}
.path-group {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--line);
}
.path-group-title {
  display: block;
  padding-top: 10px;
}
.path-group-title h3 {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px;
}
.path-group-title p {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 10px;
}
.path-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.path-row:last-child {
  border-bottom-color: transparent;
}
.path-row:hover {
  background: var(--hover);
}
.path-row.path-unit {
  padding-bottom: 4px;
  border-bottom-color: transparent;
}
.path-row.path-unit:hover {
  background: none;
}
.path-row.is-part {
  padding-left: 44px;
}
.path-row.is-part .path-state {
  width: 22px;
}
/* A lesson's number or part letter, as a pill. The accent marks the core route, an outline a deep dive, and
   green a lesson that is done. */
.path-state {
  display: grid;
  place-items: center;
  width: 30px;
  height: 22px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent-ink);
  font: 600 var(--text-xs) / 1 var(--mono);
}
.is-optional .path-state {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
}
.is-complete .path-state {
  border-color: transparent;
  background: var(--ok-pale);
  color: var(--ok);
}
.path-row-copy {
  flex: 1;
  min-width: 0;
}
.path-row h4 {
  font-size: var(--text-body);
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.3;
}
.path-row p {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 0;
  line-height: 1.45;
}
.path-duration {
  font-size: var(--text-xs);
  color: var(--faint);
  white-space: nowrap;
  min-width: 6ch;
  line-height: 22px;
  text-align: right;
}
.path-arrow {
  width: 14px;
  color: var(--faint);
  margin-top: 4px;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding: 20px 0;
  margin-top: 48px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.page-footer a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.page-footer .icon {
  width: 12px;
  height: 12px;
}

.lesson-primary {
  min-width: 0;
}
/* Whatever a lesson opens with, a still section or its figure, stands one distance under the heading. */
.film-body .lesson-primary > :first-child {
  margin-top: 20px;
}
summary {
  cursor: pointer;
}

/* Under a lesson's figure: a section heading, the one idea in reading size, then the notes beside it. A note is a
   short name and one line, set in two columns, with the same space above and below every row. */
.keep {
  margin: 0 0 40px;
}
.keep > h2 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}
.keep-idea {
  max-width: var(--measure);
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.55;
}
/* Takeaways: one to three points at reading size, each a line of its own, at the measure of running text. */
.takeaway-points {
  max-width: var(--measure);
  margin: 0;
  padding-left: 1.25em;
  font-size: var(--text-body);
  line-height: 1.55;
}
.takeaway-points li + li {
  margin-top: 6px;
}
.takeaway-points li::marker {
  color: var(--faint);
}
.takeaway-points strong {
  font-weight: 600;
  color: var(--ink);
}
/* Code in the idea to keep and its notes is set as in every lesson's running text (DESIGN.md, Typography). */
.keep-idea code,
.takeaway-points code,
.keep-notes code {
  font: 400 var(--text-xs) / 1 var(--mono);
  color: var(--ink);
  padding: 1px 4px; border-radius: calc(var(--radius-sm) / 2); background: var(--stage);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* The idea, where it opens a lesson: the paragraph alone, over the figure it prepares. Its notes then follow the
   figure with no heading, so their first rule stands where the heading would. */
.keep-idea.is-opening {
  margin: 0 0 20px;
}
.keep.is-notes .keep-notes {
  margin-top: 0;
}
.keep-idea strong,
.keep-notes strong {
  font-weight: 600;
  color: var(--ink);
}
/* The notes are words on the page: rows between rules, with no frame. */
.keep-notes {
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
}
.keep-notes > div {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 4px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.keep-notes > div:last-child {
  border-bottom: 1px solid var(--line);
}
.keep-notes dt {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}
.keep-notes dd {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--muted);
}
@media (max-width: 720px) {
  .keep-notes > div {
    grid-template-columns: minmax(0, 1fr);
  }
}
.concepts {
  margin-bottom: 24px;
  border-top: 1px solid var(--line);
}
.concepts > section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.concepts h3 {
  margin: 0 0 4px;
  font-size: var(--text-body);
  font-weight: 600;
}
.concepts p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.55;
}

dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 16px 48px var(--shadow);
}
dialog::backdrop {
  background: var(--scrim);
}
/* The dialog's top stays where it opened while the results filter under the field, so the field never moves under
   the caret: it stands 12% down the window, and only its foot moves. */
#search-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: min(680px, calc(88dvh - 24px));
  margin-block: 12dvh auto;
}
.search-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 22px 12px;
}
.search-dialog-head h2 {
  font-size: var(--text-body);
  margin: 0;
  font-weight: 600;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  margin: 0 22px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--paper);
}
/* The field takes focus as every field does, with a soft ring in the accent. */
.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.search-field input {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  outline: none;
  font-size: var(--text-sm);
}
.search-results {
  overflow-y: auto;
  max-height: 410px;
  padding: 0 12px 12px;
}
.search-results > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-radius: var(--radius-sm);
  padding: 14px 11px;
  font-size: var(--text-sm);
  line-height: 1.55;
}
.search-results > a:hover {
  background: var(--hover);
}
/* The result the arrow keys stand on, which Enter opens. */
.search-results > a[aria-selected="true"] {
  background: var(--accent-pale);
}
.search-results small {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
}
.search-results > a .icon {
  color: var(--accent);
  width: 13px;
}
.search-empty {
  font-size: var(--text-sm);
  padding: 18px 12px;
  color: var(--muted);
}
.search-dialog-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: 7px;
}
.search-dialog-foot kbd {
  margin-left: auto;
}
#reset-dialog {
  width: min(440px, calc(100% - 32px));
}
.reset-content {
  padding: 30px;
}
.reset-content h2 {
  font-size: var(--text-lg);
  line-height: 1.4;
}
.reset-content p {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.reset-content > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

@media (min-width: 1600px) {
  .main {
    padding-left: max(60px, calc((100vw - var(--sidebar-width) - 1150px) / 2));
    padding-right: max(60px, calc((100vw - var(--sidebar-width) - 1150px) / 2));
  }
  .topbar .lesson-crumbs {
    margin-left: calc(max(60px, calc((100vw - var(--sidebar-width) - 1150px) / 2)) - 56px);
  }
}
/* A lesson's column holds its widest figure at its least zoom (timeline.mjs stageZoom) at every width from 1024px:
   the sidebar narrows, and the column's gutters with it, under 1340px, and under 1280px, where even so the column
   would be too narrow, the sidebar stands aside as a drawer, as on a phone (app.mjs). */
@media (max-width: 1340px) {
  :root {
    --sidebar-width: 222px;
  }
  .main {
    padding-left: 34px;
    padding-right: 34px;
  }
  .topbar {
    padding: 0 22px;
    gap: 16px;
  }
  .brand {
    min-width: calc(var(--sidebar-width) + 12px);
  }
  .topbar .lesson-crumbs {
    margin-left: -16px;
  }
  .top-actions {
    gap: 12px;
  }
  .path-group {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
  }
}
@media (max-width: 1279px) {
  :root {
    --sidebar-width: 0px;
  }
  .brand {
    min-width: 0;
  }
  .topbar .lesson-crumbs {
    margin-left: 0;
  }
  .mobile-menu {
    display: grid;
  }
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .menu-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px var(--shadow);
  }
}
@media (max-width: 1000px) {
  .search-button > span {
    display: none;
  }
  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }
  .path-group {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .path-group-title {
    padding-top: 0;
    padding-bottom: 12px;
  }
}
@media (max-width: 720px) {
  :root {
    --header-height: 56px;
  }
  .topbar {
    padding: 0 18px;
    gap: 16px;
  }
  .brand {
    min-width: 0;
    font-size: var(--text-body);
    gap: 9px;
  }
  .brand-mark {
    width: 28px;
    height: 28px;
  }
  .brand-sub {
    display: none;
  }
  .search-button kbd {
    display: none;
  }
  .top-actions {
    gap: 7px;
  }
  .search-button {
    padding: 8px;
  }
  .icon-button {
    width: 30px;
    height: 32px;
  }
  .main {
    padding: 28px 22px 0;
  }
  .hero h1 {
    font-size: var(--text-2xl);
  }
  .hero-description {
    font-size: var(--text-sm);
    margin-bottom: 23px;
  }
  .path-section {
    margin-top: 28px;
  }
  .path-row {
    gap: 11px;
    padding: 17px 2px;
  }
  .path-state {
    width: 26px;
    height: 26px;
    font-size: var(--text-xs);
  }
  .path-duration {
    display: none;
  }
  .path-arrow {
    width: 12px;
  }
  .page-footer {
    margin-top: 30px;
    padding: 23px 0;
    font-size: var(--text-xs);
    align-items: start;
  }
  .page-footer > span {
    max-width: 150px;
    line-height: 1.55;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Lesson page: one column. Text keeps a reading width; figures use the full width. */
.lesson-main {
  padding-top: 28px;
}
/* A lesson's heading is one line: its title, what it is about, and at the end the part of the runtime the lesson
   is about, as a link to that part on the home map. A line under the heading parts it from the lesson, as a line
   parts one section from the next. */
.lesson-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1049px;
  margin: 0 0 24px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
/* Where a lesson is in the course stands in the top bar, starting at the left edge of the page's column, and the
   bar's line parts it from the lesson. The crumb of the page itself is in ink. */
.lesson-crumbs {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.lesson-crumbs > [aria-current] { color: var(--ink); }
/* The path and the page's own crumb keep their width. Where the bar is short the stage's name gives way, ending in
   an ellipsis, with the whole name on hover: the stage's crumb clips its own name, and the row clips nothing, so the
   path's focus ring, flush at the row's edge, stands whole. At 761px, the narrowest bar that shows the path, the
   stage still keeps 190px of its name, so the row never overflows. */
.lesson-crumbs > * { flex: none; }
.lesson-crumbs > .lesson-stage { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.lesson-stage > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* After the breadcrumb, a short line and then the facts about the lesson, as quiet as the crumbs: that it is
   optional, how long it takes, and that it is done. Where the bar is too narrow to hold them beside the
   breadcrumb, they stand under the title instead. */
.topbar .lesson-meta { flex: none; flex-wrap: nowrap; white-space: nowrap; font-size: var(--text-sm); }
.topbar .lesson-meta::before { content: ""; width: 1px; height: 16px; margin: 0 20px 0 -12px; background: var(--line-strong); }
.lesson-title > .lesson-meta { display: none; flex-basis: 100%; margin-top: 6px; }
@media (max-width: 1340px) {
  .topbar .lesson-meta { display: none; }
  .lesson-title > .lesson-meta { display: flex; }
}
.lesson-part { flex: none; border-radius: var(--radius); text-decoration: none; }
.lesson-part > .sf-part { min-height: 32px; padding: 4px 12px; gap: 6px; font: 600 var(--text-sm) / 1.2 var(--sans); }
.lesson-part:hover > .sf-part { border-color: var(--muted); }
/* The lesson's part, then the lessons before and after it: two quiet square buttons as tall as the part. */
.lesson-head-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.lesson-steps { display: flex; gap: 4px; }
.lesson-step {
  display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
a.lesson-step:hover { background: var(--hover); }
span.lesson-step { color: var(--faint); border-color: var(--line); }
.rq-heading > .lesson-head-actions { flex: none; }
button.lesson-step { min-height: 0; padding: 0; cursor: pointer; }
button.lesson-step:hover { background: var(--hover); }
/* On the home map, thin grey rings spread from the part a lesson sent the reader to, and the part glows faintly. */
.e-ripple {
  fill: none; stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0;
  transform-box: fill-box; transform-origin: center;
  animation: e-ripple 1.7s cubic-bezier(0.2, 0.6, 0.3, 1) calc(var(--n) * 0.45s) 3;
}
@keyframes e-ripple {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(var(--sx), var(--sy)); }
}
.e-block.is-found { animation: e-found 1.7s ease-out 3; }
@keyframes e-found {
  0%, 100% { filter: none; }
  30% { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--ink) 28%, transparent)); }
}
@media (prefers-reduced-motion: reduce) {
  .e-ripple { animation: none; opacity: 1; }
  .e-block.is-found { animation: none; }
}
/* Each chevron travels with the crumb after it. */
.lesson-crumbs > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lesson-crumbs > a,
.lesson-crumbs > span {
  white-space: nowrap;
}
.lesson-crumbs a:hover {
  color: var(--accent);
}
.lesson-crumbs .icon {
  width: 12px;
  height: 12px;
  color: var(--faint);
}
/* A lesson's title and the line that says what it is about stand on one line, the line beside the title; where
   the column is too narrow for both, the line goes under the title. */
.lesson-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 20px;
  margin: 0;
}
.lesson-heading h1 {
  font: 600 var(--text-2xl) / 1.2 var(--sans);
  letter-spacing: -0.015em;
  margin: 0;
}
.lesson-heading .lesson-summary {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.5;
}
.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}
.lesson-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lesson-meta > span:not([hidden]) + span::before {
  content: "";
  width: 1px;
  height: 12px;
  margin: 0 12px;
  background: var(--line-strong);
}
.lesson-meta .icon {
  width: 14px;
  height: 14px;
}
.lesson-meta .lesson-done {
  color: var(--ok);
}
/* A lesson's body keeps the page at least this tall, so a short lesson still ends near the foot of the window. */
.lesson-body {
  min-height: calc(100vh - 480px);
}
.lesson-more {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.lesson-more > h2 {
  margin: 0 0 14px;
  font-size: var(--text-lg);
  font-weight: 600;
}
/* Two lists of things to go on to: in this book, and elsewhere. An entry is a linked title and one line under it. */
.more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}
.more-grid h3 {
  margin: 0 0 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}
.more-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.more-list li {
  display: grid;
  gap: 2px;
}
/* A title is text that wraps like any line: its icon rides on its last word, and a source's mark hangs before it so a
   second line starts under the title's first word. */
.more-list a {
  display: block;
  justify-self: start;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink);
}
.more-list a.has-logo {
  padding-left: 24px;
  text-indent: -24px;
}
.more-list a .more-end {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  white-space: nowrap;
}
/* Under the lists, one muted line asks for what made the page hard to read or use, and links to the form for it. */
.page-report {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.page-report a {
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}
.page-report .icon {
  margin-left: 4px;
  vertical-align: -2px;
}
.more-list .more-end .icon {
  margin-left: 6px;
  vertical-align: 0;
}
.more-list a .more-logo {
  display: inline-block;
  margin-right: 8px;
  vertical-align: -2px;
  text-indent: 0;
}
/* The Run trace entry reads as a link beside the others; it opens the run under the lists, and its chevron turns. */
.more-list .more-trace {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.more-trace .icon {
  transition: transform 160ms ease;
}
.more-trace[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}
@media (prefers-reduced-motion: reduce) {
  .more-trace .icon {
    transition: none;
  }
}
.more-list .more-trace:hover {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.more-list .more-trace:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.more-list a:hover {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.more-list .icon {
  width: 12px;
  height: 12px;
  color: var(--faint);
}
/* A source's mark, drawn in the text colour so it follows the theme. */
.more-logo {
  flex: none;
  width: 16px;
  height: 16px;
  margin-right: 2px;
  background: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}
.logo-claude {
  --logo: url("logo-claude.svg");
}
.logo-openai {
  --logo: url("logo-openai.svg");
}
.logo-pi {
  --logo: url("logo-pi.svg");
}
.logo-deepseek {
  --logo: url("logo-deepseek.svg");
}
.logo-opencode {
  --logo: url("logo-opencode.svg");
}
.logo-langchain {
  --logo: url("logo-langchain.svg");
}
.logo-langgraph {
  --logo: url("logo-langgraph.svg");
}
.logo-huggingface {
  --logo: url("logo-huggingface.svg");
}
.logo-cloudflare {
  --logo: url("logo-cloudflare.svg");
}
.more-list span {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--muted);
}
/* A command wraps before it rather than inside it, and inside it only between its words (`.cmd-word`), never after a
   flag's dashes; a word wider than its line still breaks. */
.more-list code {
  display: inline-block;
  max-width: 100%;
  font: var(--text-xs) / 1.5 var(--mono);
  overflow-wrap: anywhere;
}
.lesson-main .page-footer {
  align-items: center;
  margin-top: 40px;
  font-size: var(--text-sm);
}
.page-footer .footer-next {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}
.footer-next > span {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--muted);
}
.footer-next strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.footer-next:hover {
  color: var(--accent);
}
/* A lesson's last row: the lesson before it, the button that marks it complete, and the lesson after it. */
.lesson-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}
.page-footer .footer-prev {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  justify-self: start;
  font-weight: 600;
  color: var(--ink);
}
.footer-prev > span {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--muted);
}
.footer-prev strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.footer-prev:hover {
  color: var(--accent);
}
.lesson-footer .footer-next {
  justify-self: end;
}
.footer-done {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  font-weight: 600;
  color: var(--muted);
}
/* Once the lesson is complete, the next lesson is the way on: it takes the accent and a pale ground. */
.lesson-footer.is-done .footer-next {
  margin: -8px 0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-pale);
  color: var(--accent-ink);
}
.lesson-footer.is-done .footer-next > span {
  color: var(--accent-ink);
}
/* On a phone the button takes a row of its own, over the lessons before and after it. */
@media (max-width: 720px) {
  .lesson-footer {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "done done" "prev next";
    gap: 20px 16px;
    align-items: start;
  }
  .lesson-footer > .button,
  .lesson-footer > .footer-done {
    grid-area: done;
    justify-self: center;
  }
  .lesson-footer > .footer-prev {
    grid-area: prev;
  }
  .lesson-footer > .footer-next {
    grid-area: next;
  }
}

/* Sidebar stages fold; the current stage stays open. */
details.nav-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 4px 0;
  list-style: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
details.nav-group > summary::-webkit-details-marker {
  display: none;
}
details.nav-group > summary h2 {
  margin: 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}
details.nav-group > summary .icon {
  width: 12px;
  height: 12px;
  color: var(--faint);
  transition: transform 0.15s;
}
details.nav-group[open] > summary {
  margin-bottom: 4px;
}
details.nav-group[open] > summary .icon {
  transform: rotate(90deg);
}
details.nav-group:not([open]) {
  margin-bottom: 4px;
}
.lesson-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--muted);
  transition: background 0.15s;
}
/* A unit row carries the number; its parts sit one step in and carry a letter. */
.lesson-link.lesson-unit {
  color: var(--ink);
}
.lesson-link.is-part {
  padding-left: 42px;
}
.lesson-link.is-part .lesson-number {
  width: 12px;
  text-align: left;
}

@media (max-width: 1100px) {
  .more-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .footer-next {
    max-width: 60%;
  }
  .lesson-meta {
    gap: 6px 16px;
  }
  .lesson-meta > span:not([hidden]) + span::before {
    content: none;
  }
  /* A phone's top bar has room for the lesson's number alone, and a small phone's for the mark without the name. */
  .topbar .lesson-crumbs { flex: none; margin-left: 0; }
  .topbar .lesson-crumbs > :not([aria-current]), .topbar .lesson-crumbs > [aria-current] > .icon { display: none; }
}
@media (max-width: 420px) {
  /* The mark stays, a stop for Tab with its ring; only the name gives way. */
  .topbar:has(.lesson-crumbs) .brand > span:not(.brand-mark) { display: none; }
  .topbar:has(.lesson-crumbs) .brand { flex: none; }
}

.path-tier {
  margin-top: 6px;
}
/* A small label: names what follows, in the sentence case of the rest of the page. */
.label {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}
.film-body .concepts {
  border-top: 0;
}
.film-body .concepts > section {
  padding: 0;
  border-bottom: 0;
}
.film-body .concepts p {
  color: var(--ink);
}
.concept-rows {
  display: grid;
  gap: 2px;
  max-width: 720px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.keep-notes .concept-rows li {
  display: grid;
  /* The chip column fits "assistant", nine monospace characters. */
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: inherit;
  line-height: 1.5;
}
.concept-rows .is-aside {
  background: color-mix(in srgb, var(--actor-runtime) 10%, transparent);
}
.keep a,
.lead-text a,
.lead-note a,
.resource-table a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* What will appear later, such as a lesson's completion, keeps its room unseen until then. */
.is-later {
  visibility: hidden;
}
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}
p,
li {
  text-wrap: pretty;
}

/* A box that scrolls fades the edge past which it holds more (edges.mjs) over about a line, so a line it has scrolled
   past is never cut through its letters; a box whose left edge holds pinned names fades its right edge alone. While
   it has a keyboard's focus, or a tooltip of its own is open, the fade gives way, so the ring and the tip show
   whole. */
[data-fade] { --fade-in: var(--fade, 24px); --fade-out: calc(100% - var(--fade, 24px)); }
[data-fade="y"][data-more="below"] { mask-image: linear-gradient(to bottom, black var(--fade-out), transparent); }
[data-fade="y"][data-more="above"] { mask-image: linear-gradient(to top, black var(--fade-out), transparent); }
[data-fade="y"][data-more="above below"] {
  mask-image: linear-gradient(to bottom, transparent, black var(--fade-in), black var(--fade-out), transparent);
}
[data-fade="x"][data-more="right"], [data-fade="right"][data-more~="right"] {
  mask-image: linear-gradient(to right, black var(--fade-out), transparent);
}
[data-fade="x"][data-more="left"] { mask-image: linear-gradient(to left, black var(--fade-out), transparent); }
[data-fade="x"][data-more="left right"] {
  mask-image: linear-gradient(to right, transparent, black var(--fade-in), black var(--fade-out), transparent);
}
/* A box that scrolls both ways, as the Code card's code does on a phone, fades each edge it holds more past: one
   gradient on each axis, the box kept where both keep it. */
[data-fade="xy"]:not([data-more=""]) {
  mask-image:
    linear-gradient(to bottom, var(--more-above, black), black var(--fade-in), black var(--fade-out),
      var(--more-below, black)),
    linear-gradient(to right, var(--more-left, black), black var(--fade-in), black var(--fade-out),
      var(--more-right, black));
  mask-composite: intersect;
}
[data-fade="xy"][data-more~="above"] { --more-above: transparent; }
[data-fade="xy"][data-more~="below"] { --more-below: transparent; }
[data-fade="xy"][data-more~="left"] { --more-left: transparent; }
[data-fade="xy"][data-more~="right"] { --more-right: transparent; }
[data-fade]:focus-visible, [data-fade]:has([data-open] > [role="tooltip"]) { mask-image: none; }
/* A box that scrolls is a stop for the keyboard, named for what it holds (nameScroller, edges.mjs), and takes the
   book's ring as a button does, outside its edge, where nothing it holds can paint over it; a box as wide as a card
   that clips it, a workbench's pane, takes it just inside its edge, where the card cannot cut it. While it has the
   focus no edge fades, whatever rule fades it, so the ring is whole. */
[data-more]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; mask-image: none !important; }
:is(.so-map-frame, .tw-pane, .rq-output-panel):focus-visible { outline-offset: -2px; }
/* A figure's stage that scrolls is as wide as its card, and its cards and pinned names reach its edge, where they
   would paint over a ring drawn there. It stands in a frame that does not scroll, which draws the stage's ring just
   inside its edge while the stage has the focus, over everything the stage holds, so the ring stands whole however
   far the arrow keys scroll the stage under it. A tall figure's held foot still passes over it. */
.scroll-frame { position: relative; isolation: isolate; min-width: 0; }
.scroll-frame > :focus-visible { outline: none; }
.scroll-frame:has(> :focus-visible)::after {
  content: ""; position: absolute; inset: 0; z-index: 10; border: 2px solid var(--accent); border-radius: inherit;
  pointer-events: none;
}
/* A stage at the top of its card, under a title outside it, rounds its ring with the card's corners, which clip it. */
.walkthrough > .scroll-frame:first-child { border-radius: var(--radius-card) var(--radius-card) 0 0; }
/* A control in a box that scrolls comes into its view with room for its ring, as the focus brings it there. */
:where([data-more]) :is(a, button, summary, input, select, textarea, [tabindex]) { scroll-margin: 6px; }

/* Mobile sizes of what the desktop rules set from the scale. */
@media (max-width: 720px) {
  .lesson-heading h1 {
    font-size: var(--text-xl);
    line-height: 1.25;
  }
  .lesson-heading .lesson-summary {
    min-height: 0;
  }
  /* The part and the buttons beside it take a row of their own under the title, so the title keeps the width. */
  .lesson-heading, .request-embedded .rq-heading { flex-wrap: wrap; }
  .lesson-heading > .lesson-title, .rq-heading > div:first-child { flex: 1 1 100%; }
  .hero h1 {
    font-size: var(--text-2xl);
  }
}

/* The code behind a lesson and the command that runs its example: two tabs of one card under the figures. Each
   panel takes its own height, so the Run tab's few lines stand over no empty band the Code tab's taller box would
   leave; the tabs stay where they are, and only what is under the card moves. */
.code-card {
  display: grid; margin: 0 0 32px; overflow: hidden;
  border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--raise);
  outline: 1px solid transparent;
}
.code-tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.code-tabs [role="tab"] {
  min-height: 0; margin-bottom: -1px; padding: 12px 10px 10px; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; background: none; color: var(--muted); font: 600 var(--text-sm) / 1.2 var(--sans); cursor: pointer;
}
.code-tabs [role="tab"]:hover { color: var(--ink); background: none; }
.code-tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.code-panels { display: grid; }
.code-panel { min-width: 0; display: grid; gap: 12px; align-content: start; padding: 16px 20px 20px; }
.code-panel[aria-hidden="true"] { display: none; }
.code-snippet { min-width: 0; margin: 0; }
.code-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; }
.code-file a {
  display: inline-flex; align-items: center; gap: 5px; color: var(--ink); text-decoration: none;
  font: 600 var(--text-xs) / 1.3 var(--mono);
}
.code-file a:hover { text-decoration: underline; text-underline-offset: 3px; }
.code-file a .icon { width: 13px; height: 13px; color: var(--muted); }
.code-file > code { color: var(--muted); font: 400 var(--text-xs) / 1.3 var(--mono); }
.code-copy {
  display: inline-flex; align-items: center; gap: 6px; min-height: 0; height: 28px; margin-left: auto; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted);
  font: 600 var(--text-xs) / 1 var(--sans); cursor: pointer;
}
.code-copy:hover { background: var(--hover); color: var(--ink); }
.code-copy .icon { width: 14px; height: 14px; }
/* About 22 lines show; a longer snippet scrolls inside its box, the numbers with it, and a line longer than the box
   scrolls sideways; the box fades over 20px each edge it holds more past (`data-fade="xy"`), so a line is cut through
   its letters at neither its foot nor its right edge. Each line is a block that carries its own number, drawn by CSS so that
   selecting or copying the code never takes the numbers. */
.code-block {
  --fade: 20px;
  position: relative; max-height: calc(22 * 1.6em + 24px); margin: 0; padding: 12px 0; overflow: auto;
  border-radius: var(--radius); background: var(--chip); font: 400 var(--text-xs) / 1.6 var(--mono);
}
.code-block code {
  display: block; width: max-content; min-width: 100%; color: var(--ink); font: inherit; white-space: pre;
}
.code-line {
  display: block; padding-right: 14px; box-shadow: inset 2px 0 transparent;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.code-line::before {
  content: attr(data-line); display: inline-block; width: 4ch; margin-right: 16px; padding-left: 10px;
  color: var(--faint); text-align: right; user-select: none;
}
.code-line[data-folded]:not(.is-unfolded) { display: none; }
/* The lines between a stage's marks, folded while that stage is marked, under the pill at the end of the line before
   them. */
.code-line.is-gapped, .code-fold[hidden] { display: none; }
/* The lines the figure's stage runs: a pale band with the accent at its edge, the number in the accent. */
.code-line.is-step { background: var(--accent-pale); box-shadow: inset 2px 0 var(--accent); }
.code-line.is-step::before { color: var(--accent-ink); }
/* A fold, a docstring's or a block's: a chip at the end of its first line. Its words come from CSS, both laid in one
   cell. Where that line runs past the box, the pill stays at the box's right edge, over the line's end, so it is
   always in view and never cut. */
.code-fold {
  position: sticky; right: 10px; z-index: 1;
  display: inline-grid; vertical-align: 1px; min-height: 0; height: 20px; margin-left: 10px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--muted); font: 600 var(--text-xs) / 18px var(--sans); cursor: pointer;
  /* Where it stands over the line's end, the words fade into it rather than stop at its edge. */
  box-shadow: -18px 0 10px -4px var(--chip), 12px 0 0 2px var(--chip);
}
.code-line.is-step .code-fold { box-shadow: -18px 0 10px -4px var(--accent-pale), 12px 0 0 2px var(--accent-pale); }
.code-fold:hover { color: var(--ink); background: var(--hover); }
.code-fold > span { grid-area: 1 / 1; }
.code-fold > span::after { content: attr(data-text); }
.code-fold[aria-expanded="false"] > span:last-child, .code-fold[aria-expanded="true"] > span:first-child {
  visibility: hidden;
}
/* Which stage marks lines here, in the accent beside the code's name; every stage's words share one cell. */
.code-now { display: inline-grid; max-width: 100%; color: var(--accent-ink); font: 600 var(--text-xs) / 1.3 var(--sans); }
/* Where the stage's lines are more than a phone's line holds, they wrap, the cell as tall as the longest. */
.code-now > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 6px; }
.code-now > span[aria-hidden="true"] { visibility: hidden; }
.code-now i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--accent-pale); box-shadow: inset 2px 0 var(--accent); }
.code-about { max-width: 68ch; margin: 0; color: var(--ink); font: 400 var(--text-sm) / 1.5 var(--sans); }
.code-about code {
  padding: 1px 4px; border-radius: calc(var(--radius-sm) / 2); background: var(--chip); color: var(--ink);
  white-space: nowrap; font: 400 var(--text-xs) / 1 var(--mono);
}
.code-runners {
  display: inline-flex; width: max-content; gap: 2px; padding: 2px; border-radius: var(--radius); background: var(--chip);
}
.code-runners button {
  min-height: 0; height: 28px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); font: 600 var(--text-xs) / 1 var(--mono); cursor: pointer;
}
.code-runners [aria-checked="true"] {
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line);
}
.code-command {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 8px 8px 14px;
  border-radius: var(--radius); background: var(--chip);
}
/* The command wraps where the card is narrower than it, as on a phone, at its spaces first, so every word of it shows;
   Copy takes it as one line. */
.code-command > code {
  flex: 1; min-width: 0; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
  font: 400 var(--text-sm) / 1.4 var(--mono);
}
.code-command .code-copy { margin-left: 0; }
/* A command's words stand whole: it wraps between them, never inside a flag after its dashes, and inside a word only
   where the word is wider than its line, after a dot between its names, and inside a name of words (`.cmd-name`)
   only after an underscore, where the name is wider than its line too (commandWords). */
:is(.code-command, .more-list) :is(.cmd-word, .cmd-name) { display: inline-block; max-width: 100%; }
.code-note { margin: 0; color: var(--muted); font: 400 var(--text-xs) / 1.4 var(--sans); }
@media (max-width: 600px) {
  .code-panel { padding: 14px 14px 16px; }
  .code-copy span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .code-copy { padding: 0 8px; }
}

/* Code, wherever the book shows it: one colour per kind of token. highlight.mjs sets the classes. */
.syntax-key,
.syntax-keyword {
  color: var(--accent-ink);
}
.syntax-keyword,
.syntax-def {
  font-weight: 600;
}
.syntax-string {
  color: var(--ok);
}
.syntax-number {
  color: var(--warn);
}
.syntax-comment {
  color: var(--faint);
}
/* A line of code that wraps hangs two places in from its own start, so what wraps never reads as a line of its own.
   `--hang` is the line's indent (hangStyle in highlight.mjs); a line with padding of its own adds it to `--hang-at`. */
.code-hang, .tw-code-line, .so-tool-json-line {
  --hang-at: calc((var(--hang, 0) + 2) * 1ch);
  text-indent: calc(-1 * var(--hang-at));
  overflow-wrap: break-word;
}
.code-hang { display: block; padding-left: var(--hang-at); white-space: pre-wrap; }
