/* Site layer on top of Tufte CSS (tufte.css). Tokens first; components after.
   Rule: color carries meaning. --accent marks what the reader manipulates or the
   first of two compared quantities; --second marks the other. Nothing else is colored. */

:root {
  /* Type sizes: page title (h1), section heading (h2), --text for the text, and --small (below). */
  /* Faces. --font-text: what is read. --font-label: controls, block names, navigation.
     --font-data: text inside charts and diagrams. A skin (css/skins/) may change them. */
  --font-text: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-label: var(--font-text);
  --font-data: var(--font-text);
  --text: 16pt;
  /* A fourth size (owner decision 2026-11-20), used only for chart text, sidenotes, and the top line. */
  --small: 13pt;
  --paper: #fffff8;
  --ink: #111111;
  --quiet: #5f5e57;
  --rule: #d9d6c9;
  --faint: #efede2;
  --accent: #2b4fa0;
  --second: #a8690f;
  --good: #3c6e3a;
  --bad: #9e2a20;
  --focus: #2b4fa0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161614;
    --ink: #e6e4dc;
    --quiet: #a3a196;
    --rule: #3b3a34;
    --faint: #2c2b27;
    --accent: #8fa8ec;
    --second: #dba64a;
    --good: #8cc488;
    --bad: #e08a80;
    --focus: #8fa8ec;
  }
}
:root[data-theme="dark"] {
  --paper: #161614; --ink: #e6e4dc; --quiet: #a3a196; --rule: #3b3a34; --faint: #2c2b27;
  --accent: #8fa8ec; --second: #dba64a; --good: #8cc488; --bad: #e08a80; --focus: #8fa8ec;
}

body { background-color: var(--paper); color: var(--ink); }
a:link, a:visited { color: inherit; }
/* Links in running text and sidenotes: a plain underline in the text color. Tufte CSS draws its
   underline with gradients and text shadows in fixed paper colors, which do not follow the theme
   tokens and do not apply to visited links. */
a:link, a:visited {
  background: none; text-shadow: none;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em;
}
.sidenote, .marginnote { overflow-wrap: break-word; }
::selection { background: var(--faint); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Numbers in readouts and tables line up. */
.num, .readout, table, .tool output { font-variant-numeric: lining-nums tabular-nums; }

/* Top line: where you are, and the way back to the contents. */
.topline {
  width: 55%; display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 2rem; font-size: var(--text); color: var(--quiet);
}
.topline a { text-decoration: none; background: none; color: var(--quiet); }
.topline a:hover { color: var(--ink); }
.topline .core-dot { margin-left: 0.4rem; }
article { padding-top: 1.5rem; }
h1 { margin-top: 1.5rem; }
h1 .pageno { color: var(--quiet); margin-right: 0.6rem; }

/* Core-path marker: a small filled dot, explained on the contents page. */
.core-dot {
  display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--ink); vertical-align: 0.15rem;
}

/* Colored words in prose that name a figure element. */
.c-accent { color: var(--accent); }
.c-second { color: var(--second); }

/* Interactive tool: spans text column and margin. */
.tool { width: 90%; margin: 2rem 0 2.5rem; clear: right; }
figure.multiples, ol.tasks, .check, .explain, .takeaway { clear: right; }
.katex-display { width: 55%; overflow-x: auto; overflow-y: hidden; padding: 0.2rem 0; }
.tool .panel { margin-bottom: 2.2rem; }
.tool h3 { margin-top: 0.4rem; margin-bottom: 0.6rem; font-size: var(--text); }
.tool .panel-note { font-size: var(--text); line-height: 1.5; color: var(--quiet); width: 61%; margin: 0.2rem 0 0.8rem; }
.tool div.row { display: flex; flex-wrap: wrap; gap: 1.6rem; align-items: flex-start; }
.tool .controls { display: flex; flex-direction: column; gap: 0.9rem; min-width: 15rem; max-width: 19rem; flex: 0 1 19rem; }
.tool .stage { flex: 1 1 26rem; min-width: 0; }
.tool svg, .tool canvas, figure svg { display: block; max-width: 100%; height: auto; touch-action: none; }
.readout { font-size: var(--text); line-height: 1.5; width: 61%; margin: 0.8rem 0 0; }
.readout b { font-weight: 600; }

