/* Screen only (linked with media="screen"): the dark colour scheme,
   scrolling table regions, focus and hover states, and the desktop and
   narrow-window layouts. WeasyPrint never loads this file, and browsers
   do not apply it when printing. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --fg: #e6e6e3;
    --muted: #a8a8a3;
    --border: #3d4147;
    --surface: #1f2226;
    --link: #8cc4ff;
    --focus: #ffb366;
    --banner-bg: #3a2f12;
    --banner-fg: #ffe7a8;
    --banner-border: #8a6d1f;
    --draft-bg: #4a3410;
    --draft-fg: #ffe0b0;
    --checked-bg: #173d22;
    --checked-fg: #c4f0cf;
    --retired-bg: #33363a;
    --retired-fg: #dddddd;
  }
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* A table wider than its box scrolls inside it, and a shadow at an edge
   shows that more columns lie that way. The covers scroll with the
   content and hide each shadow once its edge is reached. */
.table-scroll {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--bg) 40%, transparent) left / 2rem 100% no-repeat local,
    linear-gradient(to left, var(--bg) 40%, transparent) right / 2rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--fg) 30%, transparent), transparent) left / 0.75rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--fg) 30%, transparent), transparent) right / 0.75rem 100% no-repeat scroll;
}
.table-scroll:focus-visible { outline-offset: 0; }

button:hover { border-color: var(--muted); }
.site-header a:hover, .site-title:hover { text-decoration: underline; }

/* Desktop is the primary workspace. Keep the page shell wide for data
   tables and use separate columns for browsing and procedure details.
   These rules live here so the A4 layout keeps its single-column flow. */
/* On screen the whole interface is plain sans-serif; paper keeps the
   text face of tokens.css. The scrollbar's gutter is kept on short pages
   too, so the shell does not shift between pages. */
html { font-family: var(--font-ui); scrollbar-gutter: stable; }
/* The shell: the header is a sidebar beside the page, holding the
   title, the search form, the navigation and, on the lab application's
   pages, the account at its foot. It is one window high and stays in
   view, scrolling on its own when its content is taller. Its contents
   are the same on the site's pages and the application's, so nothing
   moves between them. Below 55rem it stacks above the page. A scrolling
   box clips what sticks out of it, so the header reaches 1rem into the
   body's padding, room for the focus outline and the current link's
   bar. */
body {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: var(--space-5);
  min-height: 100vh;
  max-width: none;
  margin-left: 0;
  padding: 0 2.5rem;
}
main, .site-footer { grid-column: 2; }
.site-header {
  grid-column: 1;
  grid-row: 1 / 3;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--space-4);
  margin-left: calc(-1 * var(--space-3));
  padding: var(--space-5) var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 0;
  border-right: 1px solid var(--border);
}
.site-title { font-size: 1.25rem; line-height: 2rem; }
/* Where the title's row runs short, on a phone beside long initials,
   the title gives way rather than run into the account. */
.site-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The title's row: the sidebar's toggle, a menu icon whose text is
   kept for assistive technology, then the title. The toggle shows only
   once site.js has marked the root with the sidebar's state, from the
   first paint on, so that it never appears late and moves the title;
   without the script it could do nothing. */
.site-brand { display: flex; align-items: center; gap: var(--space-2); }
.sidebar-toggle {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0;
}
.sidebar-toggle::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  margin: auto;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 3.5h12M2 8h12M2 12.5h12' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sidebar-toggle:hover { color: var(--fg); background: var(--surface); }
:root:not([data-sidebar]) .sidebar-toggle { display: none; }
/* Collapsed, the sidebar is a rail holding only the toggle, which
   stays where it was. */
@media (width > 55rem) {
  :root[data-sidebar="collapsed"] body { grid-template-columns: auto minmax(0, 1fr); }
  :root[data-sidebar="collapsed"] .site-header { padding-right: var(--space-2); }
  :root[data-sidebar="collapsed"] .site-header > :not(.site-brand),
  :root[data-sidebar="collapsed"] .site-title { display: none; }
}
.site-header nav > ul { flex-direction: column; flex-wrap: nowrap; gap: var(--space-3); }
.site-header nav ul ul { flex-direction: column; flex-wrap: nowrap; gap: 0; }
.nav-group-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-header nav a {
  display: block;
  margin-left: calc(-1 * var(--space-2) - 3px);
  padding: 0.2rem var(--space-2);
  border-left: 3px solid transparent;
  border-radius: 0 0.25rem 0.25rem 0;
  color: var(--muted);
  text-decoration: none;
}
.site-header nav a:hover { color: var(--fg); background: var(--surface); }
.site-header nav a[aria-current] {
  color: var(--fg);
  font-weight: 600;
  background: var(--surface);
  border-left-color: currentColor;
}
main { padding: var(--space-5) 0; }
h1 { font-size: 2.25rem; }

