/* Benson Increments Calculator - visual styles.

   Colours are declared once as custom properties, then redefined for dark mode
   and for an explicit [data-theme] choice, so nothing has a single-branch colour.

   The text tokens are a hierarchy, and the order matters: --ink is content,
   --ink-soft is context about that content, and --ink-helper is a hint that is
   not content at all. A value on a card is content and takes --ink; the
   category it came from is context and takes --ink-soft. Nothing that a reader
   needs is ever set in --ink-helper, which is why it is the only text token
   allowed to be the faintest one.

   Surfaces step in the same way - --bg, then --layer, then --layer-accent -
   rather than being separated by a shadow, which says nothing in dark mode.

   Every pair below clears WCAG AA against the surface it is used on: body text
   at 4.5:1, and boundaries and focus rings at 3:1. --line is decorative only
   (rules between rows); anything that marks out a control uses --line-strong.

   Type is split by role rather than by taste. Benson notation is code-shaped -
   bracketed, subscripted, structural - so it is set in mono, and so is every
   numeral, because that is what makes the ligand columns and the sign column
   line up down a grid of 236 cards. Everything that is prose about the
   chemistry rather than the chemistry itself - headings, chips, labels,
   explanatory copy - stays in the sans stack.

   Nothing here has a corner radius. A rounded card asks to be read as an
   object on a surface; this page is a dense reference, and square edges plus a
   1px hairline let the increments read as one continuous table. Radius is also
   the cheapest way to look like a generic web app, which this is not. */

/* IBM Plex Mono, shipped with the site rather than fetched from anywhere.

   The design language names Plex Mono, and until now the page asked for
   "whatever mono this machine has", which is three different typefaces: SF
   Mono on a Mac, Consolas on Windows, usually a Courier clone on Linux. They
   differ in width, weight and x-height, so the one thing the mono is here to
   do - line the ligands up in a column and make the values comparable down the
   grid - came out differently for every student in the class.

   Self-hosting keeps both properties the project has held on to. There is no
   build step: these are two files in assets/. And there is still no external
   dependency - no CDN, no Google Fonts, no third-party request and nothing for
   a reader to be tracked by, which also means the page works in a lab with no
   internet once it has been loaded.

   Only the two weights actually used are shipped, and both are declared, so
   the browser never synthesises a weight from the other one. Every mono rule
   below asks for 400 or 600 and nothing else.

   SIL Open Font License 1.1 - assets/fonts/OFL.txt. The system stack stays
   behind it, both for the moment before the font arrives and for the rare
   glyph Plex does not carry, such as the Mac command key in the search hint. */
@font-face {
  font-family: "IBM Plex Mono";
  src: local("IBM Plex Mono"), url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: local("IBM Plex Mono SemiBold"), url("fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #e9ecee;
  --layer: #fcfdfd;
  --layer-accent: #d7dcdf;
  --ink: #12181b;
  --ink-soft: #4a545a;
  --ink-helper: #5c676d;
  --line: #c2c9cd;
  --line-strong: #7d878c;
  --accent: #0b5d63;
  /* A tint, not a wash. Selection is carried by the 2px ring; when a dozen
     increments are chosen the fill only has to say which cards they are, and
     a saturated one turns the grid into blocks of colour that out-shout the
     values. Lighter here also means more contrast under the ink, not less. */
  --accent-soft: #e8f4f5;
  /* Text on a filled accent. Hardcoding #fff here is the bug that made the
     selected tab 2.42:1 in dark mode, so it is a token like everything else. */
  --on-accent: #ffffff;
  /* Distinct from --accent's other job by shape - an offset ring, never a fill. */
  --focus: #0b5d63;

  /* Two stacks, two jobs. --font-mono is notation and numerals and nothing
     else; --font-sans is everything the page says about them.

     The mono is shipped with the site so it is the same everywhere, because
     the columns it lines up are the point. The sans is the reader's own UI
     face on purpose: it is chrome, it should look like the rest of their
     machine, and shipping a second file to restyle the word "Contributions"
     would be 40KB spent on nothing. */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* One spacing scale, so the density pass is not fifty separate judgements.

     It has one deliberate exception, and it is written out where it happens
     rather than left for a reader to notice: .grid button keeps the padding
     the design spec drew, because 236 cards tile the page and a pixel each way
     is a column. Everything else that looks off-scale is not spacing - a 3px
     grip bar, a 1px hairline, a 2px ring - and those are in px on purpose,
     because a hairline is a hairline whatever the type size. */
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  /* The width below which the tally panel stops being a column beside the
     grid and becomes a sheet at the foot of the page.

     assets/app.js has to agree with this number. It measures how far the
     sheet slides, and that measurement means nothing on the other side of the
     line - so a breakpoint that disagreed would either measure a desktop
     panel that never moves, or leave a phone's sheet unmeasured and sitting
     permanently across the bottom of the screen. The script reads this token
     rather than carrying its own copy.

     A media query cannot read a custom property, so the queries below still
     write the number out: the rail is (min-width) at one pixel more than this.
     What holds them together is tools/validate_css.mjs, which fails if this
     token and the queries disagree - the same bargain index.html strikes with
     the asset version, where one value in eight places is checked rather than
     pretended away.

     In px deliberately, as the three other breakpoints are (62369df): a
     breakpoint describes the viewport, not the text in it. */
  --sheet-max: 859px;

  /* How long the sheet takes to arrive and how long it takes to leave.
     Material's emphasized pair: it leaves quickly and arrives gently, which
     is what "native" turns out to mean when you slow it down and look.

     --sheet-close is a token because two rules have to agree on it. The panel
     slides out over this long, and the contributions inside it are made
     invisible after exactly this long - a delay rather than a fade, so they
     stay readable for precisely as long as they are still sliding past.
     visibility is what stops a shut sheet being tabbed into, so the two
     numbers disagreeing is a keyboard bug either way round: shorter and the
     panel goes untabbable while it is still on screen, longer and it stays
     tabbable after it has gone. They were written out separately before and
     nothing held them together. */
  --sheet-open: .34s;
  --sheet-close: .25s;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101417;
    --layer: #1a2024;
    --layer-accent: #262e33;
    --ink: #e8edef;
    --ink-soft: #a4b0b5;
    --ink-helper: #8b979c;
    --line: #2c353a;
    --line-strong: #626e74;
    --accent: #5cc9d3;
    --accent-soft: #16333a;
    --on-accent: #101417;
    --focus: #5cc9d3;
  }
}
:root[data-theme="dark"] {
  --bg: #101417;
  --layer: #1a2024;
  --layer-accent: #262e33;
  --ink: #e8edef;
  --ink-soft: #a4b0b5;
  --ink-helper: #8b979c;
  --line: #2c353a;
  --line-strong: #626e74;
  --accent: #5cc9d3;
  --accent-soft: #16333a;
  --on-accent: #101417;
  --focus: #5cc9d3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0 var(--space-5) var(--space-7);
  background: var(--bg);
  color: var(--ink);
  /* 1rem, not a pixel size: a reader who has set a larger default font in the
     browser gets one. Every size below is relative to this. */
  font: 1rem/1.55 var(--font-sans);
}
.wrap { max-width: 1180px; margin: 0 auto; }
/* A chemist looked straight at these and did not see them: at .72em of a small
   card they were about 9px. Larger, with the line-height collapsed so a
   subscript no longer stretches the row it sits in. */