/* Controls */
.ctl { display: flex; flex-direction: column; gap: 0.25rem; font-size: var(--text); }
.ctl .ctl-head { display: flex; justify-content: space-between; gap: 1rem; }
.ctl .ctl-head output { color: var(--ink); }
.ctl .ctl-name { color: var(--quiet); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 1.4rem; background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--quiet); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--quiet); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 0.95rem; height: 0.95rem; border-radius: 50%;
  background: var(--accent); margin-top: -0.45rem; border: 0;
}
input[type="range"]::-moz-range-thumb { width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--accent); border: 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
button, .seg button {
  font: inherit; font-size: var(--text); color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 3px; padding: 0.15rem 0.65rem; cursor: pointer;
}
button:hover { border-color: var(--quiet); }
.seg button[aria-pressed="true"], button.primary { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }

/* Tasks: predict, then try, then see what to notice. */
ol.tasks { width: 61%; padding-left: 1.4rem; }
ol.tasks > li { margin-bottom: 1.3rem; }
.task .prompt { margin: 0; }
.task .choices { margin: 0.5rem 0 0.2rem; }
.task .choices-label { font-size: var(--text); color: var(--quiet); margin-right: 0.5rem; }
.task .after { display: none; font-size: var(--text); line-height: 1.5; margin-top: 0.4rem; }
.task.predicted .after { display: block; }
.task .notice { display: none; border-left: 2px solid var(--rule); padding-left: 0.8rem; margin-top: 0.5rem; }
.task.revealed .notice { display: block; }
.task button[aria-pressed="true"] { border-color: var(--ink); }

/* Check questions and self-explanation. */
.check, .explain, .takeaway {
  width: 55%; border-top: 1px solid var(--rule); padding-top: 0.8rem; margin-top: 2rem;
}
.check .label, .explain .label, .takeaway .label { font-style: italic; color: var(--quiet); font-size: var(--text); }
.check .q { margin-top: 0.4rem; margin-bottom: 0.6rem; }
.check .feedback { display: none; margin-top: 0.7rem; }
.check.answered .feedback { display: block; }
.check .verdict-right { color: var(--good); }
.check .verdict-wrong { color: var(--bad); }
.check button.chosen { border-color: var(--ink); }
.explain textarea {
  width: 100%; min-height: 4.5rem; font: inherit; font-size: var(--text); line-height: 1.5;
  color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 3px; padding: 0.4rem 0.5rem;
}
.explain .saved { font-size: var(--text); color: var(--quiet); }
.takeaway p { margin-top: 0.4rem; }

/* Page-end navigation. */
.pagenav { width: 55%; margin: 3rem 0 4rem; font-size: var(--text); }
.pagenav .row { display: flex; justify-content: space-between; gap: 2rem; }
.pagenav .row + .row { margin-top: 1.4rem; }
.pagenav a { text-decoration: none; background: none; }
.pagenav a:hover { text-decoration: underline; }
.pagenav .dir { display: block; color: var(--quiet); font-size: var(--text); }
.pagenav .next { text-align: right; }

/* Charts: no frames or grids; quiet axes; labels on the lines. */
.chart text { font-family: var(--font-data); fill: var(--quiet); font-size: var(--text); font-variant-numeric: lining-nums tabular-nums; }
.chart .axis path, .chart .axis line { stroke: var(--rule); }
.chart .label-ink { fill: var(--ink); }
.chart .label-accent { fill: var(--accent); }
.chart .label-second { fill: var(--second); }
figure.multiples { display: flex; flex-wrap: wrap; gap: 1.2rem; max-width: 90%; }
figure.multiples > div { flex: 1 1 12rem; min-width: 11rem; }
figure .small-title { font-size: var(--text); color: var(--ink); margin: 0 0 0.2rem; }

/* Figure captions and claim-type labels. */
.caption { width: 61%; color: var(--quiet); font-size: var(--text); line-height: 1.5; }
.claim { font-style: italic; color: var(--quiet); font-size: var(--text); margin-right: 0.3rem; }
.claim::after { content: "."; }

