/* The one stylesheet. It follows DESIGN.md: white ground, near-black text, one deep blue accent,
   thin grey rules, one left-aligned column about 68 characters wide, tables for data. */

/* The two typefaces, served from this site (fonts/PROVENANCE.md): no request leaves the site. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
}

/* The width of the text column, worked out once from the body text (68 characters of it) and then
   passed down as a length, so a heading, the navigation and the footer, each with its own font
   size, are exactly as wide as the column and their rules end where the text ends. A browser that
   does not know @property falls back to 68ch of each element's own size. (The initial value must be
   in pixels: a value in rem or ch makes the browser drop the whole rule.) */
@property --column {
  syntax: "<length>";
  inherits: true;
  initial-value: 680px;
}
/* The width of running text: paragraphs and lists. It is set once, from the same 68 characters of
   body text, and never changes, so on the ledger page and the sample page, whose column is wider,
   paragraphs and lists still run as wide as the front page's text, and no wider. */
@property --text {
  syntax: "<length>";
  inherits: true;
  initial-value: 680px;
}

:root {
  --paper: #ffffff;
  --ink: #16181d;
  --quiet: #4a4f59;
  --accent: #12355b;
  --rule: #c9ccd1;
  --code: #f5f6f7;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  --column: 68ch;
  --text: 68ch;
}

.site {
  max-width: var(--column);
  margin: 0;
  padding: 1rem 0 0.6rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.94rem;
}

/* Each link keeps its words on one line: on a narrow screen the navigation wraps between links,
   never inside one ("Rule ledger" stays whole). The links sit side by side in the markup with no
   space between them, so the wrapping comes from the flex row, not from the text. */
.site { display: flex; flex-wrap: wrap; align-items: baseline; }
.site a { margin-right: 1.25rem; white-space: nowrap; }
.site a.name { font-weight: 600; color: var(--ink); text-decoration: none; }

main { padding-top: 0.5rem; }
main > * { max-width: var(--column); }
main > .wide, main > section > .wide { max-width: none; }
main > section > * { max-width: var(--column); }

@media (min-width: 900px) {
  body { padding-left: 3.5rem; }
}

h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 600; margin: 2rem 0 0.75rem; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 2.25rem 0 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.4rem; }

p, li { margin: 0 0 0.7rem; }
/* A string with no break in it (a SHA-256 value, a long file name) wraps instead of widening the
   page on a narrow screen (DESIGN.md, Layout). */
p, li, h1, h2, h3, h4 { overflow-wrap: anywhere; }
ul, ol { padding-left: 1.25rem; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }

/* A statute's own words, set out by its own subdivisions ((I), (aa), (bb), (II)) on the How it works
   page: each part on its own line, led by the statute's label instead of a bullet, the inner level
   indented. No box and no rule: only the indent sets it apart. */
.statute, .statute ul { list-style: none; padding-left: 0; }
.statute { margin: 0 0 1rem; }
.statute ul { padding-left: 1.75rem; margin: 0.7rem 0 0; }
/* A citation in running text ("section 7701(a)(52)(D)(ii)", "Public Law 119-21", "139 Stat. 262")
   stays on one line: the sentence breaks at the spaces around it, never inside it. */
.nobr { white-space: nowrap; overflow-wrap: normal; }

.quiet { color: var(--quiet); }
.asof { color: var(--accent); font-weight: 600; }

.notice {
  color: var(--accent);
  font-weight: 600;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  padding: 0.5rem 0;
}
/* The sample page's own closing notice follows the last document's closing notice: clear space between
   the two bars, so they do not stack. */
.sample-body + .notice { margin-top: 2.5rem; }

code, pre, .mono, td.date, td.num { font-family: var(--mono); font-size: 0.88em; }

pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--code);
  border: 1px solid var(--rule);
  padding: 0.6rem 0.75rem;
}

.wide { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; margin: 0.5rem 0 1.5rem; font-size: 0.9rem; }
th, td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; border-bottom: 1px solid var(--ink); }
/* A table cell breaks no word: its lines break at spaces (and after a hyphen or a slash, as text does), so a
   column is at least as wide as its longest word, and a table that needs more room than the column scrolls
   sideways inside its own frame (.wide), never the page. A digest (a SHA-256 value or a commit), which has no
   spaces, is the one token that wraps at any character: refresh_sample.py puts each run of 32 or more hex
   digits in a .hex span. */
td { overflow-wrap: break-word; }
.hex { overflow-wrap: anywhere; word-break: break-all; }
td.date { white-space: nowrap; overflow-wrap: normal; }
td.date .quiet { display: block; font-family: var(--sans); font-size: 0.8rem; white-space: normal; }

/* The ledger's least width, 51.5rem (824 pixels), is less than the room a 920-pixel screen leaves
   beside the page's side margins (844 pixels, or 827 with a classic 17-pixel scrollbar), so the
   table never scrolls inside its frame from 920 pixels up, where it stops stacking. */
.ledger { min-width: 51.5rem; }
/* Each row's rule cell: the row's plain name, and beneath it the rule's citation in smaller text. */
.ledger td.rule .name { display: block; font-weight: 600; overflow-wrap: normal; }
.ledger td.rule .cite { display: block; font-size: 0.8rem; font-weight: 400; color: var(--quiet); margin-top: 0.15rem; }
/* A document number in a citation ("DA 26-870", "Public Law 119-60") stays on one line: the citation
   breaks only at the spaces around it, never at the hyphen or the space inside it. */
.ledger td.rule .cite .nobr { white-space: nowrap; overflow-wrap: normal; }
.ledger td.source { font-family: var(--mono); font-size: 0.8rem; }
/* The source link's text is short (the site's domain and the document number) and breaks only at
   its spaces; the full address is the link itself. On paper the full address is printed under it,
   in pieces that each end after a slash or a dot: the line may break between pieces, never inside
   one. */