/* The Procedures section's tabs: one row above the h1, wrapping on narrow
   windows; the current tab is underlined as well as coloured. */
.section-tabs ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
}
.section-tabs li + li { margin-top: 0; }
.section-tabs a { color: var(--muted); text-decoration: none; padding-bottom: 0.2rem; }
.section-tabs a:hover { color: var(--fg); }
.section-tabs a[aria-current] {
  color: var(--fg);
  border-bottom: 2px solid currentColor;
}

/* The search field fills the sidebar's width; its button is a
   magnifier inside the field's end, its text kept for assistive
   technology. */
.site-search { position: relative; }
.site-search input {
  flex: 1 1 auto;
  font-size: 0.875rem;
  padding: 0.4rem 2rem 0.4rem 0.5rem;
}
.site-search button {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0 0.25rem 0.25rem 0;
  background: transparent;
  color: var(--muted);
  font-size: 0;
}
.site-search button::before {
  content: "";
  display: block;
  width: 1rem;
  height: 1rem;
  margin: auto;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.75' fill='none' stroke='black' stroke-width='1.75'/%3E%3Cpath d='M10 10l4.5 4.5' stroke='black' stroke-width='1.75' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.site-search button:hover { color: var(--fg); }

.home-intro { margin-bottom: var(--space-5); }
.lede { max-width: var(--measure); }

/* A build that links the lab frames its summary, a lab page of the same
   host, at a height that shows the stock bar and the four figures whole;
   their wrapping on a narrow window takes the taller frame below. */
.home-lab { margin-bottom: var(--space-5); }
.home-lab h2 { margin-top: 0; }
.home-lab-frame {
  display: block;
  width: 100%;
  height: 19rem;
  border: 0;
}

/* The recent and unchecked lists stop short of the full width, so that
   each date stays within reach of its title; the browse list stands
   beside both. */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 46rem) 19rem;
  gap: var(--space-5);
  align-items: start;
}
.home-recent, .home-unchecked, .home-browse, .procedure-details,
.procedure-content { min-width: 0; }
.home-layout h2:first-child { margin-top: 0; }
.home-browse {
  grid-column: 2;
  grid-row: 1 / span 2;
  border-left: 1px solid var(--border);
  padding-left: var(--space-4);
}
.recent-list, .unchecked-list, .browse-list { list-style: none; padding: 0; }
.recent-list li, .unchecked-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}
.recent-list li + li, .unchecked-list li + li, .browse-list li + li { margin-top: 0; }
.recent-list a, .unchecked-list a { min-width: 0; overflow-wrap: anywhere; }
.browse-list li { padding: var(--space-1) 0; }

/* The procedure header: a compact title block with the ID line, title
   and key facts on the left and the print action at the right. */
.procedure-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.procedure-header .procedure-id {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
}
.procedure-header h1 {
  grid-column: 1;
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.2;
}
.procedure-header .key-facts {
  grid-column: 1;
  margin-top: 0.2rem;
  font-size: 0.875rem;
}
.procedure-header .actions {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}
/* Procedure widgets: a band of details widgets above the optional scope
   widget and the full-width body widgets. */
.procedure {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.procedure-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-3);
  align-items: start;
}
.scope-table { width: 100%; }
/* Numbers and their units stay on one line; names and notes wrap. */
.scope-table .num, .scope-scale, .scope-time { white-space: nowrap; }
.scope-product { display: inline-block; vertical-align: top; }
.scope-structure {
  display: block;
  width: 6rem;
  height: auto;
  margin-bottom: var(--space-1);
  padding: var(--space-1);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}
.procedure-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* On wide screens the Notes widget stands beside Procedure and Workup by
   dense packing, without reordering the DOM. */