/* Contents page. */
.contents { width: 61%; }
.contents h2 { font-size: 2.2rem; margin-top: 2.2rem; margin-bottom: 0.4rem; }
.contents ol { list-style: none; padding-left: 0; margin: 0; }
.contents li { display: flex; gap: 0.7rem; align-items: baseline; font-size: var(--text); line-height: 1.5; }
.contents .no { color: var(--quiet); min-width: 2.2rem; }
.contents .planned { color: var(--quiet); }
.contents .mark { min-width: 0.8rem; }
.contents .done-dot { display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%; border: 1px solid var(--quiet); }
.contents .done-dot.done { background: var(--quiet); }
.contents li a { text-decoration: none; background: none; }
.contents li a:hover { text-decoration: underline; }

/* Phones: the tool and its text take the full column. */
@media (max-width: 1079px) {
  .katex-display, .topline, .tool, ol.tasks, .readout, .check, .explain, .takeaway, .pagenav, .contents, .tool .panel-note, .caption { width: 100%; }
  .tool .controls { max-width: none; flex: 1 1 100%; }
  ol.tasks { padding-left: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* One text size for everything below the two heading levels, including Tufte CSS defaults,
   sidenotes, formulas, and chart labels. Gray and italics carry the remaining distinctions. */
p, dl, ol, ul, li, blockquote, table, label, input, textarea, button, figcaption, code,
.sidenote, .marginnote, p.subtitle, h3, .tool h3, .katex, .katex-display > .katex {
  font-size: var(--text);
}
p, dl, ol, ul, .sidenote, .marginnote { line-height: 1.5; }
.sidenote, .marginnote { vertical-align: baseline; }
.sidenote-number::after, .sidenote::before { font-size: 0.75em; }

/* Sidenote numbers come from site.js (data-n), not the CSS counter. */
.sidenote-number[data-n]::after { content: attr(data-n); }
.sidenote[data-n]::before { content: attr(data-n) " "; }
/* Long single words in titles must not overflow on phones. */
h1 { hyphens: auto; overflow-wrap: break-word; }
.topline { flex-wrap: wrap; column-gap: 1.2rem; }
/* A page's own canvas cap (e.g. .plane) wins over the generic max-width. */
.tool .plane { max-width: 100%; }
.sidenote > code { font-size: var(--text); }
.check .again { color: var(--quiet); font-style: italic; margin: 0 0 0.6rem; }
.check button.chosen:disabled { opacity: 1; }
.review { width: 55%; clear: right; margin: 1.4rem 0 2.2rem; }
.review > .label { font-style: italic; color: var(--quiet); font-size: var(--text); margin-bottom: 0; }
.review .check { width: 100%; }
.contents .view { margin-top: 1.4rem; }
.contents .core-next { font-size: var(--text); margin: 0.9rem 0 0; }
@media (max-width: 1079px) { .review { width: 100%; } }
/* On a phone an opened sidenote sits in the text column. A long formula or a line that cannot
   wrap then scrolls inside the note instead of widening the page. */
@media (max-width: 1079px) {
  .sidenote, .marginnote { max-width: 95%; overflow-x: auto; }
  /* An opened sidenote floats left, so what follows must start below it. */
  figure, figure.multiples, .tool, ol.tasks, .check, .explain, .takeaway { clear: both; }
}
.licence { color: var(--quiet); font-size: var(--text); margin-top: 3rem; }

/* ==========================================================================
   Layout grid (2026-11-20). One grid for every page, in units of the text line.

   Columns:  [ text column: --col ] [ gap: --gap ] [ margin column: --side ]
   The text column holds what is read in order: prose, charts, questions.
   The margin column holds what is said about it: sidenotes, a tool's controls,
   and the name of a block (Check, Takeaway). Wide figures span both.
   Every block ends at one of two right edges: the text column's or the margin's.

   Rows: one line of text is --line. Space between blocks is a whole number of
   half lines (--u), so text in the two columns stays on the same lines.
   ========================================================================== */
:root {
  --line: 2rem;                 /* line height of the text: 30px at the 15px root size */
  --u: 1rem;                    /* half a line: the unit for all vertical space */
  --col: 42rem;                 /* about 68 characters of 16pt ET Book */
  --gap: 3rem;
  --side: 18rem;
  --wide: calc(var(--col) + var(--gap) + var(--side));
}
p, dl, ol, ul, .sidenote, .marginnote, .caption, .readout, .tool .panel-note, .task .after { line-height: var(--line); }

@media (min-width: 1080px) {
  body { width: auto; max-width: none; padding: 0 2rem; margin: 0; }
  .topline, article, .pagenav { width: var(--wide); margin-left: auto; margin-right: auto; }
  article { padding: calc(2 * var(--u)) 0 calc(4 * var(--u)); }

  /* Text column. */
  article > p, article > ul, article > ol, article > dl, article > blockquote, article > h1, article > h2, article > h3,
  section > p, section > ul, section > ol, section > dl, section > h2, section > h3,
  .katex-display, .caption, .review, article > table, figure { width: var(--col); max-width: var(--col); box-sizing: border-box; }
  article > ul, article > ol, section > ul, section > ol { padding-left: 2rem; -webkit-padding-start: 2rem; }
  p { margin-top: 0; margin-bottom: var(--u); }
  h1 { margin: calc(3 * var(--u)) 0 calc(5 * var(--u)); line-height: calc(2 * var(--line)); }
  h2 { margin: calc(8 * var(--u)) 0 calc(2 * var(--u)); line-height: calc(1.5 * var(--line)); }
  article > ul, article > ol, section > ul, section > ol { margin-top: var(--u); margin-bottom: calc(2 * var(--u)); }

  /* Margin column: sidenotes. */
  .sidenote, .marginnote {
    float: right; clear: right; width: var(--side);
    margin: 0 calc(-1 * (var(--side) + var(--gap))) 0 0;
  }

  /* Wide blocks span both columns. */
  .tool, figure.multiples, figure.fullwidth, figure.wide { width: var(--wide); max-width: var(--wide); }

  /* A tool: the chart sits in the text column and the controls beside it in the margin column. */
  .tool { margin: calc(3 * var(--u)) 0 calc(4 * var(--u)); border-top: 1px solid var(--rule); padding-top: calc(2 * var(--u)); }
  .tool .panel { margin-bottom: calc(4 * var(--u)); }
  .tool .panel:last-child { margin-bottom: 0; }
  .tool .panel + .panel { border-top: 1px solid var(--rule); padding-top: calc(2 * var(--u)); }
  .tool h3 { margin: 0 0 var(--u); font-style: normal; font-weight: 600; line-height: var(--line); }
  .tool .panel-note, .readout { width: var(--col); margin: 0 0 calc(2 * var(--u)); }
  .readout { margin: calc(2 * var(--u)) 0 0; }
  .tool div.row { display: grid; grid-template-columns: var(--col) var(--side); column-gap: var(--gap); align-items: start; }
  .tool div.row > .stage { grid-column: 1; grid-row: 1; min-width: 0; }
  .tool div.row > .controls { grid-column: 2; grid-row: 1; min-width: 0; max-width: none; gap: var(--u); }

  /* Blocks that end a page: the name of the block sits in the margin column, level with its first line. */
  ol.tasks, .check, .explain, .takeaway { width: var(--col); position: relative; box-sizing: border-box; }
  .check, .explain, .takeaway { margin-top: calc(4 * var(--u)); padding-top: calc(2 * var(--u)); }
  .check + .check { margin-top: calc(3 * var(--u)); }
  .check .q { margin-bottom: calc(1.5 * var(--u)); }
  .check .feedback { margin-top: calc(1.5 * var(--u)); }
  .explain textarea { margin-top: var(--u); min-height: calc(4 * var(--line)); }
  .check > .label, .explain > .label, .takeaway > .label {
    position: absolute; left: calc(var(--col) + var(--gap)); top: calc(2 * var(--u)); width: var(--side); margin: 0;
    font-style: normal; color: var(--quiet); line-height: var(--line);
  }
  .check .q, .explain > p:not(.label), .takeaway > p:not(.label) { margin-top: 0; }
  .takeaway { border-top: 2px solid var(--ink); }
  .pagenav { margin-top: calc(8 * var(--u)); margin-bottom: calc(6 * var(--u)); }
  .pagenav .row + .row { margin-top: calc(2 * var(--u)); }
  .pagenav .row { width: var(--col); }
  .topline { padding-top: calc(2 * var(--u)); }

  /* Tasks: numbers hang in the left margin, so the questions align with the text. */
  ol.tasks { padding-left: 0; margin: calc(4 * var(--u)) 0 calc(2 * var(--u)); list-style-position: outside; }
  ol.tasks > li { margin: 0 0 calc(3 * var(--u)); padding-left: 0; }
  .task .choices { margin: var(--u) 0 0; }
  .task .after { margin-top: var(--u); }
  ol.tasks > li::marker { color: var(--quiet); }
}

.explain textarea { box-sizing: border-box; }

/* Answers use the same boxes as controls (owner decision 2026-11-20). A check's options are stacked
   and share one width, so their edges line up with the text column. */
.check .options.seg { display: flex; flex-direction: column; gap: calc(0.5 * var(--u)); align-items: stretch; }
.check .options button { text-align: left; padding: calc(0.4 * var(--u)) 0.9rem; line-height: 1.5; }
.task .choices .seg { gap: 0.5rem; }
.task .choices button, .seg button, button { padding: 0.25rem 0.8rem; }

/* The small size: chart text, sidenotes, and the top line. */
.chart text { font-size: var(--small); }
.sidenote, .marginnote, .sidenote > code { font-size: var(--small); line-height: calc(0.75 * var(--line)); }
.topline, .topline a { font-size: var(--small); }

/* Top line: the site, then the section with its pages; the current page is marked. */
.topline .here { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 1.2rem; }
.topline .pages { display: inline-flex; gap: 0.7rem; list-style: none; margin: 0; padding: 0; font-variant-numeric: lining-nums tabular-nums; }
.topline .pages li { margin: 0; font-size: var(--small); line-height: var(--line); }
.topline .pages a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--ink); }

