/* Lessons (/learn) and the "Learn it first" box on step pages. --c is the stage's hue, set on the page; every colour is a
   site.css token. The index is the route as a board; a lesson is one page of numbered stops on a thread. The marker
   (Excalifont) numbers and labels things, and the text stays quiet. */
.tick { color: var(--c, var(--go)); font-weight: 700; }

/* /learn: the route as a board */
.book-home { padding-top: 28px; padding-bottom: 48px; }
.book-head h1 { font-size: clamp(34px, 4.6vw, 56px); }
.book-head .lead { margin-top: 12px; font-size: 17px; max-width: 48em; }
.lvpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
.lvpick span { font: 400 20px/1 var(--hand); color: var(--mute); margin-right: 6px; }
.lvpick button, .content .lv button, .lvbox .lv button { font: inherit; font-size: 14px; font-weight: 600; min-height: 36px; padding: 6px 13px; border: 0;
  border-radius: 999px; color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line-2); cursor: pointer; }
.lvpick button:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.lvpick button[aria-pressed="true"] { background: var(--ink); color: var(--board); box-shadow: none; }

/* each stage is a leg of the route: a thread in its hue with a node at its head (filled when every lesson in it is read),
   down the left on a phone, across the top on a laptop, so the four legs read as the home's ring unrolled */
