/* Peptide Sentinel — forest green on a near-white ground.
 *
 * The brief for this stylesheet is the publication's brief: dense, serious, data-forward.
 * Rules, not cards. Tabular numerals everywhere a figure appears. One accent colour. The
 * methods box is the only block with its own ground, because it is the only block a reader
 * must be able to find without reading.
 *
 * Nothing here is decorative: there are no shadows, no gradients, no rounded corners, no
 * transitions and no icons. The whole visual system is a serif for argument, a grotesque
 * for apparatus, and a 1px rule.
 */

:root {
  --ground: #f8f8f5;
  --ink: #141a16;
  --ink-soft: #4b554e;
  --forest: #1b4332;
  --forest-mid: #2d6a4f;
  --rule: #d2d5ce;
  --rule-dark: #9ba199;
  --tint: #ecf0ea;

  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --grot: 'Inter', 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', system-ui, sans-serif;

  --measure: 36rem;   /* prose */
  --wide: 56rem;      /* tables, charts, the masthead */
  --gutter: 1.5rem;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

a { color: var(--forest); text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
a:hover { color: var(--forest-mid); }
a:focus-visible,
[tabindex]:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--forest); color: var(--ground);
  padding: 0.5rem 0.75rem; font-family: var(--grot); font-size: 0.875rem;
}
.skip-link:focus { left: 0; z-index: 10; }

/* ------------------------------------------------------- masthead and nav */

.masthead {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 0;
  border-bottom: 1px solid var(--forest);
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.wordmark a { color: var(--forest); text-decoration: none; }

.masthead .strapline {
  margin: 0.3rem 0 0.9rem;
  font-family: var(--grot);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.masthead nav ul,
#site-disclaimer nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0 0 0.7rem;
  font-family: var(--grot);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.masthead nav a { text-decoration: none; color: var(--ink); }
.masthead nav a:hover { color: var(--forest-mid); text-decoration: underline; }

/* ----------------------------------------------------------- RUO notice */

#ruo-notice {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.8rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--grot);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
#ruo-notice p { margin: 0; max-width: var(--measure); }
#ruo-notice .ruo-headline {
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}
#ruo-notice strong { font-weight: 600; }

/* ----------------------------------------------------------- breadcrumb */

nav[aria-label="Breadcrumb"] {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.65rem var(--gutter) 0;
}
nav[aria-label="Breadcrumb"] ol {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0 0.4rem;
  margin: 0; padding: 0;
  font-family: var(--grot); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--ink-soft);
}
nav[aria-label="Breadcrumb"] li + li::before { content: '/ '; color: var(--rule-dark); }

/* ---------------------------------------------------------------- main */

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 3.5rem;
}

main p { max-width: var(--measure); }
main > ul, main > ol, main section > ul, main section > ol { max-width: var(--measure); }

h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin: 0.2rem 0 0;
  max-width: 22ch;
  text-wrap: balance;
}

h2 {
  font-family: var(--grot);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--forest);
  margin: 2.75rem 0 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--forest);
  max-width: var(--wide);
}

h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 1.75rem 0 0.4rem;
}

p { margin: 0 0 1.05rem; }

.kicker {
  font-family: var(--grot);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--forest-mid);
  margin: 0 0 0.5rem;
}

.standfirst {
  font-size: 1.25rem;
  line-height: 1.4;
  color: var(--ink);
  margin: 1rem 0 0.9rem;
  max-width: 40rem;
}

.dateline {
  font-family: var(--grot);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  margin-bottom: 1.6rem;
  max-width: var(--wide);
}
.dateline span + span::before { content: ' · '; color: var(--rule-dark); }

/* ------------------------------------------------------- key findings */

ol.findings {
  counter-reset: finding;
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  max-width: 40rem;
}
ol.findings li {
  counter-increment: finding;
  position: relative;
  padding: 0.7rem 0 0.7rem 2.4rem;
  border-top: 1px solid var(--rule);
  font-size: 1.0625rem;
  line-height: 1.45;
}
ol.findings li:last-child { border-bottom: 1px solid var(--rule); }
ol.findings li::before {
  content: counter(finding);
  position: absolute; left: 0; top: 0.72rem;
  font-family: var(--grot);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--forest-mid);
}
ol.findings b { font-weight: 700; }

/* -------------------------------------------------------------- tables */

.scroll {
  max-width: var(--wide);
  overflow-x: auto;
  margin: 0 0 0.5rem;
}

table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  font-family: var(--grot);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
table.narrow { min-width: 0; }

caption {
  text-align: left;
  font-family: var(--grot);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding-bottom: 0.5rem;
}

thead th {
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--forest);
  padding: 0.4rem 0.9rem 0.4rem 0;
  vertical-align: bottom;
}
tbody th {
  text-align: left;
  font-weight: 500;
  font-family: var(--serif);
  font-size: 0.9375rem;
}
tbody th, tbody td {
  border-bottom: 1px solid var(--rule);
  padding: 0.38rem 0.9rem 0.38rem 0;
  vertical-align: top;
}
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 1px solid var(--rule-dark); }
td.num, th.num { text-align: right; padding-right: 1.1rem; white-space: nowrap; }
tbody td:last-child, thead th:last-child { padding-right: 0; }