/* Contents page on the grid: number, core mark, title, and the done circle in a column at the
   right edge of the text column. The key to the two marks sits in the margin column. */
h1:has(+ .subtitle) { margin-bottom: var(--u); }
p.subtitle { margin-top: 0; margin-bottom: calc(3 * var(--u)); line-height: var(--line); }
.contents h2 { margin: calc(4 * var(--u)) 0 var(--u); }
.contents li { display: grid; grid-template-columns: 3rem 1.4rem 1fr 1rem; gap: 0; align-items: baseline; line-height: var(--line); margin: 0; }
.contents li:not(:first-child) { margin-top: 0; }
.contents .no { min-width: 0; font-variant-numeric: lining-nums tabular-nums; }
.contents .mark { min-width: 0; }
.contents .done-dot { justify-self: end; }
.contents .done-dot.done { background: var(--ink); border-color: var(--ink); }
.contents .view { margin-top: calc(3 * var(--u)); }
.contents .key { font-size: var(--small); color: var(--quiet); line-height: calc(0.75 * var(--line)); margin: var(--u) 0 0; }
.contents .key span { white-space: nowrap; margin-right: 1.2rem; }
.contents .key .done-dot { margin-right: 0.3rem; }
@media (min-width: 1080px) {
  .contents { width: var(--col); position: relative; }
  .contents .key { position: absolute; left: calc(var(--col) + var(--gap)); top: calc(3 * var(--u)); width: var(--side); margin: 0; }
  .contents .key span { display: block; margin: 0 0 calc(0.5 * var(--u)); white-space: normal; }
  .licence { width: var(--col); margin-top: calc(6 * var(--u)); }
}
.contents .key span > span { display: inline-block; margin: 0 0.45rem 0 0; white-space: nowrap; }