.board { margin-top: 24px; display: grid; gap: 18px; }
.lane { position: relative; padding-left: 26px; min-width: 0; }
.lane::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: -18px; width: 3px; border-radius: 2px; background: var(--c); }
.lane:last-child::before { bottom: 0; }
.lane::after { content: ""; position: absolute; left: 0; top: 4px; width: 17px; height: 17px; border-radius: 50%; background: var(--board); box-shadow: inset 0 0 0 3px var(--c); }
.lane.all-read::after { background: var(--c); }
.lane h2 { font: 400 26px/1.1 var(--hand); letter-spacing: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.lane h2 small { font: 600 14px/1.2 "Mona Sans", sans-serif; color: var(--mute); font-variant-numeric: tabular-nums; }
.lane ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lt { display: grid; grid-template-rows: 1fr auto; border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.lt > a:first-child { display: flex; flex-wrap: wrap; align-content: space-between; gap: 6px 10px; min-height: 80px; padding: 10px 12px 9px;
  border-top: 3px solid var(--c); color: inherit; text-decoration: none; transition: background .15s; }
.lt a:hover { background: color-mix(in srgb, var(--c) 9%, transparent); }
.lt a:focus-visible { outline-offset: -3px; }
.lt .tt { flex: 1 0 100%; font-weight: 650; font-size: 16px; line-height: 1.3; }
.lt .tm, .lt .mk { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.lt .mk:empty { display: none; }
.lt .mk { font-weight: 650; }
.lt[data-v="read"] .mk { color: var(--c); }
.lt[data-v="skim"] .mk { color: var(--ink); }
/* a lesson to skip at your level steps back: no card, a dashed edge, a muted title (still 4.5:1) */
.lt[data-v="skip"] { background: transparent; backdrop-filter: none; box-shadow: inset 0 0 0 1.5px var(--line); }
.lt[data-v="skip"] > a:first-child { border-top-style: dashed; }
.lt[data-v="skip"] .tt { color: var(--mute); font-weight: 600; }
.lt a.is-read .tt { color: var(--mute); }
.lt .dp { display: block; border-left: 3px solid var(--c); padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--mute); text-decoration: none; border-top: 1px dashed var(--line-2); }
.lt .dp:hover { color: var(--ink); }
@media (min-width: 1000px) {
  .board { grid-template-columns: 1fr 1fr 2fr 1fr; gap: 0 14px; margin-top: 30px; }
  .lane { padding: 30px 0 0; }
  .lane::before { left: 0; right: -14px; top: 7px; bottom: auto; width: auto; height: 3px; }
  .lane:last-child::before { right: 0; }
  .lane::after { top: 0; }
  .lane h2 { flex-direction: column; align-items: flex-start; } /* a narrow lane would wrap its count under some heads only */
  .lane ol { grid-template-columns: 1fr; }
  .lane:nth-child(3) ol { grid-template-columns: 1fr 1fr; }
  .lt > a:first-child { min-height: 78px; }
}
.shelf { margin-top: 30px; }
.shelf h2 { font: 400 24px/1.1 var(--hand); letter-spacing: 0; }
.shelf ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.shelf a { display: inline-block; padding: 6px 13px; border-radius: 999px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
  color: inherit; text-decoration: none; font-size: 14px; font-weight: 600; }
.shelf a:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.book-home .beta { margin-top: 26px; font-size: 14px; color: var(--mute); max-width: 62ch; }

/* a lesson: reading progress under the nav (browsers with scroll-driven animations; the rest simply don't show it) */
@supports (animation-timeline: scroll()) {
  .chapter-wrap::before { content: ""; position: fixed; inset: 0 0 auto; height: 3px; z-index: 30; background: var(--c);
    transform-origin: 0 50%; animation: read-bar linear both; animation-timeline: scroll(root); }
  @keyframes read-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
.chapter-wrap { padding-top: 20px; padding-bottom: 64px; }
.ch-head { max-width: 900px; }
.ch-part { font-size: 14px; color: var(--mute); display: flex; flex-wrap: wrap; margin: 0; }
.ch-part > * + *::before { content: "·"; display: inline-block; margin: 0 8px; color: var(--mute); }
.ch-part a { color: var(--mute); }
.ch-part span { color: var(--c); font-weight: 650; }
.ch-head h1 { font-size: clamp(32px, 5vw, 56px); margin-top: 8px; }
.ch-meta { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; font-size: 15px; font-weight: 600; color: var(--mute); font-variant-numeric: tabular-nums; }
.ch-meta li + li::before { content: "·"; margin: 0 8px; }
/* the level line: "At SDE-2: read", the six chips behind "Change" */
.lvbox { margin-top: 12px; }
.lvbox > summary { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 7px 15px; border-radius: 999px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 650; background: color-mix(in srgb, var(--c) 12%, var(--paper)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.lvbox > summary::-webkit-details-marker { display: none; }
.lvbox .chg { font-weight: 500; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.lvbox .callout { margin: 10px 0 0; max-width: 70ch; }
.pickup { margin: 12px 0 0; font-size: 15px; }
.pickup a { color: var(--ink); font-weight: 600; text-decoration-color: var(--c); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ch-do { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.ch-do a { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 650; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--c) 14%, var(--paper)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.ch-do a:hover { box-shadow: inset 0 0 0 1.5px var(--c); }

.ch-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); margin-top: 32px; align-items: start; }
/* the rail: the stops on a thread, seen ones filled, the one you're reading ringed. On a phone it is the "Stops" sheet. */
.ch-toc { font-size: 14px; }
.ch-toc .sh { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; color: var(--mute); }
.ch-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.ch-toc li { position: relative; }
.ch-toc li:not(.src) { counter-increment: s; }
.ch-toc li::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.ch-toc li:first-child::before { top: 15px; }
.ch-toc li:last-child::before { bottom: auto; height: 15px; }
.ch-toc li.seen::before { background: var(--c); }
.ch-toc a { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 8px 6px 32px; border-radius: 10px;
  color: var(--mute); text-decoration: none; line-height: 1.35; transition: background .15s, color .15s; }
.ch-toc a::before { content: counter(s); position: absolute; left: 0; top: 5px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: 400 12px/1 var(--hand); color: var(--mute); background: var(--board); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.ch-toc .src a::before { content: ""; width: 8px; height: 8px; left: 6px; top: 11px; }
.ch-toc li.seen a::before { background: var(--c); color: var(--board); box-shadow: none; }
.ch-toc a:hover { color: var(--ink); background: var(--paper); }
.ch-toc a:focus-visible { outline-offset: -2px; }
.ch-toc a[aria-current] { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--c) 10%, transparent); }
.ch-toc a[aria-current]::before { color: var(--ink); background: var(--board); box-shadow: inset 0 0 0 2px var(--c), 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.ch-toc small { font-size: 12px; font-weight: 500; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-toc .done-box { margin: 16px 0 0; padding: 0; background: none; box-shadow: none; }
.ch-toc .done-box .btn { font-size: 14px; padding: .55em 1.05em; }
.ch-toc .done-box .fine { display: none; }
.ch-toc > .fine { margin: 10px 0 0; font-size: 12px; color: var(--mute); }
.ch-toc .all { margin-top: 6px; font-size: 13px; }
@media (min-width: 981px) {
  /* a laptop shows the rail in place: undo the popover's top-layer box */
  .ch-toc[popover] { display: block; position: sticky; inset: auto; top: 88px; margin: 0; padding: 0 4px 0 0; border: 0; width: auto; height: auto;
    max-height: calc(100vh - 110px); overflow: auto; overscroll-behavior: contain; background: none; color: inherit; }
  .ch-toc .sh button { display: none; }
}
@media (max-width: 980px) {
  .ch-grid { grid-template-columns: minmax(0, 1fr); margin-top: 22px; }
  .ch-toc[popover] { position: fixed; inset: auto 0 0; margin: 0; width: 100%; max-width: none; max-height: 82dvh; overflow: auto; overscroll-behavior: contain;
    padding: 18px var(--gut) calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink);
    box-shadow: 0 -24px 60px -24px color-mix(in srgb, var(--board) 80%, transparent), inset 0 1px 0 var(--line-2); }
  .ch-toc[popover]::backdrop { background: color-mix(in srgb, var(--board) 60%, transparent); }
  .ch-toc .sh b { font: 400 22px/1.1 var(--hand); color: var(--ink); }
  .ch-toc a { padding-block: 9px; font-size: 15px; }
  .ch-toc a::before { top: 8px; }
  .ch-toc .src a::before { top: 14px; }
  .ch-toc:popover-open { transition: translate .2s ease-out; }
  @starting-style { .ch-toc:popover-open { translate: 0 48px; } }
}
/* the phone's stop bar: which stop, previous and next, and the sheet. It reserves its height, so it never covers text. */
.stopbar { display: none; }
@media (max-width: 980px) {
  .stopbar { position: fixed; inset: auto 0 0; z-index: 25; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
    padding: 7px var(--gut) calc(7px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--board) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); box-shadow: 0 -1px 0 var(--line); }
  body:has(.stopbar) { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  html:has(.stopbar) { scroll-padding-bottom: 76px; }
  .stopbar a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
  .sb-prev { grid-column: 1; justify-self: start; } /* fixed columns: a hidden Previous or Next keeps Stops centred */
  .sb-mid { grid-column: 2; }
  .sb-prev::before { content: "←" / ""; color: var(--c); }
  .sb-next { grid-column: 3; justify-self: end; }
  .sb-next::after { content: "→" / ""; color: var(--c); }
  .sb-mid { display: grid; justify-items: center; min-height: 44px; padding: 3px 20px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; color: var(--ink);
    background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--c); }
  .sb-n { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
  .sb-s { font-size: 12px; color: var(--mute); line-height: 1.2; }
}
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; max-width: calc(240px + 70ch + 56px); }
.pager a { display: grid; gap: 4px; padding: 18px 20px; border-radius: 18px; background: var(--paper); text-decoration: none; color: inherit; font-weight: 650;
  box-shadow: var(--shadow); transition: transform .15s; }
.pager a:hover { transform: translateY(-2px); }
.pager a span { font-weight: 500; font-size: 13px; color: var(--mute); }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* lesson text, at a 70-character measure */
.content { font-size: 17px; line-height: 1.7; min-width: 0; max-width: 70ch; counter-reset: s; }
.content > :first-child { margin-top: 0; }
.content h2 { font-size: clamp(24px, 2.6vw, 30px); font-stretch: 110%; letter-spacing: -.015em; margin: 48px 0 14px; scroll-margin-top: 90px; }
.content .nx + h2 { margin-top: 30px; }
.content h2:not(.src) { counter-increment: s; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
/* each stop's number sits in a node in the stage's hue, like the rail's */
.content h2:not(.src)::before { content: counter(s); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; margin-top: -1px;
  font: 400 21px/1 var(--hand); letter-spacing: 0; color: var(--c); box-shadow: inset 0 0 0 2.5px var(--c); }
.content h3 { font-size: 21px; margin: 34px 0 10px; scroll-margin-top: 90px; }
.content h4 { font-size: 17px; font-weight: 700; margin: 22px 0 6px; letter-spacing: 0; }
.content p, .content ul, .content ol, .content dl { margin: 0 0 14px; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin: 4px 0; }
.content li::marker { color: var(--c); }
.content a { color: inherit; text-decoration-color: var(--c); text-decoration-thickness: 2px; }
.content code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 5px; padding: .08em .35em; }
.content .lede { font-size: clamp(19px, 1.9vw, 22px); line-height: 1.55; color: var(--ink); font-weight: 450; margin-bottom: 16px; }
.content pre { margin: 18px 0; padding: 16px 18px; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto;
  font: 400 14px/1.55 ui-monospace, "SF Mono", Menlo, monospace; font-variant-ligatures: none; }
.content pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.content blockquote { margin: 16px 0; padding-left: 16px; border-left: 3px solid var(--line-2); }
/* "Next stop", at the end of each stop */
.content .nx { margin: 22px 0 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
.content .nx a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; color: var(--mute); text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--line-2); }
.content .nx a::after { content: "↓" / ""; color: var(--c); }
.content .nx a:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--c); }

/* boxes: a marker label (never shouted in capitals), a quiet surface, and a shape that says what kind of box it is */
:is(.content, .lvbox) :is(.callout, .example, .verdict, .glance, .ask) { margin: 26px 0; padding: 18px 22px 6px; border-radius: 18px;
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
:is(.content, .lvbox) .tag { display: block; font: 400 19px/1.2 var(--hand); color: var(--c); margin: 0 0 8px; }
:is(.content, .lvbox) .callout { box-shadow: inset 4px 0 0 var(--c), inset 0 0 0 1px var(--line); }
.lvbox p { margin: 0 0 14px; font-size: 15px; line-height: 1.6; }
.content .callout.warn { background: color-mix(in srgb, var(--beh) 7%, var(--paper)); box-shadow: inset 4px 0 0 var(--beh); }
.content .callout.warn .tag { color: var(--beh); }
/* an invented example is drawn, not printed: a dashed marker outline */
.content .example { background: transparent; box-shadow: none; outline: 2px dashed color-mix(in srgb, var(--c) 55%, var(--line)); outline-offset: -2px; overflow-x: auto; }
.content .verdict { background: var(--ink); color: var(--board); box-shadow: none; }
.content .verdict .tag, .content .verdict a { color: var(--board); }
.content p.for { font-style: italic; font-size: 15px; color: var(--mute); margin-top: -6px; }
/* who should read it: one chip per level; read is solid, skim outlined, skip faded. A chip sets your level. */
.lv { list-style: none; padding: 0; margin: 4px 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.lv li { margin: 0; }
.lv button { box-shadow: inset 0 0 0 1.5px var(--ink); }
.lv-read button { background: var(--ink); color: var(--board); }
.lv-skip button { box-shadow: inset 0 0 0 1.5px var(--line-2); color: var(--mute); }
.lv-skip button b { text-decoration: line-through; text-decoration-color: var(--line-2); }
.lv button[aria-pressed="true"] { outline: 3px solid var(--c); outline-offset: 2px; }

/* folds: tables, code and examples ship open; learn.js closes the tall ones. The summary names what is inside. */
.content details.fold:not(.example) { margin: 20px 0; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; }
.content .fold > summary { position: sticky; left: 0; display: flex; align-items: baseline; gap: 4px 10px; cursor: pointer; list-style: none; }
.content .fold:not(.example) > summary { padding: 11px 16px; font-size: 14px; font-weight: 650; line-height: 1.45; color: var(--mute); }
.content .fold:not(.example)[open] > summary { box-shadow: inset 0 -1px 0 var(--line); }
.content .fold > summary:hover { color: var(--ink); }
.content :is(.fold, .na) > summary::-webkit-details-marker { display: none; }
.content :is(.fold, .na) > summary::before { content: ""; flex: none; width: 7px; height: 7px; border: solid var(--c); border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(-45deg); transition: transform .15s; }
.content :is(.fold, .na)[open] > summary::before { transform: translateY(-4px) rotate(45deg); }
.content .fold > pre { margin: 0; border-radius: 0 0 16px 16px; box-shadow: none; background: none; }
.content .fold > .sources { padding: 10px 16px 4px; }
.content .example > summary { flex-wrap: wrap; margin-bottom: 8px; }
.content .example > summary .tag { margin: 0; }
.content .example > summary small { font-size: 13px; font-weight: 600; color: var(--mute); }
.content .example:not([open]) { padding-bottom: 12px; }
.content .example:not([open]) > summary { margin: 0; }
/* "Not advice": one line that opens */
.content .na { margin: 0 0 22px; font-size: 15px; }
.content .na > summary { display: inline-flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; color: var(--mute); }
.content .na > summary::before { border-color: var(--beh); }
.content .na > summary:hover { color: var(--ink); }
.content .na .callout { margin: 10px 0 0; }
.content .na .tag { display: none; }

/* tables: rows on a laptop; on a phone each row is a small card (the fold's summary names the columns) */
.content table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.content th { text-align: left; font-weight: 650; padding: 10px 14px; background: color-mix(in srgb, var(--c) 9%, var(--paper)); border-bottom: 1px solid var(--line); }
.content td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.content tbody tr:hover td { background: color-mix(in srgb, var(--c) 5%, transparent); }
.content td.num, .content th.num { text-align: right; }
.content td.box { width: 2.2em; text-align: center; }
.content td.box::before { content: "\2610"; }
@media (max-width: 600px) {
  .content table, .content tbody, .content tr, .content td, .content th { display: block; width: 100%; }
  .content thead { display: none; }
  .content .fold > table { padding: 2px 10px 8px; }
  .content tr { margin: 8px 0; padding: 6px 12px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--line); }
  .content td, .content th { padding: 3px 0; border: 0; text-align: left; }
  .content td:first-child { font-weight: 650; }
  .content td.num { text-align: left; }
  .content td.box { width: auto; text-align: left; }
  .content tbody tr:hover td { background: none; }
}

/* figures: drawn on a dotted whiteboard. The source draws in ink #14171f, accent #1e3bd4 and soft #f3f5f9; map them to the theme */
.content figure { position: relative; margin: 30px 0; padding: 24px 22px 16px; border-radius: 20px; box-shadow: inset 0 0 0 1px var(--line);
  background: radial-gradient(circle, var(--line-2) 1.1px, transparent 1.5px) 0 0 / 20px 20px, var(--paper); }
.content figure svg { display: block; width: 100%; height: auto; }
.content figure.fig.sm svg { width: 78%; margin: 0 auto; }
.content figcaption { font-size: 14px; line-height: 1.5; color: var(--mute); margin: 14px -22px -16px; padding: 10px 22px 14px; border-top: 1px dashed var(--line);
  background: var(--paper); border-radius: 0 0 20px 20px; }
@media (max-width: 600px) { .content figure { padding: 50px 14px 16px; } .content figcaption { margin-inline: -14px; padding-inline: 14px; } }
.content figure svg text { font-family: "Mona Sans", system-ui, sans-serif; fill: var(--ink); }
.content figure svg .ln { stroke: var(--ink); fill: none; }
.content figure svg .ac { stroke: var(--c); fill: none; }
.content figure svg .fl { fill: var(--paper); stroke: var(--ink); }
.content figure svg .fa { fill: var(--c); }
.content figure svg [fill="#14171f"] { fill: var(--ink); }
.content figure svg [stroke="#14171f"] { stroke: var(--ink); }
.content figure svg [fill="#1e3bd4"] { fill: var(--c); }
.content figure svg [stroke="#1e3bd4"] { stroke: var(--c); }
.content figure svg [fill="#f3f5f9"], .content figure svg [fill="#fff"] { fill: var(--paper); }
.content figure svg [stroke="#fff"] { stroke: var(--paper); }
/* some labels set their colour inline; accent text is darkened (light) or lightened (dark) so it reads like body text */
.content figure svg [style*="fill:#14171f"] { fill: var(--ink) !important; }
.content figure svg [style*="stroke:#14171f"] { stroke: var(--ink) !important; }
.content figure svg [style*="fill:#1e3bd4"] { fill: var(--c) !important; }
.content figure svg [style*="stroke:#1e3bd4"] { stroke: var(--c) !important; }
.content figure svg text[fill="#1e3bd4"], .content figure svg text[style*="fill:#1e3bd4"] { fill: color-mix(in srgb, var(--c) 70%, var(--ink)) !important; }
.content figure svg [style*="stroke:#fff"] { stroke: var(--paper) !important; }
.content figure svg [style*="fill:#fff"], .content figure svg [style*="fill:#f3f5f9"] { fill: var(--paper) !important; }
.content .zoom { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); cursor: zoom-in; opacity: .75; transition: opacity .15s; }
.content figure:hover .zoom, .content .zoom:focus-visible { opacity: 1; }
.content .zoom svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* the full-size diagram: as wide as the screen allows, and never narrower than its labels can bear */
.fig-zoom { width: min(1200px, 96vw); max-width: none; max-height: 92vh; padding: 14px; border: 0; border-radius: 22px; background: var(--board); color: var(--ink);
  font-size: 17px; overflow: auto; }
.fig-zoom::backdrop { background: color-mix(in srgb, var(--board) 60%, transparent); backdrop-filter: blur(3px); }
.fig-zoom form { position: sticky; left: 0; display: flex; justify-content: flex-end; margin-bottom: 10px; }
.fig-zoom figure { margin: 0; min-width: 760px; }

/* the end of a lesson: mark it read, then use it */
.content .end { margin-top: 48px; display: grid; gap: 16px; }
.done-box { padding: 18px 22px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.done-box .btn:disabled { opacity: 1; cursor: default; color: var(--ink); background: color-mix(in srgb, var(--c) 18%, var(--paper)); box-shadow: inset 0 0 0 1.5px var(--c); }
.done-box .fine { margin: 0; font-size: 14px; line-height: 1.5; color: var(--mute); flex: 1 1 260px; }
.done-box .linkish { font-size: 14px; color: var(--ink); }

/* sources, at the end of a lesson */
.content h2.src { font-size: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.content .sources { font-size: 14px; color: var(--mute); overflow-wrap: anywhere; }

/* step pages: "Learn it first" */
.learn { margin: 28px 0; }
.learn h2 { font-size: 24px; }
.learn .lessons { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.learn .lessons a { display: grid; gap: 2px; padding: 14px 18px; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow);
  border-left: 4px solid var(--c, var(--sd)); text-decoration: none; color: inherit; }
.learn .lessons small { font-size: 13px; font-weight: 650; color: var(--c, var(--sd)); font-variant-numeric: tabular-nums; }
.learn .lessons b { font-size: 18px; }
.learn .lessons span:not(.tick):not(.vh) { font-size: 15px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.learn .lessons a:hover b { text-decoration: underline; text-decoration-color: var(--c, var(--sd)); }
.learn .refs { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 15px; }
.learn .refs a { color: inherit; text-decoration-color: var(--c, var(--sd)); text-decoration-thickness: 2px; }

@media (prefers-reduced-motion: reduce) {
  .chapter-wrap::before { display: none; }
  .pager a, .lt a, .ch-toc a, .ch-toc:popover-open, :is(.fold, .na) > summary::before { transition: none; }
  .pager a:hover { transform: none; }
}