sub { font-size: .82em; line-height: 0; }

/* ---------------- app bar ---------------- */

/* The edge of the application, rather than the first paragraph of the page.

   Three things say so, and they are the three every application chrome uses:
   it runs the full width of the window, it sits on a surface of its own, and a
   hairline closes it. The band is pulled out past the body's own padding and
   given that padding back inside, so the surface reaches both edges of the
   screen while its contents stay in column with everything below.

   The description and citation used to spend 208px before anything you could
   click. They are still here, and still in the markup for anyone reading the
   page with a screen reader or a search engine - just not in front of the
   thing you came to use. */
.appbar {
  margin-inline: calc(-1 * var(--space-5));
  padding-inline: var(--space-5);
  margin-bottom: var(--space-5);
  background: var(--layer);
  border-bottom: 1px solid var(--line);
}
/* 1180px is .wrap's width, written again rather than shared, because these are
   two boxes that happen to line up rather than one box inside another - the
   band has to be able to reach the edges while its contents do not. */
.appbar-inner {
  max-width: 1180px; margin: 0 auto;
  min-height: 3.25rem;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-4);
}
/* The title is the one thing here nobody needs to read twice. */
h1 { margin: 0; font-size: 1.0625rem; letter-spacing: -.01em; font-weight: 620; }
/* Pushed to the far end, so the bar has two ends and not one queue. Wraps to a
   line of its own below the title when the window is too narrow to hold both,
   which on a phone is most of them - still right-aligned there, so it reads as
   the same group that was beside the title a moment ago. */
.appnav {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--space-1);
}

/* A control drawn with spacing and a hover rather than with a border.

   The border is what a container gets - the field you type into, the toggle
   holding two states. Spending it on every control as well is what made the
   old strip read as five rectangles of equal weight, none of them saying
   which mattered. These recede until they are pointed at, which is what
   secondary means.

   It is a <button> for About, which discloses a panel, and an <a> for
   Reference, which goes to a page: one rule for both, so they sit level, and
   the link still opens in a new tab and still works with scripting off. */
.ghost {
  font: inherit; font-size: .8125rem; line-height: 1.6;
  cursor: pointer; text-decoration: none;
  background: transparent; color: var(--ink-soft); border: 0;
  padding: var(--space-2) var(--space-3);
  display: inline-flex; align-items: center; justify-content: center;
  /* The same height as the square one beside them. Left to their text they
     came to 29px against the theme button's 32px, so the three sat in a row
     at two different heights - close enough to look like a mistake rather
     than a difference. It is also the floor for a touch target on the widths
     between a phone in landscape and a laptop, where these are still words
     and a thumb is still what presses them. */
  min-height: 2rem;
}
.ghost:hover { background: var(--layer-accent); color: var(--ink); }
/* Words while there is room for words. The glyph ships on every screen and is
   shown on the narrow ones by the rule further down; a word is unambiguous and
   a glyph has to be learnt, so the glyph is what a shortage of width buys, not
   a default. */
.ghost-icon { display: none; }

/* Which theme is on is something the page already shows by being that theme,
   so this needs no label - only a target big enough to hit and a glyph saying
   where it goes. Square, and sized to sit level with the words beside it. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
}
/* The same three branches the colour tokens use, so the icon is right on a
   system-dark machine whose reader has never pressed this. Light shows the
   moon, because the moon is where pressing it takes you. */
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
}
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
/* A thumb needs more than 32px, and the row it sits in has the width to give. */
@media (max-width: 859px) { .theme-toggle { width: 2.25rem; height: 2.25rem; } }

/* Below this the title and the three words stop sharing a line, so the two
   that are words become the glyphs they already ship, and the row fits beside
   the title again instead of dropping underneath it.

   440px is measured rather than chosen. The title is 224px, the nav reading
   About / Reference / theme is 160px, the gap between them is 12px and the
   page keeps 16px each side: 428px, below which they cannot share a line. The
   next ten pixels up are slack, because a reader who has raised their browser
   font makes both of those numbers larger and there is no width at which that
   is still exactly true.

   As glyphs the same row is 112px, so the title has 348px of the 358px a
   390px phone leaves - it fits, with the pixels to spare that the word version
   did not have. Narrower than about 370px the title wraps to two lines rather
   than the row breaking apart, which is why h1 is allowed to be narrower than
   its text here: a wrapped title with the controls still beside it reads
   better than a title alone above a row of three glyphs.

   The word is hidden, never dropped. It is still the button's accessible name,
   so a screen reader on a phone still meets "About" and "Reference" - and the
   markup carries no aria-label repeating what the element already says. */
@media (max-width: 440px) {
  /* nowrap, and it is the whole of why the title wraps instead of the row
     breaking apart. A wrapping flex container moves an item to the next line
     before it will shrink one that is already on this line, so min-width alone
     did nothing: the nav went underneath while the title sat on a line of its
     own with room to spare beside it. Told it may not wrap, the container has
     to shrink something instead, and min-width: 0 is what says the title is
     the one that gives. The nav is held out of that: three 36px targets are
     the floor here, not the slack. */
  .appbar-inner { flex-wrap: nowrap; }
  .appnav { flex: none; }
  h1 { font-size: 1rem; min-width: 0; }
  .ghost { width: 2.25rem; height: 2.25rem; padding: 0; }
  .ghost-icon { display: block; }
  .ghost-label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden; clip-path: inset(50%);
    white-space: nowrap; border: 0;
  }
}