/* Shared fixes found while fitting pages to the grid (2026-11-20). */
@media (max-width: 1079px) {
  ol.tasks { box-sizing: border-box; }
  figure, figure.multiples, .fullwidth { max-width: 100%; }
  section > ul, section > ol, section > dl, article > ul, article > ol { width: auto; }
}
figure { margin: calc(3 * var(--u)) 0 calc(2 * var(--u)); }
.caption { margin: 0 0 calc(3 * var(--u)); }
.tool .controls > button { align-self: flex-start; }
/* A stage that needs both columns: add class "wide" to its .row; the controls go in a row above it. */
@media (min-width: 1080px) {
  .tool div.row.wide { display: block; }
  .tool div.row.wide > .controls { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: var(--u) calc(2 * var(--u)); margin-bottom: calc(2 * var(--u)); }
}
.small-title { margin: 0 0 var(--u); line-height: var(--line); }

/* Review block: closed by a rule before the page's own text begins. */
.review > .label { font-style: normal; }
@media (min-width: 1080px) {
  .review { margin: 0 0 calc(6 * var(--u)); padding-bottom: calc(4 * var(--u)); border-bottom: 1px solid var(--rule); }
  .review > .label { margin: 0 0 var(--u); line-height: var(--line); }
}
/* A tool's panel title looks the same at every width. */
.tool h3 { font-style: normal; font-weight: 600; }
.tool .stage > div + div { margin-top: calc(2 * var(--u)); }
figure.multiples.two { gap: var(--gap); }
.tool .readout + .panel-note { margin-top: calc(2 * var(--u)); }