@media (min-width: 70rem) {
  .procedure-content:has(> [data-section="procedure"]):has(> [data-section="notes"]) {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(17rem, 1fr);
    grid-auto-flow: dense;
    gap: var(--space-3);
    align-items: start;
  }
  .procedure-content:has(> [data-section="procedure"]):has(> [data-section="notes"]) > * {
    grid-column: 1 / -1;
  }
  .procedure-content:has(> [data-section="procedure"]):has(> [data-section="notes"]) > [data-section="procedure"],
  .procedure-content:has(> [data-section="procedure"]):has(> [data-section="notes"]) > [data-section="procedure"] + [data-section="workup"] {
    grid-column: 1;
  }
  .procedure-content:has(> [data-section="procedure"]):has(> [data-section="notes"]) > [data-section="notes"] {
    grid-column: 2;
  }
  /* Notes reaches down beside Workup only when Workup directly follows
     Procedure; otherwise it stays in the procedure's row. */
  .procedure-content:has(> [data-section="procedure"] + [data-section="workup"]):has(> [data-section="notes"]) > [data-section="notes"] {
    grid-row: span 2;
  }
}
/* Body section widgets keep body font size and the reading measure, do
   not clip the :target note highlight, and leave h3 in prose as
   headings. The compound selector outranks .widget, which comes later. */
.widget.procedure-section {
  overflow: visible;
  font-size: 1rem;
  line-height: 1.55;
}
.procedure-section > .widget__head {
  border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0;
}
.procedure-section > .widget__body {
  padding: var(--space-3) var(--space-4);
}
.procedure-section .widget__body > p,
.procedure-section .widget__body > ul,
.procedure-section .widget__body > ol,
.procedure-content > p,
.procedure-content > ul,
.procedure-content > ol {
  max-width: 64ch;
}
.procedure-section .widget__body h3 {
  margin: var(--space-4) 0 var(--space-2);
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--fg);
  border-top: 0;
  background: none;
}
.procedure-section .widget__body h3:first-child { margin-top: 0; }
/* A note reached from a reference is marked, so the eye lands on it. */
.procedure-content [id^="note-"] { scroll-margin-top: var(--space-4); }
.procedure-content li:has(> :target, > p:first-child > :target) {
  background: var(--surface);
  box-shadow: 0 0 0 var(--space-2) var(--surface);
}
/* Style metadata lists inside widgets like the lab's key-value table. */
.widget dl.metadata {
  display: grid;
  /* A long declared label wraps instead of pushing its value out. */
  grid-template-columns: fit-content(45%) minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  font-size: 0.75rem;
  line-height: 1.42;
}
.widget dl.metadata dt,
.widget dl.metadata dd {
  padding: 0.27rem 0.6rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.widget dl.metadata dt:first-of-type,
.widget dl.metadata dt:first-of-type + dd {
  border-top: 0;
}
.widget dl.metadata dt {
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.widget dl.metadata dd {
  padding-left: 0.2rem;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.widget dl.metadata .copy-button {
  margin-left: 0.35rem;
  font-size: 0.6875rem;
  padding: 0.05rem 0.4rem;
}
.widget .structure__slot {
  max-width: none;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px dashed color-mix(in srgb, var(--border) 75%, transparent);
  font-size: 0.75rem;
}

/* Catalogue: the head with the count, then the facets as a sidebar
   beside the results. Without the script the facets stay hidden and the
   results take the whole width. */
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); }
.list-head h1 { margin-bottom: var(--space-3); }

.catalogue-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
.catalogue-facets, .catalogue-results { min-width: 0; }
.catalogue-facets[hidden] + .catalogue-results { grid-column: 1 / -1; }
.catalogue-facets h2 { font-size: 1rem; margin: 0 0 var(--space-2); }
.facet { border-top: 1px solid var(--border); padding: var(--space-2) 0; font-size: 0.875rem; }
.facet summary { cursor: pointer; font-weight: 600; padding: 0.2rem 0; }
.facet-values { margin: var(--space-1) 0 var(--space-2); }
.facet-value { cursor: pointer; padding: 0.1rem 0; }
/* A value of a vocabulary sits one step in for each of its ancestors. */
label.facet-value { margin-inline-start: calc(var(--depth, 0) * 1.25rem); }
.facet-value input { margin: 0; }
.facet-value input:disabled { cursor: default; }
.facet-directory { margin: 0; font-size: 0.8125rem; }

.catalogue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 0.875rem;
}
.facets-toggle { display: none; }
.catalogue-active { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.catalogue-active li + li { margin-top: 0; }
.catalogue-active button { border-radius: 1rem; padding: 0.15rem 0.7rem; }
.catalogue-active button::after { content: " \00d7"; color: var(--muted); }
.catalogue-select { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--muted); }
.catalogue-select:first-of-type { margin-left: auto; }
.catalogue-message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: var(--space-2) var(--space-3);
}
.catalogue-message button { margin-left: var(--space-2); }