/* ---------------- toolbar ---------------- */

/* What acts on the increments, on the near side of the bar's hairline: what to
   look for, and how to look at it. The filters follow on their own row, which
   they now get by being their own element rather than by asking a flex parent
   for a whole line.

   The search is allowed to grow but not to sprawl. Given the whole row it
   became the largest thing on the page by area - a text field out-shouting 236
   values - so it takes the room it needs to show a long placeholder and stops.
   Cards/Table sits at the far end rather than trailing the field, so the row
   has two ends the way the bar above it does. */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.toolbar .search { flex: 1 1 20rem; min-width: 12rem; max-width: 34rem; margin-bottom: 0; }
.toolbar .views { flex: none; margin-left: auto; }
/* Too narrow for the field to ask for a comfortable width and still leave room
   beside it. Asking for most of a line rather than all of one is the whole
   change: Cards/Table then rides along on the same row instead of being
   pushed onto a row of its own, which on a phone is 37px of chrome for one
   control.

   The floor comes down with it, and that is the half that actually mattered.
   A flex basis only decides who wraps when there is room to negotiate; a
   min-width decides it outright. At 320px the row has 288px, Cards/Table takes
   120px and the gap 12px, so a field refusing to go below 12rem could not fit
   whatever its basis said - and the toggle went back onto a row of its own on
   the narrowest screens, which are the ones that could least afford it. 9rem
   still shows enough of the placeholder to say what the field is for. */
@media (max-width: 620px) {
  .toolbar .search { flex: 1 1 45%; min-width: 9rem; }
}

.about { margin-bottom: var(--space-5); }
.about p { margin: 0; color: var(--ink-soft); font-size: .92rem; max-width: 62ch; }
.about .cite { margin-top: var(--space-3); color: var(--ink-helper); font-size: .8rem; }
/* The accent, not the browser's blue. Every other link on the site is already
   a token; this one was the last one left to the user agent. */
.about a { color: var(--accent); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
/* A grid item's min-width is auto, which means "as wide as my content", and
   the table's content is six nowrap columns. Without this the column grew to
   fit the table and took the whole document sideways with it - the header and
   the filters slid off the left of a phone screen, and .table-wrap's own
   overflow never got the chance to scroll. Everything in this column has to
   be allowed to be narrower than what is inside it. */
main, .library, .table-wrap { min-width: 0; }
/* The panel is 23rem once it has contributions to list, and a little over a
   third of that before it does - where its whole content is "0". It never
   disappears, because the README promises the running total is always on
   screen and that is worth keeping; it just stops reserving a column it is
   not using, which is four more columns of increments while you are choosing
   the first one.

   The rail arrives at 860px rather than 980px, so a tablet held either way
   gets the total beside the increments instead of underneath them. At 860px
   that still leaves three columns of cards, and four once the panel collapses. */
@media (min-width: 860px) {
  .layout { grid-template-columns: minmax(0,1fr) 23rem; }
  /* "empty" is assets/app.js's word, and index.html's before that. An
     attribute selector can no more read a value from a script than a media
     query can read a token, so all three write it out and
     tools/validate_css.mjs fails if they stop agreeing. Rename it on one side
     alone and this rule quietly matches nothing: the wide column stays
     reserved for a panel with nothing in it, and nothing reports a thing. */
  .layout[data-tally="empty"] { grid-template-columns: minmax(0,1fr) 11rem; }
}

/* ---------------- picker ---------------- */
.search { position: relative; margin-bottom: var(--space-5); }
/* Search spans all 236 rows and is the most-used control here, so it carries a
   heavier bottom rule than its other three sides and an icon that says what it
   is before the placeholder has to.

   It is sized to sit in the line of text beside it rather than to announce
   itself: at full width and body size it read as a banner, and the longest
   thing anyone types into it is "cyclohexane". */
.search input {
  width: 100%; font: inherit; font-size: .9375rem; line-height: 1.3;
  color: var(--ink); background: var(--layer);
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  padding: 6px 60px 6px 30px;
}
.search input::placeholder { color: var(--ink-helper); }
/* Drawn rather than fetched, and in currentColor so it themes for free. */
.search .icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--ink-soft); pointer-events: none;
}
/* The shortcut is a hint, so it steps out of the way as soon as it is used -
   which is also why it and the clear button can share one corner: the hint is
   gone by the time there is anything to clear. */
.shortcut {
  position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%);
  pointer-events: none; font-family: var(--font-mono); font-size: .7rem;
  color: var(--ink-helper);
  border: 1px solid var(--line); padding: 0 var(--space-2);
  background: var(--layer-accent);
}
.search input:not(:placeholder-shown) ~ .shortcut { display: none; }
@media (max-width: 520px) {
  .shortcut { display: none; }
  .search input { padding-right: var(--space-7); }
}
.search .clear {
  position: absolute; right: var(--space-1); top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--ink-helper);
  font: inherit; cursor: pointer; padding: var(--space-2) var(--space-3); line-height: 1;
}
.search .clear:hover { color: var(--ink); }
/* Links are in this list too, and were not. Reference is an <a> because it goes
   to a page, so it took the browser's default ring while the button beside it
   took this one - two controls in the same row of three, focused the same way
   by the same key, drawn differently. Nothing here can see that: it is a
   selector that does not mention a tag, and the page looks right until
   somebody navigates it by keyboard. */
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
/* The panel is given focus when the control holding it disappears, so that it
   does not fall to the body. It is a container and not a control - it is not
   in the tab order and there is nothing on it to operate - so it is not drawn
   as one. The heading and the total below it say where you have landed. */
.tally-panel:focus, .tally-panel:focus-visible { outline: none; }

/* Category filters, not tabs. Several can be on at once, and none being on
   means the whole set is showing rather than nothing - which is why "All"
   reads as chosen exactly when no category is. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
/* Unselected chips carry a transparent border rather than none, so choosing one
   changes its colour without moving the row a pixel. */