/* Two layouts only (2026-11-20): two columns at 1080 px and wider, one column below. In one column
   the text keeps its measure and is centered, and vertical space follows the same units. */
@media (max-width: 1079px) {
  body { width: auto; max-width: none; margin: 0; padding: 0 1.6rem; }
  .topline, article, .pagenav { max-width: var(--col); margin-left: auto; margin-right: auto; }
  .topline, .pagenav, .contents, .review, .caption, .katex-display, .readout, .tool, .tool .panel-note,
  ol.tasks, .check, .explain, .takeaway { width: 100%; box-sizing: border-box; }
  section > p, section > ul, section > ol, section > dl, article > p, article > ul, article > ol, figure { width: auto; max-width: 100%; }
  p { margin-top: 0; margin-bottom: var(--u); }
  h1 { margin: calc(2 * var(--u)) 0 calc(3 * var(--u)); }
  h2 { margin: calc(6 * var(--u)) 0 calc(2 * var(--u)); }
  .tool { margin: calc(3 * var(--u)) 0; border-top: 1px solid var(--rule); padding-top: calc(2 * var(--u)); }
  .tool .panel { margin-bottom: calc(3 * var(--u)); }
  .tool .panel + .panel { border-top: 1px solid var(--rule); padding-top: calc(2 * var(--u)); }
  .tool .controls { max-width: none; flex: 1 1 100%; gap: var(--u); }
  .tool div.row { gap: calc(2 * var(--u)); }
  .tool .panel-note { margin: 0 0 calc(2 * var(--u)); }
  .readout { margin: calc(2 * var(--u)) 0 0; }
  ol.tasks { margin: calc(3 * var(--u)) 0 calc(2 * var(--u)); padding-left: 1.6rem; }
  ol.tasks > li { margin-bottom: calc(2.5 * var(--u)); }
  .task .choices { margin-top: var(--u); }
  .check, .explain, .takeaway { margin-top: calc(3 * var(--u)); padding-top: calc(1.5 * var(--u)); }
  .check > .label, .explain > .label, .takeaway > .label { font-style: normal; margin: 0 0 var(--u); }
  .check .q { margin-bottom: calc(1.5 * var(--u)); }
  .takeaway { border-top: 2px solid var(--ink); }
  .pagenav { margin: calc(6 * var(--u)) auto calc(4 * var(--u)); }
  .margin-toggle:checked + .sidenote, .margin-toggle:checked + .marginnote { width: 100%; left: 0; margin: var(--u) 0; box-sizing: border-box; }
}

/* Faces by role. */
body { font-family: var(--font-text); }
button, .ctl, .topline, .pagenav .dir, .choices-label, .tool h3, .small-title, .contents .key, .contents .view,
.check > .label, .explain > .label, .takeaway > .label, .review > .label, .explain .saved, select, input, textarea { font-family: var(--font-label); }


