/* Mpaka essays: one stylesheet for every piece in the series. */
:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #4c4c4c;
  --muted: #686868;
  --rule: #dddddc;
  --wash: #efefef;
  --green: #046A38;
  --grey: #c7c7c6;
  --measure: 680px;
  --wide: 960px;
  /* The type scale: three sizes, plus the page title. */
  --t-s: 15px;      /* navigation, text inside exhibits, notes, sources (footnote markers are .65em of their text) */
  --t-body: 18px;   /* the essay, exhibit titles, quotes */
  --t-l: 24px;      /* section headings, subtitle, numbers in exhibits */
  --t-m: var(--t-s); /* text inside exhibits: small, like a chart's labels */
  --t-num: var(--t-l);
  --t-big: var(--t-l);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Public Sans", Helvetica, Arial, sans-serif;
  font-size: var(--t-body); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* The series header */
.fam { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: 0; z-index: 10; font-size: var(--t-s); }
.fam-in { max-width: var(--measure); margin: 0 auto; padding: 18px 16px; display: flex; gap: 32px; align-items: baseline; flex-wrap: wrap; }
.brand { font-weight: 500; color: var(--ink); text-decoration: none; }
.fam ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 24px; flex-wrap: wrap; }
.fam li a, .fam li span { color: var(--muted); text-decoration: none; white-space: nowrap; }
.fam li a:hover { color: var(--ink); }
.fam li .on { color: var(--ink); font-weight: 500; }
.fam li .soon { color: #a0a09f; }
.fam .cn { font-variant-numeric: tabular-nums; }
/* ?solo on an essay's link: the essay on its own, without the series around it */
.solo .fam, .solo .next { display: none; }

/* The essay column */
.essay { max-width: var(--measure); margin: 0 auto; padding: 56px 16px 96px; }
.essay h1 { font-size: clamp(36px, 6vw, 56px); line-height: 1.06; font-weight: 500; letter-spacing: -.025em; margin: 0; text-wrap: balance; }
/* the home page's title, set like a dictionary entry */
.headword { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; }
.gloss { font-size: var(--t-s); color: var(--muted); margin: 0 !important; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.gloss .pos { font-style: italic; }
.headword + .subtitle { margin-top: 22px; }
.gloss .def { color: var(--ink); font-weight: 500; padding-left: 10px; border-left: 1px solid var(--rule); }
.subtitle { font-size: var(--t-l); line-height: 1.35; color: var(--ink-2); margin: 12px 0 44px; }
.essay h2 { font-size: var(--t-l); line-height: 1.25; font-weight: 500; letter-spacing: -.01em; margin: 56px 0 14px; text-wrap: balance; }
/* Introduction: the closing note on methods sits apart, with a smaller heading */
.essay h2#a-note-on-methods { font-size: var(--t-body); margin-top: 72px; padding-top: 18px; border-top: 1px solid var(--rule); }
.essay h2#a-note-on-methods ~ p { font-size: var(--t-s); line-height: 1.5; color: var(--ink-2); }
.essay p { margin: 0 0 18px; }
.essay ul, .essay ol { margin: 0 0 18px; padding-left: 22px; }
.essay li { margin-bottom: 8px; }
.fn { font-size: .65em; line-height: 0; margin-left: 1px; }
.fn a { text-decoration: none; font-weight: 500; }

/* Exhibits: wider than the text, on their own surface. The title is --t-body; everything inside is --t-s. */
.exhibit {
  margin: 40px calc((min(100vw - 32px, var(--wide)) - 100%) / -2);
  background: var(--surface); padding: 22px 28px 24px; border-top: 2px solid var(--ink);
  font-size: var(--t-m); line-height: 1.4;
}
.exhibit figcaption { margin-bottom: 20px; max-width: 720px; }
.xtitle { display: block; font-size: var(--t-body); line-height: 1.3; font-weight: 500; text-wrap: pretty; }
.xsub { display: block; font-size: var(--t-s); color: var(--muted); margin-top: 4px; }
.xnote { font-size: var(--t-s); color: var(--muted); margin: 14px 0 0 !important; }
.exhibit p { margin: 0; }

/* split: one stacked bar per row, each segment labelled underneath */
.split { display: grid; gap: 18px; }
.srow { display: grid; grid-template-columns: minmax(0, 22%) minmax(0, 1fr); gap: 0 14px; align-items: start; }
.srow .bl { padding-top: 1px; font-weight: 500; }
.strack { display: flex; gap: 2px; }
.sseg { min-width: 0; }
.sseg i { display: block; height: 22px; background: var(--green); }
.sseg i.l { background: #8fb8a2; }
.sseg i.n { background: var(--grey); }
.sseg span { display: block; margin-top: 6px; padding-right: 8px; color: var(--ink-2); line-height: 1.3; }
.sseg span strong { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

/* bars: label, bar and value on one row */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(0, 34%) minmax(0, 1fr) 52px; gap: 0 14px; align-items: center; }
.bar .bt { display: flex; align-items: center; height: 18px; }
.bar .bt i { display: block; height: 18px; background: var(--green); border-radius: 0 3px 3px 0; }
.bar.muted .bt i { background: var(--grey); }
.bar b, .crow b { font-weight: 500; font-variant-numeric: tabular-nums; }
.bar b { text-align: right; }

/* change from a centre line */
.change { display: grid; gap: 12px; }
.crow { display: grid; grid-template-columns: minmax(0, 1fr) 64px; grid-template-rows: auto 22px; column-gap: 10px; }
.crow .bl { grid-column: 1 / -1; }
.crow .ct { position: relative; height: 22px; }
.crow .ct i { position: absolute; top: 0; height: 22px; background: var(--green); border-radius: 0 4px 4px 0; }
.crow .ct i.neg { border-radius: 4px 0 0 4px; }
.crow.muted .ct i { background: var(--grey); }
.crow .zero { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 1px; background: var(--ink); }
.crow b { text-align: right; align-self: center; }

/* numbers */
.stats { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 20px 32px; }
.stat b { display: block; font-size: var(--t-big); line-height: 1.1; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat b.green { color: var(--green); }
.stat b.muted { color: var(--muted); }
.stat p { margin-top: 6px !important; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 20px 28px; }
.tile b { display: block; font-size: var(--t-num); line-height: 1.1; font-weight: 500; letter-spacing: -.02em; color: var(--green); }
.tile p { margin-top: 6px !important; color: var(--ink-2); }

/* cards and panels */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
.card { background: var(--bg); padding: 16px 18px; }
.card h4 { margin: 0 0 2px; font-size: var(--t-body); font-weight: 500; line-height: 1.3; }
.card .ck { color: var(--muted); margin-bottom: 10px !important; }
.card p { margin-bottom: 10px !important; }
.card ul { margin: 0 !important; padding-left: 18px !important; }
.card li { margin-bottom: 4px; }
.card .cs { margin-top: 12px !important; }
.card .cs b { color: var(--green); font-size: var(--t-num); line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; margin-right: 4px; }

/* area chips, in Chapter I's colours (the dot carries the colour, the text stays ink) */
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 12px !important; }
a.chip { color: var(--ink); text-decoration: none; }
a.chip:hover { color: var(--green); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); font-weight: 500; white-space: nowrap; }
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* what a service needs */
.stack { list-style: none; margin: 0 !important; padding: 0 !important; display: grid; gap: 6px; }
.stack li { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto; gap: 4px 18px; align-items: baseline; padding: 12px 16px; background: var(--bg); border-left: 3px solid var(--green); margin: 0; }
.stack li.muted { border-left-color: var(--grey); color: var(--muted); }
.stack b { font-weight: 500; }
.stack span { color: var(--ink-2); }
.stack li.muted span { color: var(--muted); }
.stack em { font-style: normal; font-size: var(--t-s); color: var(--muted); }

/* pipelines */
.pipes { display: grid; gap: 22px; }
.pipe h4 { margin: 0 0 8px; font-size: var(--t-body); font-weight: 500; }
.pipe ol { list-style: none; margin: 0 !important; padding: 0 !important; display: flex; gap: 4px; }
.pipe li { flex: 1 1 0; margin: 0; padding: 10px 14px 10px 12px; background: var(--grey); color: var(--ink); font-size: var(--t-s); line-height: 1.3;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); padding-left: 18px; }
.pipe li:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 12px; }
.pipe li.ai { background: var(--green); color: #fff; }
.pipe .pnote { margin-top: 8px !important; color: var(--ink-2); }

/* tables: no grid, just rules between rows */
.tablewrap { overflow-x: auto; }
.xt { border-collapse: collapse; width: 100%; }
.xt th, .xt td { text-align: left; vertical-align: top; padding: 9px 16px 9px 0; border-bottom: 1px solid var(--rule); }
.xt thead th { font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--ink); }
.xt tbody th { font-weight: 500; min-width: 120px; }
.xt tbody tr:last-child th, .xt tbody tr:last-child td { border-bottom: 0; }