.ledger td.source a, .ledger .url { overflow-wrap: normal; }
.ledger .url { display: none; }
.ledger .url > span, .ledger td.source .nobr { white-space: nowrap; }
.ledger .label { display: none; font-family: var(--sans); color: var(--quiet); }

/* On a screen narrower than 920 pixels the ledger does not scroll sideways: each row stacks, in
   the table's own order (the date, the rule, the sentence, then the source and the capture date,
   each of the last two with its label), with one rule under each row. Wider screens keep the
   table. (920, not 900: a browser that shows a classic scrollbar takes about 17 pixels of the
   room, and from 920 up the table still fits beside it.) */
@media screen and (max-width: 919.98px) {
  .ledger { min-width: 0; margin-top: 0; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger thead { display: none; }
  .ledger tr { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
  .ledger td { padding: 0.1rem 0; border-bottom: 0; }
  .ledger td.what { padding: 0.3rem 0; }
  .ledger .label { display: inline; }
}

/* On a screen 900 pixels wide or wider, the ledger page and the sample page each have one column,
   wider than the front page's text column, shared by the tables, the headings, the rules (under the
   navigation, above each heading, around the notice, above the footer), the "As of" line and the
   notice, so no table runs past them. On the sample page that includes the download table and
   every table and code block inside the sample's four documents; a table that needs more room
   wraps inside the column, as its cells allow, or scrolls inside its own frame. The column, 60rem
   (960 pixels), is wider than the ledger's least width, so the two never conflict; below 960 pixels
   of room it fills the room there is. Paragraphs and lists keep the front page's text width
   (--text), so their lines are no longer than the front page's. Paper keeps the front page's
   column for everything. */
@media screen and (min-width: 900px) {
  body.ledger-page, body.sample-page { --column: 60rem; }
  body.ledger-page main > .wide,
  body.sample-page main > .wide,
  body.sample-page .sample-body > .wide,
  body.sample-page .sample-body > pre { max-width: var(--column); }
  body.ledger-page main > p:not(.asof):not(.notice),
  body.ledger-page main > ul,
  body.ledger-page main > ol,
  body.sample-page main > p:not(.asof):not(.notice),
  body.sample-page main > ul,
  body.sample-page main > ol,
  body.sample-page .sample-body > p:not(.asof):not(.notice),
  body.sample-page .sample-body > ul,
  body.sample-page .sample-body > ol { max-width: var(--text); }
}

/* The sample page's download table breaks no word: it wraps only at the spaces between words, and
   each file name and size stays on one line. The one exception is the SHA-256 value, a string with
   no spaces: it wraps inside its own cell, at any character. Its column asks for the width of the
   64 characters on one line (plus the cell's right padding), so a value stays whole while the other
   columns can still narrow, and wraps only when they are as narrow as their words allow. */
.downloads td, .downloads th { overflow-wrap: normal; word-break: normal; hyphens: manual; }
.downloads th, .downloads td.mono, .downloads td.num { white-space: nowrap; }
.downloads td.sha { white-space: normal; overflow-wrap: anywhere; word-break: break-all; width: calc(64ch + 0.6rem); }
/* The description keeps a readable width (about two words a line at the least) before the SHA-256
   column gives way. */
.downloads td.what { min-width: 12rem; }

/* On a screen narrower than 900 pixels a table cell that holds a digest keeps a least width of about 16 hex
   digits (18ch: a hex digit is a little wider than the zero that ch measures), so its column never narrows
   until the digest wraps three or four characters a line; the digest still wraps at any character, and the
   words around it stay on its lines. */
@media screen and (max-width: 899.98px) {
  td:has(.hex) { min-width: 18ch; }
}

/* On a screen 600 pixels wide or narrower the sample page's tables (the class stack) do not scroll sideways:
   each row stacks, one cell under another, each under a small label that repeats its column's heading (the
   cell's data-label, which refresh_sample.py writes), with one rule under each row, as the ledger does below
   920 pixels. An empty cell is left out. The download table shows the file name, what it is and the SHA-256;
   at this width it leaves out the format and the size. Wider screens, and paper, keep the tables. */
@media screen and (max-width: 600px) {
  .stack, .stack tbody, .stack tr, .stack td { display: block; }
  .stack thead { display: none; }
  .stack tr { padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
  .stack td { padding: 0.1rem 0; border-bottom: 0; }
  .stack td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--quiet);
  }
  .stack td:empty { display: none; }
  .downloads td.format, .downloads td.size { display: none; }
  .downloads td.mono { white-space: normal; overflow-wrap: anywhere; }
  .downloads td.what { min-width: 0; }
  .downloads td.sha { width: auto; }
}

/* The tables inside the sample's four documents are the same size as every other table on the
   site, and follow the same rules for breaking (the rules for all tables above). */
.sample-body h2 { font-size: 1.35rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--ink); }
.sample-body h3 { font-size: 1.1rem; margin: 2rem 0 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--rule); }
.sample-body h4 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.4rem; }
.sample-body > * { max-width: var(--column); }
.sample-body > .wide, .sample-body > pre { max-width: none; }

footer {
  max-width: var(--column);
  margin-top: 3rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--quiet);
  font-size: 0.9rem;
}

@media print {
  body { padding: 0; font-size: 10.5pt; }
  .site { display: none; }
  a { color: var(--ink); text-decoration: none; }
  .wide { overflow: visible; }
  .ledger { min-width: 0; }
  .downloads { font-size: 0.75rem; }
  .downloads td.mono, .downloads td.num { font-size: 0.6em; }
  .ledger .url { display: block; margin-top: 0.2rem; }
  tr, pre { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
}