/* ==========================================================================
   The design of aydinmohseni.com (owner decision 2026-11-20). These rules come last and set the
   site's faces, colors, and label rail; the layout grid above supplies the columns and rhythm.
   Three zones at 1240 px and wider: a label rail on the left (page number, panel titles, block
   names), the text column, and the margin column (sidenotes, controls). From 1080 to 1239 px there
   is no rail and the names sit in the margin column. Below 1080 px, one column.
   Computer Modern throughout: CMU Serif for text, CMU Sans Serif for labels, controls, and chart
   text. Ink on warm paper with one red. No rules between blocks; space separates them.
   ========================================================================== */
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmu/cmu-serif-500-roman.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmu/cmu-serif-500-italic.woff2") format("woff2"); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmu/cmu-serif-700-roman.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmu/cmu-serif-700-italic.woff2") format("woff2"); font-weight: 600 700; font-style: italic; font-display: swap; }
@font-face { font-family: "CMU Sans Serif"; src: url("../fonts/cmu/cmu-sans-serif-500-roman.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Sans Serif"; src: url("../fonts/cmu/cmu-sans-serif-500-italic.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --font-text: "CMU Serif", "Latin Modern Roman", Georgia, serif;
  --font-label: "CMU Sans Serif", "Helvetica Neue", Arial, sans-serif;
  --font-data: "CMU Sans Serif", "Helvetica Neue", Arial, sans-serif;
  --text: 20.7px; --small: 15.5px;       /* the website's 1.15rem of 18px, and its note size */
  --line: 2rem; --u: 1rem;
  --rail: 10.2rem; --col: 40.8rem; --gap: 3rem; --side: 18rem;   /* 8.5rem, 34rem, 2.5rem, 15rem of the website's 18px root */
  --paper: #fbf8f0; --ink: #141413; --quiet: #5d5d58; --rule: #ddd6c6; --faint: #f1ecdf;   /* warm paper (owner decision 2026-11-20); the website's ink and graphite */
  /* One red and one mineral blue, the same pair as aydinmohseni.com (owner decision 2026-11-20). --second
     (a compared quantity) and --good (a correct answer) are the same blue; red and blue can be told apart by
     readers with the common color-vision deficiencies. A wrong answer is marked in ink, since red is the accent. */
  --accent: #b0122b; --second: #1f4e8c; --good: #1f4e8c; --bad: #141413; --focus: #b0122b;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #050505; --ink: #f5f5f2; --quiet: #b8b8b3; --rule: #2c2c2a; --faint: #1a1a19;
    --accent: #e0304f; --second: #7fb2e5; --good: #7fb2e5; --bad: #f5f5f2; --focus: #e0304f;
  }
}
h1 { font-size: 2.9rem; font-weight: 400; letter-spacing: 0; }
h2 { font-style: normal; font-size: 1.9rem; font-weight: 400; }
b, strong, .readout b { font-weight: 700; }
a:link, a:visited { text-decoration: none; }
article p a:link, article p a:visited,
.sidenote a:link, .sidenote a:visited { border-bottom: 1px solid var(--rule); }
a:hover { color: var(--accent); }

/* Labels: the website's small sans capitals. */
.check > .label, .explain > .label, .takeaway > .label,
.review > .label, .tool h3, .pagenav .dir, .topline {
  font-family: var(--font-label); font-size: 12.3px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--quiet); font-style: normal; line-height: 1.5;
}
.topline a { font-size: inherit; }
.topline .pages li { font-size: inherit; }
.topline .pages a[aria-current="page"] { color: var(--accent); border-bottom: 0; }
.ctl, button, .choices-label { font-size: 17px; }
button { border-radius: 0; border-color: var(--quiet); padding: 0.3rem 0.8rem; }
.claim { font-family: var(--font-label); font-style: normal; font-size: 12.3px; letter-spacing: 0.12em; text-transform: uppercase; }
.claim::after { content: ""; }

/* No rules between blocks. */
.tool, .tool .panel + .panel, .check, .explain,
.takeaway, .review { border: 0; }

