/* ==================================================================== *
 * print.css — because the honest end state of a revision site at 1am is
 * a stack of paper.
 *
 * Everything interactive collapses to its final, complete frame: a
 * stepped diagram prints fully stepped, a codewalk prints every note
 * beside its line, a <details> prints open. Nothing prints as a control
 * you cannot press.
 * ==================================================================== */
@media print {
  /* Washes are lightened for toner: a 30% pastel that reads correctly on
     a screen prints as a grey block you cannot read through. */
  :root {
    --paper: #fff; --card: #fff; --recessed: #f4f4f2;
    --rule: #d8d8d4; --rule-strong: #9a9a94;
    --ink: #000; --ink-dim: #333; --ink-sub: #555;
    --wash: 18%; --wash-strong: 30%; --grain-opacity: 0;
  }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  body::before, body::after { display: none !important; }

  /* The rails are fixed-position now, so they must be pulled out of the
     flow explicitly or they print stamped over the first page. */
  .rail { position: static !important; }

  .bar, .rail-l, .rail-r, .rail-scrim, .pagenav, .foot,
  .w-ctl, .fig-ctl, .cw-hd .w-ctl, .skip, .search-panel { display: none !important; }

  .page { display: block; max-width: none; padding: 0; }
  .prose { max-width: none; padding: 0; margin: 0; }
  .prose > * { max-width: none !important; }

  h2 { break-after: avoid; margin-top: 18pt; }
  h3, h4 { break-after: avoid; }
  .fig, .cw, .plain, .analogy, .warn, .spec, .exam, .term, pre, table { break-inside: avoid; }

  a { text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }

  /* Reveal what the screen hides behind a click. */
  .recall[open], .recall { border-style: solid; }
  .recall > summary { font-weight: 700; }
  .recall .a { display: block !important; }
  details:not([open]) > *:not(summary) { display: revert !important; }

  .w .fade { opacity: 1 !important; }
  .cw-body { grid-template-columns: 1fr 1fr; }
  .cw-code { max-height: none; }
  .cw-ln.on { background: #f0f0f0; }
  .cw-note { display: block; }

  thead th { position: static; }
}