.chip {
  font: inherit; font-size: .8125rem; cursor: pointer;
  background: var(--layer-accent); color: var(--ink-soft);
  border: 1px solid transparent;
  padding: var(--space-2) 11px; min-height: 28px;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { background: var(--line); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600;
}
/* The category is what you are choosing; how many it holds is a footnote to it. */
.chip .n {
  font-family: var(--font-mono); font-size: .78em; font-weight: 400;
  opacity: .65; font-variant-numeric: tabular-nums;
}

.views { display: flex; border: 1px solid var(--line-strong); }
.views button {
  font: inherit; font-size: .8rem; cursor: pointer; padding: var(--space-2) var(--space-4);
  background: var(--layer); color: var(--ink-soft); border: 0;
  border-right: 1px solid var(--line-strong);
}
.views button:last-child { border-right: 0; }
.views button:hover { background: var(--layer-accent); color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* The table says what a card cannot: the unit, the quantity and the source,
   which is what notation/categories.csv exists to supply. Wide content scrolls
   inside its own box rather than pushing the page sideways. */
.table-wrap { overflow-x: auto; margin: var(--space-3) 0 var(--space-6); }
.table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.table th, .table td { padding: var(--space-2) var(--space-4); text-align: left; white-space: nowrap; }
/* A column heading is a label for the chemistry, not chemistry, so it is sans -
   the same rank and treatment as the headings over the card sections. */
.table thead th {
  border-bottom: 1px solid var(--line-strong); color: var(--ink-soft);
  font-size: .6875rem; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
}
.table tbody th { font-weight: 400; }
/* The whole row adds, the way the whole card does - not only the name inside
   it - so it carries the pointer cursor a card's button gets for free. */
.table tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; }
.table tbody tr:hover { background: var(--layer-accent); }
.table tbody tr.picked { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.table .num {
  text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.table .soft { color: var(--ink-soft); }
/* The row is what adds now, but the name stays the one real, focusable
   control in it - what Tab and the arrow keys land on - so it still needs a
   target of its own: at .85rem with no padding it came to about 21px, under
   the 24px a pointer target needs. The height is given rather than the padding
   so the column does not widen and the row does not grow. */
.table tbody th button {
  font: inherit; font-family: var(--font-mono); cursor: pointer;
  background: none; border: 0; padding: 0;
  color: var(--ink); text-align: left;
  display: inline-flex; align-items: center; min-height: 1.5rem;
}
.table tbody th button:hover { color: var(--accent); text-decoration: underline; }
/* The same job as the card's badge, and here it can be a real button, because
   a table cell is not itself one. */
.table .tally {
  font: inherit; font-family: var(--font-mono); font-weight: 600; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid transparent;
  margin-left: var(--space-3); padding: 0 var(--space-2); min-height: 1.5rem;
}
.table .tally:hover { background: var(--accent); color: var(--on-accent); }

/* One scrolling library rather than five exclusive panels. The heading sticks
   so that "where am I" is answered without a sidebar spending 240px of the
   width the grid is already short of. */
.library { display: flex; flex-direction: column; }
.section-head {
  position: sticky; top: 0; z-index: 2;
  margin: 0; padding: var(--space-3) var(--space-1) var(--space-2);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: .75rem; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
  color: var(--ink-soft);
  display: flex; align-items: baseline; gap: var(--space-3);
}
.section-head .n {
  margin-left: auto; font-family: var(--font-mono); font-size: .6875rem;
  font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.section-head + .grid { margin: var(--space-3) 0 var(--space-6); }

/* 7.25rem is measured rather than chosen: 116px is the 95th-percentile label
   (92px at the card's own type size) plus the card's 24px of padding. Sizing
   the track to the single longest label instead would cost every one of the
   other 235 cards a column's worth of width to fit "cyclononene (trans)"; the
   handful that are longer wrap to a second line, which is what the extra room
   in the card is for.
   The column count is left to auto-fill deliberately, so it follows the space
   available - and survives a reader who has set a larger default font. */
/* The increments meet along a 1px hairline rather than floating 8px apart: 236
   of them are one continuous body of reference, and separated boxes ask to be
   read one at a time. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr)); gap: 1px; background: transparent; }
/* Each card draws its own hairline as a ring, rather than the grid painting one
   by showing a container background through the gap. The container trick is a
   pixel cheaper and leaves a grey block wherever the last row is incomplete,
   which is most of the time with sections of 44, 82, 57, 24 and 29. */
.grid button {
  font: inherit; font-size: .8125rem; cursor: pointer; text-align: left;
  background: var(--layer); color: var(--ink);
  border: 0; box-shadow: 0 0 0 1px var(--line-strong);
  /* Off the spacing scale, and staying off it. These two came from the design
     spec as drawn numbers rather than derived ones, and the card's density is
     the one place in this stylesheet where that is the point: 236 of them tile
     the page, so a pixel each way is a column gained or lost. Snapping them to
     8px/12px would be tidier to read and a different grid to look at.

     The height is a rem because it is a height. It was 46px, which is what
     2.875rem comes to at the default font size - identical today, and no
     longer identical for a reader who has raised their browser's font, who
     used to get the larger text and the same 46px box to fit it in. That is
     the whole point of un-pinning the body font in 62369df, and this rule was
     quietly undoing it. */
  padding: 7px 10px; min-height: 2.875rem;
  display: flex; flex-direction: column; gap: var(--space-1);
  transition: background .11s ease;
  overflow-wrap: anywhere;
}
.grid button:hover { background: var(--layer-accent); }
/* Chosen is a fill plus a 2px ring; focus is a ring of a different form. Both
   have to sit above their neighbours or the flush grid clips them, and the
   focus ring is drawn inside the card for the same reason. */
.grid button.picked {
  background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent);
  position: relative; z-index: 1;
}
.grid button:focus-visible {
  outline: 2px solid var(--focus); outline-offset: -2px;
  position: relative; z-index: 2;
}
/* The notation is the thing being scanned; mono is what lets the ligands line
   up in a column so that looking for (H)2 is possible at all. */
.grid .name { font-family: var(--font-mono); line-height: 1.35; }
/* On a calculator the number is the content, so it is the boldest thing on the
   card - and it shares the notation's mono, which is what puts the sign and
   the decimal point in the same place on every card in the row. */
.grid .meta {
  font-family: var(--font-mono); color: var(--ink); font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
/* Which category a search result came from - prose about the value, not the
   value, so it steps back into the sans stack. */
.grid .from { font-family: var(--font-sans); font-size: .6875rem; font-weight: 400; color: var(--ink-soft); }
/* How many are chosen, as a filled badge: a count set inline in the accent was
   read as part of the value. This cannot be missed and cannot be misread.

   It is also how you take one back. Adding is a tap on the card, and until now
   removing meant opening the panel and finding the row - three interactions to
   undo one, and on a phone the panel is a sheet that has to be opened first.
   The badge is already exactly where the thumb is.

   The badge stays small because the card is only about 46px tall and a 40px
   block would own it. The hit area does not: ::after reaches past the glyph on every side,
   giving roughly 38x34px to press without moving anything in the layout. That
   clears the 24px minimum comfortably and is a single tap - no gesture, no
   path to trace, nothing a pointer cannot do. */
.grid .tally {
  position: relative; margin-left: auto; cursor: pointer;
  font-size: .6875rem; font-weight: 600;
  background: var(--accent); color: var(--on-accent); padding: 1px 5px;
}
.grid .tally::after { content: ""; position: absolute; inset: -9px -7px; }
/* Inverted rather than merely lit, so it reads as a different control from the
   card it sits on rather than as the card highlighting. */
.grid .tally:hover { background: var(--ink); color: var(--layer); }
/* The bounds an averaged value came from, beside the average itself. */
.grid .range { color: var(--ink-soft); font-size: .6875rem; font-weight: 400; }
.status { color: var(--ink-helper); font-size: .9rem; padding: var(--space-6) var(--space-1); }

/* ---------------- tally ---------------- */
.tally-panel {
  background: var(--layer); border: 1px solid var(--line-strong);
  padding: var(--space-5);
  /* Beside the grid it follows the page down. This needs no media query of
     its own: the sheet rules further down take the panel out of the flow
     entirely and win on source order, and they reset top so that a panel
     pinned to the bottom is not also pinned to the top and stretched between
     the two. One less place for the breakpoint to be written. */
  position: sticky; top: var(--space-5);
}
/* Beside the grid there is nothing to collapse, so neither the disclosure nor
   the drag handle is merely hidden - both are absent, and cannot be tabbed to
   or dragged. */
.panel-toggle, .sheet-grip { display: none; }
/* What the number underneath is a measure of. Written from the data rather
   than hardcoded, so a category that has declared nothing reads "Total".
   Deliberately not uppercased: the content is a quantity symbol, and the
   lowercase f in dHf is part of the notation, not a styling accident. */
.tally-label {
  margin: 0 0 var(--space-1); color: var(--ink-soft);
  font-size: .6875rem; font-weight: 600; letter-spacing: .4px;
}
/* Deliberately its own rule and not grouped with .tally-label above. The two
   want the same type, but only this one may be uppercased: "Contributions" is
   static English, and the label beside it is a quantity symbol. */
.picks-head {
  margin: var(--space-5) 0 0; color: var(--ink-soft);
  font-size: .6875rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
}
/* Shown only when the sum holds more than one kind of quantity. */
.mixed {
  margin: var(--space-3) 0 0; color: var(--ink-soft);
  font-size: .78rem; line-height: 1.45;
}
.mixed b { color: var(--ink); font-weight: 600; }

/* The answer, and the largest thing on the page.

   No negative tracking. It was carried over from a spec written for a
   proportional face, and on a monospace one it fought the typeface twice: the
   advance widths are already uniform so tightening them only crowded the
   digits, and it pulled the total out of column with the kcal figure below -
   which is the whole reason both are set in tabular figures. */
.kj {
  font-family: var(--font-mono); font-size: 1.875rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* The unit is not a figure, so it is not mono and does not take the tracking. */
.kj span {
  font-family: var(--font-sans); font-size: .5em; font-weight: 400; color: var(--ink-soft);
  margin-left: var(--space-2); letter-spacing: 0;
}
/* The figure is mono so it stays in column with the kJ total above it; the
   unit is not a figure, so it is set like the kJ unit is. Both were mono here
   because the number and the words were written as one string, which put
   "kcal/mol" in a code face two lines under a sans "kJ/mol". */
.kcal {
  font-family: var(--font-mono); color: var(--ink-soft); font-size: .875rem;
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.kcal span { font-family: var(--font-sans); margin-left: var(--space-2); }

ul.picks { list-style: none; margin: var(--space-3) 0 0; padding: 0; max-height: 46vh; overflow-y: auto; }
ul.picks li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
/* A contribution row is a small equation: the notation, then what it is worth
   each, then what it is worth here. Only the first and last are figures. */
ul.picks .name {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: .8125rem;
  overflow-wrap: anywhere;
}
ul.picks .each {
  display: block; font-family: var(--font-sans); color: var(--ink-soft);
  font-size: .6875rem; font-variant-numeric: tabular-nums;
}
/* Right-aligned in a fixed column so the signs line up down the list, which is
   how you spot the one term that is pulling the total the wrong way. */
ul.picks .sum {
  font-family: var(--font-mono); font-size: .8125rem; font-weight: 600;
  font-variant-numeric: tabular-nums; min-width: 3.875rem; text-align: right;
}
/* One boundary around the pair, rather than one around each button: the group
   is the control, and two boxes side by side read as two. */
.stepper { display: flex; align-items: center; gap: 1px; border: 1px solid var(--line); }
.stepper button, .rm {
  font: inherit; cursor: pointer; background: transparent; color: var(--ink-soft);
  border: 1px solid transparent;
  width: 1.875rem; height: 1.875rem; line-height: 1; padding: 0;
}
.stepper button:hover, .rm:hover { background: var(--accent); color: var(--on-accent); }
.stepper .n {
  min-width: 1.625rem; text-align: center; font-family: var(--font-mono);
  font-size: .8125rem; font-variant-numeric: tabular-nums;
}
.rm { font-size: 1.05rem; }
/* Remove is the rarest thing you do to a row and the only destructive one.

   It used to wait for hover, behind @media (hover: hover). That is a claim the
   device makes about itself, and it is wrong often enough to matter: Chrome on
   Android reports hover when it is asked for the desktop site, and so do
   tablets with a stylus or a keyboard case. When the claim was wrong the
   button was still there and still took a tap - opacity does not stop pointer
   events - so the row carried an invisible destructive control right beside
   the number. Reported from a phone, where it was simply not there.

   Hiding it saved a little chrome and cost the one thing a remove button has
   to be, which is findable. It is always drawn now: borderless, in --ink-soft,
   and it only fills with the accent under an actual pointer. The space was
   reserved for it either way, so nothing moves. */
.empty { color: var(--ink-helper); font-size: .87rem; margin: var(--space-5) 0 var(--space-1); }

/* How far the total would move if every averaged range were read at its
   bounds. Only shown when something chosen was published as a range. */
.band {
  color: var(--ink-soft); font-size: .78rem; line-height: 1.45;
  margin: var(--space-4) 0 0; padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.band b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* How far the method itself typically misses, under the figures it qualifies.
   Not part of the band above, and not styled as it is: the band bounds this
   total's published ranges, and this is a statistic about the method. */
.method {
  color: var(--ink-soft); font-size: .78rem; line-height: 1.45;
  margin: var(--space-2) 0 0;
}
/* A citation mark. line-height: 0 keeps the raised figure from opening up the
   line it sits in, as it does for the subscripts in a group name. */
sup.cite-mark { font-size: .75em; line-height: 0; }
.cite-mark a { color: var(--accent); text-decoration: none; padding: 0 1px; }
.cite-mark a:hover { text-decoration: underline; }

/* On a phone the panel sits at the foot of the page rather than beside the
   grid, and there it has to earn every pixel of its height.

   It used to take whatever it needed and stick to the bottom, which meant that
   with nothing chosen at all it still covered the lower half of the screen -
   and once a few increments were in it, it covered the grid entirely and hid
   three of the six category filters behind it. It also sat underneath the
   sticky section headings, which have a z-index and it did not, so "CHO
   GROUPS" painted a bar straight across the middle of it.

   So on a small screen it becomes a sheet: the total is always on the screen,
   as the README promises, and the working out is one tap away. Collapsed it
   costs about 70px; opened it takes at most 70% of the viewport and scrolls
   inside itself, so the grid is always reachable behind it.

   These come after the rules they override - at the same specificity, order is
   what decides. */
@media (max-width: 859px) {
  /* Pinned and slid, rather than grown and shrunk.

     The sheet used to open by animating its height while sticky, which changes
     the height of the document on every frame - and with 236 cards behind it,
     that is a full page reflow sixty times a second. Height is a layout
     property and layout cannot run on the compositor, so it was never going to
     be smooth however the curve was tuned; it read as jitter because it was.

     Fixed takes the panel out of the flow, so its size stops being the
     document's problem, and transform is handed to the compositor. The page
     gets padding under it worth exactly what the sheet leaves showing, so
     nothing hides behind a panel that no longer occupies any space.

     Both distances are measured rather than guessed - the head is as tall as
     the total is, and the total is as tall as the reader's font makes it. */
  .tally-panel {
    /* top: auto undoes the sticky offset above. With both top and bottom set
       a fixed box is stretched between them, which would make the sheet as
       tall as the window instead of as tall as its contents. */
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 3;
    margin: 0; padding: var(--space-3) var(--space-4);
    max-height: 80vh; display: flex; flex-direction: column;
    transform: translateY(0);
    transition: transform var(--sheet-open) cubic-bezier(.05, .7, .1, 1);
  }
  /* "true" is assets/app.js's word, written here again because a selector
     cannot read one from a script. tools/validate_css.mjs fails if the two
     stop agreeing, which is the only thing that would: change the spelling on
     one side and the button still flips the attribute, the sheet still has
     every rule it needs, and none of them apply - it just never opens. */
  /* Shut, the sheet is pushed down by exactly its own body, which leaves the
     head showing.

     That distance grows as contributions are added, and the panel grows by the
     same amount at the same moment, because it is anchored to the bottom and
     grows upwards. The two cancel and the head does not move - but only if
     they arrive together. They did not: the height is layout and lands at
     once, the transform is transitioned and takes var(--sheet-close) to
     follow, so the head jumped up and slid back on every pick. It stopped
     after a handful because once the body passes 80vh the panel is capped and
     the distance stops changing - which is why it read as "bounces for the
     first few clicks and then settles" rather than as a bug with a cause.

     What fixes it is not written here, because it cannot be: CSS has no way to
     say "transition this property when that other one changes, but not when
     this one does". assets/app.js turns the transition off for the one frame
     in which it applies a new measurement, which is the honest version of the
     same sentence - a re-measurement is not a state change, and only a state
     change should move the sheet.

     Written as a plain length rather than as `100% - var(--sheet-peek)`, which
     is the tidier way to say it and does not work: a percentage inside a
     transform is resolved against the border box, and a Chrome that has handed
     the transform to the compositor does not re-resolve it when the custom
     property in the calc changes. The sheet stayed pushed down by a full 100%
     and never came back onto the screen. */
  .tally-panel:not([data-open="true"]) {
    transform: translateY(var(--sheet-hidden, 0px));
    transition-duration: var(--sheet-close);
    transition-timing-function: cubic-bezier(.3, 0, .8, .15);
  }
  body { padding-bottom: calc(var(--sheet-peek, 0px) + var(--space-5)); }
  /* A sheet with a handle is a sheet you know you can drag. Without one the
     swipe would be a secret, and a gesture nobody finds is not a feature. The
     button beside the total does the same job for anyone who does not.

     touch-action: none on the two parts you drag - the handle and the head -
     is what makes the gesture work on a real phone rather than only in a
     simulation. Without it the browser claimed the same downward swipe:
     the page scrolled under the finger, and at the top of the page a downward
     drag was pull-to-refresh, which reloaded the document and threw away every
     increment chosen. The list below keeps its own scrolling, which is why
     this sits on the grip and the head and not on the panel. */
  .sheet-grip {
    display: block; flex: none; touch-action: none; cursor: grab;
    padding: var(--space-1) 0 var(--space-2);
  }
  .sheet-grip::before {
    content: ""; display: block; width: 2rem; height: 3px;
    background: var(--line-strong); margin: 0 auto;
  }
  /* One line: what the quantity is, what it comes to, and the way in.

     Shut, this bar is the entire sheet, and it is on the screen for as long as
     somebody is choosing increments - so every pixel of it is a pixel of the
     grid they came to read. It used to take three lines and 134px of an 844px
     phone. The kcal figure has moved into the body (index.html), which leaves
     a label, a figure and a button, and those fit beside each other.

     Baselines, not centres: a .6875rem label has nothing to line up on
     against a 1.875rem figure except the line they are written on. The button
     is the exception and centres itself, because it is a box rather than
     text.

     The figure takes its own leading here. 1.55 is set on the body for prose,
     and prose leading around a number that is alone on its line is 10px of air
     above and below it - which on this bar is 20px of the grid. */
  .tally-head {
    touch-action: none;
    display: flex; align-items: baseline; column-gap: var(--space-3);
  }
  /* Pushes the button to the far end, so the two readings stay together at
     the near one rather than being spread across the bar. */
  .tally-head .kj { margin-right: auto; line-height: 1.15; }
  .panel-toggle {
    display: flex; align-items: center; gap: var(--space-2);
    align-self: center; flex: none;
    font: inherit; font-size: .8125rem; cursor: pointer;
    background: transparent; color: var(--ink-soft);
    border: 1px solid var(--line-strong);
    padding: var(--space-2) var(--space-3); min-height: 2.375rem;
  }
  .panel-toggle .caret { transition: transform .12s ease; }
  .tally-panel[data-open="true"] .panel-toggle .caret { transform: rotate(180deg); }
  /* The body no longer animates anything. It keeps its full height at all
     times - that height is exactly how far the panel slides - and simply ends
     up below the bottom of the screen when the sheet is shut.

     visibility still does the job display was doing before: once the sheet has
     finished closing, nothing inside it can be tabbed to or announced, so the
     keyboard order matches what is on the screen. The delay is what keeps the
     contributions visible for as long as they are still sliding past.

     overscroll-behavior stops a flick that reaches the end of the list from
     continuing into the page behind it - the same chaining that turns into
     pull-to-refresh at the top. */
  .tally-body {
    min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    visibility: visible; transition: visibility 0s;
  }
  .tally-panel:not([data-open="true"]) .tally-body {
    visibility: hidden; transition: visibility 0s linear var(--sheet-close);
  }
  /* The list no longer needs its own cap - the sheet caps the whole thing, and
     one scrolling region is easier to use than two nested ones. */
  ul.picks { max-height: none; margin-top: var(--space-2); }
  .stepper button, .rm { width: 2.375rem; height: 2.375rem; }
  /* One row that scrolls, rather than three that stack.

     Six categories wrapped to three rows at 390px and took 116px - an eighth
     of the screen - before a single increment was on it. Sideways they take
     one row, and the row is the same height whatever the reader's font does
     to the labels, which wrapping was not.

     The row is pulled out to both edges of the screen and given the padding
     back inside, so a chip that continues past the edge is cut off by the
     screen rather than tucked behind the page margin. Being cut off is the
     only thing telling a reader there is more, which is also why there is no
     scrollbar: this is a thumb-scrolled row of six on a touch screen, and a
     scrollbar would take height to say what the cut-off chip already says.

     A chip must not be squeezed to make the row fit, which is what
     flex-shrink would otherwise do to the longest label the moment the row
     overflowed - so the labels stay whole and the row scrolls instead.

     The chip itself is big enough for a thumb without spending lines on it:
     the rule this replaced grew the padding, which pushed the last chips off
     the first screen entirely. Height is what makes a target hittable, not
     width. */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--space-5));
    padding-inline: var(--space-5);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { min-height: 2.25rem; padding: var(--space-2) var(--space-4); flex: none; }
}

/* Narrower still, and a name like C-(Cd)(CB)(H)2 has no room left beside four
   controls - it ends up one character per line. Give the name the full width
   and let the counters sit underneath it. */
@media (max-width: 520px) {
  ul.picks li { flex-wrap: wrap; }
  ul.picks .name { flex-basis: 100%; }
  ul.picks .sum { margin-left: auto; }
}

.actions { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
/* With nothing chosen there is nothing to undo, copy or reset, and three
   greyed-out buttons said so three times. They also did not fit: the panel is
   11rem while it is empty, and the row needs about 14rem before the labels
   start being clipped, so Reset hung out past the panel's own border and took
   the document 1px wider than the window with it. They come back the moment
   they can do something. */
.layout[data-tally="empty"] .actions { display: none; }
/* The same bargain the header strikes, one panel over: a border means a
   container, and these are controls. They were three identical outlined
   rectangles of equal width - the same fault the top of the page had, where
   nothing said which of them mattered or which of them you could not undo.

   Quiet fills rather than ghosts, and the chips' fill exactly. Ghost controls
   work in the bar because they are words at the edge of the page with a hover
   to find them by; these sit under a list on a panel that on a phone has no
   hover at all, and three bare words in a row there read as a caption rather
   than as three things you can press. The chip is already this page's word for
   "a control you can press that is not the important thing on the screen", so
   these become chips rather than a fourth kind of button. */
/* --ink, not --ink-soft, and all three the same. Marking Copy by giving it the
   darker ink and leaving the other two soft did read as a hierarchy - it also
   read as two disabled buttons beside an enabled one, because faded is already
   this panel's word for "you cannot press this yet" and all three spend the
   first part of every visit actually being that. One signal, one meaning. */
.actions button {
  font: inherit; font-size: .8125rem; cursor: pointer;
  background: var(--layer-accent); color: var(--ink);
  border: 0; padding: var(--space-2) var(--space-4); min-height: 2rem;
}
.actions button:hover:not(:disabled) { background: var(--line); }
.actions button:disabled { opacity: .4; cursor: default; }
/* Weight, then - which is the one axis nothing else on this panel is using.
   An accent fill would have said "primary" loudest and is the one thing it
   must not do here: it would sit directly under the total and out-shout it,
   and on this page a filled accent already means a state is on. Copy is not a
   state. */
.actions .primary { font-weight: 600; }
/* Distance, not colour. Reset is the only one of the three that cannot be
   taken back, and this palette has no danger red to say so - deliberately, and
   adding one for a single button would be the wrong trade. Space says it
   instead, and says it better: the two you can undo stay together at one end
   and the one you cannot sits alone at the other, out of the path of a thumb
   going for Copy. */
.actions .destructive { margin-left: auto; }

/* The foot of the page: what a figure means, then the works cited, numbered. */
.notes {
  margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: .85rem;
}
.notes-head {
  margin: var(--space-5) 0 var(--space-2); color: var(--ink-soft);
  font-size: .6875rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
}
.notes-head:first-child { margin-top: 0; }
.notes p, .notes ol { margin: 0; max-width: 72ch; }
.notes ol { padding-left: var(--space-5); }
/* A DOI has no spaces to break at, and would otherwise push a phone's page sideways. */
.notes li { overflow-wrap: anywhere; }
.notes a { color: var(--accent); }
footer { color: var(--ink-helper); font-size: .8rem; margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); }
footer a { color: var(--ink-soft); }

/* Visible to screen readers only - the search field's label. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* Blink renders its own clear button inside type="search"; the page provides
   one that is styled and works in every browser, so hide the built-in. */
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* Animation is a preference. Everything here is decorative, so it all goes.

   The delay goes with the duration, and not only for tidiness. The sheet
   holds its contributions visible for --sheet-close after it starts closing,
   as a delay rather than a fade, so they are readable while they slide past.
   Killing the duration alone left that delay standing: the panel vanished in
   a frame and the contributions stayed visible - and so stayed tabbable -
   for a quarter of a second after it had gone, which is the exact keyboard
   fault the shared token above exists to prevent. With no motion to cover,
   there is nothing to wait for. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ reference.html

   The reference page. One stylesheet, not two: the page is the same design
   language as the calculator and shares its tokens, and a second file would be
   a second thing to version. Everything below is prefixed .ref- so it costs the
   calculator nothing but the bytes.

   Two rules from the calculator carry over unchanged and are the reason this
   section is short. Nothing has a corner radius. And the mono face is for
   notation and numerals only - which here means <code>, and nothing else, so a
   table cell is set in mono because its content is a group name rather than
   because of which column it happens to be in. That is why the notation is
   written `Cd` in reference/03_Notation.csv: the content decides its own
   typography, and the renderer never has to know which column is which.

   There is no text-transform anywhere on this page. A heading here can contain
   a chemistry symbol - ΔHf° is a row in the glossary - and uppercasing it
   renders ΔHF°, which is a different thing and not a real one. */

/* The reference page's own strip, which stands on its own layout.

   It used to say only `justify-content` and `border-bottom`, and take being a
   flex row from `.bar` alongside it - the one strip this page had before the
   calculator was split into an app bar and a toolbar. `.bar` is gone, so the
   two lines it was leaning on are written here.

   Said out loud because reference.html is not on main: it is built on the
   docs/reference-page branch, whose markup still reads `class="bar ref-bar"`.
   Nothing in this repository can fail on that, so this rule is what stops that
   branch merging into an unstyled header. When it does land, the honest
   follow-up is to give that page the same app bar as this one rather than to
   keep a second kind of strip alive. */
.ref-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-5) 0;
  justify-content: space-between; border-bottom: 1px solid var(--line);
}
.ref-back {
  font-size: .78rem; color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--line-strong); padding: var(--space-1) var(--space-3);
}
.ref-back:hover { background: var(--layer-accent); color: var(--ink); }

/* Contents above the prose on a narrow screen, beside it on a wide one. The
   grid is declared once at the wide breakpoint rather than being un-declared
   here, so the small screen keeps the simpler box model. */
.ref-toc { margin: var(--space-6) 0; }
.ref-toc-head {
  margin: 0 0 var(--space-3); font-size: .78rem; color: var(--ink-helper);
  letter-spacing: .02em;
}
.ref-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.ref-toc a { color: var(--ink-soft); font-size: .87rem; text-decoration: none; border-bottom: 1px solid var(--line); }
.ref-toc a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* A measure, not a column width. Prose past about 70 characters a line is
   measurably harder to come back to after looking away, and this is a page
   people read a paragraph of, look at the calculator, and return to. */
.ref-main { max-width: 68ch; }
.ref-section { margin: 0 0 var(--space-8); scroll-margin-top: var(--space-5); }
.ref-section h2 {
  margin: 0 0 var(--space-4); font-size: 1.05rem; font-weight: 620;
  letter-spacing: -.01em; padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--accent);
}
.ref-section h3 { margin: var(--space-6) 0 var(--space-3); font-size: .95rem; font-weight: 620; }
.ref-section p { margin: 0 0 var(--space-4); color: var(--ink); }
.ref-section ul { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
.ref-section li { margin-bottom: var(--space-2); }
.ref-section code { font: 600 .89em/1 var(--font-mono); color: var(--ink); }
.ref-section a { color: var(--accent); }

/* Wide enough for the contents to sit beside the prose without either being
   squeezed. Below this the two stack, which is also what happens when a reader
   has zoomed a narrow window - the breakpoint is about the space available,
   not about what kind of machine is asking. */
@media (min-width: 900px) {
  /* Narrower than the calculator's 1180px, and deliberately. The calculator
     wants width - it is a grid of 236 cards. This page is a column of prose
     with a contents list beside it, and at 1180px the two sit at opposite
     edges of the window with a hand's width of nothing between them. Sized to
     the content it actually has, the list reads as attached to the prose. */
  .ref-body .wrap { max-width: 940px; }
  .ref-toc {
    float: right; width: 13rem; margin: 0 0 var(--space-6) var(--space-7);
    padding-left: var(--space-5); border-left: 1px solid var(--line);
    position: sticky; top: var(--space-5);
  }
  .ref-toc ul { flex-direction: column; gap: var(--space-2); }
}

/* A table here is a reference table, so it reads like the increment grid:
   hairlines, no fill, no radius, and it scrolls inside its own box rather than
   pushing the page sideways. The wrap is what keeps a six-column table - the
   categories, included whole from notation/categories.csv - from setting the
   width of the whole document on a phone. */
.ref-table-wrap { overflow-x: auto; margin: 0 0 var(--space-5); border: 1px solid var(--line); }
.ref-table { border-collapse: collapse; width: 100%; font-size: .87rem; }
/* Wide tables take their natural width and scroll inside .ref-table-wrap. At
   100% of a 68ch measure a six-column table gives each column about nine
   characters, which turns "Cohen & Benson 1993" into four lines and the table
   into a wall. */
.ref-table-wide { width: max-content; min-width: 100%; }
.ref-table-wide .ref-cell { white-space: nowrap; }
/* The one column that is prose rather than a label still wraps, so a long note
   does not set the width of the whole table. */
.ref-table-wide .ref-cell:last-child { white-space: normal; min-width: 22rem; }
.ref-table th {
  text-align: left; font-weight: 620; color: var(--ink-soft);
  background: var(--layer-accent); white-space: nowrap;
}
.ref-cell { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: top; }
.ref-table tbody tr:last-child .ref-cell { border-bottom: 0; }
.ref-table tbody tr:hover { background: var(--layer); }