@media (min-width: 1240px) {
  /* The label rail: page number, block names, and panel titles sit left of the text column. */
  .topline, article, .pagenav {
    width: calc(var(--rail) + var(--gap) + var(--wide)); padding-left: calc(var(--rail) + var(--gap)); box-sizing: border-box;
  }
  .topline { padding-left: 0; border-bottom: 1px solid var(--rule); padding-bottom: var(--u); }
  h1 { position: relative; }
  h1 .pageno { position: absolute; left: calc(-1 * (var(--rail) + var(--gap))); width: var(--rail); margin: 0; }
  .check > .label, .explain > .label, .takeaway > .label {
    left: calc(-1 * (var(--rail) + var(--gap))); width: var(--rail); top: calc(2 * var(--u) + 0.5rem);
  }
  .tool .panel { position: relative; }
  .tool h3 { position: absolute; left: calc(-1 * (var(--rail) + var(--gap))); top: 0.5rem; width: var(--rail); margin: 0; }
  .tool .panel + .panel > h3 { top: calc(2 * var(--u) + 0.5rem); }
  .contents .key { left: calc(var(--col) + var(--gap)); }
}
.topline .pages a { font-size: 12.3px; letter-spacing: 0.06em; }

/* The page opens with a red initial, three lines deep. */
article > section:first-of-type > p:first-of-type:not(.starts-claim):not(.no-initial)::first-letter {
  font-style: normal; font-weight: 400; float: left; font-size: 3.05em; line-height: 0.82; padding: 0.07em 0.12em 0 0; color: var(--accent);
}
.check .verdict-wrong { font-weight: 700; }

/* Shared fixes from the page-by-page pass in the new design (2026-11-20). */
.sidenote-number::after, .sidenote::before { font-family: var(--font-text); }
label.sidenote-number { display: inline; line-height: 0; }
@media (min-width: 1080px) {
  .sidenote, .marginnote { margin-bottom: var(--u); }
  h1 { hyphens: manual; }
}
@media (min-width: 1080px) and (max-width: 1239px) {
  .check > .label, .explain > .label, .takeaway > .label { margin-top: 0.5rem; }
}
/* The review block and the transfer question: a short name as the label, and their instruction as quiet text. */
.review > .note, .check.transfer > .note { color: var(--quiet); margin: 0 0 calc(2 * var(--u)); }
.review { position: relative; }
@media (min-width: 1080px) {
  .review > .label { position: absolute; left: calc(var(--col) + var(--gap)); top: 0; width: var(--side); margin: 0; }
  .review .check > .label { font-family: var(--font-text); font-size: var(--small); text-transform: none; letter-spacing: 0; }
}
@media (min-width: 1240px) {
  .review > .label { left: calc(-1 * (var(--rail) + var(--gap))); width: var(--rail); top: 0.5rem; }
}
@media (max-width: 1079px) { .review { margin-bottom: calc(4 * var(--u)); } }
@font-face { font-family: "CMU Typewriter Text"; src: url("../fonts/cmu/cmu-typewriter-text-500-roman.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
code, pre { font-family: "CMU Typewriter Text", monospace; }
button, .seg button { font-family: var(--font-label); font-size: 17px; }
.sidenote .katex, .marginnote .katex { font-size: 1em; }
h2 .katex { font-size: 1em; }
:root { --font-code: "CMU Typewriter Text", monospace; }
code, pre { font-family: var(--font-code); }
/* One button shape. A control is in the label face; an answer is a sentence, so it is in the text face. */
button, .seg button { border-radius: 0; }
.check .options button, .task .choices button { font-family: var(--font-text); font-size: var(--text); }
.seg button, button { border-color: var(--quiet); }
.seg button[aria-pressed="true"], button.primary { border-color: var(--accent); }
.explain textarea { border-radius: 0; }
.claim { line-height: 1; }
.exp { vertical-align: 0.4em; font-size: 0.75em; line-height: 0; }
@media (min-width: 1080px) { .pagenav .row > * { min-width: 40%; } .pagenav .dir { white-space: nowrap; } }
/* One column: the two page-end links stack, so long direction labels cannot collide. */
@media (max-width: 1079px) { .pagenav .row { flex-direction: column; gap: var(--u); } .pagenav .next { text-align: left; } }
