/* The blog's look, taken from www.sphere-software.com: the same two typefaces, the same paper
   and ink colours, the same header, and the text-page layout of its About page. */

:root {
  --bg: #f5f3ee;
  --ink: #1e2128;
  --ink-muted: rgba(30, 33, 40, 0.45);
  --ink-label: rgba(30, 33, 40, 0.55);
  --line: rgba(30, 33, 40, 0.12);
  --wash: rgba(30, 33, 40, 0.04);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

a { color: var(--ink); }

/* ---------- Header (as on the main site) ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 300ms ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-logo-link { display: flex; align-items: center; text-decoration: none; }
.header-logo { width: 108px; height: auto; display: block; }
.header-nav { display: flex; align-items: center; gap: 32px; }
.header-link {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(30, 33, 40, 0.5);
  text-decoration: none;
  transition: color 200ms ease;
}
.header-link:hover, .header-link.is-active { color: var(--ink); }
.header-linkedin { display: flex; align-items: center; color: rgba(30, 33, 40, 0.5); transition: color 200ms ease; }
.header-linkedin:hover { color: var(--ink); }

/* ---------- Article ---------- */

.article, .listing {
  max-width: 680px;
  margin: 0 auto;
  padding: 144px 32px 0;
  line-height: 1.7;
}

.article-back {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  margin-bottom: 40px;
}
.article-back:hover { opacity: 1; }

.article-title, .listing-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 2.7rem;
  line-height: 1.15;
  letter-spacing: -0.3px;
  margin: 0 0 16px;
  text-wrap: balance;
}

.article-meta, .listing-date, .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-label);
  margin: 0 0 56px;
}
.article-meta span { margin: 0 6px; }

.article-body p, .article-body li { font-size: 1.05rem; margin: 0 0 20px; }
.article-body ul, .article-body ol { padding-left: 22px; margin: 0 0 20px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { font-weight: 400; }
.article-body h2, .article-sources h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: 0.2px;
  margin: 56px 0 16px;
  text-wrap: balance;
}
.article-body h3 { font-family: var(--sans); font-weight: 400; font-size: 1.05rem; margin: 32px 0 8px; }
.article-body a { text-decoration: underline; text-underline-offset: 3px; }

.cite { font-size: 0.68em; line-height: 0; margin-left: 2px; }
.cite a { text-decoration: none; color: var(--ink-label); }
.cite a:hover { color: var(--ink); }

/* The benchmark table. It scrolls sideways on a narrow screen instead of squeezing. */
.table-wrap { overflow-x: auto; margin: 8px 0 12px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.article-body table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; }
.article-body th {
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-label);
  text-align: left;
  padding: 12px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: bottom;
}
.article-body td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.article-body tr:last-child td { border-bottom: none; }
.article-body td:not(:first-child):not(:last-child) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.article-body td:last-child { color: var(--ink-label); font-size: 0.85rem; min-width: 150px; }
.article-body td strong { font-weight: 700; }
.table-wrap + p { font-size: 0.85rem; color: var(--ink-label); margin-bottom: 20px; }

.article-sources { margin-top: 64px; padding-top: 8px; border-top: 1px solid var(--line); }
.article-sources h2 { font-size: 1.4rem; margin-top: 32px; }
.article-sources ol { padding-left: 20px; margin: 0; }
.article-sources li { font-size: 0.9rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.article-sources li:target { background: var(--wash); }

.article-tags { margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.article-tags span {
  font-size: 0.68rem;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--ink-label);
  border: 1px solid var(--line);
  padding: 5px 10px;
}

.more { max-width: 680px; margin: 72px auto 0; padding: 0 32px; }
.more h2 { font-family: var(--serif); font-weight: 300; font-size: 1.4rem; margin: 0 0 12px; }
.more ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.more li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.more a { text-decoration: none; }
.more a:hover { text-decoration: underline; text-underline-offset: 3px; }
.more span { flex: none; font-size: 0.7rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-label); padding-top: 4px; }

