/* Layout, typography and components for every medium. print.css adjusts
   these for paper. Nothing here may clip content: no overflow hidden or
   clip, and no fixed height. */
*, *::before, *::after { box-sizing: border-box; }
/* Scripts show and hide controls with the hidden attribute, whatever
   display a rule gives the element. */
[hidden] { display: none !important; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 100%;
  line-height: 1.55;
}

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 2 * var(--space-3));
  padding: 0 var(--space-3);
}

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  line-height: 1.25;
  margin: var(--space-4) 0 var(--space-2);
}
h1 { font-size: 1.85rem; margin-top: var(--space-2); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p, ul, ol, dl, figure { margin: 0 0 var(--space-3); }
li + li { margin-top: var(--space-1); }
code { font-family: var(--font-mono); font-size: 0.9em; overflow-wrap: anywhere; }
pre {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
pre code { font-size: inherit; overflow-wrap: normal; }
sub { line-height: 0; }

button {
  font: inherit;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.2rem 0.75rem;
  cursor: pointer;
}
input[type="search"], select {
  font: inherit;
  font-family: var(--font-ui);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  padding: 0.3rem 0.5rem;
}

/* Page shell */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -10rem;
  background: var(--bg);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui);
  z-index: 10;
}
.skip-link:focus { top: var(--space-2); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
}
.site-title { color: var(--fg); font-weight: 700; text-decoration: none; }
.site-header ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header li + li { margin-top: 0; }
.nav-group-label { color: var(--muted); }

main { padding: var(--space-3) 0 var(--space-5); }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: var(--space-3) 0;
}
.site-footer p { margin: 0; }

.print-only { display: none; }

/* Header search */
.site-search {
  display: flex;
  gap: var(--space-2);
  min-width: 0;
}
.site-search input { flex: 1 1 8rem; min-width: 0; }

/* Home page and directories */
.lede { font-size: 1.1rem; }
.count { font-family: var(--font-ui); color: var(--muted); }
.term-list, .browse-list { font-family: var(--font-ui); padding-left: var(--space-4); }
.recent-list, .unchecked-list { font-family: var(--font-ui); padding-left: var(--space-4); }
.recent-list time, .unchecked-list time { color: var(--muted); white-space: nowrap; }

/* Catalogue */
.catalogue-count, .catalogue-scope, .catalogue-noscript, .catalogue-message,
.catalogue-toolbar, .catalogue-facets { font-family: var(--font-ui); }
.catalogue-count { color: var(--muted); font-size: 0.875rem; margin: 0; }
.catalogue-scope { color: var(--muted); }
.facet-values { display: flex; flex-direction: column; gap: 0.15rem; }
.facet-value { display: flex; align-items: baseline; gap: var(--space-2); }
.facet-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.facet-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.catalogue-active { list-style: none; margin: 0; padding: 0; }
.row-details dl { margin: var(--space-1) 0 0; }
.row-details dd { margin: 0; }
.row-structure { display: block; max-width: 100%; height: auto; background: #fff; }

/* Procedure page */
.sample-banner {
  background: var(--banner-bg);
  color: var(--banner-fg);
  border: 1px solid var(--banner-border);
  border-radius: 0.25rem;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui);
  font-weight: 600;
}
.procedure-id {
  font-family: var(--font-ui);
  color: var(--muted);
  margin-bottom: 0;
}
.procedure-header h1 { margin-top: var(--space-1); }
.actions { margin: 0; }
/* The key facts read as one line under the title: label, value, label,
   value. */
.key-facts { margin: 0; font-family: var(--font-ui); }
.key-facts dt, .key-facts dd { display: inline; margin: 0; }
.key-facts dt { color: var(--muted); }
.key-facts dd { margin-right: var(--space-4); font-weight: 600; }

.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0 0.5rem;
  border-radius: 1rem;
  border: 1px solid transparent;
}
.badge--draft { background: var(--draft-bg); color: var(--draft-fg); }
.badge--checked { background: var(--checked-bg); color: var(--checked-fg); }
.badge--retired { background: var(--retired-bg); color: var(--retired-fg); }

.metadata {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: var(--space-3);
  font-family: var(--font-ui);
  font-size: 0.925rem;
}
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.metadata code { font-size: 0.95em; }

/* The values a compound link carries after it (compound-link.html). */
.compound-beside { color: var(--muted); }

.copy-button { margin-left: var(--space-2); padding: 0 0.5rem; }

.structure img {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}
.structure__slot {
  max-width: 20rem;
  padding: var(--space-4) var(--space-3);
  border: 1px dashed var(--border);
  border-radius: 0.25rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  text-align: center;
}

/* Sequence page: the header reads as a procedure's; the scheme runs
   compound, step, compound in one wrapping row, each step an arrow with
   its number, reaction type and yield under it. The arrows are drawn by
   the stylesheet and carry no text for assistive technology. */
.sequence-id {
  font-family: var(--font-ui);
  color: var(--muted);
  margin-bottom: 0;
}
.sequence-header h1 { margin-top: var(--space-1); }
.sequence-scheme { margin: var(--space-4) 0; }
.sequence-scheme ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
}
.sequence-compound {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  max-width: 12rem;
  text-align: center;
  overflow-wrap: anywhere;
}
/* The starting materials of the first step stand side by side, joined
   by a plus sign centred in the gap between them. */
.sequence-compound + .sequence-compound { position: relative; }
.sequence-compound + .sequence-compound::before {
  content: "+";
  content: "+" / "";
  position: absolute;
  left: calc(var(--space-3) / -2);
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--fg);
}
.sequence-compound img {
  display: block;
  max-width: 100%;
  max-height: 8rem;
  height: auto;
  background: #fff;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}
.sequence-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 9rem;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}
.sequence-step::before {
  content: "\2192";
  content: "\2192" / "";
  color: var(--fg);
  font-size: 1.75rem;
  line-height: 1;
}
.sequence-step__number { color: var(--fg); font-weight: 600; }
.sequence-steps { font-family: var(--font-ui); padding-left: var(--space-4); }
.sequence-steps li + li { margin-top: var(--space-1); }

/* Tables */
.table-scroll { margin: 0 0 var(--space-3); }
table {
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
thead th { border-bottom: 2px solid var(--muted); }
th.num, td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