.table-note {
  font-family: var(--grot);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0.45rem 0 1.9rem;
  max-width: 44rem;
  line-height: 1.5;
}

/* -------------------------------------------------------------- charts */

figure { margin: 0 0 1.9rem; max-width: var(--wide); }
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-family: var(--grot);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  line-height: 1.5;
  max-width: 44rem;
}
.chart-bar { fill: var(--forest); }
.chart-bar-soft { fill: var(--forest-mid); opacity: 0.45; }
.chart-label, .chart-value {
  font-family: var(--grot);
  font-size: 11px;
  fill: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.chart-value { fill: var(--ink); }
.chart-axis { stroke: var(--rule-dark); stroke-width: 1; }

/* ---------------------------------------------------------- methods box */

.methods {
  background: var(--tint);
  border-left: 4px solid var(--forest);
  padding: 1.1rem 1.25rem 0.4rem;
  margin: 2.5rem 0 1.75rem;
  max-width: var(--wide);
  font-family: var(--grot);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.methods h2 {
  border-top: 0;
  padding-top: 0;
  margin: 0 0 0.75rem;
  color: var(--forest);
}
.methods dl { margin: 0; }
.methods dt {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
  color: var(--forest);
  margin-top: 0.7rem;
}
.methods dd { margin: 0.1rem 0 0; color: var(--ink); max-width: 46rem; }
.methods dd:last-of-type { margin-bottom: 0.9rem; }
/* A literal: a query string, a field name, a file path. Grotesque on a tint rather than
 * monospace, which the design standard rules out as a personality. */
.q {
  font-family: var(--grot);
  font-size: 0.9em;
  background: #e2e7df;
  padding: 0.05rem 0.3rem;
  white-space: nowrap;
}
.methods .q { background: #e0e6dd; }

/* ------------------------------------------------------------- limits */

.limits { max-width: var(--wide); }
.limits ul {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  max-width: 44rem;
  font-size: 1rem;
}
.limits li {
  border-top: 1px solid var(--rule);
  padding: 0.6rem 0;
}
.limits li:last-child { border-bottom: 1px solid var(--rule); }

/* ------------------------------------------------------- dataset block */

.dataset-link {
  border-top: 2px solid var(--forest);
  border-bottom: 1px solid var(--forest);
  padding: 0.9rem 0 1rem;
  margin: 2.25rem 0 1.5rem;
  max-width: var(--wide);
}
.dataset-link p { margin: 0; max-width: 44rem; }
.dataset-link .label {
  font-family: var(--grot);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--forest);
  margin-bottom: 0.3rem;
}
.dataset-link .file {
  font-family: var(--grot);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}
.dataset-link a { font-weight: 600; }

/* ------------------------------------------------------- front and lists */

.front-intro {
  max-width: 40rem;
  font-size: 1.1rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.4rem;
  margin-bottom: 0.5rem;
}

ol.pieces, ul.pieces { list-style: none; margin: 0; padding: 0; max-width: var(--wide); }
.pieces li {
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0 1.4rem;
  max-width: var(--wide);
}
.pieces h2 {
  border-top: 0;
  padding-top: 0;
  margin: 0.35rem 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.18;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 34ch;
  text-wrap: balance;
}
.pieces h2 a { color: inherit; text-decoration: none; }
.pieces h2 a:hover { color: var(--forest); text-decoration: underline; }
.pieces .finding {
  margin: 0;
  max-width: 44rem;
  font-size: 1.0625rem;
  line-height: 1.45;
}
.pieces .meta {
  font-family: var(--grot);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0.55rem 0 0;
}
.pieces .meta a { color: var(--ink-soft); }

/* ------------------------------------------------------------- footer */

/* A centred text column that children sit inside, rather than auto margins on every child:
 * the footer paragraphs have their own measure and must still start on the same vertical as
 * the main column, which auto margins on each one cannot do. */
#site-disclaimer {
  border-top: 1px solid var(--forest);
  background: var(--tint);
  font-family: var(--grot);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns:
    minmax(var(--gutter), 1fr)
    minmax(0, calc(var(--wide) - 2 * var(--gutter)))
    minmax(var(--gutter), 1fr);
}
#site-disclaimer > * { grid-column: 2; }
#site-disclaimer p { margin: 0 0 0.6rem; max-width: 46rem; }
#site-disclaimer p:first-child { margin-top: 1.5rem; }
#site-disclaimer strong { color: var(--ink); font-weight: 600; }
#site-disclaimer nav ul { padding: 0 0 2rem; text-transform: none; letter-spacing: 0.03em; }
#site-disclaimer nav a { color: var(--ink-soft); }

/* ------------------------------------------------------------ mobile */

@media (max-width: 40rem) {
  :root { --gutter: 1.1rem; }
  body { font-size: 1rem; }
  .standfirst { font-size: 1.125rem; }
  .masthead { padding-top: 1.25rem; }
  .masthead nav ul { gap: 0 1rem; font-size: 0.75rem; }
  h1 { max-width: none; }
  .methods { padding: 1rem 1rem 0.3rem; }
  .pieces h2 { font-size: 1.3rem; }
}