/* ---------- Charts and diagrams (visuals.py) ----------
   One ink for the data, one grey for bars the story is not about, text in the text inks. Sizes that
   depend on the data are SVG attributes (the page allows no inline styles); the rest is here. The
   bar and line SVGs use CSS padding as their label gutters: their percentages run inside the
   padding, and the value and tick labels are drawn out into it. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.article-body .viz { margin: 40px 0 44px; padding-top: 16px; border-top: 1px solid var(--ink); }
.article-body .viz-title { font-family: var(--sans); font-weight: 400; font-size: 0.98rem; line-height: 1.4; margin: 0 0 20px; }
.article-body .viz-note { font-size: 0.86rem; line-height: 1.55; color: rgba(30, 33, 40, 0.75); margin: 16px 0 0; }
.article-body .viz-source { font-size: 0.74rem; line-height: 1.5; color: rgba(30, 33, 40, 0.68); margin: 10px 0 0; }
.article-body .viz-source a { color: inherit; }

/* One accent per article (visuals.accent_for, by topic number), for marks only; text stays in the inks.
   Each was checked against this paper (contrast 3:1 or more) and against the grey of dimmed bars. */
.viz { --viz-accent: var(--ink); --viz-wash: rgba(30, 33, 40, 0.05); }
.viz.accent-1 { --viz-accent: #0a5f6b; --viz-wash: rgba(10, 95, 107, 0.08); }
.viz.accent-2 { --viz-accent: #b5532c; --viz-wash: rgba(181, 83, 44, 0.08); }
.viz.accent-3 { --viz-accent: #5b6b1f; --viz-wash: rgba(91, 107, 31, 0.09); }
.viz.accent-4 { --viz-accent: #3d4f9a; --viz-wash: rgba(61, 79, 154, 0.08); }
.viz.accent-5 { --viz-accent: #7a3e6b; --viz-wash: rgba(122, 62, 107, 0.08); }

.viz-mark { fill: var(--viz-accent); }
.is-dim .viz-mark { fill: #85878b; }
.viz-value { font-family: var(--sans); font-size: 13px; font-weight: 400; fill: var(--ink); font-variant-numeric: tabular-nums; }
.viz-tick { font-family: var(--sans); font-size: 12px; font-weight: 300; fill: rgba(30, 33, 40, 0.68); font-variant-numeric: tabular-nums; }

/* Bars: label above, bar below, value at the tip. */
.article-body .viz-row { margin: 0 0 14px; }
.article-body .viz-row:last-child { margin-bottom: 0; }
.article-body .viz-label { font-size: 0.86rem; line-height: 1.35; margin: 0 0 5px; }
.viz-bar { display: block; width: 100%; height: 18px; box-sizing: border-box; padding-right: 7.5rem; overflow: visible; }

/* Line: ticks to the left of the plot, the last value above the end dot. */
.viz-plot { display: block; width: 100%; box-sizing: border-box; padding: 0 14px 0 56px; overflow: visible; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-line { stroke: var(--viz-accent); stroke-width: 2; stroke-linecap: round; }
.viz-dot { fill: var(--viz-accent); stroke: var(--bg); stroke-width: 2; }
.viz-hit { fill: transparent; pointer-events: all; }

/* Key figures: the numbers large, in the sans, with what they measure underneath. */
.viz-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; }
.viz-figures.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.article-body .viz-figure-value { font-family: var(--sans); font-weight: 400; font-size: 2.1rem; line-height: 1.1; letter-spacing: -0.5px; margin: 0 0 8px; }
.article-body .viz-figure-value .cite { font-size: 0.4em; letter-spacing: 0; }
.article-body .viz-figure-label { font-size: 0.86rem; line-height: 1.45; color: rgba(30, 33, 40, 0.75); margin: 0; }

.article-body .viz-figure { border-top: 3px solid var(--viz-accent); padding-top: 12px; }

/* Steps: numbered circles joined by a hairline. */
.article-body .viz-steps { list-style: none; counter-reset: viz-step; padding: 0; margin: 0; }
.article-body .viz-steps li { counter-increment: viz-step; position: relative; padding: 0 0 20px 50px; margin: 0; }
.article-body .viz-steps li:last-child { padding-bottom: 0; }
.viz-steps li::before {
  content: counter(viz-step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--viz-accent); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 400; font-variant-numeric: tabular-nums;
}
.viz-steps li::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 1px; background: var(--line); }
.viz-steps li:last-child::after { display: none; }
.article-body .viz-step-title { font-size: 1rem; font-weight: 400; line-height: 1.4; margin: 4px 0 2px; }
.article-body .viz-step-detail { font-size: 0.9rem; line-height: 1.55; color: rgba(30, 33, 40, 0.75); margin: 0; }

/* Comparison: two or three columns side by side. */
.viz-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.viz-compare.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.viz-col { background: var(--viz-wash); border-top: 2px solid var(--viz-accent); padding: 14px 16px 6px; }
.article-body .viz-col-title { font-size: 0.95rem; font-weight: 400; margin: 0 0 10px; }
.article-body .viz-col ul { padding-left: 18px; margin: 0 0 8px; }
.article-body .viz-col li { font-size: 0.9rem; line-height: 1.5; margin: 0 0 8px; }

/* Timeline: dated events on a hairline, a dot in the accent for each. */
.article-body .viz-timeline { list-style: none; padding: 0 0 0 26px; margin: 0; position: relative; }
.viz-timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.article-body .viz-timeline li { position: relative; margin: 0 0 18px; padding: 0; }
.article-body .viz-timeline li:last-child { margin-bottom: 0; }
.viz-timeline li::before {
  content: ""; position: absolute; left: -25px; top: 6px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--viz-accent); box-shadow: 0 0 0 3px var(--bg);
}
.article-body .viz-when { font-size: 0.72rem; letter-spacing: 1.1px; text-transform: uppercase; color: rgba(30, 33, 40, 0.68); margin: 0 0 2px; }
.article-body .viz-what { font-size: 0.95rem; line-height: 1.5; margin: 0; }

/* Before and after: two panels and an arrow; the "after" panel carries the accent. */
.viz-ba { display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); align-items: stretch; }
.viz-ba-panel { padding: 14px 16px 6px; border-top: 2px solid #85878b; background: rgba(30, 33, 40, 0.035); }
.viz-ba-panel.is-after { border-top-color: var(--viz-accent); background: var(--viz-wash); }
.viz-ba-arrow { display: flex; align-items: center; justify-content: center; }
.viz-arrow { fill: none; stroke: var(--viz-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.article-body .viz-ba-figure { font-size: 1.9rem; font-weight: 400; line-height: 1.1; letter-spacing: -0.4px; margin: 4px 0 4px; }
.article-body .viz-ba-figure .cite { font-size: 0.4em; letter-spacing: 0; }
.article-body .viz-ba-label { font-size: 0.82rem; line-height: 1.4; color: rgba(30, 33, 40, 0.75); margin: 0 0 12px; }
.article-body .viz-ba ul { padding-left: 18px; margin: 0 0 8px; }
.article-body .viz-ba li { font-size: 0.9rem; line-height: 1.5; margin: 0 0 8px; }

/* Decision flow: question cards joined by a hairline; Yes ends the path, No goes on. */
.article-body .viz-flow { list-style: none; padding: 0; margin: 0; }
.article-body .viz-q { position: relative; margin: 0 0 22px; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg); }
.viz-q:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: -23px; width: 1px; height: 22px; background: var(--line); }
.article-body .viz-q:last-child { margin-bottom: 0; }
.article-body .viz-q-text { font-size: 0.98rem; font-weight: 400; margin: 0 0 10px; }
.viz-q-answers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.article-body .viz-yes, .article-body .viz-no { font-size: 0.88rem; line-height: 1.45; margin: 0; padding: 8px 10px; }
.article-body .viz-yes { background: var(--viz-wash); border-left: 3px solid var(--viz-accent); }
.article-body .viz-no { background: rgba(30, 33, 40, 0.035); border-left: 3px solid #85878b; }
.article-body .viz-no.is-next { color: rgba(30, 33, 40, 0.68); }
.viz-tag { display: block; font-size: 0.68rem; letter-spacing: 1.1px; text-transform: uppercase; font-weight: 400; margin-bottom: 2px; }

/* Matrix: a 2 by 2 grid with its two measures on the edges; the high-high corner is tinted. */
.viz-matrix { display: block; }
.article-body .viz-axis { font-size: 0.72rem; letter-spacing: 1.1px; text-transform: uppercase; color: rgba(30, 33, 40, 0.68); margin: 0; }
.article-body .viz-axis-y { padding-bottom: 6px; }
.article-body .viz-axis-x { text-align: right; padding-top: 6px; }
.viz-grid4 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.viz-quad { background: var(--bg); padding: 10px 12px; min-height: 96px; }
.viz-quad.q-high-high { background: var(--viz-wash); }
.article-body .viz-quad-name { font-size: 0.68rem; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(30, 33, 40, 0.6); margin: 0 0 8px; }
.article-body .viz-quad ul { list-style: none; padding: 0; margin: 0; }
.article-body .viz-quad li { font-size: 0.86rem; line-height: 1.4; margin: 0 0 6px; padding-left: 8px; border-left: 2px solid var(--viz-accent); }

/* ---------- The list of articles ---------- */

.listing-lead { font-size: 1.05rem; margin: 0 0 56px; color: var(--ink); }
.listing-posts { list-style: none; margin: 0; padding: 0; }
.listing-posts li { padding: 32px 0; border-top: 1px solid var(--line); }
.listing-posts li:last-child { border-bottom: 1px solid var(--line); }
.listing-date { margin-bottom: 10px; }
.listing-posts h2 { font-family: var(--serif); font-weight: 300; font-size: 1.8rem; line-height: 1.2; margin: 0 0 10px; text-wrap: balance; }
.listing-posts h2 a { text-decoration: none; }
.listing-posts h2 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.listing-summary { font-size: 1rem; margin: 0; }
.listing-empty { color: var(--ink-label); }

/* ---------- The closing line (as on the main site) ---------- */

.tagline {
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  color: var(--ink-muted);
  text-align: center;
  margin: 96px 0 0;
  padding: 0 24px 64px;
}

@media (max-width: 600px) {
  .site-header { height: 52px; padding: 0 20px; }
  .header-logo { width: 88px; }
  .header-nav { gap: 14px; }
  .header-link { font-size: 0.66rem; letter-spacing: 1px; }
  .header-link:not(.is-active):nth-child(n+2):nth-child(-n+3) { display: none; }   /* Work, FAQ */
  .article, .listing { padding: 108px 24px 0; }
  .more { padding: 0 24px; }
  .more li { flex-direction: column; gap: 4px; }
  .article-back { margin-bottom: 32px; }
  .article-title, .listing-title { font-size: 2.05rem; }
  .article-meta { margin-bottom: 40px; }
  .article-body p, .article-body li { font-size: 1rem; }
  .article-body h2 { font-size: 1.5rem; margin-top: 44px; }
  .listing-posts h2 { font-size: 1.5rem; }
  .tagline { margin-top: 64px; }
  .viz-figures.n3, .viz-compare, .viz-compare.n3 { grid-template-columns: minmax(0, 1fr); }
  .viz-ba { grid-template-columns: minmax(0, 1fr); }
  .viz-ba-arrow { height: 32px; transform: rotate(90deg); }
  .viz-q-answers { grid-template-columns: minmax(0, 1fr); }
  .article-body .viz-figure-value { font-size: 1.8rem; }
  .viz-bar { padding-right: 6.5rem; }
  .viz-plot { padding-left: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
