/* Howthings: every page is a notebook page in one hand (owner, 2026-11-15: style study
   B, with the paper toned down, the writing loosened off its rules and the drawings
   looser). The type is Playpen Sans; there is no second face.

   The ruling. --L is the distance between rules: 30 px below 768 px, 32 px from 768 px.
   --bb is where a line's baseline would fall inside its line box: --L / 2 + 0.415 x font
   size, from Playpen Sans' own metrics (ascent 1.170, descent 0.340; fontTools,
   2026-11-15). Every block is a whole number of rules tall, and each block that is not
   body text is moved by `top` until its baseline lands on a rule (the "sit" rule below).
   hand.js then lifts the words a little off those rules, and ink.js evens each figure
   up to a whole rule. */

@font-face { font-family: "Playpen Sans"; src: url("fonts/playpen-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* --L is registered as a length so that scripts reading it (ink.js, the hand gate) get px
   whatever unit it is written in (site check M4). */
@property --L { syntax: "<length>"; inherits: true; initial-value: 30px; }

:root {
  --paper: #FAFAF7;
  --ink: #2B2723;
  --ink-2: #5E5850;
  /* The rules: halfway from #C9C5BC (1.65 : 1 on the paper) to the paper. */
  --rule: #E2E0DA;
  --brass: #B8892B;
  --nickel: #DCE2E5;
  --edge: 20px;
  --hand: "Playpen Sans", "Trebuchet MS", sans-serif;
  --a: 0.415;
  /* Sizes in rem follow the reader's default text size; at the default 16 px they are
     the px sizes they replace (site check M4). The breakpoints stay in px, as hand.js and
     ink.js read them. */
  --fs0: 1.125rem;
  --L: 1.875rem;
  --bb: calc(var(--L) / 2 + 0.415 * 1.125rem);
  color-scheme: light;
}
@media (min-width: 480px) { :root { --edge: 24px; } }
@media (min-width: 768px) { :root { --edge: 32px; --fs0: 1.1875rem; --L: 2rem; --bb: calc(var(--L) / 2 + 0.415 * 1.1875rem); } }

/* hidden="until-found" stays to the browser, which keeps the text findable (site check M5). */
[hidden]:not([hidden="until-found"]) { display: none !important; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--hand);
  font-size: var(--fs0);
  line-height: var(--L);
  font-kerning: normal;
  font-synthesis: none;
  font-size-adjust: from-font; /* a fallback face takes Playpen Sans' x-height (site check M19) */
  hyphens: manual;
  overflow-wrap: break-word;
}
/* A run of words lifted off its rule by hand.js. */
.l { position: relative; }

a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover, a:focus-visible { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The top of the page is left unruled, as on a notebook page. Plain paper with faint
   rules: no margin line, no holes, no tint. */
.site { min-height: calc(var(--L) * 2); padding: 20px var(--edge) 0; box-sizing: border-box; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }
main {
  padding: calc(var(--L) * 2) var(--edge) calc(var(--L) * 4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='30'%3E%3Cpath d='M0 0.5H8' fill='none' stroke='%23E2E0DA'/%3E%3C/svg%3E");
  background-position: 0 var(--bb);
  background-size: auto var(--L); /* the rules follow the text size too (site check M4) */
}
@media (min-width: 768px) {
  main { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='32'%3E%3Cpath d='M0 0.5H8' fill='none' stroke='%23E2E0DA'/%3E%3C/svg%3E"); }
}
article { max-width: 32em; margin: 0 auto; counter-reset: note; }

/* The sit rule: --fs is the font size, --lh the line height (a whole number of rules).
   mod() finds how far this block's baseline is from the next rule, and `top` moves the
   block by that much (up or down, at most half a rule). */
h1, h2, h3, p, li, figcaption, summary, details.desc > div {
  font-size: var(--fs, var(--fs0));
  line-height: var(--lh, var(--L));
  position: relative;
  top: calc(mod(var(--bb) - var(--lh, var(--L)) / 2 - var(--a) * var(--fs, var(--fs0)) + var(--L) / 2, var(--L)) - var(--L) / 2);
}

h1 { --fs: 2.875rem; --lh: calc(var(--L) * 2); margin: 0 0 var(--L); font-weight: 400; text-wrap: balance; }
h2 { --fs: 1.75rem; --lh: calc(var(--L) * 2); margin: calc(var(--L) * 2) 0 var(--L); font-weight: 400; text-wrap: balance; }
.lead { --fs: 1.3125rem; }
@media (min-width: 768px) {
  h1 { --fs: 3.5rem; }
  h2 { --fs: 1.875rem; }
  .lead { --fs: 1.375rem; }
}
p { margin: 0; text-indent: 1.2em; text-wrap: pretty; }
h2 + p, h2 + .noted > p, figure + p, details + p, .opening p, .sn p { text-indent: 0; }

/* Sidenotes: in the margin from 1100 px, under their paragraph below that. */
.noted { counter-increment: note; position: relative; }
.noted > p::after { content: counter(note); content: counter(note) / ""; font-size: 0.68em; line-height: 0; vertical-align: 0.6em; margin-left: 0.04em; }
.sn { --fs: 1rem; margin: 0 0 0 1.2em; }
.sn p::before { content: counter(note) "\2002"; }
.sn-btn {
  display: inline-block; position: relative; min-width: 24px; min-height: 24px; margin: -8px 0; padding: 0 4px;
  font: inherit; font-size: 0.875rem; line-height: 24px; text-indent: 0;
  vertical-align: 0.45em; color: var(--ink); background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em;
}
.sn-btn[aria-expanded="true"] { text-decoration-thickness: 2px; }
/* A 44 px hit area round the 24 px button, with no change to its look (site check A6). */
.sn-btn::before { content: ""; position: absolute; inset: -10px; }
@media (max-width: 1099px) { html.js .noted > p::after { display: none; } }

/* Figures */
figure { margin: var(--L) 0; }
figcaption { --fs: 1rem; max-width: 34em; color: var(--ink-2); }
.fig-no { color: var(--ink); margin-right: 0.3em; }
svg { display: block; width: 100%; height: auto; overflow: hidden; }
details.desc { --fs: 1rem; max-width: 34em; margin: 0 0 var(--L); color: var(--ink-2); }
details.desc summary { min-height: 24px; cursor: pointer; color: var(--ink); list-style: none; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
details.desc summary::-webkit-details-marker { display: none; }
details.desc[open] summary { text-decoration-thickness: 2px; }
/* The summary's hit area reaches 6 px above and below its one rule (site check A6). */
details.desc summary::before { content: ""; position: absolute; inset: -6px 0; }
/* Open or closed at a glance: a plus while closed, a dash while open; not read aloud
   (site check M14, owner's pick 2026-11-16). */
details.desc summary::after { content: "+"; content: "+" / ""; display: inline-block; margin-left: 0.4em; text-decoration: none; }
details.desc[open] summary::after { content: "\2013"; content: "\2013" / ""; }

@media (min-width: 1100px) {
  article { max-width: 49.5em; }
  article > header > *, section > * { max-width: 32em; }
  section > .noted { max-width: none; }
  .noted { display: grid; grid-template-columns: 32em 15em; column-gap: 2.5em; }
  .noted > p { grid-column: 1; }
  .noted > .sn { grid-column: 2; grid-row: 1; align-self: end; margin: 0; }
  .sn-btn { display: none; }
}

/* A page's own figure layout (grids, drag handles, label sizes) lives in a <style> in
   that page's <head>, after this stylesheet. The Lock page's is in lock-and-key/. */

/* Controls: real buttons and radios. Their border is drawn by the pen (ink.js); the CSS
   border stays, transparent, so the box keeps its size and forced colours can show it. */
/* Groups that wrap keep twice the gap of buttons inside a group (site check A8, owner's pick 2026-11-16). */
.controls { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 16px 20px; }
.grp { display: flex; flex-wrap: wrap; gap: 8px; }
.controls button.reset { border-color: transparent; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; padding: 0 8px; }
.controls button, .keys label {
  position: relative; box-sizing: border-box; min-height: 44px; padding: 0 16px;
  font: inherit; font-size: 1.0625rem; line-height: 1.2;
  color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; cursor: pointer;
}
html.js .controls button, html.js .keys label { border-color: transparent; }
.controls button:active { color: var(--paper); background: var(--ink); }
.keys { display: block; margin: 0; padding: 0; border: 0; min-width: 0; }
.keys legend { float: left; margin-right: 12px; padding: 0; font-size: 1.0625rem; line-height: 44px; }
/* A legend above its options, where a row of long labels needs the width (site check U11). */
.keys.stack legend { float: none; line-height: var(--L); }
.keys label { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; vertical-align: top; }
.keys input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
html.js .keys input[type="radio"] {
  -webkit-appearance: none; appearance: none; border: 0; border-radius: 50%;
  background: var(--ring) center / 18px 18px no-repeat;
}
html.js .keys input[type="radio"]:checked { background-image: var(--ring-on); }
.keys label:has(input:disabled) { border-style: dashed; cursor: not-allowed; }
svg.pb { position: absolute; left: -1px; top: -1px; width: calc(100% + 2px); height: calc(100% + 2px); overflow: visible; pointer-events: none; }
svg.pb path { fill: var(--ink); }
svg.pb .dash, .keys label:has(input:disabled) svg.pb .solid { display: none; }
.keys label:has(input:disabled) svg.pb .dash { display: inline; }
.controls button:active svg.pb path { fill: var(--paper); }
/* One free rule always parts a readout from its caption (site check U6b, owner's pick 2026-11-16). */
.readout { --fs: 1rem; max-width: 36em; min-height: calc(var(--L) * 3); margin: var(--L) 0; color: var(--ink-2); text-indent: 0; }
/* From 768 px the longest readout fits on two rules, so only two are kept free for it. */
@media (min-width: 768px) { .readout { min-height: calc(var(--L) * 2); } }
.nb { white-space: nowrap; }

/* Drawing conventions without JavaScript: clean lines. */
svg path, svg circle, svg ellipse, svg rect, svg line, svg polyline, svg polygon { vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
svg [hidden] { display: none; }
.o, .o path, .o circle, .o ellipse, .o rect, .o line, .o polyline, .o polygon { fill: none; stroke: var(--ink); stroke-width: 1.75px; }
.f-paper { fill: var(--paper); }
.f-brass { fill: var(--brass); }
.f-nickel { fill: var(--nickel); }
.f-paper.o, .f-paper.o circle, .f-paper.o ellipse, .f-paper.o rect, .f-paper.o polygon { fill: var(--paper); }
.f-brass.o { fill: var(--brass); }
.f-nickel.o { fill: var(--nickel); }
.h { stroke: var(--ink); fill: none; vector-effect: none; }
.halo path, .halo1 { fill: none; stroke: var(--paper); stroke-width: 4.75px; }
.halo-br { fill: none; stroke: var(--paper); stroke-width: 3.9px; }
.br { fill: none; stroke: var(--ink); stroke-width: 0.9px; }
.sp { fill: none; stroke: var(--ink); stroke-width: 1px; }
.cl { fill: none; stroke: var(--ink-2); stroke-width: 0.75px; stroke-dasharray: 12 3 2 3; }
.ld, .tick { fill: none; stroke: var(--ink-2); stroke-width: 0.75px; }
.tick { stroke: var(--ink); }
.hid path.o, path.hid.o { fill: none; stroke-width: 1px; stroke-dasharray: 4 3; }
.lbl { font-family: var(--hand); font-size: calc(var(--lf, 62) * 1.12px); fill: var(--ink-2); }

/* The pen (ink.js). With JavaScript the drawings stay hidden until they are inked, so the
   clean lines never flash. The clean strokes and fills go; ink.js draws both again on the
   loosened shape. ink.js inks every <svg role="img"> inside a <figure>. */
.js figure svg[role="img"]:not(.inked) { visibility: hidden; }
.inked .o, .inked .o path, .inked .o circle, .inked .o ellipse, .inked .o rect, .inked .o line, .inked .o polyline, .inked .o polygon,
.inked .sp, .inked .br, .inked .cl, .inked .ld, .inked .tick, .inked .hid path.o, .inked path.hid.o { stroke: none; }
.inked path.o, .inked .o > path, .inked .o > ellipse, .inked .o > circle, .inked ellipse.o, .inked circle.o,
.inked .o > rect, .inked .o > polygon, .inked rect.o, .inked polygon.o { fill: none; }
.inked .halo, .inked .halo1, .inked .halo-br, .inked path[fill^="url("] { display: none; }
.inked path.ink, .inked .o path.ink { fill: var(--ink); stroke: none; }
.inked path.ink.i2 { fill: var(--ink-2); }
.inked path.inkfill { stroke: none; }
.inked path.inkfill.f-paper, .inked .o path.inkfill.f-paper { fill: var(--paper); }
.inked path.inkfill.f-brass, .inked .o path.inkfill.f-brass { fill: var(--brass); }
.inked path.inkfill.f-nickel, .inked .o path.inkfill.f-nickel { fill: var(--nickel); }
svg.ul, svg.na { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
svg.ul path, svg.na path { fill: var(--ink); stroke: none; }

/* The patent drawing (Fig. 5) is the patent's own sheet, shown as found. */
.patentfig img { display: block; width: 100%; max-width: 490px; height: auto; margin: 0 auto; }
.sc { letter-spacing: 0.02em; }

/* Sources */
.sources ol { margin: var(--L) 0 0; padding: 0 0 0 2em; font-size: 1rem; }
.sources li { --fs: 1rem; }
.sources li::marker { color: var(--ink-2); }
.read-on { --fs: 1rem; color: var(--ink-2); }
.sources .read-on + ol + .read-on { margin-top: var(--L); }

/* Home: today's page and the A to Z list, in the same column on the same paper. */
.home > * { max-width: 32em; margin-left: auto; margin-right: auto; }
/* 32em of the h1's own size would be far wider: hold it to the column (site check U7). */
.home > h1 { max-width: calc(32 * var(--fs0)); }
.home h1 { margin-bottom: 0; }
.home h2 { margin-top: calc(var(--L) * 2); }
.pick { --fs: 1.375rem; margin: 0; text-indent: 0; }
.pick-lead, .pick-read, .random { margin: 0; text-indent: 0; }
/* Today's figure: the page's first hands-on figure in a frame (shown once it has said how
   tall it is), or without JavaScript the newest page's share card. */
.today-fig { margin: var(--L) 0; }
.today-fig:empty { display: none; }
.today-fig iframe { display: block; width: 100%; height: 0; border: 0; visibility: hidden; }
.today-fig.on iframe { visibility: visible; }
.today-fig img { display: block; width: 100%; height: auto; }
.az-letter { --fs: 1.4375rem; margin: var(--L) 0 0; font-weight: 400; }
.az ul { margin: 0; padding: 0; list-style: none; }
/* From 1100 px the A to Z runs in three columns inside the same column (site check U21, owner's pick 2026-11-16). */
@media (min-width: 1100px) {
  .az { columns: 3; column-gap: 1.5em; }
  .az > h2, .az > .random { column-span: all; }
  .az > .random { margin-bottom: var(--L); }
  /* The first column starts level with the others: a column keeps its top margin only in the first. */
  .az > h2 + .az-letter, .az > h2 + .az-group > .az-letter, .az > .random + .az-group > .az-letter { margin-top: 0; }
  /* A letter never parts from its list. Safari ignores break-after on the letter, so each
     letter and its list share one box (.az-group) that does not break. */
  .az-letter { break-after: avoid; }
  .az-group, .az ul { break-inside: avoid; }
}
.site-end { padding: var(--L) var(--edge) 40px; max-width: 32em; margin: 0 auto; font-size: 1rem; line-height: 1.4; }
@media (min-width: 1100px) { .site-end { max-width: 49.5em; } }
/* Three pages that work the same way (tools/related.mjs), off the ruling like the rest of
   the end; each link at least 24 px tall (SC 2.5.8). */
.site-end .related { font-size: inherit; line-height: inherit; top: 0; text-indent: 0; margin: 0 0 12px; color: var(--ink-2); }
.site-end a { display: inline-block; min-height: 24px; }

/* One figure of a page, framed by the home page's Today (hand.js sets html.embed): on plain
   paper, nothing round it, and no scrolling inside the frame. */
html.embed, html.embed body { overflow: hidden; }
html.embed main { padding: 0; background: none; }
html.embed article { max-width: none; }
html.embed .embed-off { height: 0; min-height: 0; margin: 0; padding: 0; border: 0; overflow: hidden; visibility: hidden; }
html.embed figure.embed-on { margin: 0; }

@media (forced-colors: active) {
  svg { forced-color-adjust: none; }
  .o, .o path, .o circle, .o ellipse, .o rect, .o line, .o polyline, .o polygon, .h, .br, .sp, .cl, .ld, .tick, .hid path.o, path.hid.o { stroke: CanvasText; }
  .f-paper, .f-brass, .f-nickel, .f-paper.o, .f-brass.o, .f-nickel.o, .f-paper.o circle,
  .inked path.inkfill.f-paper, .inked path.inkfill.f-brass, .inked path.inkfill.f-nickel,
  .inked .o path.inkfill.f-paper, .inked .o path.inkfill.f-brass, .inked .o path.inkfill.f-nickel { fill: Canvas; }
  .halo path, .halo1, .halo-br { stroke: Canvas; }
  .lbl, .inked path.ink, .inked .o path.ink, .inked path.ink.i2, svg.ul path, svg.na path { fill: CanvasText; }
  main { background-image: none; }
  html.js .controls button, html.js .keys label { border-color: ButtonText; }
  svg.pb { display: none; }
  html.js .keys input[type="radio"] { -webkit-appearance: auto; appearance: auto; background: none; }
}