/* The Details view adds a block to the Procedure cell of the same rows. */
.catalogue:not([data-view="details"]) .row-details { display: none; }
.row-details {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-2);
}
.row-details dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.1rem var(--space-3);
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.row-details dd { color: var(--fg); overflow-wrap: anywhere; }
.row-structure {
  width: 9rem;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}
/* Structure drawings are black on white. In the dark scheme they are
   inverted and blended into the page instead of glaring as a white box;
   the hue turns back so that coloured atoms keep their colour. A border
   would be inverted too, so the thumbnail's goes. */
@media (prefers-color-scheme: dark) {
  .structure img, .row-structure, .scope-structure, .sequence-compound img {
    filter: invert(0.92) hue-rotate(180deg);
    mix-blend-mode: lighten;
  }
  .row-structure, .scope-structure, .sequence-compound img { border-color: transparent; }
}
.catalogue[data-view="details"] .procedure-list td { vertical-align: top; }

/* The sequence directory shares the catalogue table's rows. */
.procedure-list, .sequence-table { width: 100%; font-size: 0.925rem; }
:is(.procedure-list, .sequence-table) :is(th, td) {
  padding: 0.5rem 0.9rem;
  vertical-align: middle;
}
:is(.procedure-list, .sequence-table) thead { background: var(--surface); }
:is(.procedure-list, .sequence-table) thead th { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
:is(.procedure-list, .sequence-table) tbody tr:hover { background: var(--surface); }
.procedure-list td:first-child a { color: var(--fg); text-decoration: none; }
.procedure-list td:nth-child(2) a, .sequence-table td:first-child a { text-decoration: none; }
.procedure-list td:nth-child(2) a:hover, .sequence-table td:first-child a:hover { text-decoration: underline; }
.sequence-table td:first-child { overflow-wrap: anywhere; }
.procedure-list td:nth-child(n+4) { color: var(--muted); }
.procedure-list .badge {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
/* The table marks only the exceptions: a draft keeps its tinted badge,
   and a retired procedure's whole row is muted. */
.procedure-list .badge--draft {
  padding: 0 0.5rem;
  border-radius: 1rem;
  background: var(--draft-bg);
  color: var(--draft-fg);
}
.procedure-list tr[data-status="retired"] td,
.procedure-list tr[data-status="retired"] a { color: var(--muted); }
.procedure-list th:first-child, .procedure-list td:first-child,
.procedure-list time { white-space: nowrap; }
.procedure-content table { width: 100%; }
/* While a search is pending the rows shown so far fade back, after a
   short delay so that a quick search does not flicker. */
.catalogue-results[aria-busy="true"] tbody {
  opacity: 0.5;
  transition: opacity 0.2s 0.2s;
}
@media (prefers-reduced-motion: reduce) {
  .catalogue-results[aria-busy="true"] tbody { transition-duration: 0s; }
}

/* Help pages read like a procedure body: prose keeps a measure, tables
   and code blocks run up to the wide measure and scroll in their own
   boxes beyond it. */
.help-page { max-width: var(--measure-wide); }
.help-page :is(p, ul, ol, dl) { max-width: 64ch; }
pre { overflow-x: auto; }
/* A code block is as wide as its longest line: at least the prose
   measure, so that short ones line up with the text, at most the
   column. */
:is(.procedure-content, .help-page) pre {
  width: fit-content;
  min-width: min(100%, 64ch);
}
.help-list li + li { margin-top: var(--space-2); }

/* Shared widget machinery: framed sections, collapsible details widgets,
   compact data tables, key-value tables and the figures strip. */
.widget {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  line-height: 1.42;
}
.widget__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  padding: 0.36rem 0.65rem;
  background: var(--surface);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  min-height: 1.95rem;
}
.widget__head h2 {
  margin: 0;
  font-size: 0.71875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.widget__count {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0 0.45rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.widget__note {
  margin-left: auto;
  font-size: 0.71875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.widget__body { padding: 0.55rem 0.65rem; }
.widget__body--flush { padding: 0; }
.widget__body > :first-child { margin-top: 0; }
.widget__body > :last-child { margin-bottom: 0; }
.widget__body--flush > p { padding: 0.55rem 0.65rem; margin: 0; }
.widget__body h3 {
  margin: 0;
  padding: 0.4rem 0.65rem 0.25rem;
  font-size: 0.71875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: color-mix(in srgb, var(--surface) 50%, var(--bg));
}
.widget__body h3:first-child { border-top: 0; }

details.widget > summary.widget__head {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.widget > summary.widget__head::-webkit-details-marker { display: none; }
details.widget > summary.widget__head h2::before {
  content: "▸";
  content: "▸" / "";
  font-size: 0.6875rem;
  color: var(--muted);
  width: 0.7rem;
  display: inline-block;
}
details.widget[open] > summary.widget__head h2::before {
  content: "▾";
  content: "▾" / "";
}
details.widget:not([open]) > summary.widget__head { border-bottom: 0; }

.widget .table-scroll { margin: 0; }
.widget .badge {
  font-size: 0.6875rem;
  line-height: 1.35;
  padding: 0 0.45rem;
  white-space: nowrap;
}
.widget .structure {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.widget .structure img {
  max-width: 100%;
  max-height: 7.5rem;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.compound-key { font-family: var(--font-mono); font-size: 0.92em; }
.smiles-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.kv-sub {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  font-weight: 400;
}

.rank-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}
.rank-bar {
  width: 4.5rem;
  height: 0.42rem;
  background: var(--surface);
  border-radius: 0.125rem;
  overflow: hidden;
  flex: none;
}
.rank-bar > span {
  display: block;
  height: 100%;
  background: var(--link);
}

.figures-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  font-family: var(--font-ui);
}
.figure-tile {
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--bg);
  padding: 0.4rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}
.figure-tile__label {
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}
.figure-tile__value {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.figure-tile__value a { text-decoration: none; }
.figure-tile__value a:hover { text-decoration: underline; }
.figure-tile__value .badge {
  font-size: 0.6875rem;
  line-height: 1.35;
  padding: 0 0.45rem;
  white-space: nowrap;
}
.figure-tile__sub {
  font-size: 0.6875rem;
  color: var(--muted);
  font-weight: 400;
}

/* A narrow browser window still has a complete reading order. */
@media (max-width: 70rem) {
  body { padding: 0 var(--space-4); }
  .home-layout { grid-template-columns: minmax(0, 1fr); }
  .home-lab-frame { height: 27rem; }
  .home-browse {
    grid-column: auto;
    grid-row: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: var(--space-4) 0 0;
  }
}
/* On a phone the summary's figures wrap one per line. */
@media (max-width: 30rem) {
  .home-lab-frame { height: 30rem; }
}
/* Below 55rem the search form takes a line of its own under the title and
   the navigation, and the facets wait behind the Filters button, above
   the results. */
@media (max-width: 55rem) {
  /* The header stacks above the page: the toggle and the title, with
     the account at the end of their row, then the search form and the
     navigation, each group its label over a row of links. Collapsed, it
     keeps the first row alone. */
  body { display: block; min-height: 0; }
  .site-header {
    position: static;
    height: auto;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    margin-left: 0;
    padding: var(--space-4) 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .site-brand, .lab-account { grid-row: 1; }
  .site-search, .site-header nav { grid-column: 1 / -1; }
  :root[data-sidebar="collapsed"] .site-search,
  :root[data-sidebar="collapsed"] .site-header nav { display: none; }
  .site-header nav > ul { gap: var(--space-2); }
  .site-header nav ul ul { flex-direction: row; flex-wrap: wrap; gap: 0 var(--space-3); }
  .site-header nav a {
    margin-left: 0;
    padding: 0.2rem 0;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
  }
  .site-header nav a[aria-current] { border-bottom-color: currentColor; }
  .catalogue-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .facets-toggle { display: inline-block; }
  .catalogue:not([data-facets-open]) .catalogue-facets { display: none; }
  .procedure-header { grid-template-columns: minmax(0, 1fr); }
  .procedure-header .actions { grid-column: 1; grid-row: auto; margin-top: var(--space-1); }
  .procedure-details { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 35rem) {
  .catalogue-select:first-of-type { margin-left: 0; }
  /* The scheme runs down the page, its arrows pointing down. */
  .sequence-scheme ol { flex-direction: column; align-items: flex-start; }
  .sequence-step, .sequence-compound { max-width: none; align-items: flex-start; text-align: left; }
  .sequence-step::before { content: "\2193"; content: "\2193" / ""; }
  .sequence-compound + .sequence-compound::before {
    left: 0;
    top: calc(var(--space-3) / -2);
    transform: translateY(-50%);
  }
}
/* On the smallest phones the page's margins narrow, so that the title's
   row keeps the toggle, the title and the account apart. */
@media (max-width: 22.5rem) {
  body { padding: 0 var(--space-3); }
  .site-header { column-gap: var(--space-2); }
}