/* timeline and loop */
.timeline, .loop { list-style: none; margin: 0 !important; padding: 0 !important; display: grid; }
.timeline li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--rule); margin: 0; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-weight: 500; font-variant-numeric: tabular-nums; }
.timeline li.key .when { color: var(--green); }
.loop li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 9px 0; margin: 0; }
.loop .n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: var(--t-s); font-weight: 500; display: grid; place-items: center; }
.loop li.key .n { background: var(--green); }

/* quotes */
.ex-quote { border-top: 0; background: var(--wash); }
.xq { margin: 0; }
.xq p { font-size: var(--t-body); line-height: 1.6; margin-bottom: 12px !important; }
.xq footer { font-size: var(--t-s); color: var(--muted); }

/* a page in parts (the method page): each chapter's part opens with a rule */
.essay h2.part { border-top: 2px solid var(--ink); padding-top: 16px; margin-top: 72px; }
.essay h3 { font-size: var(--t-body); font-weight: 500; margin: 36px 0 10px; }
/* the method page's interactive part, as wide as the exhibits */
.exhibit-app { margin: 24px calc((min(100vw - 32px, var(--wide)) - 100%) / -2) 0; }

/* end matter */
.next { margin-top: 56px !important; padding-top: 18px; border-top: 1px solid var(--rule); font-weight: 500; }
.sources { margin-top: 48px; }
.sources h2 { margin: 0 0 12px !important; }
.sources ol { font-size: var(--t-s); line-height: 1.5; color: var(--ink-2); padding-left: 24px; }
.sources li { margin-bottom: 6px; }
.sources li:target { background: #e6f0ea; }

@media (max-width: 900px) {
  .tiles, .stats, .cards { grid-template-columns: repeat(min(var(--n, 3), 2), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  :root { --t-body: 17px; --t-l: 22px; --t-s: 14px; }
  .tiles, .stats, .cards { grid-template-columns: minmax(0, 1fr); }
  .bar { grid-template-columns: minmax(0, 1fr) 52px; }
  .bar .bl { grid-column: 1 / -1; }
  .bar .bt { grid-column: 1; }
  .essay { padding-top: 36px; }
  .exhibit { margin-left: -16px; margin-right: -16px; padding: 20px 16px 16px; }
  .fam-in { flex-wrap: nowrap; gap: 20px; padding: 14px 16px; }
  .fam ol { gap: 18px; }
  .fam nav { overflow-x: auto; scrollbar-width: none; }
  .fam ol { flex-wrap: nowrap; }
  /* tables become one block per row, each cell labelled */
  .xt thead { display: none; }
  .xt, .xt tbody, .xt tr, .xt th, .xt td { display: block; width: auto; }
  .xt tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .xt tbody tr:last-child { border-bottom: 0; }
  .xt th, .xt td { border: 0; padding: 2px 0; }
  .xt tbody th { margin-bottom: 4px; }
  .xt td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .pipe ol { flex-direction: column; }
  .pipe li, .pipe li:first-child { clip-path: none; padding-left: 12px; }
  .stack li { grid-template-columns: minmax(0, 1fr) auto; }
  .stack span { grid-column: 1 / -1; }
}
